29 #include "WMainWindow.h"
31 #include "WApplication.h"
33 #include "core/common/WException.h"
34 #include "core/common/WLogger.h"
36 #define OPENWALNUT_BUGREPORTER_URL "https://bsvgit.informatik.uni-leipzig.de/openwalnut/openwalnut/issues"
52 QString exception_msg;
55 retval = QApplication::notify(
object, event );
59 exception_msg = QString( we.
what() );
61 catch(
const std::exception &se )
63 exception_msg = QString( se.what() );
66 if( !exception_msg.isEmpty() )
69 msgBox.setIcon( QMessageBox::Critical );
70 QString info(
"An uncaught exception occurred which may be due to a corrupt installation or a programming bug. "
71 "Please check the openwalnut bug reporter for similar tickets and report the issue including the "
72 "following text: <br><br><i>" + exception_msg +
"</i><br><br> Please report to: <br><a href=\""
73 OPENWALNUT_BUGREPORTER_URL
"\">" OPENWALNUT_BUGREPORTER_URL
"</a>" );
74 msgBox.setInformativeText( tr( info.toStdString().c_str() ) );
75 QPushButton* websiteButton = msgBox.addButton( tr(
"Go to web site" ), QMessageBox::ActionRole );
76 msgBox.setStandardButtons( QMessageBox::Ignore );
77 msgBox.setEscapeButton( QMessageBox::Ignore );
79 if( msgBox.clickedButton() == websiteButton )
81 QDesktopServices::openUrl( QUrl( OPENWALNUT_BUGREPORTER_URL ) );
85 wlog::error(
"WApplication" ) << info.remove( QRegExp(
"<[^>]*>" ) ).toStdString();
void setMyMainWidget(QWidget *widget)
store the main widget for error reporting and session management
QWidget * myMainWidget
Reference to the main widget set by setMyMainWidget.
virtual bool notify(QObject *receiver, QEvent *e)
Overloaded to catch uncaught exceptions in event handlers and displays a bug-warning.
WApplication(int &argc, char **argv, bool GUIenabled=true)
default constructor, see QApplication
virtual const char * what() const
Returns the message string set on throw.
WStreamedLogger error(const std::string &source)
Logging an error message.