author | sheepluva |
Fri, 06 Dec 2013 20:38:48 +0100 | |
changeset 9758 | 3b8058b251b8 |
parent 9080 | 9b42757d7e71 |
child 9998 | 736015b847e3 |
permissions | -rw-r--r-- |
8383 | 1 |
/* |
2 |
* Hedgewars, a free turn based strategy game |
|
9080 | 3 |
* Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com> |
8383 | 4 |
* |
5 |
* This program is free software; you can redistribute it and/or modify |
|
6 |
* it under the terms of the GNU General Public License as published by |
|
7 |
* the Free Software Foundation; version 2 of the License |
|
8 |
* |
|
9 |
* This program is distributed in the hope that it will be useful, |
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU General Public License for more details. |
|
13 |
* |
|
14 |
* You should have received a copy of the GNU General Public License |
|
15 |
* along with this program; if not, write to the Free Software |
|
16 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
|
17 |
*/ |
|
18 |
||
19 |
#include "MessageDialog.h" |
|
8799
44e520374cfc
drop QApplication in favor of HWApplication and minor refactor of MessageDialog
koda
parents:
8434
diff
changeset
|
20 |
#include "HWApplication.h" |
44e520374cfc
drop QApplication in favor of HWApplication and minor refactor of MessageDialog
koda
parents:
8434
diff
changeset
|
21 |
|
44e520374cfc
drop QApplication in favor of HWApplication and minor refactor of MessageDialog
koda
parents:
8434
diff
changeset
|
22 |
int MessageDialog::ShowFatalMessage(const QString & msg, QWidget * parent) |
44e520374cfc
drop QApplication in favor of HWApplication and minor refactor of MessageDialog
koda
parents:
8434
diff
changeset
|
23 |
{ |
8805 | 24 |
return ShowMessage(QMessageBox::tr("Hedgewars - Error"), |
25 |
msg, |
|
26 |
QMessageBox::Critical, |
|
27 |
parent); |
|
8799
44e520374cfc
drop QApplication in favor of HWApplication and minor refactor of MessageDialog
koda
parents:
8434
diff
changeset
|
28 |
} |
8383 | 29 |
|
30 |
int MessageDialog::ShowErrorMessage(const QString & msg, QWidget * parent) |
|
31 |
{ |
|
8805 | 32 |
return ShowMessage(QMessageBox::tr("Hedgewars - Warning"), |
33 |
msg, |
|
34 |
QMessageBox::Warning, |
|
35 |
parent); |
|
8383 | 36 |
} |
37 |
||
38 |
int MessageDialog::ShowInfoMessage(const QString & msg, QWidget * parent) |
|
39 |
{ |
|
8805 | 40 |
return ShowMessage(QMessageBox::tr("Hedgewars - Information"), |
41 |
msg, |
|
42 |
QMessageBox::Information, |
|
43 |
parent); |
|
8383 | 44 |
} |
45 |
||
8805 | 46 |
int MessageDialog::ShowMessage(const QString & title, const QString & msg, QMessageBox::Icon icon, QWidget * parent) |
8383 | 47 |
{ |
8799
44e520374cfc
drop QApplication in favor of HWApplication and minor refactor of MessageDialog
koda
parents:
8434
diff
changeset
|
48 |
QMessageBox msgMsg(parent ? parent : HWApplication::activeWindow()); |
44e520374cfc
drop QApplication in favor of HWApplication and minor refactor of MessageDialog
koda
parents:
8434
diff
changeset
|
49 |
msgMsg.setWindowTitle(title != NULL ? title : "Hedgewars"); |
8383 | 50 |
msgMsg.setText(msg); |
8805 | 51 |
msgMsg.setIcon(icon); |
8383 | 52 |
msgMsg.setWindowModality(Qt::WindowModal); |
8805 | 53 |
|
8383 | 54 |
return msgMsg.exec(); |
8386 | 55 |
} |