17 #ifndef QMITKSAFENOTIFY_H
18 #define QMITKSAFENOTIFY_H
23 #include <QMessageBox>
31 return app->A::notify(receiver, event);
35 msg = QString(
"MITK Exception:\n\n") + QString(
"Description: ") + QString(e.GetDescription()) + QString(
"\n\n") +
36 QString(
"Filename: ") + QString(e.GetFile()) + QString(
"\n\n") + QString(
"Line: ") +
37 QString::number(e.GetLine());
39 catch (std::exception &e)
45 msg =
"Unknown exception";
47 MITK_ERROR <<
"An error occurred: " << msg.toStdString();
50 msgBox.setText(
"An error occurred. You should save all data and quit the program to prevent possible data loss.");
51 msgBox.setDetailedText(msg);
52 msgBox.setIcon(QMessageBox::Critical);
53 msgBox.addButton(app->trUtf8(
"Exit immediately"), QMessageBox::YesRole);
54 msgBox.addButton(app->trUtf8(
"Ignore"), QMessageBox::NoRole);
56 int ret = msgBox.exec();
62 app->closeAllWindows();
66 <<
"The error was ignored by the user. The program may be in a corrupt state and don't behave like expected!";
73 #endif // QMITKSAFENOTIFY_H
An object of this class represents an exception of MITK. Please don't instantiate exceptions manually...
bool QmitkSafeNotify(A *app, QObject *receiver, QEvent *event)