QTfrontend/util/MessageDialog.cpp
branchwebgl
changeset 8833 c13ebed437cb
parent 8805 c0ea47957bdc
child 9080 9b42757d7e71
--- a/QTfrontend/util/MessageDialog.cpp	Wed Feb 20 02:21:58 2013 +0100
+++ b/QTfrontend/util/MessageDialog.cpp	Tue Apr 02 21:00:57 2013 +0200
@@ -17,23 +17,39 @@
  */
 
 #include "MessageDialog.h"
+#include "HWApplication.h"
+
+int MessageDialog::ShowFatalMessage(const QString & msg, QWidget * 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);
+    QMessageBox msgMsg(parent ? parent : HWApplication::activeWindow());
+    msgMsg.setWindowTitle(title != NULL ? title : "Hedgewars");
+    msgMsg.setText(msg);
     msgMsg.setIcon(icon);
-    msgMsg.setWindowTitle(title.isEmpty() ? QMessageBox::tr("Hedgewars") : title);
-    msgMsg.setText(msg);
     msgMsg.setWindowModality(Qt::WindowModal);
+
     return msgMsg.exec();
 }