QTfrontend/util/MessageDialog.cpp
changeset 8799 44e520374cfc
parent 8434 4821897a0f10
child 8805 c0ea47957bdc
equal deleted inserted replaced
8797:b7e0b7a18e3a 8799:44e520374cfc
    15  * along with this program; if not, write to the Free Software
    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
    16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
    17  */
    17  */
    18 
    18 
    19 #include "MessageDialog.h"
    19 #include "MessageDialog.h"
       
    20 #include "HWApplication.h"
       
    21 
       
    22 int MessageDialog::ShowFatalMessage(const QString & msg, QWidget * parent)
       
    23 {
       
    24     return ShowMessage(msg, QMessageBox::tr("Hedgewars - Fatal Error"), QMessageBox::Critical, parent);
       
    25 }
    20 
    26 
    21 int MessageDialog::ShowErrorMessage(const QString & msg, QWidget * parent)
    27 int MessageDialog::ShowErrorMessage(const QString & msg, QWidget * parent)
    22 {
    28 {
    23     return ShowMessage(msg, QMessageBox::tr("Hedgewars - Warning"), QMessageBox::Warning, parent);
    29     return ShowMessage(msg, QMessageBox::tr("Hedgewars - Warning"), QMessageBox::Warning, parent);
    24 }
    30 }
    28     return ShowMessage(msg, QMessageBox::tr("Hedgewars - Information"), QMessageBox::Information, parent);
    34     return ShowMessage(msg, QMessageBox::tr("Hedgewars - Information"), QMessageBox::Information, parent);
    29 }
    35 }
    30 
    36 
    31 int MessageDialog::ShowMessage(const QString & msg, const QString & title, QMessageBox::Icon icon, QWidget * parent)
    37 int MessageDialog::ShowMessage(const QString & msg, const QString & title, QMessageBox::Icon icon, QWidget * parent)
    32 {
    38 {
    33     QMessageBox msgMsg(parent);
    39     QMessageBox msgMsg(parent ? parent : HWApplication::activeWindow());
    34     msgMsg.setIcon(icon);
    40     msgMsg.setIcon(icon);
    35     msgMsg.setWindowTitle(title.isEmpty() ? QMessageBox::tr("Hedgewars") : title);
    41     msgMsg.setWindowTitle(title != NULL ? title : "Hedgewars");
    36     msgMsg.setText(msg);
    42     msgMsg.setText(msg);
    37     msgMsg.setWindowModality(Qt::WindowModal);
    43     msgMsg.setWindowModality(Qt::WindowModal);
    38     return msgMsg.exec();
    44     return msgMsg.exec();
    39 }
    45 }