author | sheepluva |
Fri, 13 Jun 2014 14:55:06 +0200 | |
changeset 10297 | e5ed72b40c57 |
parent 10108 | c68cf030eded |
child 10305 | 17f3ca06e39a |
permissions | -rw-r--r-- |
8383 | 1 |
/* |
2 |
* Hedgewars, a free turn based strategy game |
|
9998 | 3 |
* Copyright (c) 2004-2014 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 |
|
10108
c68cf030eded
update FSF address. note: two sdl include files (by Sam Lantinga) still have the old FSF address in their copyright - but I ain't gonna touch their copyright headers
sheepluva
parents:
9998
diff
changeset
|
16 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
8383 | 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 |
} |