diff --git a/src/widgets/vapplication.cpp b/src/widgets/vapplication.cpp index 0a4d7eaca..16664f94a 100644 --- a/src/widgets/vapplication.cpp +++ b/src/widgets/vapplication.cpp @@ -45,77 +45,33 @@ bool VApplication::notify(QObject *receiver, QEvent *event) } catch (const VExceptionObjectError &e) { - QMessageBox msgBox; - msgBox.setWindowTitle(tr("Error!")); - msgBox.setText(tr("Error parsing file. Program will be terminated.")); - msgBox.setInformativeText(e.ErrorMessage()); - msgBox.setStandardButtons(QMessageBox::Ok); - msgBox.setDefaultButton(QMessageBox::Ok); - msgBox.setDetailedText(e.DetailedInformation()); - msgBox.setIcon(QMessageBox::Critical); - msgBox.exec(); + e.CriticalMessageBox(tr("Error parsing file. Program will be terminated.")); abort(); } catch (const VExceptionBadId &e) { - QMessageBox msgBox; - msgBox.setWindowTitle(tr("Error!")); - msgBox.setText(tr("Error bad id. Program will be terminated.")); - msgBox.setInformativeText(e.ErrorMessage()); - msgBox.setStandardButtons(QMessageBox::Ok); - msgBox.setDefaultButton(QMessageBox::Ok); - msgBox.setIcon(QMessageBox::Critical); - msgBox.exec(); + e.CriticalMessageBox(tr("Error bad id. Program will be terminated.")); abort(); } catch (const VExceptionConversionError &e) { - QMessageBox msgBox; - msgBox.setWindowTitle(tr("Error!")); - msgBox.setText(tr("Error can't convert value. Program will be terminated.")); - msgBox.setInformativeText(e.ErrorMessage()); - msgBox.setStandardButtons(QMessageBox::Ok); - msgBox.setDefaultButton(QMessageBox::Ok); - msgBox.setIcon(QMessageBox::Critical); - msgBox.exec(); + e.CriticalMessageBox(tr("Error can't convert value. Program will be terminated.")); abort(); } catch (const VExceptionEmptyParameter &e) { - QMessageBox msgBox; - msgBox.setWindowTitle(tr("Error!")); - msgBox.setText(tr("Error empty parameter. Program will be terminated.")); - msgBox.setInformativeText(e.ErrorMessage()); - msgBox.setStandardButtons(QMessageBox::Ok); - msgBox.setDefaultButton(QMessageBox::Ok); - msgBox.setDetailedText(e.DetailedInformation()); - msgBox.setIcon(QMessageBox::Critical); - msgBox.exec(); + e.CriticalMessageBox(tr("Error empty parameter. Program will be terminated.")); abort(); } catch (const VExceptionWrongParameterId &e) { - QMessageBox msgBox; - msgBox.setWindowTitle(tr("Error!")); - msgBox.setText(tr("Error wrong id. Program will be terminated.")); - msgBox.setInformativeText(e.ErrorMessage()); - msgBox.setStandardButtons(QMessageBox::Ok); - msgBox.setDefaultButton(QMessageBox::Ok); - msgBox.setDetailedText(e.DetailedInformation()); - msgBox.setIcon(QMessageBox::Critical); - msgBox.exec(); + e.CriticalMessageBox(tr("Error wrong id. Program will be terminated.")); abort(); } catch (const VException &e) { - QMessageBox msgBox; - msgBox.setWindowTitle(tr("Error!")); - msgBox.setText(tr("Something's wrong!!")); - msgBox.setInformativeText(e.ErrorMessage()); - msgBox.setStandardButtons(QMessageBox::Ok); - msgBox.setDefaultButton(QMessageBox::Ok); - msgBox.setIcon(QMessageBox::Critical); - msgBox.exec(); + e.CriticalMessageBox(tr("Something's wrong!!")); + return true; } catch (std::exception& e) {