minor refactor of MessageDialog
authorkoda
Wed, 27 Mar 2013 14:20:34 +0100
changeset 8805 c0ea47957bdc
parent 8803 b3f37e7f9ff4
child 8807 509d812ca219
child 8808 636cd1b8361d
minor refactor of MessageDialog
QTfrontend/util/MessageDialog.cpp
QTfrontend/util/MessageDialog.h
--- a/QTfrontend/util/MessageDialog.cpp	Wed Mar 27 14:12:19 2013 +0100
+++ b/QTfrontend/util/MessageDialog.cpp	Wed Mar 27 14:20:34 2013 +0100
@@ -21,25 +21,35 @@
 
 int MessageDialog::ShowFatalMessage(const QString & msg, QWidget * parent)
 {
-    return ShowMessage(msg, QMessageBox::tr("Hedgewars - Fatal Error"), QMessageBox::Critical, parent);
+    return ShowMessage(QMessageBox::tr("Hedgewars - Error"),
+                       msg,
+                       QMessageBox::Critical,
+                       parent);
 }
 
 int MessageDialog::ShowErrorMessage(const QString & msg, QWidget * parent)
 {
-    return ShowMessage(msg, QMessageBox::tr("Hedgewars - Warning"), QMessageBox::Warning, parent);
+    return ShowMessage(QMessageBox::tr("Hedgewars - Warning"),
+                       msg,
+                       QMessageBox::Warning,
+                       parent);
 }
 
 int MessageDialog::ShowInfoMessage(const QString & msg, QWidget * parent)
 {
-    return ShowMessage(msg, QMessageBox::tr("Hedgewars - Information"), QMessageBox::Information, parent);
+    return ShowMessage(QMessageBox::tr("Hedgewars - Information"),
+                       msg,
+                       QMessageBox::Information,
+                       parent);
 }
 
-int MessageDialog::ShowMessage(const QString & msg, const QString & title, QMessageBox::Icon icon, QWidget * parent)
+int MessageDialog::ShowMessage(const QString & title, const QString & msg, QMessageBox::Icon icon, QWidget * parent)
 {
     QMessageBox msgMsg(parent ? parent : HWApplication::activeWindow());
-    msgMsg.setIcon(icon);
     msgMsg.setWindowTitle(title != NULL ? title : "Hedgewars");
     msgMsg.setText(msg);
+    msgMsg.setIcon(icon);
     msgMsg.setWindowModality(Qt::WindowModal);
+
     return msgMsg.exec();
 }
--- a/QTfrontend/util/MessageDialog.h	Wed Mar 27 14:12:19 2013 +0100
+++ b/QTfrontend/util/MessageDialog.h	Wed Mar 27 14:20:34 2013 +0100
@@ -29,7 +29,7 @@
         static int ShowFatalMessage(const QString & msg, QWidget * parent = 0);
         static int ShowErrorMessage(const QString & msg, QWidget * parent = 0);
         static int ShowInfoMessage(const QString & msg, QWidget * parent = 0);
-        static int ShowMessage(const QString & msg, const QString & title = 0, QMessageBox::Icon icon = QMessageBox::NoIcon, QWidget * parent = 0);
+        static int ShowMessage(const QString & title = 0, const QString & msg, QMessageBox::Icon icon = QMessageBox::NoIcon, QWidget * parent = 0);
 };
 
 #endif