Commit 313a136b authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum
Browse files

[CHANGE] - now crashed modules will cause an info dialog to be called. This is...

[CHANGE] - now crashed modules will cause an info dialog to be called. This is a more convenient user feedback.
parent 5079d5bf
......@@ -46,6 +46,7 @@
#include "WQtNavGLWidget.h"
#include "WQtCustomDockWidget.h"
#include "events/WModuleReadyEvent.h"
#include "events/WModuleCrashEvent.h"
#include "events/WEventTypes.h"
#include "datasetbrowser/WPropertyBoolWidget.h"
#include "../../common/WColor.h"
......@@ -552,6 +553,19 @@ bool WMainWindow::event( QEvent* event )
}
}
if ( event->type() == WQT_CRASH_EVENT )
{
// convert event to ready event
WModuleCrashEvent* e1 = dynamic_cast< WModuleCrashEvent* >( event ); // NOLINT
if ( e1 )
{
QString title = "Module crashed: " + QString::fromStdString( e1->getModule()->getName() );
QString message = "<b>Module Crashed</b><br/><br/><b>Module: </b>" + QString::fromStdString( e1->getModule()->getName() ) +
"<br/><b>Message: </b>" + QString::fromStdString( e1->getMessage() );
QMessageBox::critical( this, title, message );
}
}
return QMainWindow::event( event );
}
......
......@@ -32,7 +32,6 @@
#include <QtGui/QApplication>
#include <QtGui/QFileDialog>
#include <QtGui/QMessageBox>
#include "WMainWindow.h" // this has to be included before any other includes
#include "../../common/WConditionOneShot.h"
......
......@@ -42,5 +42,8 @@
// when a roi got associated
#define WQT_ROI_ASSOC_EVENT QEvent::User + 3
// when a module crashes
#define WQT_CRASH_EVENT QEvent::User + 4
#endif // WEVENTTYPES_H
......@@ -27,7 +27,7 @@
#include "WModuleCrashEvent.h"
WModuleCrashEvent::WModuleCrashEvent( boost::shared_ptr< WModule > module, std::string message )
: QEvent( static_cast< QEvent::Type >( WQT_READY_EVENT ) ),
: QEvent( static_cast< QEvent::Type >( WQT_CRASH_EVENT ) ),
m_module( module ),
m_message( message )
{
......@@ -44,3 +44,8 @@ boost::shared_ptr< WModule > WModuleCrashEvent::getModule()
return m_module;
}
std::string WModuleCrashEvent::getMessage()
{
return m_message;
}
......@@ -61,6 +61,13 @@ public:
*/
boost::shared_ptr< WModule > getModule();
/**
* The crash message.
*
* \return the crash message.
*/
std::string getMessage();
protected:
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment