DynExp
Highly flexible laboratory automation for dynamically changing experiments.
DynExpManager Class Reference

Implements DynExp's main window as a Qt-based user interface (UI). More...

+ Inheritance diagram for DynExpManager:

Classes

struct  ItemTreeItemDataType
 Bundles data which is assigned to items of the main QTreeWidget. Each item refers to a DynExp::Object instance. More...
 
struct  StatusBarType
 Type bundling widgets to be displayed in the main window's status bar. More...
 

Public Member Functions

 DynExpManager (DynExp::DynExpCore &DynExpCore, QWidget *parent=Q_NULLPTR)
 Constructs a DynExpManager instance. More...
 
 ~DynExpManager ()=default
 
void RegisterModuleUI (DynExp::Object *const Object)
 Initializes the UI of the module Object (expecting that Object is a DynExp::QModuleBase instance. Does nothing if this is not the case or if the module is not running. Resets the module in case the initialization of its UI fails. More...
 
bool StopItem (DynExp::RunnableObject *Object, bool Force=false) noexcept
 Calls DynExp::RunnableObject::Terminate() on a DynExp::RunnableObject instance. More...
 
void FocusMainWindow () noexcept
 Focuses/activates DynExp's main window and moves it on top of other windows if possible. More...
 
void PostKeyPressEvent (QKeyEvent *Event) noexcept
 Delegates a Qt key press event (e.g. the key sequences Ctrl+1 - Ctrl+9) from module widgets to the main window. More...
 
std::string GetDataSaveDirectory () const
 Recalls a path where modules might save recorded data to. Used by Util::PromptSaveFilePathModule() to recall the directory the user has chosen last for saving a file. This directory is the same across all modules. More...
 
void SetDataSaveDirectory (std::string_view Directory) const
 Sets a path where modules might save recorded data to. Used by Util::PromptSaveFilePathModule() to store the directory the user has chosen last for saving a file. This directory is the same across all modules. More...
 

Private Slots

Qt slots

Qt slot functions invoked upon UI/widget interaction.

void OnUpdateUI ()
 
void OnUIThemeChanged (QAction *ThemeAction)
 
void OnNewProject ()
 
void OnOpenProject ()
 
void OnSaveProject ()
 
void OnSaveProjectAs ()
 
void OnRunProject ()
 
void OnStopProject ()
 
void OnResetFailedItems ()
 
void OnRestoreWindowStatesFromParams ()
 
void OnProjectSettingsClicked ()
 
void OnRunItem ()
 
void OnStopItem (bool Force=false)
 
void OnForceStopItem ()
 
void OnResetItem ()
 
void OnConfigureItem ()
 
void OnDeleteItem ()
 
void OnWindowMenuOpened ()
 
void OnWindowMenuClosed ()
 
void OnDockUndockWindow ()
 
void OnShowCircuitDiagram ()
 
void OnAboutClicked ()
 
void OnStatusBarStateClicked ()
 
void OnLogContextMenuRequested (const QPoint &Position)
 
void OnItemTreeContextMenuRequested (const QPoint &Position)
 
void OnClearLog ()
 
void OnClearWarning ()
 
void OnAddHardwareAdapter ()
 
void OnAddInstrument ()
 
void OnAddModule ()
 
void OnItemSelectionChanged ()
 
void OnItemDoubleClicked (QTreeWidgetItem *Item, int Column)
 
void OnModuleWindowActivated (QMdiSubWindow *Window)
 

Private Member Functions

template<typename LibraryVectorT >
void RegisterItemsFromLibrary (const LibraryVectorT &Lib, QMenu *const MenuBase, const QString IconPath, void(DynExpManager::*Slot)())
 Adds the library entries from Lib to submenus below MenuBase and assigns actions to them invoking Slot when clicked. Submenus are defined by the library entries' categories and the actions assigned to the submenus by the entries' names. More...
 
template<typename LibraryVectorT , typename ManagerT >
void MakeItem (QAction *SenderAction, LibraryVectorT &Lib, ManagerT &ResourceManager)
 Creates a DynExp::Object instance according to a QAction instance SenderAction, which contains the index (as its data property) of the item within a library vector Lib to instantiate. Displays a configuration dialog (ParamsConfigDialog) to let the user set the object's parameters. More...
 
template<typename LibraryVectorT , typename ManagerT >
bool UpdateItemConfig (DynExp::Object *Object, LibraryVectorT &Lib, ManagerT &ResourceManager)
 Invokes a configuration dialog to let the user adjust the parameters of a DynExp::Object instance. More...
 
void EnsureItemReadyState (DynExp::Object *Object)
 Calls DynExp::Object::EnsureReadyState() on a DynExp::Object instance. More...
 
void ResetItem (DynExp::Object *Object)
 Calls DynExp::Object::Reset() on a DynExp::Object instance. More...
 
QColor HTMLColorStringToThemeColor (const std::string &HTMLColor) const
 Constructs a QColor instance from an HTML color string depending on the currently active UI theme. More...
 
QColor AdjustColorToThemeColor (const QColor &Color) const
 Transforms a QColor instance depending on the currently active UI theme. More...
 
void Reset (bool Force=false)
 Resets the currently loaded project removing all resources from the resource managers. After a call to this function, a new empty project is available. More...
 
bool CloseProject () noexcept
 Closes the current project and opens a new, empty one. More...
 
bool Shutdown () noexcept
 Terminates DynExpCore::WorkerThread and waits until the thread has ended. More...
 
void SaveProject (std::string_view Filename) noexcept
 Saves the current DynExp project to an XML project file. More...
 
void DisableAllActions () noexcept
 Disables all user interface actions such that item-specific ones can be reenabled upon a selection change in the main tree widget showing DynExp::Object instances. More...
 
void UpdateModuleWindowsActionShortcuts () noexcept
 Establishes shortcuts to switch between module windows. Refer to ModuleWindowsActionGroup. More...
 
void UpdateModuleWindowsActionIcons () noexcept
 Invokes DynExp::QModuleBase::UpdateModuleWindowFocusAction() on each module. More...
 
DynExp::QModuleBaseGetModuleByActiveUIWindow () noexcept
 Determines the DynExp::QModuleBase instance of the current project whose UI window is active (has the focus). More...
 
UI functions

Functions updating the user interface. Called periodically in OnUpdateUI().

void UpdateLog ()
 
void ResetLogColors ()
 
void UpdateModulesUI () noexcept
 
void UpdateTitleBar ()
 
void UpdateStatusBar ()
 
void UpdateCircuitDiagram ()
 
void UpdateItemTree ()
 
void UpdateItemTreeItem (const DynExp::HardwareAdapterManager::ResourceType &Resource)
 
void UpdateItemTreeItem (const DynExp::InstrumentManager::ResourceType &Resource)
 
void UpdateItemTreeItem (const DynExp::ModuleManager::ResourceType &Resource)
 
UI item tree functions

Functions to update and manipulate the main QTreeWidget containing an item for each DynExp::Object instance within the currently opened project.

template<typename ManagerT >
QTreeWidgetItem * UpdateItemTreeSection (QTreeWidgetItem *Section, ManagerT &ResourceManager)
 Loops through resources managed by ResourceManager and adds respective QTreeWidgetItem instances as childs to Section. Data is assigned to the user role of the columns of added items: column 0's data contains a boolean flag which is true if column 0's text (object name) needs to be updated. column 1's data contains a pointer (QTreeWidgetItem*) to the respectve item. column 2's data contains a ItemTreeItemDataType instance. More...
 
void UpdateItemTreeItemObjectName (QTreeWidgetItem *Item, const DynExp::Object *Object)
 Updates the text of a QTreeWidgetItem instance to match it to the related DynExp::Object instance. More...
 
void SelectItemTreeItem (QTreeWidgetItem *SelectedEntry)
 Selects the given QTreeWidgetItem instance and brings this DynExpManager window to the front. More...
 
void ChangeItemTreeItemToNormalState (QTreeWidgetItem &ItemTreeItem, const ItemTreeItemDataType &ItemTreeItemData, const QString &Description, const QString &StateTitle, const char *IconPath=DynExpUI::Icons::Stopped)
 
void ChangeItemTreeItemToRunningState (QTreeWidgetItem &ItemTreeItem, const ItemTreeItemDataType &ItemTreeItemData, const QString &Description)
 
void ChangeItemTreeItemToPausedState (QTreeWidgetItem &ItemTreeItem, const ItemTreeItemDataType &ItemTreeItemData, const QString &Description)
 
void ChangeItemTreeItemToWarningState (QTreeWidgetItem &ItemTreeItem, const ItemTreeItemDataType &ItemTreeItemData, const QString &Description)
 
void ChangeItemTreeItemToErrorState (QTreeWidgetItem &ItemTreeItem, const ItemTreeItemDataType &ItemTreeItemData, const std::exception_ptr &ExceptionPtr)
 
void ChangeItemTreeItemToNotConnectedState (QTreeWidgetItem &ItemTreeItem, const ItemTreeItemDataType &ItemTreeItemData, const QString &Description)
 
void ChangeItemTreeItemToNotRespondingState (QTreeWidgetItem &ItemTreeItem, const ItemTreeItemDataType &ItemTreeItemData, const QString &Description)
 
Qt events

Overridden Qt event functions

virtual void closeEvent (QCloseEvent *event) override
 

Static Private Member Functions

static std::string GetObjectNameSafe (DynExp::Object *Object)
 Retrieves the name of a DynExp::Object instance from its parameter class instance. More...
 

Private Attributes

DynExp::DynExpCoreDynExpCore
 Handle to DynExp's internal data. More...
 
Ui::DynExpManagerClass ui
 Qt widgets belonging to the main window's user interface. More...
 
QTimer * UpdateUITimer
 Timer for periodically updating the user interface. More...
 
DynExpAboutAboutDialog
 Dialog showing license and copyright information. More...
 
std::unique_ptr< CircuitDiagramCircuitDiagramDlg
 Dialog showing the circuit diagram of the current project. It has no parent to not stay on top of the main window, so delete it manually. More...
 
ErrorListDialogErrorListDlg
 Dialog showing the list of currently active warnings and errors (ErrorEntries) More...
 
QActionGroup * ModuleWindowsActionGroup
 Actions to switch between module windows with CTRL + < number key > shortcuts. More...
 
QActionGroup * UIThemeActionGroup
 Actions to switch in between different UI themes. More...
 
QAction * UIBrightThemeAction
 Action for a bright UI theme. More...
 
QAction * UIDarkThemeAction
 Action for a dark UI theme. More...
 
QMenu * LogContextMenu
 Context menu appearing when right-clicking on the message log widget. More...
 
QMenu * ItemTreeContextMenu
 Context menu appearing when right-clicking on the main tree widget showing DynExp::Object instances. More...
 
QAction * ClearWarningAction
 Action to clear the warning of an item within the main tree widget showing DynExp::Object instances. More...
 
QTreeWidgetItem * ItemTreeHardwareAdapters
 Item for the hardware adapters section within the main tree widget showing DynExp::Object instances. More...
 
QTreeWidgetItem * ItemTreeInstruments
 Item for the instruments section within the main tree widget showing DynExp::Object instances. More...
 
QTreeWidgetItem * ItemTreeModules
 Item for the modules section within the main tree widget showing DynExp::Object instances. More...
 
struct DynExpManager::StatusBarType StatusBar
 
ErrorListDialog::ErrorEntriesType ErrorEntries
 List of all currently active warnings and errors. More...
 
bool IsResetting
 Indicates whether DynExpManager is currently deleting all resources to empty the project. More...
 
bool ShouldRedrawCircuitDiagram
 Indicates whether the circuit diagram has to be rebuilt. Particularly, this must be set to true directly after invalidating any pointers to QTreeWidgetItem instances of the main window's item tree. More...
 
bool ShouldUpdateCircuitDiagram
 Indicates whether any item state has changed. Set to true to update the circuit diagram. The circuit diagram saves pointers to QTreeWidgetItem instances of the main window's item tree. Make sure that these pointers are still valid. If they have been invalidated, rebuild the circuit diagram first! More...
 

Detailed Description

Implements DynExp's main window as a Qt-based user interface (UI).

Definition at line 20 of file DynExpManager.h.

Constructor & Destructor Documentation

◆ DynExpManager()

DynExpManager::DynExpManager ( DynExp::DynExpCore DynExpCore,
QWidget *  parent = Q_NULLPTR 
)

Constructs a DynExpManager instance.

Parameters
DynExpCoreDynExp's internal data managed by this DynExpManager instance
parentParent Qt widget owning this main window. Pass nullptr.

Definition at line 7 of file DynExpManager.cpp.

◆ ~DynExpManager()

DynExpManager::~DynExpManager ( )
default

Member Function Documentation

◆ AdjustColorToThemeColor()

QColor DynExpManager::AdjustColorToThemeColor ( const QColor &  Color) const
private

Transforms a QColor instance depending on the currently active UI theme.

Parameters
ColorOriginal QColor instance
Returns
Returns the adjusted new QColor instance.

Definition at line 780 of file DynExpManager.cpp.

◆ ChangeItemTreeItemToErrorState()

void DynExpManager::ChangeItemTreeItemToErrorState ( QTreeWidgetItem &  ItemTreeItem,
const ItemTreeItemDataType ItemTreeItemData,
const std::exception_ptr &  ExceptionPtr 
)
private

Definition at line 720 of file DynExpManager.cpp.

◆ ChangeItemTreeItemToNormalState()

void DynExpManager::ChangeItemTreeItemToNormalState ( QTreeWidgetItem &  ItemTreeItem,
const ItemTreeItemDataType ItemTreeItemData,
const QString &  Description,
const QString &  StateTitle,
const char *  IconPath = DynExpUI::Icons::Stopped 
)
private

Definition at line 656 of file DynExpManager.cpp.

◆ ChangeItemTreeItemToNotConnectedState()

void DynExpManager::ChangeItemTreeItemToNotConnectedState ( QTreeWidgetItem &  ItemTreeItem,
const ItemTreeItemDataType ItemTreeItemData,
const QString &  Description 
)
private

Definition at line 736 of file DynExpManager.cpp.

◆ ChangeItemTreeItemToNotRespondingState()

void DynExpManager::ChangeItemTreeItemToNotRespondingState ( QTreeWidgetItem &  ItemTreeItem,
const ItemTreeItemDataType ItemTreeItemData,
const QString &  Description 
)
private

Definition at line 749 of file DynExpManager.cpp.

◆ ChangeItemTreeItemToPausedState()

void DynExpManager::ChangeItemTreeItemToPausedState ( QTreeWidgetItem &  ItemTreeItem,
const ItemTreeItemDataType ItemTreeItemData,
const QString &  Description 
)
private

Definition at line 688 of file DynExpManager.cpp.

◆ ChangeItemTreeItemToRunningState()

void DynExpManager::ChangeItemTreeItemToRunningState ( QTreeWidgetItem &  ItemTreeItem,
const ItemTreeItemDataType ItemTreeItemData,
const QString &  Description 
)
private

Definition at line 672 of file DynExpManager.cpp.

◆ ChangeItemTreeItemToWarningState()

void DynExpManager::ChangeItemTreeItemToWarningState ( QTreeWidgetItem &  ItemTreeItem,
const ItemTreeItemDataType ItemTreeItemData,
const QString &  Description 
)
private

Definition at line 704 of file DynExpManager.cpp.

◆ closeEvent()

void DynExpManager::closeEvent ( QCloseEvent *  event)
overrideprivatevirtual

Definition at line 1040 of file DynExpManager.cpp.

◆ CloseProject()

bool DynExpManager::CloseProject ( )
privatenoexcept

Closes the current project and opens a new, empty one.

Returns
Returns true if closing was successful or if it should be forced by e.g. terminating the application in case of an error. Returns false when closing should be aborted in case of an error.

Definition at line 815 of file DynExpManager.cpp.

◆ DisableAllActions()

void DynExpManager::DisableAllActions ( )
privatenoexcept

Disables all user interface actions such that item-specific ones can be reenabled upon a selection change in the main tree widget showing DynExp::Object instances.

Definition at line 941 of file DynExpManager.cpp.

◆ EnsureItemReadyState()

void DynExpManager::EnsureItemReadyState ( DynExp::Object Object)
private

Calls DynExp::Object::EnsureReadyState() on a DynExp::Object instance.

Parameters
ObjectDynExp::Object instance to make ready. Does nothing if Object is nullptr.

Definition at line 152 of file DynExpManager.cpp.

◆ FocusMainWindow()

void DynExpManager::FocusMainWindow ( )
noexcept

Focuses/activates DynExp's main window and moves it on top of other windows if possible.

Definition at line 1141 of file DynExpManager.cpp.

◆ GetDataSaveDirectory()

std::string DynExpManager::GetDataSaveDirectory ( ) const
inline

Recalls a path where modules might save recorded data to. Used by Util::PromptSaveFilePathModule() to recall the directory the user has chosen last for saving a file. This directory is the same across all modules.

Returns
Path to show by default in the modules' file open/save dialogs.

Definition at line 362 of file DynExpManager.h.

◆ GetModuleByActiveUIWindow()

DynExp::QModuleBase * DynExpManager::GetModuleByActiveUIWindow ( )
privatenoexcept

Determines the DynExp::QModuleBase instance of the current project whose UI window is active (has the focus).

Returns
DynExp::QModuleBase instance with the active UI window

Definition at line 1002 of file DynExpManager.cpp.

◆ GetObjectNameSafe()

std::string DynExpManager::GetObjectNameSafe ( DynExp::Object Object)
staticprivate

Retrieves the name of a DynExp::Object instance from its parameter class instance.

Parameters
ObjectDynExp::Object whose name to retrieve
Returns
Returns the name of Object or a string indicating an error if retrieving the name failed.

Definition at line 133 of file DynExpManager.cpp.

◆ HTMLColorStringToThemeColor()

QColor DynExpManager::HTMLColorStringToThemeColor ( const std::string &  HTMLColor) const
private

Constructs a QColor instance from an HTML color string depending on the currently active UI theme.

Parameters
HTMLColorHTML color string to construct a QColor instance from
Returns
Returns the constructed QColor instance.

Definition at line 765 of file DynExpManager.cpp.

◆ MakeItem()

template<typename LibraryVectorT , typename ManagerT >
void DynExpManager::MakeItem ( QAction *  SenderAction,
LibraryVectorT &  Lib,
ManagerT &  ResourceManager 
)
private

Creates a DynExp::Object instance according to a QAction instance SenderAction, which contains the index (as its data property) of the item within a library vector Lib to instantiate. Displays a configuration dialog (ParamsConfigDialog) to let the user set the object's parameters.

Template Parameters
LibraryVectorTType of a list of library entries (DynExp::LibraryEntry)
ManagerTType of the resource manager managing instances of type extracted from SenderAction
Parameters
SenderActionQAction which has been triggered to generate a certain DynExp::Object instance.
LibList of library entries to select the entry to be instantiated from according to the QAction::data() property stored in SenderAction
ResourceManagerResource manager to insert the newly generated DynExp::Object instance into

Definition at line 441 of file DynExpManager.h.

◆ OnAboutClicked

void DynExpManager::OnAboutClicked ( )
privateslot

Definition at line 1841 of file DynExpManager.cpp.

◆ OnAddHardwareAdapter

void DynExpManager::OnAddHardwareAdapter ( )
privateslot

Definition at line 1931 of file DynExpManager.cpp.

◆ OnAddInstrument

void DynExpManager::OnAddInstrument ( )
privateslot

Definition at line 1936 of file DynExpManager.cpp.

◆ OnAddModule

void DynExpManager::OnAddModule ( )
privateslot

Definition at line 1941 of file DynExpManager.cpp.

◆ OnClearLog

void DynExpManager::OnClearLog ( )
privateslot

Definition at line 1870 of file DynExpManager.cpp.

◆ OnClearWarning

void DynExpManager::OnClearWarning ( )
privateslot

Definition at line 1902 of file DynExpManager.cpp.

◆ OnConfigureItem

void DynExpManager::OnConfigureItem ( )
privateslot

Definition at line 1649 of file DynExpManager.cpp.

◆ OnDeleteItem

void DynExpManager::OnDeleteItem ( )
privateslot

Definition at line 1729 of file DynExpManager.cpp.

◆ OnDockUndockWindow

void DynExpManager::OnDockUndockWindow ( )
privateslot

Definition at line 1827 of file DynExpManager.cpp.

◆ OnForceStopItem

void DynExpManager::OnForceStopItem ( )
privateslot

Definition at line 1595 of file DynExpManager.cpp.

◆ OnItemDoubleClicked

void DynExpManager::OnItemDoubleClicked ( QTreeWidgetItem *  Item,
int  Column 
)
privateslot

Definition at line 2005 of file DynExpManager.cpp.

◆ OnItemSelectionChanged

void DynExpManager::OnItemSelectionChanged ( )
privateslot

Definition at line 1946 of file DynExpManager.cpp.

◆ OnItemTreeContextMenuRequested

void DynExpManager::OnItemTreeContextMenuRequested ( const QPoint &  Position)
privateslot

Definition at line 1865 of file DynExpManager.cpp.

◆ OnLogContextMenuRequested

void DynExpManager::OnLogContextMenuRequested ( const QPoint &  Position)
privateslot

Definition at line 1860 of file DynExpManager.cpp.

◆ OnModuleWindowActivated

void DynExpManager::OnModuleWindowActivated ( QMdiSubWindow *  Window)
privateslot

Definition at line 2010 of file DynExpManager.cpp.

◆ OnNewProject

void DynExpManager::OnNewProject ( )
privateslot

Definition at line 1220 of file DynExpManager.cpp.

◆ OnOpenProject

void DynExpManager::OnOpenProject ( )
privateslot

Definition at line 1226 of file DynExpManager.cpp.

◆ OnProjectSettingsClicked

void DynExpManager::OnProjectSettingsClicked ( )
privateslot

Definition at line 1468 of file DynExpManager.cpp.

◆ OnResetFailedItems

void DynExpManager::OnResetFailedItems ( )
privateslot

Definition at line 1404 of file DynExpManager.cpp.

◆ OnResetItem

void DynExpManager::OnResetItem ( )
privateslot

Definition at line 1600 of file DynExpManager.cpp.

◆ OnRestoreWindowStatesFromParams

void DynExpManager::OnRestoreWindowStatesFromParams ( )
privateslot

Definition at line 1437 of file DynExpManager.cpp.

◆ OnRunItem

void DynExpManager::OnRunItem ( )
privateslot

Definition at line 1499 of file DynExpManager.cpp.

◆ OnRunProject

void DynExpManager::OnRunProject ( )
privateslot

Definition at line 1313 of file DynExpManager.cpp.

◆ OnSaveProject

void DynExpManager::OnSaveProject ( )
privateslot

Definition at line 1294 of file DynExpManager.cpp.

◆ OnSaveProjectAs

void DynExpManager::OnSaveProjectAs ( )
privateslot

Definition at line 1302 of file DynExpManager.cpp.

◆ OnShowCircuitDiagram

void DynExpManager::OnShowCircuitDiagram ( )
privateslot

Definition at line 1835 of file DynExpManager.cpp.

◆ OnStatusBarStateClicked

void DynExpManager::OnStatusBarStateClicked ( )
privateslot

Definition at line 1846 of file DynExpManager.cpp.

◆ OnStopItem

void DynExpManager::OnStopItem ( bool  Force = false)
privateslot

Definition at line 1552 of file DynExpManager.cpp.

◆ OnStopProject

void DynExpManager::OnStopProject ( )
privateslot

Definition at line 1371 of file DynExpManager.cpp.

◆ OnUIThemeChanged

void DynExpManager::OnUIThemeChanged ( QAction *  ThemeAction)
privateslot

Definition at line 1199 of file DynExpManager.cpp.

◆ OnUpdateUI

void DynExpManager::OnUpdateUI ( )
privateslot

Definition at line 1153 of file DynExpManager.cpp.

◆ OnWindowMenuClosed

void DynExpManager::OnWindowMenuClosed ( )
privateslot

Definition at line 1821 of file DynExpManager.cpp.

◆ OnWindowMenuOpened

void DynExpManager::OnWindowMenuOpened ( )
privateslot

Definition at line 1814 of file DynExpManager.cpp.

◆ PostKeyPressEvent()

void DynExpManager::PostKeyPressEvent ( QKeyEvent *  Event)
noexcept

Delegates a Qt key press event (e.g. the key sequences Ctrl+1 - Ctrl+9) from module widgets to the main window.

Parameters
EventQt event to delegate. Refer to Qt documentation.

Definition at line 1147 of file DynExpManager.cpp.

◆ RegisterItemsFromLibrary()

template<typename LibraryVectorT >
void DynExpManager::RegisterItemsFromLibrary ( const LibraryVectorT &  Lib,
QMenu *const  MenuBase,
const QString  IconPath,
void(DynExpManager::*)()  Slot 
)
private

Adds the library entries from Lib to submenus below MenuBase and assigns actions to them invoking Slot when clicked. Submenus are defined by the library entries' categories and the actions assigned to the submenus by the entries' names.

Template Parameters
LibraryVectorTType of the library vector
Parameters
LibLibrary vector whose items to add to the menu
MenuBaseParent menu where to add submenus to
IconPathIcon to display next to the actions
SlotQt slot function to call when the action related to a library entry is triggered.

Definition at line 413 of file DynExpManager.h.

◆ RegisterModuleUI()

void DynExpManager::RegisterModuleUI ( DynExp::Object *const  Object)

Initializes the UI of the module Object (expecting that Object is a DynExp::QModuleBase instance. Does nothing if this is not the case or if the module is not running. Resets the module in case the initialization of its UI fails.

Parameters
ObjectModule whose UI to initialize
Exceptions
Util::InvalidArgExceptionis thrown if Object is nullptr.

Definition at line 1057 of file DynExpManager.cpp.

◆ Reset()

void DynExpManager::Reset ( bool  Force = false)
private

Resets the currently loaded project removing all resources from the resource managers. After a call to this function, a new empty project is available.

Parameters
ForceIf false, ResourceManagerBase::PrepareReset() is called on each owned resource manager, before calls to ResourceManagerBase::Reset() follow. If true, only the latter method is called.

Definition at line 796 of file DynExpManager.cpp.

◆ ResetItem()

void DynExpManager::ResetItem ( DynExp::Object Object)
private

Calls DynExp::Object::Reset() on a DynExp::Object instance.

Parameters
ObjectDynExp::Object instance to reset. Does nothing if Object is nullptr.

Definition at line 186 of file DynExpManager.cpp.

◆ ResetLogColors()

void DynExpManager::ResetLogColors ( )
private

Definition at line 249 of file DynExpManager.cpp.

◆ SaveProject()

void DynExpManager::SaveProject ( std::string_view  Filename)
privatenoexcept

Saves the current DynExp project to an XML project file.

Parameters
FilenamePath where to save the DynExp project XML file

Definition at line 910 of file DynExpManager.cpp.

◆ SelectItemTreeItem()

void DynExpManager::SelectItemTreeItem ( QTreeWidgetItem *  SelectedEntry)
private

Selects the given QTreeWidgetItem instance and brings this DynExpManager window to the front.

Parameters
SelectedEntryQTreeWidgetItem instance to select

Definition at line 631 of file DynExpManager.cpp.

◆ SetDataSaveDirectory()

void DynExpManager::SetDataSaveDirectory ( std::string_view  Directory) const
inline

Sets a path where modules might save recorded data to. Used by Util::PromptSaveFilePathModule() to store the directory the user has chosen last for saving a file. This directory is the same across all modules.

Parameters
DirectoryPath to show by default in the modules' file open/save dialogs.

Definition at line 367 of file DynExpManager.h.

◆ Shutdown()

bool DynExpManager::Shutdown ( )
privatenoexcept

Terminates DynExpCore::WorkerThread and waits until the thread has ended.

If the worker thread cannot be stopped, offers to terminate the application.

Returns
Returns true if shutdown was successful, false otherwise.

Definition at line 867 of file DynExpManager.cpp.

◆ StopItem()

bool DynExpManager::StopItem ( DynExp::RunnableObject Object,
bool  Force = false 
)
noexcept

Calls DynExp::RunnableObject::Terminate() on a DynExp::RunnableObject instance.

Parameters
ObjectDynExp::RunnableObject instance to terminate. Does nothing if Object is nullptr.
ForceIf true, Object is terminated even if it is still used.
Returns
Returns true in case of success, otherwise false.

Definition at line 1086 of file DynExpManager.cpp.

◆ UpdateCircuitDiagram()

void DynExpManager::UpdateCircuitDiagram ( )
private

Definition at line 364 of file DynExpManager.cpp.

◆ UpdateItemConfig()

template<typename LibraryVectorT , typename ManagerT >
bool DynExpManager::UpdateItemConfig ( DynExp::Object Object,
LibraryVectorT &  Lib,
ManagerT &  ResourceManager 
)
private

Invokes a configuration dialog to let the user adjust the parameters of a DynExp::Object instance.

Template Parameters
LibraryVectorTType of the library vector the object to be configured belongs to
ManagerTType of the resource manager owning the object to be configured
Parameters
ObjectDynExp::Object instance to be configured
LibLibrary vector the object to be configured belongs to
ResourceManagerResource manager owning the object to be configured
Returns
Returns true if resetting the Object is required to apply the changed settings, false otherwise.
Exceptions
Util::InvalidArgExceptionis thrown if Object is nullptr.

Definition at line 513 of file DynExpManager.h.

◆ UpdateItemTree()

void DynExpManager::UpdateItemTree ( )
private

Definition at line 392 of file DynExpManager.cpp.

◆ UpdateItemTreeItem() [1/3]

void DynExpManager::UpdateItemTreeItem ( const DynExp::HardwareAdapterManager::ResourceType Resource)
private

Definition at line 417 of file DynExpManager.cpp.

◆ UpdateItemTreeItem() [2/3]

void DynExpManager::UpdateItemTreeItem ( const DynExp::InstrumentManager::ResourceType Resource)
private

Definition at line 473 of file DynExpManager.cpp.

◆ UpdateItemTreeItem() [3/3]

void DynExpManager::UpdateItemTreeItem ( const DynExp::ModuleManager::ResourceType Resource)
private

Definition at line 529 of file DynExpManager.cpp.

◆ UpdateItemTreeItemObjectName()

void DynExpManager::UpdateItemTreeItemObjectName ( QTreeWidgetItem *  Item,
const DynExp::Object Object 
)
private

Updates the text of a QTreeWidgetItem instance to match it to the related DynExp::Object instance.

Parameters
ItemQTreeWidgetItem instance to adjust
ObjectDynExp::Object instance related to Item

Definition at line 611 of file DynExpManager.cpp.

◆ UpdateItemTreeSection()

template<typename ManagerT >
QTreeWidgetItem * DynExpManager::UpdateItemTreeSection ( QTreeWidgetItem *  Section,
ManagerT &  ResourceManager 
)
private

Loops through resources managed by ResourceManager and adds respective QTreeWidgetItem instances as childs to Section. Data is assigned to the user role of the columns of added items: column 0's data contains a boolean flag which is true if column 0's text (object name) needs to be updated. column 1's data contains a pointer (QTreeWidgetItem*) to the respectve item. column 2's data contains a ItemTreeItemDataType instance.

Template Parameters
ManagerTType of ResourceManager (type derived from class DynExp::ResourceManagerBase).
Parameters
SectionParent QTreeWidgetItem listing ResourceManager's resources as child items.
ResourceManagerInstance of type ManagerT containing resources to be processed.
Returns
Returns a pointer to the item added most recently by this function or nullptr if no item has been added to Section.

Definition at line 528 of file DynExpManager.h.

◆ UpdateLog()

void DynExpManager::UpdateLog ( )
private

Definition at line 222 of file DynExpManager.cpp.

◆ UpdateModulesUI()

void DynExpManager::UpdateModulesUI ( )
privatenoexcept

Definition at line 256 of file DynExpManager.cpp.

◆ UpdateModuleWindowsActionIcons()

void DynExpManager::UpdateModuleWindowsActionIcons ( )
privatenoexcept

Invokes DynExp::QModuleBase::UpdateModuleWindowFocusAction() on each module.

Definition at line 967 of file DynExpManager.cpp.

◆ UpdateModuleWindowsActionShortcuts()

void DynExpManager::UpdateModuleWindowsActionShortcuts ( )
privatenoexcept

Establishes shortcuts to switch between module windows. Refer to ModuleWindowsActionGroup.

Definition at line 953 of file DynExpManager.cpp.

◆ UpdateStatusBar()

void DynExpManager::UpdateStatusBar ( )
private

Definition at line 319 of file DynExpManager.cpp.

◆ UpdateTitleBar()

void DynExpManager::UpdateTitleBar ( )
private

Definition at line 305 of file DynExpManager.cpp.

Member Data Documentation

◆ AboutDialog

DynExpAbout* DynExpManager::AboutDialog
private

Dialog showing license and copyright information.

Definition at line 260 of file DynExpManager.h.

◆ CircuitDiagramDlg

std::unique_ptr<CircuitDiagram> DynExpManager::CircuitDiagramDlg
private

Dialog showing the circuit diagram of the current project. It has no parent to not stay on top of the main window, so delete it manually.

Definition at line 266 of file DynExpManager.h.

◆ ClearWarningAction

QAction* DynExpManager::ClearWarningAction
private

Action to clear the warning of an item within the main tree widget showing DynExp::Object instances.

Definition at line 275 of file DynExpManager.h.

◆ DynExpCore

DynExp::DynExpCore& DynExpManager::DynExpCore
private

Handle to DynExp's internal data.

Definition at line 255 of file DynExpManager.h.

◆ ErrorEntries

ErrorListDialog::ErrorEntriesType DynExpManager::ErrorEntries
private

List of all currently active warnings and errors.

Definition at line 308 of file DynExpManager.h.

◆ ErrorListDlg

ErrorListDialog* DynExpManager::ErrorListDlg
private

Dialog showing the list of currently active warnings and errors (ErrorEntries)

Definition at line 268 of file DynExpManager.h.

◆ IsResetting

bool DynExpManager::IsResetting
private

Indicates whether DynExpManager is currently deleting all resources to empty the project.

Definition at line 313 of file DynExpManager.h.

◆ ItemTreeContextMenu

QMenu* DynExpManager::ItemTreeContextMenu
private

Context menu appearing when right-clicking on the main tree widget showing DynExp::Object instances.

Definition at line 274 of file DynExpManager.h.

◆ ItemTreeHardwareAdapters

QTreeWidgetItem* DynExpManager::ItemTreeHardwareAdapters
private

Item for the hardware adapters section within the main tree widget showing DynExp::Object instances.

Definition at line 276 of file DynExpManager.h.

◆ ItemTreeInstruments

QTreeWidgetItem* DynExpManager::ItemTreeInstruments
private

Item for the instruments section within the main tree widget showing DynExp::Object instances.

Definition at line 277 of file DynExpManager.h.

◆ ItemTreeModules

QTreeWidgetItem* DynExpManager::ItemTreeModules
private

Item for the modules section within the main tree widget showing DynExp::Object instances.

Definition at line 278 of file DynExpManager.h.

◆ LogContextMenu

QMenu* DynExpManager::LogContextMenu
private

Context menu appearing when right-clicking on the message log widget.

Definition at line 273 of file DynExpManager.h.

◆ ModuleWindowsActionGroup

QActionGroup* DynExpManager::ModuleWindowsActionGroup
private

Actions to switch between module windows with CTRL + < number key > shortcuts.

Definition at line 269 of file DynExpManager.h.

◆ ShouldRedrawCircuitDiagram

bool DynExpManager::ShouldRedrawCircuitDiagram
private

Indicates whether the circuit diagram has to be rebuilt. Particularly, this must be set to true directly after invalidating any pointers to QTreeWidgetItem instances of the main window's item tree.

Definition at line 319 of file DynExpManager.h.

◆ ShouldUpdateCircuitDiagram

bool DynExpManager::ShouldUpdateCircuitDiagram
private

Indicates whether any item state has changed. Set to true to update the circuit diagram. The circuit diagram saves pointers to QTreeWidgetItem instances of the main window's item tree. Make sure that these pointers are still valid. If they have been invalidated, rebuild the circuit diagram first!

Definition at line 327 of file DynExpManager.h.

◆ StatusBar

struct DynExpManager::StatusBarType DynExpManager::StatusBar
private

◆ ui

Ui::DynExpManagerClass DynExpManager::ui
private

Qt widgets belonging to the main window's user interface.

Definition at line 257 of file DynExpManager.h.

◆ UIBrightThemeAction

QAction* DynExpManager::UIBrightThemeAction
private

Action for a bright UI theme.

Definition at line 271 of file DynExpManager.h.

◆ UIDarkThemeAction

QAction* DynExpManager::UIDarkThemeAction
private

Action for a dark UI theme.

Definition at line 272 of file DynExpManager.h.

◆ UIThemeActionGroup

QActionGroup* DynExpManager::UIThemeActionGroup
private

Actions to switch in between different UI themes.

Definition at line 270 of file DynExpManager.h.

◆ UpdateUITimer

QTimer* DynExpManager::UpdateUITimer
private

Timer for periodically updating the user interface.

Definition at line 259 of file DynExpManager.h.


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