From 3137da2bc2686fe2b73da7dd5116573e2af3ac9f Mon Sep 17 00:00:00 2001 From: "craig.p.drummond@gmail.com" Date: Fri, 10 Aug 2012 11:16:51 +0000 Subject: [PATCH] In Qt-builds, if we failt to update files (tag editor, replaygain) then show the list of failures in the 'detailed text' section. --- ChangeLog | 2 ++ gui/tageditor.cpp | 9 +++++---- replaygain/rgdialog.cpp | 9 +++++---- widgets/messagebox.cpp | 7 +++++++ widgets/messagebox.h | 2 +- 5 files changed, 20 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index cd5583c76..e178a56e9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -17,6 +17,8 @@ 9. If we loose MPD connection, then show error widget. 10. Reset status when connection lost. 11. Dont attempt to send commands if not connected. +12. In Qt-builds, if we failt to update files (tag editor, replaygain) then + show the list of failures in the 'detailed text' section. 0.8.2 ----- diff --git a/gui/tageditor.cpp b/gui/tageditor.cpp index cb15b975c..a77d811f0 100644 --- a/gui/tageditor.cpp +++ b/gui/tageditor.cpp @@ -680,11 +680,12 @@ void TagEditor::applyUpdates() if (failed.count()) { #ifdef ENABLE_KDE_SUPPORT - KMessageBox::errorList(this, i18n("Failed to update the tags of the following tracks:"), failed); + MessageBox::errorList(this, i18n("Failed to update the tags of the following tracks:"), failed); #else - QMessageBox::warning(this, tr("Warning"), 1==failed.count() - ? tr("Failed to update the tags of %1").arg(failed.at(0)) - : tr("Failed to update the tags of %2 tracks").arg(failed.count())); + MessageBox::errorList(this, 1==failed.count() + ? tr("Failed to update the tags of 1 track") + : tr("Failed to update the tags of %2 tracks").arg(failed.count()), + failed); #endif } diff --git a/replaygain/rgdialog.cpp b/replaygain/rgdialog.cpp index 52847f515..6ab17afb2 100644 --- a/replaygain/rgdialog.cpp +++ b/replaygain/rgdialog.cpp @@ -391,11 +391,12 @@ void RgDialog::saveTags() if (failed.count()) { #ifdef ENABLE_KDE_SUPPORT - KMessageBox::errorList(this, i18n("Failed to update the tags of the following tracks:"), failed); + MessageBox::errorList(this, i18n("Failed to update the tags of the following tracks:"), failed); #else - QMessageBox::warning(this, tr("Warning"), 1==failed.count() - ? tr("Failed to update the tags of %1").arg(failed.at(0)) - : tr("Failed to update the tags of %2 tracks").arg(failed.count())); + MessageBox::errorList(this, 1==failed.count() + ? tr("Failed to update the tags of 1 track") + : tr("Failed to update the tags of %2 tracks").arg(failed.count()), + failed); #endif } } diff --git a/widgets/messagebox.cpp b/widgets/messagebox.cpp index 5d6e3456a..094109c28 100644 --- a/widgets/messagebox.cpp +++ b/widgets/messagebox.cpp @@ -67,3 +67,10 @@ MessageBox::ButtonCode MessageBox::questionYesNoCancel(QWidget *parent, const QS return -1==box.exec() ? Cancel : map(box.standardButton(box.clickedButton())); } } + +void MessageBox::errorList(QWidget *parent, const QString &message, const QStringList &strlist, const QString &title) +{ + QMessageBox box(QMessageBox::Critical, title.isEmpty() ? QObject::tr("Error") : title, message, QMessageBox::Ok, parent); + box.setDetailedText(strlist.join("\n")); + box.exec(); +} diff --git a/widgets/messagebox.h b/widgets/messagebox.h index 3c2c146bd..98500efb0 100644 --- a/widgets/messagebox.h +++ b/widgets/messagebox.h @@ -52,7 +52,7 @@ namespace MessageBox { inline void error(QWidget *parent, const QString &message, const QString &title=QString()) { QMessageBox::warning(parent, title.isEmpty() ? QObject::tr("Error") : title, message); } - + void errorList(QWidget *parent, const QString &message, const QStringList &strlist, const QString &title=QString()); }; #endif