13 #ifndef QmitkSafeNotify_h
14 #define QmitkSafeNotify_h
19 #include <QMessageBox>
27 return app->A::notify(receiver, event);
31 msg = QString(
"MITK Exception:\n\n") + QString(
"Description: ") + QString(e.GetDescription()) + QString(
"\n\n") +
32 QString(
"Filename: ") + QString(e.GetFile()) + QString(
"\n\n") + QString(
"Line: ") +
33 QString::number(e.GetLine());
35 catch (std::exception &e)
41 msg =
"Unknown exception";
43 MITK_ERROR <<
"An error occurred: " << msg.toStdString();
46 msgBox.setText(
"An error occurred. You should save all data and quit the program to prevent possible data loss.");
47 msgBox.setDetailedText(msg);
48 msgBox.setIcon(QMessageBox::Critical);
49 msgBox.addButton(
"Exit immediately", QMessageBox::YesRole);
50 msgBox.addButton(
"Ignore", QMessageBox::NoRole);
52 int ret = msgBox.exec();
58 app->closeAllWindows();
62 <<
"The error was ignored by the user. The program may be in a corrupt state and don't behave like expected!";