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

The QT Based GUI implementation. More...

#include <WQtGui.h>

+ Inheritance diagram for WQtGui:
+ Collaboration diagram for WQtGui:

Public Member Functions

 WQtGui (const boost::program_options::variables_map &options, int argc, char **argv)
 Constructor. More...
 
virtual ~WQtGui ()
 Default destructor. More...
 
virtual int run ()
 Runs the GUI. More...
 
virtual std::shared_ptr< WModulegetSelectedModule ()
 returns a pointer to the selected module in the control panel More...
 
virtual void slotUpdateTextureSorter ()
 Slot gets called whenever we need to update the texture sorter. More...
 
virtual void slotAddDatasetOrModuleToTree (std::shared_ptr< WModule > module)
 Slot gets called whenever a new module is added. More...
 
virtual void slotAddRoiToTree (osg::ref_ptr< WROI > roi)
 Slot gets called whenever a new ROI is added. More...
 
virtual void slotRemoveRoiFromTree (osg::ref_ptr< WROI > roi)
 Slot gets called whenever a ROI is removed. More...
 
virtual void slotActivateDatasetOrModuleInTree (std::shared_ptr< WModule > module)
 Slot gets called whenever a module switches its state to "ready". More...
 
virtual void slotRemoveDatasetOrModuleInTree (std::shared_ptr< WModule > module)
 Slot gets called whenever a module has been removed from the root container. More...
 
virtual void slotConnectionEstablished (std::shared_ptr< WModuleConnector > in, std::shared_ptr< WModuleConnector > out)
 Slot gets called whenever a connector pair got connected. More...
 
virtual void slotConnectionClosed (std::shared_ptr< WModuleConnector > in, std::shared_ptr< WModuleConnector > out)
 Slot gets called whenever a connector pair got disconnected. More...
 
boost::signals2::signal< void(std::vector< std::string >) > * getLoadButtonSignal ()
 Getter functions for the signals provided by the gui. More...
 
const boost::program_options::variables_map & getOptionMap () const
 Returns the option map for the current instance of this GUI. More...
 
virtual WUIWidgetFactory::SPtr getWidgetFactory () const
 Returns the widget factory of the UI. More...
 
- Public Member Functions inherited from WUI
 WUI (int argc, char **argv)
 Constructor. More...
 
virtual ~WUI ()
 Destructor. More...
 
virtual const WFlag< bool > & isInitialized () const
 Returns the init flag. More...
 

Static Public Member Functions

static WMainWindowgetMainWindow ()
 Returns the current main window instance or NULL if not existent. More...
 
static QSettings & getSettings ()
 Returns the settings object. More...
 
static WIconManagergetIconManager ()
 Get the icon manager of this gui instance. More...
 
static void execInGUIThread (boost::function< void(void) > functor, WCondition::SPtr notify=WCondition::SPtr())
 Call a given function from within the GUI thread. More...
 
template<typename Result >
static Result execInGUIThread (boost::function< Result(void) > functor, WCondition::SPtr notify=WCondition::SPtr())
 Call a given function from within the GUI thread. More...
 
static void execInGUIThreadAsync (boost::function< void(void) > functor, WCondition::SPtr notify=WCondition::SPtr())
 Call a given function from within the GUI thread. More...
 

Protected Member Functions

void moduleError (std::shared_ptr< WModule > module, const WException &exception)
 Called whenever a module crashes. More...
 

Private Member Functions

void slotAddLog (const WLogEntry &entry)
 New log item added. More...
 
void deferredLoad ()
 This is called by the GE when the osg was set-up correctly. More...
 

Private Attributes

std::shared_ptr< WGraphicsEnginem_ge
 Graphics Engine instance. More...
 
boost::signals2::connection m_loggerConnection
 The connection to the AddLog signal of the logger. More...
 
std::shared_ptr< WKernelm_kernel
 Kernel instance. More...
 
const boost::program_options::variables_map & m_optionsMap
 Map storing the program options. More...
 
bool m_loadDeferredOnce
 If true, the next trigger of deferredLoad will actually do loading. More...
 
QMutex m_deferredLoadMutex
 This mutex protects the deferredLoad method from being called in parallel or twice. More...
 
QSplashScreen * m_splash
 The splash screen. More...
 
WUIQtWidgetFactory::SPtr m_widgetFactory
 The widget factory which handles WUI widget creation. More...
 

Static Private Attributes

static QSettings * m_settings = NULL
 Object storing certain persistent application settings. More...
 
static WMainWindowm_mainWindow = NULL
 Main window containing all needed widgets. More...
 

Additional Inherited Members

- Protected Attributes inherited from WUI
WFlag< bool > m_isInitialized
 Flag determining whether the UI is properly initialized. More...
 
int m_argc
 Number of command line arguments given. More...
 
char ** m_argv
 Command line arguments given. More...
 

Detailed Description

The QT Based GUI implementation.

Implements WUI.

Definition at line 55 of file WQtGui.h.

Constructor & Destructor Documentation

◆ WQtGui()

WQtGui::WQtGui ( const boost::program_options::variables_map &  options,
int  argc,
char **  argv 
)

Constructor.

Parameters
optionsthe option-variable map
argcnumber of arguments given on command line.
argvarguments given on command line.

Definition at line 70 of file WQtGui.cpp.

◆ ~WQtGui()

WQtGui::~WQtGui ( )
virtual

Default destructor.

Definition at line 77 of file WQtGui.cpp.

References m_settings.

Member Function Documentation

◆ deferredLoad()

void WQtGui::deferredLoad ( )
private

This is called by the GE when the osg was set-up correctly.

This triggers project and data file loading.

Note
can be called from an arbitrary thread. Protected by m_deferredLoadMutex.

Definition at line 98 of file WQtGui.cpp.

References WMainWindow::asyncProjectLoad(), wlog::debug(), wlog::error(), m_deferredLoadMutex, m_kernel, m_loadDeferredOnce, m_mainWindow, m_optionsMap, and WException::what().

Referenced by run().

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

◆ execInGUIThread() [1/2]

template<typename Result >
static Result WQtGui::execInGUIThread ( boost::function< Result(void) >  functor,
WCondition::SPtr  notify = WCondition::SPtr() 
)
inlinestatic

Call a given function from within the GUI thread.

The function posts an event and waits for its execution.

Parameters
functorthe function to call (you can implement structs with operator() too if you need parameters and return values)
notifyspecify your own condition to wait for. This is needed since the QApplication doc tells us that ownership of an event is handed over to QT and that it is not save to use the event after posting it. This means we cannot utilize an internal condition in the event as it might be deleted already when calling wait() on it. Do not specify this variable to get a fire-and-forget call (but still the method blocks until execution).
Returns
the result
Template Parameters
Resultthe type of the function return value.

Definition at line 209 of file WQtGui.h.

References getMainWindow().

+ Here is the call graph for this function:

◆ execInGUIThread() [2/2]

void WQtGui::execInGUIThread ( boost::function< void(void) >  functor,
WCondition::SPtr  notify = WCondition::SPtr() 
)
static

Call a given function from within the GUI thread.

The function posts an event and waits for its execution.

Parameters
functorthe function to call (you can implement structs with operator() too if you need parameters and return values)
notifyspecify your own condition to wait for. This is needed since the QApplication doc tells us that ownership of an event is handed over to QT and that it is not save to use the event after posting it. This means we cannot utilize an internal condition in the event as it might be deleted already when calling wait() on it. Do not specify this variable to get a fire-and-forget call (but still the method blocks until execution).

Definition at line 409 of file WQtGui.cpp.

References getMainWindow().

Referenced by WUIQtWidgetBase::addAction(), WUIQtViewWidget::addCameraPreset(), WUIQtViewWidget::clearCameraPresets(), WUIQtWidgetBase::closeImpl(), WUIQtGridWidget::placeWidgetImpl(), WUIQtTabbedWidget::setActiveTab(), WUIQtGridWidget::setColumnStretch(), WUIQtGridWidget::setRowStretch(), WUIQtTabbedWidget::setTabEnabled(), WUIQtTabbedWidget::setTabPosition(), WUIQtTabbedWidget::setTabText(), WUIQtTabbedWidget::setTabToolTip(), WUIQtWidgetBase::setVisible(), and WUIQtWidgetBase::show().

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

◆ execInGUIThreadAsync()

void WQtGui::execInGUIThreadAsync ( boost::function< void(void) >  functor,
WCondition::SPtr  notify = WCondition::SPtr() 
)
static

Call a given function from within the GUI thread.

The function posts an event and DOES NOT wait for its execution.

Parameters
functorthe function to call (you can implement structs with operator() too if you need parameters and return values)
notifyspecify your own condition to wait for. This is needed since the QApplication doc tells us that ownership of an event is handed over to QT and that it is not save to use the event after posting it. This means we cannot utilize an internal condition in the event as it might be deleted already when calling wait() on it. Do not specify this variable to get a fire-and-forget call.

Definition at line 421 of file WQtGui.cpp.

References getMainWindow().

Referenced by WMainWindow::closeStage1Thread(), WQtDataModuleInput::onInputChange(), WUIQtWidgetBase::realize(), and WQtNetworkItem::runtimeNameChanged().

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

◆ getIconManager()

WIconManager * WQtGui::getIconManager ( )
static

Get the icon manager of this gui instance.

Returns
the icon manager.

Definition at line 93 of file WQtGui.cpp.

References WMainWindow::getIconManager(), and getMainWindow().

Referenced by WPropertyIntervalWidget::WPropertyIntervalWidget(), WQtDataModuleInput::WQtDataModuleInput(), WQtGLScreenCapture::WQtGLScreenCapture(), and WQtGLWidget::WQtGLWidget().

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

◆ getLoadButtonSignal()

boost::signals2::signal< void(std::vector< std::string >) > * WQtGui::getLoadButtonSignal ( )

Getter functions for the signals provided by the gui.

Returns
the signal

Definition at line 389 of file WQtGui.cpp.

References WMainWindow::getLoaderSignal(), and m_mainWindow.

Referenced by run().

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

◆ getMainWindow()

WMainWindow * WQtGui::getMainWindow ( )
static

◆ getOptionMap()

const boost::program_options::variables_map & WQtGui::getOptionMap ( ) const

Returns the option map for the current instance of this GUI.

This can be useful to parse further commandline parameters

Returns
the option map

Definition at line 399 of file WQtGui.cpp.

References m_optionsMap.

◆ getSelectedModule()

std::shared_ptr< WModule > WQtGui::getSelectedModule ( )
virtual

returns a pointer to the selected module in the control panel

Returns
the module

Definition at line 384 of file WQtGui.cpp.

References WMainWindow::getControlPanel(), WQtControlPanel::getSelectedModule(), and m_mainWindow.

+ Here is the call graph for this function:

◆ getSettings()

QSettings & WQtGui::getSettings ( )
static

◆ getWidgetFactory()

WUIWidgetFactory::SPtr WQtGui::getWidgetFactory ( ) const
virtual

Returns the widget factory of the UI.

Returns
the factory. Use this to create your widget instances.

Implements WUI.

Definition at line 404 of file WQtGui.cpp.

References m_widgetFactory.

◆ moduleError()

void WQtGui::moduleError ( std::shared_ptr< WModule module,
const WException exception 
)
protected

Called whenever a module crashes.

Parameters
modulethe module which has thrown the exception
exceptionthe exception the module has thrown

Definition at line 82 of file WQtGui.cpp.

References WMainWindow::getNetworkEditor(), m_mainWindow, and WException::what().

Referenced by run().

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

◆ run()

int WQtGui::run ( )
virtual

◆ slotActivateDatasetOrModuleInTree()

void WQtGui::slotActivateDatasetOrModuleInTree ( std::shared_ptr< WModule module)
virtual

Slot gets called whenever a module switches its state to "ready".

Parameters
modulethe module.

Definition at line 320 of file WQtGui.cpp.

References WMainWindow::getControlPanel(), WMainWindow::getNetworkEditor(), and m_mainWindow.

Referenced by run().

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

◆ slotAddDatasetOrModuleToTree()

void WQtGui::slotAddDatasetOrModuleToTree ( std::shared_ptr< WModule module)
virtual

Slot gets called whenever a new module is added.

Parameters
modulethe module to be added
Note
This can be used to add datasets or other modules.

Definition at line 300 of file WQtGui.cpp.

References WMainWindow::getControlPanel(), WMainWindow::getNetworkEditor(), and m_mainWindow.

Referenced by run().

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

◆ slotAddLog()

void WQtGui::slotAddLog ( const WLogEntry entry)
private

New log item added.

Pushing event to QT's event queue.

Parameters
entrythe entry added.

Definition at line 289 of file WQtGui.cpp.

References WLogEntry::getLogLevel(), and m_mainWindow.

Referenced by run().

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

◆ slotAddRoiToTree()

void WQtGui::slotAddRoiToTree ( osg::ref_ptr< WROI roi)
virtual

Slot gets called whenever a new ROI is added.

Parameters
roithe ROI to be added

Definition at line 310 of file WQtGui.cpp.

References WMainWindow::getControlPanel(), and m_mainWindow.

Referenced by run().

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

◆ slotConnectionClosed()

void WQtGui::slotConnectionClosed ( std::shared_ptr< WModuleConnector in,
std::shared_ptr< WModuleConnector out 
)
virtual

Slot gets called whenever a connector pair got disconnected.

Parameters
ininput connector
outoutput connector

Definition at line 363 of file WQtGui.cpp.

References WMainWindow::getControlPanel(), WMainWindow::getNetworkEditor(), and m_mainWindow.

Referenced by run().

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

◆ slotConnectionEstablished()

void WQtGui::slotConnectionEstablished ( std::shared_ptr< WModuleConnector in,
std::shared_ptr< WModuleConnector out 
)
virtual

Slot gets called whenever a connector pair got connected.

Parameters
ininput connector
outoutput connector

Definition at line 342 of file WQtGui.cpp.

References WMainWindow::getControlPanel(), WMainWindow::getNetworkEditor(), and m_mainWindow.

Referenced by run().

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

◆ slotRemoveDatasetOrModuleInTree()

void WQtGui::slotRemoveDatasetOrModuleInTree ( std::shared_ptr< WModule module)
virtual

Slot gets called whenever a module has been removed from the root container.

Parameters
modulethe module

Definition at line 331 of file WQtGui.cpp.

References WMainWindow::getControlPanel(), WMainWindow::getNetworkEditor(), and m_mainWindow.

Referenced by run().

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

◆ slotRemoveRoiFromTree()

void WQtGui::slotRemoveRoiFromTree ( osg::ref_ptr< WROI roi)
virtual

Slot gets called whenever a ROI is removed.

Parameters
roithe ROI to be removed

Definition at line 315 of file WQtGui.cpp.

References WMainWindow::getControlPanel(), and m_mainWindow.

Referenced by run().

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

◆ slotUpdateTextureSorter()

void WQtGui::slotUpdateTextureSorter ( )
virtual

Slot gets called whenever we need to update the texture sorter.

Definition at line 283 of file WQtGui.cpp.

References WMainWindow::getControlPanel(), and m_mainWindow.

Referenced by run().

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

Member Data Documentation

◆ m_deferredLoadMutex

QMutex WQtGui::m_deferredLoadMutex
private

This mutex protects the deferredLoad method from being called in parallel or twice.

Definition at line 278 of file WQtGui.h.

Referenced by deferredLoad().

◆ m_ge

std::shared_ptr< WGraphicsEngine > WQtGui::m_ge
private

Graphics Engine instance.

Definition at line 255 of file WQtGui.h.

Referenced by run().

◆ m_kernel

std::shared_ptr< WKernel > WQtGui::m_kernel
private

Kernel instance.

Definition at line 265 of file WQtGui.h.

Referenced by deferredLoad(), and run().

◆ m_loadDeferredOnce

bool WQtGui::m_loadDeferredOnce
private

If true, the next trigger of deferredLoad will actually do loading.

This variable and the deferredLoad function are protected with m_deferredLoadMutex.

Definition at line 273 of file WQtGui.h.

Referenced by deferredLoad().

◆ m_loggerConnection

boost::signals2::connection WQtGui::m_loggerConnection
private

The connection to the AddLog signal of the logger.

Definition at line 260 of file WQtGui.h.

Referenced by run().

◆ m_mainWindow

WMainWindow * WQtGui::m_mainWindow = NULL
staticprivate

◆ m_optionsMap

const boost::program_options::variables_map& WQtGui::m_optionsMap
private

Map storing the program options.

Definition at line 267 of file WQtGui.h.

Referenced by deferredLoad(), and getOptionMap().

◆ m_settings

QSettings * WQtGui::m_settings = NULL
staticprivate

Object storing certain persistent application settings.

Definition at line 245 of file WQtGui.h.

Referenced by getSettings(), run(), and ~WQtGui().

◆ m_splash

QSplashScreen* WQtGui::m_splash
private

The splash screen.

Definition at line 297 of file WQtGui.h.

Referenced by run().

◆ m_widgetFactory

WUIQtWidgetFactory::SPtr WQtGui::m_widgetFactory
private

The widget factory which handles WUI widget creation.

Definition at line 302 of file WQtGui.h.

Referenced by getWidgetFactory(), and run().


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