19 #include "MessageDialog.h" |
19 #include "MessageDialog.h" |
20 #include "HWApplication.h" |
20 #include "HWApplication.h" |
21 |
21 |
22 int MessageDialog::ShowFatalMessage(const QString & msg, QWidget * parent) |
22 int MessageDialog::ShowFatalMessage(const QString & msg, QWidget * parent) |
23 { |
23 { |
24 return ShowMessage(msg, QMessageBox::tr("Hedgewars - Fatal Error"), QMessageBox::Critical, parent); |
24 return ShowMessage(QMessageBox::tr("Hedgewars - Error"), |
|
25 msg, |
|
26 QMessageBox::Critical, |
|
27 parent); |
25 } |
28 } |
26 |
29 |
27 int MessageDialog::ShowErrorMessage(const QString & msg, QWidget * parent) |
30 int MessageDialog::ShowErrorMessage(const QString & msg, QWidget * parent) |
28 { |
31 { |
29 return ShowMessage(msg, QMessageBox::tr("Hedgewars - Warning"), QMessageBox::Warning, parent); |
32 return ShowMessage(QMessageBox::tr("Hedgewars - Warning"), |
|
33 msg, |
|
34 QMessageBox::Warning, |
|
35 parent); |
30 } |
36 } |
31 |
37 |
32 int MessageDialog::ShowInfoMessage(const QString & msg, QWidget * parent) |
38 int MessageDialog::ShowInfoMessage(const QString & msg, QWidget * parent) |
33 { |
39 { |
34 return ShowMessage(msg, QMessageBox::tr("Hedgewars - Information"), QMessageBox::Information, parent); |
40 return ShowMessage(QMessageBox::tr("Hedgewars - Information"), |
|
41 msg, |
|
42 QMessageBox::Information, |
|
43 parent); |
35 } |
44 } |
36 |
45 |
37 int MessageDialog::ShowMessage(const QString & msg, const QString & title, QMessageBox::Icon icon, QWidget * parent) |
46 int MessageDialog::ShowMessage(const QString & title, const QString & msg, QMessageBox::Icon icon, QWidget * parent) |
38 { |
47 { |
39 QMessageBox msgMsg(parent ? parent : HWApplication::activeWindow()); |
48 QMessageBox msgMsg(parent ? parent : HWApplication::activeWindow()); |
40 msgMsg.setIcon(icon); |
|
41 msgMsg.setWindowTitle(title != NULL ? title : "Hedgewars"); |
49 msgMsg.setWindowTitle(title != NULL ? title : "Hedgewars"); |
42 msgMsg.setText(msg); |
50 msgMsg.setText(msg); |
|
51 msgMsg.setIcon(icon); |
43 msgMsg.setWindowModality(Qt::WindowModal); |
52 msgMsg.setWindowModality(Qt::WindowModal); |
|
53 |
44 return msgMsg.exec(); |
54 return msgMsg.exec(); |
45 } |
55 } |