From 240633413881be9af66ee14dee9aa7c95baae6e6 Mon Sep 17 00:00:00 2001 From: dismine Date: Wed, 18 Jun 2014 15:11:48 +0300 Subject: [PATCH] Refactoring. Delete repetitive code. --HG-- branch : feature --- src/app/mainwindow.cpp | 10 ++-------- src/app/xml/vpattern.cpp | 10 ++-------- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/src/app/mainwindow.cpp b/src/app/mainwindow.cpp index 17c1915bc..c7d01b2f5 100644 --- a/src/app/mainwindow.cpp +++ b/src/app/mainwindow.cpp @@ -1565,14 +1565,8 @@ void MainWindow::FullParseFile() #ifndef QT_NO_CURSOR QApplication::restoreOverrideCursor(); #endif - QMessageBox msgBox; - msgBox.setWindowTitle(tr("Error!")); - msgBox.setText(tr("Error parsing file.")); - msgBox.setInformativeText("std::bad_alloc"); - msgBox.setStandardButtons(QMessageBox::Ok); - msgBox.setDefaultButton(QMessageBox::Ok); - msgBox.setIcon(QMessageBox::Warning); - msgBox.exec(); + QMessageBox::critical(this, tr("Critical error!"), tr("Error parsing file (std::bad_alloc)."), QMessageBox::Ok, + QMessageBox::Ok); #ifndef QT_NO_CURSOR QApplication::setOverrideCursor(Qt::WaitCursor); #endif diff --git a/src/app/xml/vpattern.cpp b/src/app/xml/vpattern.cpp index 353d09fda..3ad86dced 100644 --- a/src/app/xml/vpattern.cpp +++ b/src/app/xml/vpattern.cpp @@ -687,14 +687,8 @@ void VPattern::LiteParseTree() #ifndef QT_NO_CURSOR QApplication::restoreOverrideCursor(); #endif - QMessageBox msgBox; - msgBox.setWindowTitle(tr("Error!")); - msgBox.setText(tr("Error parsing file.")); - msgBox.setInformativeText("std::bad_alloc"); - msgBox.setStandardButtons(QMessageBox::Ok); - msgBox.setDefaultButton(QMessageBox::Ok); - msgBox.setIcon(QMessageBox::Warning); - msgBox.exec(); + QMessageBox::critical(nullptr, tr("Critical error!"), tr("Error parsing file (std::bad_alloc)."), QMessageBox::Ok, + QMessageBox::Ok); #ifndef QT_NO_CURSOR QApplication::setOverrideCursor(Qt::WaitCursor); #endif