VR-Engage  2.2
Loading...
Searching...
No Matches
vreManagerWidget.h
Go to the documentation of this file.
1/*******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4*******************************************************************************/
5
6//! \file vreManagerWidget.h
7//! \ingroup vreManager
8//! \brief VREngage Manager widget for configuring and managing VREngage applications
9//!
10//! This file defines the DtVreManagerWidget class, which provides the main user
11//! interface for managing VREngage applications, including role assignments,
12//! entity control, and status monitoring.
13
14#pragma once
15
16#include "vreManager/export.h"
17
18#include <vrvUtil/signalslib.h>
19
20#include "vreManager/vreManagerWidget.hpp"
21
22#include <vrvCoreQt/DtPage.h>
23#include <QtWidgets/QWidget>
24
25class DtVreTableModel;
26class QModelIndex;
28
29
30namespace makVre
31{
34
35//! \brief Main widget for the VREngage Manager interface
36//!
37//! This class provides the main user interface for managing VREngage applications,
38//! including monitoring application status, assigning roles and entities to
39//! applications, and controlling spectator mode settings. It integrates with
40//! the VREngage status listener to maintain real-time status information.
41class VREMANAGER_DLL DtVreManagerWidget : public makVrv::DtPage
42{
43 Q_OBJECT
44
45public:
46 //! \brief Virtual destructor
47 //!
48 //! Cleans up resources used by the manager widget, including the table model,
49 //! entity selection dialog, and VREngage listener.
50 virtual ~DtVreManagerWidget() override;
51
52 //! \brief Gets the icon for this page
53 //! \return Icon to display for this page in the application
54 //!
55 //! Returns the icon representing the VREngage Manager in the application UI.
56 virtual QIcon icon() override;
57
58 //! \brief Gets the title for this page
59 //! \return Title to display for this page in the application
60 //!
61 //! Returns the human-readable title for the VREngage Manager page.
62 virtual QString title() override;
63
64 //! \brief Gets the class name of the page
65 //! \return Reference to the unique class name string
66 //!
67 //! Returns the unique identifier for this page class type. This name is used
68 //! for page identification and persistence purposes.
69 virtual const std::string& pageClassName() const override;
70
71 //! \brief Called when the page is displayed
72 //!
73 //! Activates the manager widget, setting up the necessary connections, initializing
74 //! the table model, and refreshing the display. This is called whenever the
75 //! page becomes visible to the user.
76 virtual void activate() override;
77
78 //! \brief Called when the page is hidden
79 //!
80 //! Deactivates the manager widget, cleaning up resources and disconnecting
81 //! signals. This is called whenever the page becomes invisible to the user.
82 virtual void deactivate() override;
83
84 //! \brief Gets the icon configurations for the page
85 //! \return The icon configuration settings
86 //!
87 //! Returns the configuration settings used to style the page's icon
88 //! based on application settings and theme.
89 virtual makVrv::DtQIconConfigurations qIconConfigurations() const override;
90
91 //! \brief Static callback for VREngage application discovery
92 //! \param id The unique identifier of the discovered application
93 //! \param usr User-defined data (pointer to the manager widget instance)
94 //!
95 //! Static callback function invoked when a new VREngage application is discovered.
96 //! Routes the callback to the appropriate instance method.
97 static void vreAppAddedCallback(unsigned long id, void* usr);
98
99 //! \brief Static callback for VREngage application removal
100 //! \param id The unique identifier of the removed application
101 //! \param usr User-defined data (pointer to the manager widget instance)
102 //!
103 //! Static callback function invoked when a VREngage application is removed.
104 //! Routes the callback to the appropriate instance method.
105 static void vreAppRemovedCallback(unsigned long id, void* usr);
106
107 //! \brief Static callback for VREngage application status changes
108 //! \param id The unique identifier of the changed application
109 //! \param usr User-defined data (pointer to the manager widget instance)
110 //!
111 //! Static callback function invoked when a VREngage application's status changes.
112 //! Routes the callback to the appropriate instance method.
113 static void vreAppChangedCallback(unsigned long id, void* usr);
114
115public slots:
116 //! \brief Handles table item click events
117 //! \param index The model index of the clicked item
118 //!
119 //! Called when the user clicks on an item in the VREngage manager table.
120 //! Updates the selection state and UI accordingly.
121 virtual void onTableItemClicked(const QModelIndex& index);
122
123 //! \brief Handles submission of changes
124 //!
125 //! Called when the user submits changes to VREngage application settings.
126 //! Applies the changes to the affected applications.
127 virtual void onSubmit();
128
129 //! \brief Handles reverting of changes
130 //!
131 //! Called when the user cancels changes to VREngage application settings.
132 //! Reverts any pending changes and refreshes the display.
133 virtual void onRevert();
134
135 //! \brief Handles completion of user edits
136 //!
137 //! Called when the user completes an edit operation in the manager.
138 //! Updates internal state and enables/disables UI elements accordingly.
139 virtual void onUserEditComplete();
140
141 //! \brief Handles VREngage application addition
142 //! \param id The unique identifier of the added application
143 //!
144 //! Called when a new VREngage application is discovered. Updates the
145 //! table model and refreshes the display to show the new application.
146 virtual void handleVreAppAdded(unsigned long id);
147
148 //! \brief Handles VREngage application removal
149 //! \param id The unique identifier of the removed application
150 //!
151 //! Called when a VREngage application is removed or times out. Updates the
152 //! table model and refreshes the display to remove the application.
153 virtual void handleVreAppRemoved(unsigned long id);
154
155 //! \brief Handles VREngage application status changes
156 //! \param id The unique identifier of the changed application
157 //!
158 //! Called when a VREngage application's status changes. Updates the
159 //! table model and refreshes the display to show the updated status.
160 virtual void handleVreAppChanged(unsigned long id);
161
162protected:
163 //! \brief Handles entity selection
164 //!
165 //! Called when the user selects an entity for assignment to a VREngage
166 //! application. Shows the entity selection dialog.
167 virtual void onEntitySelected();
168
169 //! \brief Handles completion of entity selection dialog
170 //!
171 //! Called when the entity selection dialog is closed. Processes the
172 //! selected entity and updates the application settings accordingly.
174
175 //! \brief Handles model set changes
176 //!
177 //! Populates the model sets that could possibly contain VREngage-controllable entities.
178 //! This includes any SMS (Simulation Model Set) that derives from VR-Engage.sms
179 //! somewhere in its ancestry. Called when the available model sets change.
180 virtual void onModelSetChanged();
181
182protected:
183 //! Allows the creator class to create page instances
185
186 //! \brief Internal activation handler
187 //!
188 //! Implementation of the activation logic. Called by activate().
189 virtual void handleActivate();
190
191 //! \brief Internal deactivation handler
192 //!
193 //! Implementation of the deactivation logic. Called by deactivate().
194 virtual void handleDeactivate();
195
196 //! \brief Constructor
197 //! \param de The distributed environment reference
198 //! \param parent The parent widget
199 //! \param f Window flags to apply to the widget
200 //!
201 //! Initializes a new VREngage manager widget. This constructor is private
202 //! and can only be called by the DtVreManagerWidgetCreator.
203 DtVreManagerWidget(makVrv::DtDe& de, QWidget* parent = 0, Qt::WindowFlags f = 0);
204
205 //! \brief Sets up the UI components
206 //! \param p The parent widget to set up UI on
207 //!
208 //! Initializes and configures the user interface components of the manager widget.
209 //! Creates the table, buttons, and other controls, and connects signals and slots.
210 void setupUi(QWidget* p);
211
212protected:
213 //! \brief Class name for this page type
214 //!
215 //! Unique string identifier for this page class.
216 std::string myClassName;
217
218 //! \brief UI components generated from designer file
219 Ui::DtVreManagerWidget myUI;
220
221 //! \brief Table model for VREngage applications
222 //!
223 //! Maintains the data model for the applications table.
225
226 //! \brief Entity selection dialog
227 //!
228 //! Dialog for selecting entities to assign to VREngage applications.
230
231 //! \brief VREngage status listener
232 //!
233 //! Tracks status information for VREngage applications.
235
236 //! \brief Signal connection manager
237 //!
238 //! Manages Qt signal/slot connections for cleanup.
239 makVrv::DtSignalConnectionManager myConnectionManager;
240
241 //! \brief Flag indicating if the widget is in editing state
242 //!
243 //! True when the user is editing application settings, false otherwise.
245
246 //! \brief Currently loaded SMS filename
247 //!
248 //! The filename of the currently loaded Simulation Model Set.
250};
251
252
253//! \brief Factory class for creating VREngage manager widgets
254//!
255//! This creator class is responsible for instantiating DtVreManagerWidget
256//! objects for the application. It implements the DtPageCreator interface
257//! to allow the manager to be added to the application's page system.
258class VREMANAGER_DLL DtVreManagerWidgetCreator : public makVrv::DtPageCreator
259{
260public:
261 //! \brief Constructor
262 //! \param de The distributed environment reference
263 //!
264 //! Initializes a new creator for VREngage manager widgets.
266
267 //! \brief Virtual destructor
268 //!
269 //! Allows for proper cleanup of derived classes.
270 virtual ~DtVreManagerWidgetCreator() override;
271
272 //! \brief Gets the page class name
273 //! \return The unique class name string
274 //!
275 //! Returns the unique identifier for the page class this creator instantiates.
276 //! This name should be unique across all pages. This is not the human-readable
277 //! title of the page. When replacing a page, this class name should remain the same.
278 virtual std::string pageClassName() const override;
279
280 //! \brief Creates a new page instance
281 //! \param parent The parent widget
282 //! \param f Window flags to apply to the widget
283 //! \return Pointer to the newly created page
284 //!
285 //! Creates a new instance of the DtVreManagerWidget class.
286 virtual makVrv::DtPage* create(QWidget* parent = 0, Qt::WindowFlags f = 0) override;
287};
288} // namespace makVre
Tracks the status of VREngage applications.
Definition vreListener.h:105
Table model for VREngage application information.
Definition vreTableModel.h:33
Custom item delegate for role selection.
Definition roleItemDelegate.h:30
Dialog for selecting entities in the VREngage Manager.
Definition vreEntitySelectionDialog.h:34
virtual makVrv::DtPage * create(QWidget *parent=0, Qt::WindowFlags f=0) override
Creates a new page instance.
DtVreManagerWidgetCreator(makVrv::DtDe &de)
Constructor.
virtual std::string pageClassName() const override
Gets the page class name.
virtual ~DtVreManagerWidgetCreator() override
Virtual destructor.
std::string myClassName
Class name for this page type.
Definition vreManagerWidget.h:216
static void vreAppAddedCallback(unsigned long id, void *usr)
Static callback for VREngage application discovery.
virtual void handleVreAppRemoved(unsigned long id)
Handles VREngage application removal.
DtVreManagerWidget(makVrv::DtDe &de, QWidget *parent=0, Qt::WindowFlags f=0)
Constructor.
virtual QString title() override
Gets the title for this page.
virtual void onRevert()
Handles reverting of changes.
virtual makVrv::DtQIconConfigurations qIconConfigurations() const override
Gets the icon configurations for the page.
static void vreAppRemovedCallback(unsigned long id, void *usr)
Static callback for VREngage application removal.
Ui::DtVreManagerWidget myUI
UI components generated from designer file.
Definition vreManagerWidget.h:219
DtFilename myLoadedSMSFileName
Currently loaded SMS filename.
Definition vreManagerWidget.h:249
virtual void handleDeactivate()
Internal deactivation handler.
virtual void handleActivate()
Internal activation handler.
virtual void onEntitySelectionDialogDone()
Handles completion of entity selection dialog.
virtual void onModelSetChanged()
Handles model set changes.
virtual void handleVreAppAdded(unsigned long id)
Handles VREngage application addition.
static void vreAppChangedCallback(unsigned long id, void *usr)
Static callback for VREngage application status changes.
virtual void activate() override
Called when the page is displayed.
virtual void onSubmit()
Handles submission of changes.
virtual void onUserEditComplete()
Handles completion of user edits.
bool myInEditingState
Flag indicating if the widget is in editing state.
Definition vreManagerWidget.h:244
DtVreTableModel * myModel
Table model for VREngage applications.
Definition vreManagerWidget.h:224
makVrv::DtSignalConnectionManager myConnectionManager
Signal connection manager.
Definition vreManagerWidget.h:239
DtVreStatusListener * myVreListener
VREngage status listener.
Definition vreManagerWidget.h:234
virtual QIcon icon() override
Gets the icon for this page.
virtual void onEntitySelected()
Handles entity selection.
virtual void handleVreAppChanged(unsigned long id)
Handles VREngage application status changes.
DtVreEntitySelectionDialog * mySelectEntityDialog
Entity selection dialog.
Definition vreManagerWidget.h:229
virtual void onTableItemClicked(const QModelIndex &index)
Handles table item click events.
void setupUi(QWidget *p)
Sets up the UI components.
virtual ~DtVreManagerWidget() override
Virtual destructor.
friend class DtVreManagerWidgetCreator
Allows the creator class to create page instances.
Definition vreManagerWidget.h:184
virtual void deactivate() override
Called when the page is hidden.
virtual const std::string & pageClassName() const override
Gets the class name of the page.
Monitors status messages from VR-Engage player stations.
Definition vreStatusListener.h:37
Export macros for the VREngage Manager library.
#define VREMANAGER_DLL
Platform-specific export/import macro for VREngage Manager library.
Definition export.h:28
Include export definitions for this library.
Definition glsVreMessageUtil.h:49
makVrv::DtDe * de()
Gets the display element pointer used by the plugin.