OpenWalnut  1.5.0dev
Public Slots | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Types | Private Slots | Private Member Functions | Private Attributes | List of all members
WMainWindow Class Reference

This class contains the main window and the layout of the widgets within the window. More...

#include <WMainWindow.h>

+ Inheritance diagram for WMainWindow:
+ Collaboration diagram for WMainWindow:

Public Slots

void newProject ()
 Slot handling the pressed new project button. More...
 
void openLoadDialog ()
 gets called when menu option or toolbar button load is activated More...
 
void openAboutDialog ()
 gets called when menu entry "About OpenWalnut" is activated More...
 
void openAboutQtDialog ()
 Gets called when menu entry "About Qt" is activated. More...
 
void openOpenWalnutHelpDialog ()
 Gets called when menu entry "OpenWalnut Help" is activated. More...
 
void openNotImplementedDialog ()
 Gets called when a menu entry that has no functionality yet is activated. More...
 
void newRoi ()
 gets called when the button new ROI is pressed More...
 
bool projectSaveAll ()
 Gets called whenever the user presses the project save button. More...
 
bool projectSaveCameraOnly ()
 Gets called by the save menu to only save the camera settings. More...
 
bool projectSaveROIOnly ()
 Gets called by the save menu to only save the ROI settings. More...
 
bool projectSaveModuleOnly ()
 Gets called by the save menu to only save the Module settings. More...
 
void handleLogLevelUpdate (unsigned int logLevel)
 Is able to handle updates in the log-level setting. More...
 
void handleDrop (QDropEvent *event)
 Handles the given drop. More...
 
void switchVisibility (QWidget *who)
 Change visibility of the given widget. More...
 

Public Member Functions

 WMainWindow (QSplashScreen *splash)
 Constructor of the main window. More...
 
virtual ~WMainWindow ()
 Destructor. More...
 
void setupGUI ()
 Set up all widgets menus an buttons in the main window. More...
 
WQtNetworkEditorgetNetworkEditor ()
 Returns a pointer to the network editor object. More...
 
WQtControlPanelgetControlPanel ()
 Returns a pointer to the control panel object. More...
 
WIconManagergetIconManager ()
 Return icon manager. More...
 
boost::signals2::signal< void(std::vector< std::string >) > * getLoaderSignal ()
 Returns a pointer to a signal object which signals a list of filenames to load. More...
 
std::shared_ptr< WQtCustomDockWidget > getCustomDockWidget (std::string name)
 Searches for a custom dock widget with a given name and returns it, if found. More...
 
void closeCustomDockWidget (std::string title)
 Close one of the custom dock widget saved in the map of customDockWidgets. More...
 
void setCompatiblesToolbar (WQtCombinerToolbar *toolbar=NULL)
 This method removes the old compatibles toolbar and sets the specified one. More...
 
WQtCombinerToolbargetCompatiblesToolbar ()
 This method returns the a pointer to the current compatibles toolbar. More...
 
QSplashScreen * getSplash () const
 Get the current splash screen. More...
 
void asyncProjectLoad (std::string filename)
 Loads a given project asynchronously. More...
 
void addGlobalMenu (QWidget *widget)
 Add the default OW menu to the given widget using addAction. More...
 
void reportError (QWidget *parent, QString title, QString message)
 Allows comfortable error reporting using popups. More...
 
void reportWarning (QWidget *parent, QString title, QString message)
 Allows comfortable warning reporting using popups. More...
 
void reportInfo (QWidget *parent, QString title, QString message)
 Allows comfortable info reporting using popups. More...
 
const WQtMessageDockgetMessageDock () const
 Return the message dock widget. More...
 
WQtMessageDockgetMessageDock ()
 Return the message dock widget. More...
 
void registerCustomWidget (WUIQtWidgetBase *widget)
 Register a custom widget. More...
 
void deregisterCustomWidget (WUIQtWidgetBase *widget)
 De-register a custom widget. More...
 
Qt::DockWidgetArea getDefaultCustomDockArea () const
 The default dock area to use for adding custom docks. More...
 
QMainWindowgetDefaultCustomDockAreaWidget () const
 The Widget to add custom docks. More...
 

Static Public Member Functions

static QSettings & getSettings ()
 Returns the settings object. More...
 
static void setSetting (std::string key, std::string value)
 Set a setting specified by a key to a given value. More...
 
static bool isDropAcceptable (const QMimeData *mimeData)
 This method checks whether a given drop event is acceptable. More...
 

Protected Member Functions

void moduleSpecificSetup (std::shared_ptr< WModule > module)
 Setup the GUI by handling special modules. More...
 
void moduleSpecificCleanup (std::shared_ptr< WModule > module)
 Cleanup the GUI by handling special modules. More...
 
virtual void closeEvent (QCloseEvent *e)
 We want to react on close events. More...
 
virtual void customEvent (QEvent *event)
 Handle custom events. More...
 
virtual bool event (QEvent *event)
 Custom event dispatcher. More...
 
virtual bool projectSave (const std::vector< std::shared_ptr< WProjectFileIO > > &writer)
 Called for each project save request. More...
 
void dropEvent (QDropEvent *event)
 drag and drop implementation for loading files More...
 
void dragMoveEvent (QDragMoveEvent *event)
 drag and drop implementation for loading files More...
 
void dragEnterEvent (QDragEnterEvent *event)
 drag and drop implementation for loading files More...
 

Private Types

typedef std::vector< WUIQtWidgetBase * > CustomWidgets
 Container for core/UI widgetd. More...
 

Private Slots

void handleGLVendor ()
 Handles some special GL vendors and shows the user a dialog. More...
 
void handleStartMessages ()
 Shows startup info messages. More...
 
void showWelcomeDialog (bool force=true)
 Shows the welcome message. More...
 
void closeSplash ()
 Finally closes the splash screen. More...
 

Private Member Functions

void closeStage1Thread ()
 The actual thread function for m_closeStage1Thread. More...
 
void closeStage2 ()
 The second stage function. More...
 
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. More...
 
void restoreSavedState ()
 Loads the window states and geometries from a file. More...
 
void saveWindowState ()
 Saves the current window states and geometries to a file. More...
 
void slotLoadFinished (boost::filesystem::path file, std::vector< std::string > errors, std::vector< std::string > warnings)
 Called whenever a async load has finished. More...
 

Private Attributes

QSplashScreen * m_splash
 The splash screen object opened on startup. More...
 
WQtCombinerToolbarm_currentCompatiblesToolbar
 The currently set compatibles toolbar. More...
 
WIconManager m_iconManager
 manager to provide icons in the gui thread More...
 
QMenuBar * m_menuBar
 The main menu bar of the GUI. More...
 
WQtToolBarm_permanentToolBar
 The permanent toolbar of the main window. More...
 
WQtMessageDockm_messageDock
 Message and log window. More...
 
QActionm_newAction
 the new project button More...
 
QActionm_loadButton
 the load button More...
 
QActionm_quitAction
 quit OpenWalnut More...
 
QActionm_saveAction
 the save menu More...
 
QMenum_saveMenu
 the menu using m_saveAction More...
 
QMenum_viewMenu
 view and camera control menu More...
 
QActionm_settingsAction
 the settings More...
 
QMenum_settingsMenu
 the settings More...
 
QActionm_helpAction
 the help menu More...
 
QMenum_helpMenu
 the help menu More...
 
WQtControlPanelm_controlPanel
 control panel More...
 
WQtNetworkEditorm_networkEditor
 network editor More...
 
WQtGLWidgetm_mainGLWidget
 the main GL widget of the GUI More...
 
std::shared_ptr< WQtNavGLWidgetm_navAxial
 the axial view widget GL widget of the GUI More...
 
std::shared_ptr< WQtNavGLWidgetm_navCoronal
 the coronal view widget GL widget of the GUI More...
 
std::shared_ptr< WQtNavGLWidgetm_navSagittal
 the sgittal view widget GL widget of the GUI More...
 
QMainWindowm_glDock
 the dock that is used for gl widgets More...
 
QDockWidgetm_dummyWidget
 The dummywidget serves as spacer in the dockwidget area;. More...
 
WQtGLDockWidgetm_mainGLDock
 the dock containing the main gl widget More...
 
bool m_closeFirstStage
 Used to handle the two-stage close process. More...
 
bool m_closeInProgress
 Flag whether the system is shutting down now. More...
 
WThreadedRunner::SPtr m_closeStage1Thread
 The thread responsible for doing stage 1 stuff. More...
 
WSharedSequenceContainer< CustomWidgetsm_customWidgets
 All registered widgets created by the core/UI api. More...
 
boost::signals2::signal< void(std::vector< std::string >) > m_loaderSignal
 boost signal for open file dialog More...
 
WSettingActionm_sliderMinMaxEditSetting
 The action for allowing editing min and max of sliders. More...
 

Detailed Description

This class contains the main window and the layout of the widgets within the window.

Definition at line 65 of file WMainWindow.h.

Member Typedef Documentation

◆ CustomWidgets

typedef std::vector< WUIQtWidgetBase* > WMainWindow::CustomWidgets
private

Container for core/UI widgetd.

Definition at line 487 of file WMainWindow.h.

Constructor & Destructor Documentation

◆ WMainWindow()

WMainWindow::WMainWindow ( QSplashScreen *  splash)
explicit

Constructor of the main window.

Parameters
splashthe splash screen currently show. This windows later handles its close stuff.

Definition at line 102 of file WMainWindow.cpp.

◆ ~WMainWindow()

WMainWindow::~WMainWindow ( )
virtual

Destructor.

Stores window state.

Definition at line 113 of file WMainWindow.cpp.

Member Function Documentation

◆ addGlobalMenu()

void WMainWindow::addGlobalMenu ( QWidget *  widget)

Add the default OW menu to the given widget using addAction.

Parameters
widgetthe widget to add the menu to

Definition at line 1333 of file WMainWindow.cpp.

References m_helpAction, m_loadButton, m_newAction, m_quitAction, m_saveAction, and m_settingsAction.

Referenced by WQtControlPanel::completeGuiSetup().

+ Here is the caller graph for this function:

◆ asyncProjectLoad()

void WMainWindow::asyncProjectLoad ( std::string  filename)

Loads a given project asynchronously.

Parameters
filenamethe file to load.

Definition at line 773 of file WMainWindow.cpp.

References slotLoadFinished().

Referenced by WQtGui::deferredLoad(), handleDrop(), and openLoadDialog().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ autoAdd()

void WMainWindow::autoAdd ( std::shared_ptr< WModule module,
std::string  proto,
bool  onlyOnce = false 
)
private

Combine a module with a prototype only if the module is available.

Else, nothing happens.

Parameters
modulethe module to be combined.
protothe prototype to combine with the module.
onlyOnceif true, it is ensured that only one module is in the container.

Definition at line 472 of file WMainWindow.cpp.

References WLogger::addLogMessage(), WLogger::getLogger(), and WKernel::getRunningKernel().

+ Here is the call graph for this function:

◆ closeCustomDockWidget()

void WMainWindow::closeCustomDockWidget ( std::string  title)

Close one of the custom dock widget saved in the map of customDockWidgets.

This method is thread-safe and ensures that the widget is closed in the GUI thread. NEVER call this in the GUI thread. It will block the GUI.

Note
the widget might not be closed after this call. The widget is usage counted.
Parameters
titlethe title of the widget to close

◆ closeEvent()

void WMainWindow::closeEvent ( QCloseEvent *  e)
protectedvirtual

We want to react on close events.

Parameters
ethe close event.

Definition at line 884 of file WMainWindow.cpp.

References closeStage1Thread(), m_closeFirstStage, m_closeInProgress, m_closeStage1Thread, m_mainGLDock, m_navAxial, m_navCoronal, m_navSagittal, m_splash, and saveWindowState().

+ Here is the call graph for this function:

◆ closeSplash

void WMainWindow::closeSplash ( )
privateslot

Finally closes the splash screen.

Definition at line 1323 of file WMainWindow.cpp.

References m_splash.

Referenced by setupGUI().

+ Here is the caller graph for this function:

◆ closeStage1Thread()

void WMainWindow::closeStage1Thread ( )
private

The actual thread function for m_closeStage1Thread.

Definition at line 851 of file WMainWindow.cpp.

References closeStage2(), WQtGui::execInGUIThreadAsync(), WKernel::finalize(), WSharedObject< T >::getReadTicket(), WKernel::getRunningKernel(), m_customWidgets, and wlog::warn().

Referenced by closeEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ closeStage2()

void WMainWindow::closeStage2 ( )
private

The second stage function.

Called by the finished closeStage1Thread function. Runs in GUI thread.

Definition at line 877 of file WMainWindow.cpp.

References m_closeFirstStage.

Referenced by closeStage1Thread().

+ Here is the caller graph for this function:

◆ customEvent()

void WMainWindow::customEvent ( QEvent event)
protectedvirtual

Handle custom events.

Currently only WOpenCustomDockWidgetEvent.

Parameters
eventthe custom event

Definition at line 946 of file WMainWindow.cpp.

References WDeferredCallEventBase::CUSTOM_TYPE, and event().

+ Here is the call graph for this function:

◆ deregisterCustomWidget()

void WMainWindow::deregisterCustomWidget ( WUIQtWidgetBase widget)

De-register a custom widget.

Parameters
widgetthe widget.

Definition at line 1362 of file WMainWindow.cpp.

References m_customWidgets, and WSharedSequenceContainer< S >::remove().

Referenced by WUIQtWidgetBase::closeGT().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dragEnterEvent()

void WMainWindow::dragEnterEvent ( QDragEnterEvent *  event)
protected

drag and drop implementation for loading files

Parameters
eventthe event to handle

Definition at line 1314 of file WMainWindow.cpp.

References event(), and isDropAcceptable().

+ Here is the call graph for this function:

◆ dragMoveEvent()

void WMainWindow::dragMoveEvent ( QDragMoveEvent *  event)
protected

drag and drop implementation for loading files

Parameters
eventthe event to handle

Definition at line 1305 of file WMainWindow.cpp.

References event(), and isDropAcceptable().

+ Here is the call graph for this function:

◆ dropEvent()

void WMainWindow::dropEvent ( QDropEvent *  event)
protected

drag and drop implementation for loading files

Parameters
eventthe event to handle

Definition at line 1294 of file WMainWindow.cpp.

References event(), and handleDrop().

+ Here is the call graph for this function:

◆ event()

bool WMainWindow::event ( QEvent event)
protectedvirtual

Custom event dispatcher.

Gets called by QT's Event system every time an event got sent to this widget. This event handler processes several custom events, like WModuleAssocEvent.

Note
QT Doc says: use event() for custom events.
Parameters
eventthe event that got transmitted.
Returns
true if the event got handled properly.

Definition at line 980 of file WMainWindow.cpp.

References WQtMessageDock::addLogMessage(), WLogEvent::getEntry(), WLoadFinishedEvent::getErrors(), WLoadFinishedEvent::getFilename(), WLogEntry::getLogLevel(), WModuleCrashEvent::getMessage(), WLogEntry::getMessage(), getMessageDock(), WModuleCrashEvent::getModule(), WModuleReadyEvent::getModule(), WModuleRemovedEvent::getModule(), WLogEntry::getSource(), WLoadFinishedEvent::getWarnings(), moduleSpecificCleanup(), moduleSpecificSetup(), reportError(), reportWarning(), and string_utils::toString().

Referenced by customEvent(), dragEnterEvent(), dragMoveEvent(), dropEvent(), and handleDrop().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCompatiblesToolbar()

WQtCombinerToolbar * WMainWindow::getCompatiblesToolbar ( )

This method returns the a pointer to the current compatibles toolbar.

Returns
a pointer to the current compatibles toolbar.

Definition at line 572 of file WMainWindow.cpp.

References m_currentCompatiblesToolbar.

Referenced by WQtControlPanel::createCompatibleButtons(), and WQtControlPanel::selectRoiTreeItem().

+ Here is the caller graph for this function:

◆ getControlPanel()

WQtControlPanel * WMainWindow::getControlPanel ( )

◆ getCustomDockWidget()

std::shared_ptr< WQtCustomDockWidget > WMainWindow::getCustomDockWidget ( std::string  name)

Searches for a custom dock widget with a given name and returns it, if found.

Parameters
namethe name of the widget
Returns
a shared pointer to the widget or NULL if not found

◆ getDefaultCustomDockArea()

Qt::DockWidgetArea WMainWindow::getDefaultCustomDockArea ( ) const

The default dock area to use for adding custom docks.

Returns
the dock area in getDefaultCustomDockAreaWidget

Definition at line 1368 of file WMainWindow.cpp.

Referenced by WUIQtWidgetBase::embedContent().

+ Here is the caller graph for this function:

◆ getDefaultCustomDockAreaWidget()

QMainWindow * WMainWindow::getDefaultCustomDockAreaWidget ( ) const

The Widget to add custom docks.

Returns
the widget

Definition at line 1373 of file WMainWindow.cpp.

References m_glDock.

Referenced by WUIQtWidgetBase::embedContent().

+ Here is the caller graph for this function:

◆ getIconManager()

WIconManager * WMainWindow::getIconManager ( )

Return icon manager.

Returns
the icon manager instance

Definition at line 846 of file WMainWindow.cpp.

References m_iconManager.

Referenced by WQtControlPanel::createCompatibleButtons(), WQtGui::getIconManager(), and WQtModuleConfig::WQtModuleConfig().

+ Here is the caller graph for this function:

◆ getLoaderSignal()

boost::signals2::signal< void(std::vector< std::string >) > * WMainWindow::getLoaderSignal ( )

Returns a pointer to a signal object which signals a list of filenames to load.

Returns
the signal

Definition at line 841 of file WMainWindow.cpp.

References m_loaderSignal.

Referenced by WQtGui::getLoadButtonSignal().

+ Here is the caller graph for this function:

◆ getMessageDock() [1/2]

WQtMessageDock * WMainWindow::getMessageDock ( )

Return the message dock widget.

Returns
the message dock

Definition at line 1352 of file WMainWindow.cpp.

References m_messageDock.

◆ getMessageDock() [2/2]

const WQtMessageDock * WMainWindow::getMessageDock ( ) const

Return the message dock widget.

Returns
the message dock

Definition at line 1347 of file WMainWindow.cpp.

References m_messageDock.

Referenced by event().

+ Here is the caller graph for this function:

◆ getNetworkEditor()

WQtNetworkEditor * WMainWindow::getNetworkEditor ( )

◆ getSettings()

QSettings & WMainWindow::getSettings ( )
static

Returns the settings object.

Returns
settings object.

Definition at line 1170 of file WMainWindow.cpp.

References WQtGui::getSettings().

Referenced by handleGLVendor(), WQtGLDockWidget::restoreSettings(), WQtMessageDock::saveSettings(), setSetting(), showWelcomeDialog(), and WQtMessageDock::WQtMessageDock().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSplash()

QSplashScreen * WMainWindow::getSplash ( ) const

Get the current splash screen.

Returns
the splash screen. Might be closed.

Definition at line 1328 of file WMainWindow.cpp.

References m_splash.

◆ handleDrop

void WMainWindow::handleDrop ( QDropEvent *  event)
slot

Handles the given drop.

Use this in conjunction with isDropAcceptable.

Parameters
eventthe event to handle

Definition at line 1257 of file WMainWindow.cpp.

References asyncProjectLoad(), event(), and m_loaderSignal.

Referenced by dropEvent(), and setupGUI().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleGLVendor

void WMainWindow::handleGLVendor ( )
privateslot

Handles some special GL vendors and shows the user a dialog.

Definition at line 1185 of file WMainWindow.cpp.

References getSettings(), WQtGLWidget::getViewer(), m_mainGLWidget, WQtMessageDialog::show(), and string_utils::toLower().

Referenced by setupGUI().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleLogLevelUpdate

void WMainWindow::handleLogLevelUpdate ( unsigned int  logLevel)
slot

Is able to handle updates in the log-level setting.

Parameters
logLevelthe new loglevel to set

Definition at line 1180 of file WMainWindow.cpp.

References WLogger::getLogger(), and WLogger::setDefaultLogLevel().

Referenced by setupGUI().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleStartMessages

void WMainWindow::handleStartMessages ( )
privateslot

Shows startup info messages.

Definition at line 1251 of file WMainWindow.cpp.

References showWelcomeDialog().

Referenced by setupGUI().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isDropAcceptable()

bool WMainWindow::isDropAcceptable ( const QMimeData *  mimeData)
static

This method checks whether a given drop event is acceptable.

Several widgets in the GUI should support drag and drop. Unfortunately, not all widgets automatically push these events to the MainWindow. This is especially the case for QGraphics* based classes.

Parameters
mimeDatathe mime info of the dragged thing
Returns
true if acceptable.

Definition at line 1300 of file WMainWindow.cpp.

Referenced by dragEnterEvent(), WQtNetworkScene::dragEnterEvent(), dragMoveEvent(), and WQtNetworkScene::dragMoveEvent().

+ Here is the caller graph for this function:

◆ moduleSpecificCleanup()

void WMainWindow::moduleSpecificCleanup ( std::shared_ptr< WModule module)
protected

Cleanup the GUI by handling special modules.

NavSlices for example remove several toolbar buttons.

Parameters
modulethe module to setup the GUI for.

Definition at line 488 of file WMainWindow.cpp.

Referenced by event().

+ Here is the caller graph for this function:

◆ moduleSpecificSetup()

void WMainWindow::moduleSpecificSetup ( std::shared_ptr< WModule module)
protected

Setup the GUI by handling special modules.

NavSlices for example setup several toolbar buttons.

Parameters
modulethe module to setup the GUI for.

Definition at line 493 of file WMainWindow.cpp.

Referenced by event().

+ Here is the caller graph for this function:

◆ newProject

void WMainWindow::newProject ( )
slot

Slot handling the pressed new project button.

Definition at line 666 of file WMainWindow.cpp.

References WDataHandler::getDataHandler(), WKernel::getRootContainer(), and WKernel::getRunningKernel().

Referenced by setupGUI().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ newRoi

void WMainWindow::newRoi ( )
slot

gets called when the button new ROI is pressed

Definition at line 1112 of file WMainWindow.cpp.

References WQtControlPanel::getFirstRoiInSelectedBranch(), WKernel::getRoiManager(), WKernel::getRunningKernel(), WKernel::getSelectionManager(), and m_controlPanel.

Referenced by setupGUI().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ openAboutDialog

void WMainWindow::openAboutDialog ( )
slot

gets called when menu entry "About OpenWalnut" is activated

Definition at line 799 of file WMainWindow.cpp.

References WPathHelper::getDocPath().

Referenced by setupGUI().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ openAboutQtDialog

void WMainWindow::openAboutQtDialog ( )
slot

Gets called when menu entry "About Qt" is activated.

Definition at line 794 of file WMainWindow.cpp.

Referenced by setupGUI().

+ Here is the caller graph for this function:

◆ openLoadDialog

void WMainWindow::openLoadDialog ( )
slot

gets called when menu option or toolbar button load is activated

Definition at line 721 of file WMainWindow.cpp.

References asyncProjectLoad(), WKernel::getRunningKernel(), WKernel::getScriptEngine(), WQtGui::getSettings(), and m_loaderSignal.

Referenced by setupGUI().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ openNotImplementedDialog

void WMainWindow::openNotImplementedDialog ( )
slot

Gets called when a menu entry that has no functionality yet is activated.

Definition at line 834 of file WMainWindow.cpp.

◆ openOpenWalnutHelpDialog

void WMainWindow::openOpenWalnutHelpDialog ( )
slot

Gets called when menu entry "OpenWalnut Help" is activated.

Definition at line 807 of file WMainWindow.cpp.

References WPathHelper::getDocPath().

Referenced by setupGUI().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ projectSave()

bool WMainWindow::projectSave ( const std::vector< std::shared_ptr< WProjectFileIO > > &  writer)
protectedvirtual

Called for each project save request.

Parameters
writerthe list of writers to use.
Returns
true if saving was successful

Definition at line 587 of file WMainWindow.cpp.

References WQtGui::getSettings().

Referenced by projectSaveAll(), projectSaveCameraOnly(), projectSaveModuleOnly(), and projectSaveROIOnly().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ projectSaveAll

bool WMainWindow::projectSaveAll ( )
slot

Gets called whenever the user presses the project save button.

Definition at line 638 of file WMainWindow.cpp.

References projectSave().

Referenced by setupGUI().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ projectSaveCameraOnly

bool WMainWindow::projectSaveCameraOnly ( )
slot

Gets called by the save menu to only save the camera settings.

Definition at line 645 of file WMainWindow.cpp.

References WProjectFile::getCameraWriter(), and projectSave().

Referenced by setupGUI().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ projectSaveModuleOnly

bool WMainWindow::projectSaveModuleOnly ( )
slot

Gets called by the save menu to only save the Module settings.

Definition at line 659 of file WMainWindow.cpp.

References WProjectFile::getModuleWriter(), and projectSave().

Referenced by setupGUI().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ projectSaveROIOnly

bool WMainWindow::projectSaveROIOnly ( )
slot

Gets called by the save menu to only save the ROI settings.

Definition at line 652 of file WMainWindow.cpp.

References WProjectFile::getROIWriter(), and projectSave().

+ Here is the call graph for this function:

◆ registerCustomWidget()

void WMainWindow::registerCustomWidget ( WUIQtWidgetBase widget)

Register a custom widget.

This is important as the main window needs to manage the close/delete of these widgets. Only call from withing the GUI thread.

Parameters
widgetthe widget.

Definition at line 1357 of file WMainWindow.cpp.

References m_customWidgets, and WSharedSequenceContainer< S >::unique_push_back().

Referenced by WUIQtWidgetBase::realizeGT().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reportError()

void WMainWindow::reportError ( QWidget *  parent,
QString  title,
QString  message 
)

Allows comfortable error reporting using popups.

Parameters
parentthe parent widget for this popup
titlethe title
messagethe message

Definition at line 959 of file WMainWindow.cpp.

References WQtMessageDock::addMessage(), m_messageDock, and WQtMessagePopup::show().

Referenced by event().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reportInfo()

void WMainWindow::reportInfo ( QWidget *  parent,
QString  title,
QString  message 
)

Allows comfortable info reporting using popups.

Parameters
parentthe parent widget for this popup
titlethe title
messagethe message

Definition at line 973 of file WMainWindow.cpp.

References WQtMessageDock::addMessage(), m_messageDock, and WQtMessagePopup::show().

+ Here is the call graph for this function:

◆ reportWarning()

void WMainWindow::reportWarning ( QWidget *  parent,
QString  title,
QString  message 
)

Allows comfortable warning reporting using popups.

Parameters
parentthe parent widget for this popup
titlethe title
messagethe message

Definition at line 966 of file WMainWindow.cpp.

References WQtMessageDock::addMessage(), m_messageDock, and WQtMessagePopup::show().

Referenced by event().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ restoreSavedState()

void WMainWindow::restoreSavedState ( )
private

Loads the window states and geometries from a file.

Definition at line 1131 of file WMainWindow.cpp.

References WQtGui::getSettings(), wlog::info(), m_glDock, m_navAxial, m_navCoronal, and m_navSagittal.

Referenced by setupGUI().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveWindowState()

void WMainWindow::saveWindowState ( )
private

Saves the current window states and geometries to a file.

Definition at line 1155 of file WMainWindow.cpp.

References WQtGui::getSettings(), wlog::info(), m_glDock, m_messageDock, and WQtMessageDock::saveSettings().

Referenced by closeEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setCompatiblesToolbar()

void WMainWindow::setCompatiblesToolbar ( WQtCombinerToolbar toolbar = NULL)

This method removes the old compatibles toolbar and sets the specified one.

Parameters
toolbarthe toolbar to set. If NULL, the toolbar gets reset.

Definition at line 535 of file WMainWindow.cpp.

References m_currentCompatiblesToolbar, and m_permanentToolBar.

Referenced by WQtControlPanel::createCompatibleButtons(), and WQtControlPanel::selectRoiTreeItem().

+ Here is the caller graph for this function:

◆ setSetting()

void WMainWindow::setSetting ( std::string  key,
std::string  value 
)
static

Set a setting specified by a key to a given value.

Abbreviation for the lazy programmer as it ensures proper typecast of std::string to the QSettings types (QString and QVariant).

Parameters
keythe key
valuethe value

Definition at line 1175 of file WMainWindow.cpp.

References getSettings().

Referenced by WQtGLDockWidget::saveSettings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setupGUI()

void WMainWindow::setupGUI ( )

Set up all widgets menus an buttons in the main window.

Definition at line 132 of file WMainWindow.cpp.

References WQtToolBar::addAction(), WIconManager::addMapping(), WQtControlPanel::addSubject(), WQtDockWidget::addTitleAction(), WQtDockWidget::addTitleSeperator(), closeSplash(), WQtControlPanel::completeGuiSetup(), WSettingAction::get(), WQtControlPanel::getColormapperDock(), WQtModuleConfig::getConfigureAction(), WQtGLDockWidget::getGLWidget(), WGraphicsEngine::getGraphicsEngine(), WIconManager::getIcon(), WQtControlPanel::getModuleConfig(), WQtControlPanel::getModuleDock(), WQtControlPanel::getRoiDeleteAction(), WQtControlPanel::getRoiDock(), WKernel::getRunningKernel(), WQtToolBarBase::getStyleMenu(), WQtNetworkEditor::getView(), WQtGLWidget::getViewer(), handleDrop(), handleGLVendor(), handleLogLevelUpdate(), handleStartMessages(), wlog::info(), m_controlPanel, m_glDock, m_helpAction, m_helpMenu, m_iconManager, m_loadButton, m_mainGLDock, m_mainGLWidget, m_menuBar, m_messageDock, m_navAxial, m_navCoronal, m_navSagittal, m_networkEditor, m_newAction, m_permanentToolBar, m_quitAction, m_saveAction, m_saveMenu, m_settingsAction, m_settingsMenu, m_sliderMinMaxEditSetting, m_viewMenu, newProject(), newRoi(), openAboutDialog(), openAboutQtDialog(), openLoadDialog(), openOpenWalnutHelpDialog(), projectSaveAll(), projectSaveCameraOnly(), projectSaveModuleOnly(), restoreSavedState(), WQtGLDockWidget::restoreSettings(), WQtControlPanel::selectUpperMostEntry(), showWelcomeDialog(), and WQtControlPanel::toggleViewAction().

Referenced by WQtGui::run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showWelcomeDialog

void WMainWindow::showWelcomeDialog ( bool  force = true)
privateslot

Shows the welcome message.

Parameters
forceif true, the dialog is shown even if the user said "do not show again".

Definition at line 1219 of file WMainWindow.cpp.

References WPathHelper::getDocPath(), getSettings(), and WQtMessageDialog::show().

Referenced by handleStartMessages(), and setupGUI().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ slotLoadFinished()

void WMainWindow::slotLoadFinished ( boost::filesystem::path  file,
std::vector< std::string >  errors,
std::vector< std::string >  warnings 
)
private

Called whenever a async load has finished.

Used by asyncProjectLoad. It might be called from outside the GUI thread.

Parameters
filethe filename
errorsthe list of errors
warningsthe list of warnings

Definition at line 783 of file WMainWindow.cpp.

References wlog::warn().

Referenced by asyncProjectLoad().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ switchVisibility

void WMainWindow::switchVisibility ( QWidget *  who)
slot

Change visibility of the given widget.

Useful as there is no toggleVisibility slot in Qt.

Parameters
whothe widget to switch

Definition at line 1378 of file WMainWindow.cpp.

Member Data Documentation

◆ m_closeFirstStage

bool WMainWindow::m_closeFirstStage
private

Used to handle the two-stage close process.

Definition at line 462 of file WMainWindow.h.

Referenced by closeEvent(), and closeStage2().

◆ m_closeInProgress

bool WMainWindow::m_closeInProgress
private

Flag whether the system is shutting down now.

Definition at line 467 of file WMainWindow.h.

Referenced by closeEvent().

◆ m_closeStage1Thread

WThreadedRunner::SPtr WMainWindow::m_closeStage1Thread
private

The thread responsible for doing stage 1 stuff.

Definition at line 472 of file WMainWindow.h.

Referenced by closeEvent().

◆ m_controlPanel

WQtControlPanel* WMainWindow::m_controlPanel
private

control panel

Definition at line 446 of file WMainWindow.h.

Referenced by getControlPanel(), newRoi(), and setupGUI().

◆ m_currentCompatiblesToolbar

WQtCombinerToolbar* WMainWindow::m_currentCompatiblesToolbar
private

The currently set compatibles toolbar.

Definition at line 418 of file WMainWindow.h.

Referenced by getCompatiblesToolbar(), and setCompatiblesToolbar().

◆ m_customWidgets

WSharedSequenceContainer< CustomWidgets > WMainWindow::m_customWidgets
private

All registered widgets created by the core/UI api.

Definition at line 492 of file WMainWindow.h.

Referenced by closeStage1Thread(), deregisterCustomWidget(), and registerCustomWidget().

◆ m_dummyWidget

QDockWidget* WMainWindow::m_dummyWidget
private

The dummywidget serves as spacer in the dockwidget area;.

Definition at line 456 of file WMainWindow.h.

◆ m_glDock

QMainWindow* WMainWindow::m_glDock
private

the dock that is used for gl widgets

Definition at line 455 of file WMainWindow.h.

Referenced by getDefaultCustomDockAreaWidget(), restoreSavedState(), saveWindowState(), and setupGUI().

◆ m_helpAction

QAction* WMainWindow::m_helpAction
private

the help menu

Definition at line 443 of file WMainWindow.h.

Referenced by addGlobalMenu(), and setupGUI().

◆ m_helpMenu

QMenu* WMainWindow::m_helpMenu
private

the help menu

Definition at line 444 of file WMainWindow.h.

Referenced by setupGUI().

◆ m_iconManager

WIconManager WMainWindow::m_iconManager
private

manager to provide icons in the gui thread

Definition at line 420 of file WMainWindow.h.

Referenced by getIconManager(), and setupGUI().

◆ m_loadButton

QAction* WMainWindow::m_loadButton
private

the load button

Definition at line 433 of file WMainWindow.h.

Referenced by addGlobalMenu(), and setupGUI().

◆ m_loaderSignal

boost::signals2::signal< void( std::vector< std::string > ) > WMainWindow::m_loaderSignal
private

boost signal for open file dialog

Definition at line 494 of file WMainWindow.h.

Referenced by getLoaderSignal(), handleDrop(), and openLoadDialog().

◆ m_mainGLDock

WQtGLDockWidget* WMainWindow::m_mainGLDock
private

the dock containing the main gl widget

Definition at line 457 of file WMainWindow.h.

Referenced by closeEvent(), and setupGUI().

◆ m_mainGLWidget

WQtGLWidget* WMainWindow::m_mainGLWidget
private

the main GL widget of the GUI

Definition at line 450 of file WMainWindow.h.

Referenced by handleGLVendor(), and setupGUI().

◆ m_menuBar

QMenuBar* WMainWindow::m_menuBar
private

The main menu bar of the GUI.

Definition at line 422 of file WMainWindow.h.

Referenced by setupGUI().

◆ m_messageDock

WQtMessageDock* WMainWindow::m_messageDock
private

Message and log window.

Definition at line 429 of file WMainWindow.h.

Referenced by getMessageDock(), reportError(), reportInfo(), reportWarning(), saveWindowState(), and setupGUI().

◆ m_navAxial

std::shared_ptr< WQtNavGLWidget > WMainWindow::m_navAxial
private

the axial view widget GL widget of the GUI

Definition at line 452 of file WMainWindow.h.

Referenced by closeEvent(), restoreSavedState(), and setupGUI().

◆ m_navCoronal

std::shared_ptr< WQtNavGLWidget > WMainWindow::m_navCoronal
private

the coronal view widget GL widget of the GUI

Definition at line 453 of file WMainWindow.h.

Referenced by closeEvent(), restoreSavedState(), and setupGUI().

◆ m_navSagittal

std::shared_ptr< WQtNavGLWidget > WMainWindow::m_navSagittal
private

the sgittal view widget GL widget of the GUI

Definition at line 454 of file WMainWindow.h.

Referenced by closeEvent(), restoreSavedState(), and setupGUI().

◆ m_networkEditor

WQtNetworkEditor* WMainWindow::m_networkEditor
private

network editor

Definition at line 448 of file WMainWindow.h.

Referenced by getNetworkEditor(), and setupGUI().

◆ m_newAction

QAction* WMainWindow::m_newAction
private

the new project button

Definition at line 432 of file WMainWindow.h.

Referenced by addGlobalMenu(), and setupGUI().

◆ m_permanentToolBar

WQtToolBar* WMainWindow::m_permanentToolBar
private

The permanent toolbar of the main window.

Definition at line 424 of file WMainWindow.h.

Referenced by setCompatiblesToolbar(), and setupGUI().

◆ m_quitAction

QAction* WMainWindow::m_quitAction
private

quit OpenWalnut

Definition at line 434 of file WMainWindow.h.

Referenced by addGlobalMenu(), and setupGUI().

◆ m_saveAction

QAction* WMainWindow::m_saveAction
private

the save menu

Definition at line 435 of file WMainWindow.h.

Referenced by addGlobalMenu(), and setupGUI().

◆ m_saveMenu

QMenu* WMainWindow::m_saveMenu
private

the menu using m_saveAction

Definition at line 436 of file WMainWindow.h.

Referenced by setupGUI().

◆ m_settingsAction

QAction* WMainWindow::m_settingsAction
private

the settings

Definition at line 440 of file WMainWindow.h.

Referenced by addGlobalMenu(), and setupGUI().

◆ m_settingsMenu

QMenu* WMainWindow::m_settingsMenu
private

the settings

Definition at line 441 of file WMainWindow.h.

Referenced by setupGUI().

◆ m_sliderMinMaxEditSetting

WSettingAction* WMainWindow::m_sliderMinMaxEditSetting
private

The action for allowing editing min and max of sliders.

Definition at line 518 of file WMainWindow.h.

Referenced by setupGUI().

◆ m_splash

QSplashScreen* WMainWindow::m_splash
private

The splash screen object opened on startup.

Definition at line 413 of file WMainWindow.h.

Referenced by closeEvent(), closeSplash(), and getSplash().

◆ m_viewMenu

QMenu* WMainWindow::m_viewMenu
private

view and camera control menu

Definition at line 438 of file WMainWindow.h.

Referenced by setupGUI().


The documentation for this class was generated from the following files: