int MessageDialog::ShowMessage(const QString & title, const QString & msg, QMessageBox::Icon icon, QWidget * parent) { // if no parent try to use active window parent = parent ? parent : HWApplication::activeWindow(); // didn't work? make child of hwform (e.g. for style and because modal) if (!parent) { try { HWApplication * app = dynamic_cast<HWApplication*>(HWApplication::instance()); if (app->form) parent = app->form; } catch (...) { /* nothing */ } } QMessageBox msgMsg(parent); msgMsg.setWindowTitle(title != NULL ? title : "Hedgewars"); msgMsg.setText(msg); msgMsg.setIcon(icon); msgMsg.setWindowModality(Qt::WindowModal); return msgMsg.exec(); }
void FeedbackDialog::ShowErrorMessage(const QString & msg) { QMessageBox msgMsg(this); msgMsg.setIcon(QMessageBox::Warning); msgMsg.setWindowTitle(QMessageBox::tr("Hedgewars - Error")); msgMsg.setText(msg); msgMsg.setWindowModality(Qt::WindowModal); msgMsg.exec(); }
void FeedbackDialog::ShowSpecs() { QMessageBox msgMsg(this); msgMsg.setIcon(QMessageBox::Information); msgMsg.setWindowTitle(QMessageBox::tr("System Information Preview")); msgMsg.setText(specs); msgMsg.setTextFormat(Qt::PlainText); msgMsg.setWindowModality(Qt::WindowModal); msgMsg.setStyleSheet("background: #0A0533;"); msgMsg.exec(); }