OpenWalnut
1.5.0dev
|
The QT Based GUI implementation. More...
#include <WQtGui.h>
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< WModule > | getSelectedModule () |
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 WMainWindow * | getMainWindow () |
Returns the current main window instance or NULL if not existent. More... | |
static QSettings & | getSettings () |
Returns the settings object. More... | |
static WIconManager * | getIconManager () |
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< WGraphicsEngine > | m_ge |
Graphics Engine instance. More... | |
boost::signals2::connection | m_loggerConnection |
The connection to the AddLog signal of the logger. More... | |
std::shared_ptr< WKernel > | m_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 WMainWindow * | m_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... | |
WQtGui::WQtGui | ( | const boost::program_options::variables_map & | options, |
int | argc, | ||
char ** | argv | ||
) |
Constructor.
options | the option-variable map |
argc | number of arguments given on command line. |
argv | arguments given on command line. |
Definition at line 70 of file WQtGui.cpp.
|
virtual |
|
private |
This is called by the GE when the osg was set-up correctly.
This triggers project and data file loading.
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().
|
inlinestatic |
Call a given function from within the GUI thread.
The function posts an event and waits for its execution.
functor | the function to call (you can implement structs with operator() too if you need parameters and return values) |
notify | specify 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). |
Result | the type of the function return value. |
Definition at line 209 of file WQtGui.h.
References getMainWindow().
|
static |
Call a given function from within the GUI thread.
The function posts an event and waits for its execution.
functor | the function to call (you can implement structs with operator() too if you need parameters and return values) |
notify | specify 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().
|
static |
Call a given function from within the GUI thread.
The function posts an event and DOES NOT wait for its execution.
functor | the function to call (you can implement structs with operator() too if you need parameters and return values) |
notify | specify 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().
|
static |
Get the icon manager of this gui instance.
Definition at line 93 of file WQtGui.cpp.
References WMainWindow::getIconManager(), and getMainWindow().
Referenced by WPropertyIntervalWidget::WPropertyIntervalWidget(), WQtDataModuleInput::WQtDataModuleInput(), WQtGLScreenCapture::WQtGLScreenCapture(), and WQtGLWidget::WQtGLWidget().
boost::signals2::signal< void(std::vector< std::string >) > * WQtGui::getLoadButtonSignal | ( | ) |
Getter functions for the signals provided by the gui.
Definition at line 389 of file WQtGui.cpp.
References WMainWindow::getLoaderSignal(), and m_mainWindow.
Referenced by run().
|
static |
Returns the current main window instance or NULL if not existent.
Definition at line 88 of file WQtGui.cpp.
References m_mainWindow.
Referenced by WUIQtViewWidget::addCameraPresetGT(), WQtDockWidget::addTitleProperty(), WQtDockTitleWidget::construct(), WQtPropertyGroupWidget::createPropertyGroupBox(), WQtRoiTreeItem::createWidget(), execInGUIThread(), execInGUIThreadAsync(), WQtNetworkArrow::findNearestCompatibleInput(), getIconManager(), WSettingMenu::handleUpdate(), WQtTreeItem::slotDataChanged(), WSettingAction::stateChange(), WQtTreeItem::updateState(), WPropertyColorWidget::WPropertyColorWidget(), WPropertySelectionWidget::WPropertySelectionWidget(), WQtBranchTreeItem::WQtBranchTreeItem(), WQtColormapper::WQtColormapper(), WQtControlPanel::WQtControlPanel(), WQtMessageDock::WQtMessageDock(), WQtMessagePopup::WQtMessagePopup(), WQtModuleConfig::WQtModuleConfig(), WQtModuleMetaInfo::WQtModuleMetaInfo(), and WQtColormapper::WQtTextureListItem::WQtTextureListItem().
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
Definition at line 399 of file WQtGui.cpp.
References m_optionsMap.
|
virtual |
returns a pointer to the selected module in the control panel
Definition at line 384 of file WQtGui.cpp.
References WMainWindow::getControlPanel(), WQtControlPanel::getSelectedModule(), and m_mainWindow.
|
static |
Returns the settings object.
Definition at line 394 of file WQtGui.cpp.
References m_settings.
Referenced by WUIQtWidgetBase::closeGT(), WUIQtWidgetBase::embedContent(), WMainWindow::getSettings(), WSettingMenu::handleUpdate(), WQtModuleConfig::initPathHelper(), WQtModuleConfig::loadListsFromSettings(), WQtDataModuleInput::onChange(), WMainWindow::openLoadDialog(), WMainWindow::projectSave(), WQtModuleConfig::refreshComboboxItems(), WQtModuleConfig::refreshModuleCheckboxes(), WMainWindow::restoreSavedState(), WQtDockWidget::restoreSettings(), WQtGLScreenCapture::restoreSettings(), run(), WQtModuleConfig::saveListToSettings(), WQtDockWidget::saveSettings(), WQtGLScreenCapture::saveSettings(), WMainWindow::saveWindowState(), WSettingAction::stateChange(), WPropertyDoubleWidget::update(), WPropertyIntWidget::update(), WPropertyDoubleWidget::WPropertyDoubleWidget(), WPropertyIntWidget::WPropertyIntWidget(), WQtModuleConfig::WQtModuleConfig(), WSettingAction::WSettingAction(), and WSettingMenu::WSettingMenu().
|
virtual |
Returns the widget factory of the UI.
Implements WUI.
Definition at line 404 of file WQtGui.cpp.
References m_widgetFactory.
|
protected |
Called whenever a module crashes.
module | the module which has thrown the exception |
exception | the exception the module has thrown |
Definition at line 82 of file WQtGui.cpp.
References WMainWindow::getNetworkEditor(), m_mainWindow, and WException::what().
Referenced by run().
|
virtual |
Runs the GUI.
All initialization should be done here.
Implements WUI.
Definition at line 148 of file WQtGui.cpp.
References WLogger::AddLog, wlog::debug(), deferredLoad(), WDataHandler::getDefaultSubject(), WGraphicsEngine::getGraphicsEngine(), WKernel::getGraphicsEngine(), WPathHelper::getHomePath(), getLoadButtonSignal(), WLogger::getLogger(), WPathHelper::getPathHelper(), WKernel::getRunningKernel(), getSettings(), wlog::info(), WQtModuleConfig::initPathHelper(), WKernel::instance(), WKernel::loadDataSets(), WKernel::loadDataSetsSynchronously(), WUI::m_argc, WUI::m_argv, m_ge, WUI::m_isInitialized, m_kernel, m_loggerConnection, m_mainWindow, m_settings, m_splash, m_widgetFactory, moduleError(), WLogger::setDefaultLogLevel(), WApplication::setMyMainWidget(), WMainWindow::setupGUI(), slotActivateDatasetOrModuleInTree(), slotAddDatasetOrModuleToTree(), slotAddLog(), slotAddRoiToTree(), slotConnectionClosed(), slotConnectionEstablished(), slotRemoveDatasetOrModuleInTree(), slotRemoveRoiFromTree(), slotUpdateTextureSorter(), WLogger::subscribeSignal(), and WThreadedRunner::wait().
|
virtual |
Slot gets called whenever a module switches its state to "ready".
module | the module. |
Definition at line 320 of file WQtGui.cpp.
References WMainWindow::getControlPanel(), WMainWindow::getNetworkEditor(), and m_mainWindow.
Referenced by run().
|
virtual |
Slot gets called whenever a new module is added.
module | the module to be added |
Definition at line 300 of file WQtGui.cpp.
References WMainWindow::getControlPanel(), WMainWindow::getNetworkEditor(), and m_mainWindow.
Referenced by run().
|
private |
New log item added.
Pushing event to QT's event queue.
entry | the entry added. |
Definition at line 289 of file WQtGui.cpp.
References WLogEntry::getLogLevel(), and m_mainWindow.
Referenced by run().
|
virtual |
Slot gets called whenever a new ROI is added.
roi | the ROI to be added |
Definition at line 310 of file WQtGui.cpp.
References WMainWindow::getControlPanel(), and m_mainWindow.
Referenced by run().
|
virtual |
Slot gets called whenever a connector pair got disconnected.
in | input connector |
out | output connector |
Definition at line 363 of file WQtGui.cpp.
References WMainWindow::getControlPanel(), WMainWindow::getNetworkEditor(), and m_mainWindow.
Referenced by run().
|
virtual |
Slot gets called whenever a connector pair got connected.
in | input connector |
out | output connector |
Definition at line 342 of file WQtGui.cpp.
References WMainWindow::getControlPanel(), WMainWindow::getNetworkEditor(), and m_mainWindow.
Referenced by run().
|
virtual |
Slot gets called whenever a module has been removed from the root container.
module | the module |
Definition at line 331 of file WQtGui.cpp.
References WMainWindow::getControlPanel(), WMainWindow::getNetworkEditor(), and m_mainWindow.
Referenced by run().
|
virtual |
Slot gets called whenever a ROI is removed.
roi | the ROI to be removed |
Definition at line 315 of file WQtGui.cpp.
References WMainWindow::getControlPanel(), and m_mainWindow.
Referenced by run().
|
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().
|
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().
|
private |
|
private |
|
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().
|
private |
|
staticprivate |
Main window containing all needed widgets.
Definition at line 250 of file WQtGui.h.
Referenced by deferredLoad(), getLoadButtonSignal(), getMainWindow(), getSelectedModule(), moduleError(), run(), slotActivateDatasetOrModuleInTree(), slotAddDatasetOrModuleToTree(), slotAddLog(), slotAddRoiToTree(), slotConnectionClosed(), slotConnectionEstablished(), slotRemoveDatasetOrModuleInTree(), slotRemoveRoiFromTree(), and slotUpdateTextureSorter().
|
private |
Map storing the program options.
Definition at line 267 of file WQtGui.h.
Referenced by deferredLoad(), and getOptionMap().
|
staticprivate |
Object storing certain persistent application settings.
Definition at line 245 of file WQtGui.h.
Referenced by getSettings(), run(), and ~WQtGui().
|
private |
|
private |
The widget factory which handles WUI widget creation.
Definition at line 302 of file WQtGui.h.
Referenced by getWidgetFactory(), and run().