31 #include <boost/thread.hpp>
32 #include <boost/regex.hpp>
33 #include <boost/filesystem.hpp>
35 #include <QApplication>
36 #include <QCloseEvent>
37 #include <QDockWidget>
38 #include <QFileDialog>
42 #include <QMessageBox>
46 #include <QVBoxLayout>
48 #include <QtCore/QSettings>
49 #include <QtCore/QUrl>
50 #include <QInputDialog>
51 #ifdef OW_FORCE_WEBKIT
54 #include <QWebEngineView>
57 #include "core/WVersion.h"
59 #include "controlPanel/WPropertyBoolWidget.h"
60 #include "controlPanel/WQtControlPanel.h"
61 #include "core/common/WColor.h"
62 #include "core/common/WIOTools.h"
63 #include "core/common/WPathHelper.h"
64 #include "core/common/WProjectFileIO.h"
65 #include "core/dataHandler/WDataHandler.h"
66 #include "core/dataHandler/WDataSetFibers.h"
67 #include "core/dataHandler/WDataSetSingle.h"
68 #include "core/dataHandler/WDataSetPoints.h"
69 #include "core/dataHandler/WEEG2.h"
70 #include "core/graphicsEngine/WGEZoomTrackballManipulator.h"
71 #include "core/graphicsEngine/WROIBox.h"
72 #include "core/kernel/WDataModule.h"
73 #include "core/kernel/WKernel.h"
74 #include "core/kernel/WModule.h"
75 #include "core/kernel/WModuleFactory.h"
76 #include "core/kernel/WModuleCombiner.h"
77 #include "core/kernel/WModuleCombinerTypes.h"
78 #include "core/kernel/WDataModuleInputFilterFile.h"
79 #include "core/kernel/WProjectFile.h"
80 #include "core/kernel/WROIManager.h"
81 #include "core/kernel/WSelectionManager.h"
82 #include "events/WEventTypes.h"
83 #include "events/WDeferredCallEvent.h"
84 #include "events/WModuleCrashEvent.h"
85 #include "events/WModuleReadyEvent.h"
86 #include "events/WModuleRemovedEvent.h"
87 #include "events/WLoadFinishedEvent.h"
88 #include "events/WLogEvent.h"
89 #include "guiElements/WQtPropertyBoolAction.h"
90 #include "abstractUI/WUIQtWidgetBase.h"
91 #include "WQtMessagePopup.h"
93 #include "WQtCombinerToolbar.h"
94 #include "WQtGLDockWidget.h"
95 #include "WQtNavGLWidget.h"
96 #include "WSettingAction.h"
97 #include "WSettingMenu.h"
98 #include "WQtMessageDialog.h"
100 #include "WMainWindow.h"
105 m_currentCompatiblesToolbar( NULL ),
107 m_closeFirstStage( false ),
108 m_closeInProgress( false )
110 setAcceptDrops(
true );
125 QAction* createSeperator( QWidget* parent )
128 separator->setSeparator(
true );
134 wlog::info(
"WMainWindow" ) <<
"Setting up GUI";
142 "Allows you to hide the menu. Can be restored using CTRL-M.",
145 QKeySequence( Qt::CTRL + Qt::Key_M ) );
148 "Show Navigation Views",
149 "Disables the navigation views completely. This can lead to a speed-up and is "
150 "recommended for those who do not need them.",
155 "Slider Min/Max Editing",
156 "If enabled, the maximum and minimum values of slider can be edited.",
160 "Multi-Threaded Views",
161 "If enabled, the graphic windows are rendered in different threads. This can speed-up "
162 "rendering on machines with multiple cores. WARNING: can lead to crashes sometimes.",
172 logOptions.push_back(
"Debug" );
173 logOptions.push_back(
"Info" );
174 logOptions.push_back(
"Warning" );
175 logOptions.push_back(
"Error" );
178 "Allows one to set the log verbosity.",
182 connect( logLevels, SIGNAL( change(
unsigned int ) ),
this, SLOT(
handleLogLevelUpdate(
unsigned int ) ) );
202 if( objectName().isEmpty() )
204 setObjectName( QString::fromUtf8(
"MainWindow" ) );
210 std::string windowHeading = std::string(
"OpenWalnut " ) + std::string( W_VERSION );
211 setWindowTitle( QString::fromStdString( windowHeading ) );
213 setDockOptions( QMainWindow::AnimatedDocks | QMainWindow::AllowNestedDocks | QMainWindow::AllowTabbedDocks );
218 m_networkEditor->setFeatures( QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable );
226 m_controlPanel->setFeatures( QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable );
253 m_glDock->setObjectName(
"GLDock" );
254 m_glDock->setDockOptions( QMainWindow::AnimatedDocks | QMainWindow::AllowNestedDocks | QMainWindow::AllowTabbedDocks );
300 m_loadButton->setShortcut( QKeySequence( QKeySequence::Open ) );
305 connect( roiButton, SIGNAL( triggered(
bool ) ),
this, SLOT(
newRoi() ) );
308 m_loadButton->setToolTip(
"Load a dataset or project from file" );
309 roiButton->setToolTip(
"Insert a new ROI" );
310 m_saveAction->setToolTip(
"Save current project to file" );
324 connect( hideMenuAction, SIGNAL( change(
bool ) ),
m_menuBar, SLOT( setVisible(
bool ) ) );
325 addAction( hideMenuAction );
333 QKeySequence( Qt::CTRL + Qt::Key_N ) );
342 fileMenu->addSeparator();
368 controlPanelShortcut.append( QKeySequence( Qt::Key_F9 ) );
369 controlPanelTrigger->setShortcuts( controlPanelShortcut );
370 this->addAction( controlPanelTrigger );
378 QKeySequence( QKeySequence::HelpContents ) );
389 if( showNavWidgets->
get() )
391 m_navAxial = std::shared_ptr< WQtNavGLWidget >(
new WQtNavGLWidget(
"Axial View",
"Axial View",
this,
"Axial Slice",
393 m_navAxial->setFeatures( QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable );
395 m_navAxial->getGLWidget()->setCameraManipulator( WQtGLWidget::NO_OP );
397 addDockWidget( Qt::LeftDockWidgetArea,
m_navAxial.get(), Qt::Vertical );
401 m_navCoronal->setFeatures( QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable );
403 m_navCoronal->getGLWidget()->setCameraManipulator( WQtGLWidget::NO_OP );
405 addDockWidget( Qt::LeftDockWidgetArea,
m_navCoronal.get(), Qt::Vertical );
408 std::shared_ptr< WQtNavGLWidget >(
new WQtNavGLWidget(
"Sagittal View",
"Sagittal View",
this,
"Sagittal Slice",
410 m_navSagittal->setFeatures( QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable );
412 m_navSagittal->getGLWidget()->setCameraManipulator( WQtGLWidget::NO_OP );
414 addDockWidget( Qt::LeftDockWidgetArea,
m_navSagittal.get(), Qt::Vertical );
421 showAxial->setToolTip(
"Toggle axial slice" );
422 showAxial->setText(
"Toggle Axial Slice" );
427 showCoronal->setToolTip(
"Toggle coronal slice" );
428 showCoronal->setText(
"Toggle Coronal Slice" );
433 showSagittal->setToolTip(
"Toggle sagittal slice" );
434 showSagittal->setText(
"Toggle Sagittal Slice" );
567 toolbar->setVisible(
true );
590 QString selected = QFileDialog::getSaveFileName(
this,
"Save Project as", lastPath,
591 "Project File (*.owproj *.owp)" );
598 boost::filesystem::path p( selected.toStdString() );
599 WQtGui::getSettings().setValue(
"LastProjectSavePath", QString::fromStdString( p.parent_path().string() ) );
602 std::string filename = ( selected ).toStdString();
605 if( filename.rfind(
".owp" ) != filename.size() - 4
606 && filename.rfind(
".owproj" ) != filename.size() - 7 )
611 std::shared_ptr< WProjectFile > proj = std::shared_ptr< WProjectFile >(
624 proj->save( writer );
627 catch(
const std::exception& e )
629 QString title =
"Problem while saving project file.";
630 QString message =
"<b>Problem while saving project file.</b><br/><br/><b>File: </b>" + selected +
631 "<br/><b>Message: </b>" + QString::fromStdString( e.what() );
632 QMessageBox::critical(
this, title, message );
640 std::vector< std::shared_ptr< WProjectFileIO > > w;
647 std::vector< std::shared_ptr< WProjectFileIO > > w;
654 std::vector< std::shared_ptr< WProjectFileIO > > w;
661 std::vector< std::shared_ptr< WProjectFileIO > > w;
672 QString collectFilters()
680 for( std::vector< WDataModule::SPtr >::const_iterator iter = dataModules.begin(); iter != dataModules.end(); ++iter )
682 std::vector< WDataModuleInputFilter::ConstSPtr > filters = ( *iter )->
getInputFilter();
683 for( std::vector< WDataModuleInputFilter::ConstSPtr >::const_iterator filterIter = filters.begin(); filterIter != filters.end();
689 QString description = QString::fromStdString( ff->getDescription() );
690 QString extension = QString::fromStdString( ff->getExtension() );
691 all += QString(
" *." ) + extension;
692 result += description + QString(
"(*." ) + extension + QString(
");;" );
698 all += QString(
" *.owp *.owproj" );
699 result += QString(
"Project File (*.owp *.owproj );;" );
704 QString description = QString::fromStdString(
WKernel::getRunningKernel()->getScriptEngine()->getInterpreter( k )->getName() );
706 QString extension = QString::fromStdString(
WKernel::getRunningKernel()->getScriptEngine()->getInterpreter( k )->getExtension() );
707 all += QString(
" *" ) + extension;
708 result += description + QString(
"(*" ) + extension + QString(
");;" );
715 return QString(
"Known file types (* " ) + all + QString(
");;" ) + result;
717 return QString(
"Known file types (" ) + all + QString(
");;" ) + result;
727 QString filters = collectFilters();
729 filters += QString(
"Any files (*)" );
731 QStringList filenames = QFileDialog::getOpenFileNames(
this,
"Open Data, Project or Script", lastPath, filters );
732 if( filenames.empty() )
738 boost::filesystem::path p( filenames[0].toStdString() );
739 WQtGui::getSettings().setValue(
"LastOpenPath", QString::fromStdString( p.parent_path().string() ) );
741 std::vector< std::string > loadDataFilenames;
742 QStringList::const_iterator constIterator;
743 for( constIterator = filenames.constBegin(); constIterator != filenames.constEnd(); ++constIterator )
745 boost::filesystem::path fn( ( *constIterator ).toLocal8Bit().constData() );
746 std::string suffix = getSuffix( fn );
749 if( ( suffix ==
".owp" ) || ( suffix ==
".owproj" ) )
756 std::shared_ptr< WScriptInterpreter > scriptInterpreter =
759 if( scriptInterpreter )
761 scriptInterpreter->executeFileAsync( fn.string() );
765 loadDataFilenames.push_back( fn.string() );
777 boost::placeholders::_1,
778 boost::placeholders::_2,
779 boost::placeholders::_3 ) ) );
786 QCoreApplication::postEvent(
this,
new WLoadFinishedEvent( file, errors, warnings ) );
790 wlog::warn(
"MainWindow" ) <<
"Async load error occurred. Informing user.";
796 QMessageBox::aboutQt(
this,
"About Qt" );
802 std::string content = readFileIntoString( filename );
803 std::string windowHeading = std::string(
"About OpenWalnut " ) + std::string( W_VERSION );
804 QMessageBox::about(
this, windowHeading.c_str(), content.c_str() );
811 std::string content = readFileIntoString( filename );
813 QWidget* window =
new QWidget(
this, Qt::Window );
814 window->setWindowTitle(
"OpenWalnut Help" );
816 QVBoxLayout *layout =
new QVBoxLayout( window );
817 window->setLayout( layout );
818 window->resize( 500, 500 );
822 #ifdef OW_FORCE_WEBKIT
823 QWebView *view =
new QWebView(
this );
825 QWebEngineView *view =
new QWebEngineView(
this );
829 view->setHtml( content.c_str(), QUrl( location ) );
831 layout->addWidget( view );
836 QMessageBox::information(
this,
"Not yet implemented!",
837 "This functionality is planned for future versions of OpenWalnut. "
838 "It is not yet implemented." );
865 for( CustomWidgets::iterator it = copy.begin(); it != copy.end(); ++it )
867 wlog::warn(
"MainWindow" ) <<
"Closing custom UI widget \"" << ( *it )->getTitleQString().toStdString() <<
"\". This should have be"
868 " done by the owning module!";
901 m_splash->showMessage(
"Shutting down" );
908 m_splash->showMessage(
"Shutting down kernel. Waiting for modules to finish and cleanup." );
920 m_splash->showMessage(
"Shutting down GUI." );
955 QMainWindow::customEvent(
event );
983 if(
event->type() == WQT_READY_EVENT )
994 if(
event->type() == WQT_LOG_EVENT )
999 QString title =
"Log message from " + QString::fromStdString( e1->
getEntry().
getSource() );
1003 case LogLevel::LL_WARNING:
1006 case LogLevel::LL_ERROR:
1016 if(
event->type() == WQT_CRASH_EVENT )
1022 QString title =
"Module \"" + QString::fromStdString( e1->
getModule()->getName() ) +
"\" caused a problem.";
1023 QString message = QString::fromStdString( e1->
getMessage() );
1028 if(
event->type() == WQT_MODULE_REMOVE_EVENT )
1038 if(
event->type() == WQT_LOADFINISHED )
1046 size_t curErrCount = 0;
1047 const size_t maxErrCount = 5;
1048 std::string errors =
"<ul>";
1049 for( std::vector< std::string >::const_iterator iter = e1->
getErrors().begin(); iter != e1->
getErrors().end(); ++iter )
1051 errors +=
"<li> " + *iter;
1054 if( ( curErrCount == maxErrCount ) && ( e1->
getErrors().size() > maxErrCount ) )
1056 size_t errDiff = e1->
getErrors().size() - curErrCount;
1063 size_t curWarnCount = 0;
1064 const size_t maxWarnCount = 5;
1065 std::string warnings =
"<ul>";
1066 for( std::vector< std::string >::const_iterator iter = e1->
getWarnings().begin(); iter != e1->
getWarnings().end(); ++iter )
1068 warnings +=
"<li> " + *iter;
1071 if( ( curWarnCount == maxWarnCount ) && ( e1->
getWarnings().size() > maxWarnCount ) )
1073 size_t warnDiff = e1->
getWarnings().size() - curWarnCount;
1078 warnings +=
"</ul>";
1080 if( curWarnCount && curErrCount )
1082 reportError(
this,
"There where errors and warnings during load.",
1083 "Errors occurred during load of \"" + QString::fromStdString( e1->
getFilename() ) +
"\". "
1084 "The loader tried to apply as much as possible, ignoring the erroneous data. The first errors where:"
1085 + QString::fromStdString( errors ) +
1086 "Warnings occurred during load of \"" + QString::fromStdString( e1->
getFilename() ) +
"\". "
1087 + QString::fromStdString( warnings )
1090 else if( curWarnCount && !curErrCount )
1093 "Warnings occurred during load of \"" + QString::fromStdString( e1->
getFilename() ) +
"\". "
1094 + QString::fromStdString( warnings )
1097 else if( !curWarnCount && curErrCount )
1099 reportError(
this,
"There where errors during load.",
1100 "Errors occurred during load of \"" + QString::fromStdString( e1->
getFilename() ) +
"\". "
1101 "The loader tried to apply as much as possible, ignoring the erroneous data. The first errors where:"
1102 + QString::fromStdString( errors )
1109 return QMainWindow::event(
event );
1121 osg::ref_ptr< WROIBox >
newRoi = osg::ref_ptr< WROIBox >(
new WROIBox( minROIPos, maxROIPos ) );
1126 osg::ref_ptr< WROIBox >
newRoi = osg::ref_ptr< WROIBox >(
new WROIBox( minROIPos, maxROIPos ) );
1133 wlog::info(
"MainWindow" ) <<
"Restoring window state.";
1157 wlog::info(
"MainWindow" ) <<
"Saving window state.";
1191 if( vendor.find(
"mesa" ) != std::string::npos )
1193 QString msg =
"<b>Warning:</b> Your graphics card is powered by the Mesa OpenGL implementation. OpenWalnut does not support Mesa "
1194 "officially, since Mesa has some severe problems with GLSL shaders. You can still use OpenWalnut, but you should be "
1195 "aware that Mesa can freeze OpenWalnut. Ensure you have the latest version of Mesa installed to avoid problems.";
1196 QLabel* l =
new QLabel( msg );
1197 l->setWordWrap(
true );
1198 l->setMinimumWidth( 640 );
1205 if( ( vendor.find(
"Chromium" ) != std::string::npos ) ||
1206 ( vendor.find(
"Humper" ) != std::string::npos ) )
1208 QString msg =
"<b>Warning:</b> You seem to use OpenWalnut from inside a virtual machine. Graphics acceleration on these virtual machines"
1209 " is often limited. OpenWalnut might not properly work in your setup.";
1210 QLabel* l =
new QLabel( msg );
1211 l->setWordWrap(
true );
1212 l->setMinimumWidth( 640 );
1223 std::string content = readFileIntoString( filename );
1226 QString msgID =
"OpenWalnutWelcome" + QString( W_LIB_VERSION );
1229 boost::regex reg1(
"%OW_LIB_VERSION%" );
1230 boost::regex reg2(
"%OW_VERSION%" );
1231 content = boost::regex_replace( content, reg1, std::string( W_LIB_VERSION ) );
1232 content = boost::regex_replace( content, reg2, std::string( W_VERSION ) );
1235 #ifdef OW_FORCE_WEBKIT
1236 QWebView *view =
new QWebView(
this );
1238 QWebEngineView *view =
new QWebEngineView(
this );
1240 view->setHtml( QString::fromStdString( content ) );
1241 view->setMinimumWidth( 640 );
1242 #ifdef OW_FORCE_WEBKIT
1243 view->page()->setLinkDelegationPolicy( QWebPage::DelegateExternalLinks );
1248 msgDia->
show( force );
1259 if(
event->mimeData()->hasUrls() )
1261 std::vector < std::string > projects;
1262 std::vector < std::string > filenames;
1263 std::vector < std::string > unsupported;
1264 foreach( QUrl url,
event->mimeData()->urls() )
1266 QString path = url.toLocalFile();
1267 QFileInfo info( path );
1268 QString suffix = info.completeSuffix();
1269 if( suffix ==
"owp" || suffix ==
"owproj" )
1271 projects.push_back( path.toStdString() );
1275 filenames.push_back( path.toStdString() );
1278 if( projects.size() > 0 )
1280 for(
size_t i = 0; i < projects.size(); ++i )
1286 if( filenames.size() > 0 )
1297 QMainWindow::dropEvent(
event );
1302 return mimeData->hasUrls();
1309 event->acceptProposedAction();
1311 QMainWindow::dragMoveEvent(
event );
1318 event->acceptProposedAction();
1320 QMainWindow::dragEnterEvent(
event );
1335 widget->addAction( createSeperator(
this ) );
1339 widget->addAction( createSeperator(
this ) );
1341 widget->addAction( createSeperator(
this ) );
1343 widget->addAction( createSeperator(
this ) );
1370 return Qt::BottomDockWidgetArea;
1380 who->setVisible( !who->isVisible() );
static std::shared_ptr< WDataHandler > getDataHandler()
As WDataHandler is a singleton -> return instance.
Base for all data loader modules.
virtual std::vector< WDataModuleInputFilter::ConstSPtr > getInputFilter() const =0
Return a list of input filters.
static const QEvent::Type CUSTOM_TYPE
Constant which saves the number used to distinguish this event from other custom events.
Derived WDeferredCallEvent allowing result values in calls.
static std::shared_ptr< WGraphicsEngine > getGraphicsEngine()
Returns instance of the graphics engine.
void addMapping(const std::string &newName, const std::string &mapToThis)
Add a mapping for icons.
QIcon getIcon(const std::string name)
Searches icons in the internal map and all modules for the given icon name.
std::shared_ptr< WSelectionManager > getSelectionManager()
get for selection manager
static WKernel * getRunningKernel()
Returns pointer to the currently running kernel.
std::shared_ptr< WModuleContainer > getRootContainer() const
Returns the root module container.
void finalize()
Stops execution of the modules in the root container.
std::shared_ptr< WScriptEngine > getScriptEngine()
Get the script engine of this kernel.
std::shared_ptr< WROIManager > getRoiManager()
get for roi manager
Event signalling a finished asynchronous load job.
const std::vector< std::string > & getWarnings() const
Returns the list of warnings.
const std::vector< std::string > & getErrors() const
Returns the list of errors.
std::string getFilename() const
The filename of the file loaded.
LogLevel getLogLevel() const
std::string getMessage() const
Returns the plain message of the entry.
std::string getSource() const
Returns the sender of the log.
This event is triggered when a new event is to be added to the log.
const WLogEntry & getEntry() const
To access the WLogEntry of associated with the event.
void addLogMessage(std::string message, std::string source="", LogLevel level=LL_DEBUG)
Appends a log message to the logging queue.
void setDefaultLogLevel(const LogLevel &level)
Set the default log-level used for log entries in default console-output.
static WLogger * getLogger()
Returns pointer to the currently running logger instance.
WQtToolBar * m_permanentToolBar
The permanent toolbar of the main window.
void handleDrop(QDropEvent *event)
Handles the given drop.
void showWelcomeDialog(bool force=true)
Shows the welcome message.
WThreadedRunner::SPtr m_closeStage1Thread
The thread responsible for doing stage 1 stuff.
QAction * m_loadButton
the load button
WSettingAction * m_sliderMinMaxEditSetting
The action for allowing editing min and max of sliders.
void deregisterCustomWidget(WUIQtWidgetBase *widget)
De-register a custom widget.
WQtControlPanel * getControlPanel()
Returns a pointer to the control panel object.
void openAboutDialog()
gets called when menu entry "About OpenWalnut" is activated
QAction * m_settingsAction
the settings
std::shared_ptr< WQtNavGLWidget > m_navAxial
the axial view widget GL widget of the GUI
bool projectSaveCameraOnly()
Gets called by the save menu to only save the camera settings.
bool projectSaveAll()
Gets called whenever the user presses the project save button.
std::shared_ptr< WQtNavGLWidget > m_navCoronal
the coronal view widget GL widget of the GUI
void saveWindowState()
Saves the current window states and geometries to a file.
QAction * m_quitAction
quit OpenWalnut
QMenu * m_viewMenu
view and camera control menu
QSplashScreen * getSplash() const
Get the current splash screen.
QMenu * m_settingsMenu
the settings
WQtGLDockWidget * m_mainGLDock
the dock containing the main gl widget
void handleGLVendor()
Handles some special GL vendors and shows the user a dialog.
void openOpenWalnutHelpDialog()
Gets called when menu entry "OpenWalnut Help" is activated.
void closeStage2()
The second stage function.
void moduleSpecificCleanup(std::shared_ptr< WModule > module)
Cleanup the GUI by handling special modules.
void handleLogLevelUpdate(unsigned int logLevel)
Is able to handle updates in the log-level setting.
void setupGUI()
Set up all widgets menus an buttons in the main window.
QSplashScreen * m_splash
The splash screen object opened on startup.
static bool isDropAcceptable(const QMimeData *mimeData)
This method checks whether a given drop event is acceptable.
void moduleSpecificSetup(std::shared_ptr< WModule > module)
Setup the GUI by handling special modules.
void newRoi()
gets called when the button new ROI is pressed
QAction * m_newAction
the new project button
WQtMessageDock * m_messageDock
Message and log window.
void registerCustomWidget(WUIQtWidgetBase *widget)
Register a custom widget.
void openLoadDialog()
gets called when menu option or toolbar button load is activated
WIconManager * getIconManager()
Return icon manager.
void closeStage1Thread()
The actual thread function for m_closeStage1Thread.
WQtControlPanel * m_controlPanel
control panel
QMainWindow * m_glDock
the dock that is used for gl widgets
virtual void customEvent(QEvent *event)
Handle custom events.
QMainWindow * getDefaultCustomDockAreaWidget() const
The Widget to add custom docks.
QMenu * m_saveMenu
the menu using m_saveAction
bool projectSaveROIOnly()
Gets called by the save menu to only save the ROI settings.
void dropEvent(QDropEvent *event)
drag and drop implementation for loading files
void reportWarning(QWidget *parent, QString title, QString message)
Allows comfortable warning reporting using popups.
bool projectSaveModuleOnly()
Gets called by the save menu to only save the Module settings.
QMenu * m_helpMenu
the help menu
WSharedSequenceContainer< CustomWidgets > m_customWidgets
All registered widgets created by the core/UI api.
void dragEnterEvent(QDragEnterEvent *event)
drag and drop implementation for loading files
bool m_closeFirstStage
Used to handle the two-stage close process.
void setCompatiblesToolbar(WQtCombinerToolbar *toolbar=NULL)
This method removes the old compatibles toolbar and sets the specified one.
void addGlobalMenu(QWidget *widget)
Add the default OW menu to the given widget using addAction.
void slotLoadFinished(boost::filesystem::path file, std::vector< std::string > errors, std::vector< std::string > warnings)
Called whenever a async load has finished.
bool m_closeInProgress
Flag whether the system is shutting down now.
void reportInfo(QWidget *parent, QString title, QString message)
Allows comfortable info reporting using popups.
virtual ~WMainWindow()
Destructor.
Qt::DockWidgetArea getDefaultCustomDockArea() const
The default dock area to use for adding custom docks.
void closeSplash()
Finally closes the splash screen.
void asyncProjectLoad(std::string filename)
Loads a given project asynchronously.
void reportError(QWidget *parent, QString title, QString message)
Allows comfortable error reporting using popups.
virtual bool projectSave(const std::vector< std::shared_ptr< WProjectFileIO > > &writer)
Called for each project save request.
static void setSetting(std::string key, std::string value)
Set a setting specified by a key to a given value.
WQtNetworkEditor * m_networkEditor
network editor
boost::signals2::signal< void(std::vector< std::string >) > * getLoaderSignal()
Returns a pointer to a signal object which signals a list of filenames to load.
std::shared_ptr< WQtNavGLWidget > m_navSagittal
the sgittal view widget GL widget of the GUI
WQtGLWidget * m_mainGLWidget
the main GL widget of the GUI
std::vector< WUIQtWidgetBase * > CustomWidgets
Container for core/UI widgetd.
WQtCombinerToolbar * getCompatiblesToolbar()
This method returns the a pointer to the current compatibles toolbar.
void restoreSavedState()
Loads the window states and geometries from a file.
QAction * m_saveAction
the save menu
WQtCombinerToolbar * m_currentCompatiblesToolbar
The currently set compatibles toolbar.
virtual void closeEvent(QCloseEvent *e)
We want to react on close events.
void openNotImplementedDialog()
Gets called when a menu entry that has no functionality yet is activated.
void handleStartMessages()
Shows startup info messages.
const WQtMessageDock * getMessageDock() const
Return the message dock widget.
static QSettings & getSettings()
Returns the settings object.
QAction * m_helpAction
the help menu
boost::signals2::signal< void(std::vector< std::string >) > m_loaderSignal
boost signal for open file dialog
QMenuBar * m_menuBar
The main menu bar of the GUI.
void newProject()
Slot handling the pressed new project button.
void openAboutQtDialog()
Gets called when menu entry "About Qt" is activated.
WIconManager m_iconManager
manager to provide icons in the gui thread
void dragMoveEvent(QDragMoveEvent *event)
drag and drop implementation for loading files
WQtNetworkEditor * getNetworkEditor()
Returns a pointer to the network editor object.
void switchVisibility(QWidget *who)
Change visibility of the given widget.
void autoAdd(std::shared_ptr< WModule > module, std::string proto, bool onlyOnce=false)
Combine a module with a prototype only if the module is available.
virtual bool event(QEvent *event)
Custom event dispatcher.
WMainWindow(QSplashScreen *splash)
Constructor of the main window.
Event signalling a new module has been associated with the root container in the kernel.
std::string getMessage()
The crash message.
std::shared_ptr< WModule > getModule()
Getter for the module that got associated.
static SPtr getModuleFactory()
Returns instance of the module factory to use to create modules.
Event signalling a new module has been associated with the root container in the kernel.
std::shared_ptr< WModule > getModule()
Getter for the module that got associated.
Event signalling a module was removed from the kernel root container.
std::shared_ptr< WModule > getModule()
Getter for the module that got removed.
static boost::filesystem::path getDocPath()
The path where the doc files reside in.
This only is a 3d double vector.
Class loading project files.
static std::shared_ptr< WProjectFileIO > getModuleWriter()
Returns an instance of the module writer.
std::shared_ptr< WProjectFile > SPtr
Abbreviation for a shared pointer.
static std::shared_ptr< WProjectFileIO > getROIWriter()
Returns an instance of the ROI writer.
static std::shared_ptr< WProjectFileIO > getCameraWriter()
Returns an instance of the Camera writer.
container widget for a tree widget with context menu and some control widgets
WQtDockWidget * getModuleDock() const
Gets the module dock widget.
WQtModuleConfig & getModuleConfig() const
Returns the module config dialog.
WQtSubjectTreeItem * addSubject(std::string name)
Adds a subject entry to the tree widget.
void selectUpperMostEntry()
Selects the uppermost entry in the module tree.
QAction * getRoiDeleteAction() const
Return the action to delete a selected roi.
void completeGuiSetup()
Complete own GUI setup.
WQtDockWidget * getColormapperDock() const
Gets the colormapper dock.
QAction * toggleViewAction() const
Returns a checkable action that can be used to show or close this dock widget.
WQtDockWidget * getRoiDock() const
Gets the ROI dock widget.
osg::ref_ptr< WROI > getFirstRoiInSelectedBranch()
Returns the first ROI in the currently selected branch.
static QSettings & getSettings()
Returns the settings object.
static void execInGUIThreadAsync(boost::function< void(void) > functor, WCondition::SPtr notify=WCondition::SPtr())
Call a given function from within the GUI thread.
General purpose message dialog, able to show arbitrary content.
virtual void show()
Shows the dialog if the user does not disabled it.
Dock widget for showing messages and logs.
void saveSettings()
Save state to settings.
void addMessage(QString title, QString message, WQtMessagePopup::MessageType type)
Add a message to the dock.
void addLogMessage(QString sender, QString message, WQtMessagePopup::MessageType type)
Add a message to the dock.
QAction * getConfigureAction() const
Creates an action instance allowing the configuration.
Container widget to hold the WQtNetworkScene.
WQtNetworkEditorView * getView()
Get the view handling the scene.
Implements a property action for WPropBool.
A box representing a region of interest.
Class to handle a certain setting with an action.
bool get() const
Gets the current state.
ReadTicket getReadTicket() const
Returns a ticket to get read access to the contained data.
This class provides a common interface for thread-safe access to sequence containers (list,...
void remove(const typename S::value_type &element)
Searches and removes the specified element.
void unique_push_back(const typename S::value_type &x)
Add the element only if it is not inside the container until now.
Base class for all classes needing to be executed in a separate thread.
std::shared_ptr< WThreadedRunner > SPtr
Abbreviation to a shared_ptr to this type.
std::string toLower(const std::string &source)
Transforms all characters in the given string into lower case characters.
std::string toString(const T &value)
Convert a given value to a string.
WStreamedLogger warn(const std::string &source)
Logging a warning message.
WStreamedLogger info(const std::string &source)
Logging an information message.