VR-Engage  2.2
Loading...
Searching...
No Matches
vreHeaderFooterUIBase.h
Go to the documentation of this file.
1/******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4******************************************************************************/
5
6//! \file vreHeaderFooterUIBase.h
7//! \brief Defines the base class for UI components with header and footer
8//!
9//! This file contains the DtVreHeaderFooterUIBase class which provides a common
10//! foundation for UI components that have a standard header and footer layout.
11//! It manages the visibility, initialization, and event handling for these UI elements.
12
13#pragma once
14
18
19#include <QObject>
20
21class QQuickItem;
22
23namespace makVre
24{
25//! \brief Forward declaration of the player station application class
27
28//! \brief Base class for UI components with header and footer
29//!
30//! DtVreHeaderFooterUIBase provides a foundation for UI components that use
31//! a standard header and footer layout. It manages the visibility, initialization,
32//! and event handling for these UI elements, as well as common dialogs like
33//! settings and exit confirmation. This class simplifies the creation of
34//! consistent UI components throughout the application.
36{
37 Q_OBJECT
38
39public:
40 //! \brief Simple constructor
41 //! \param app Reference to the player station application
42 //! \param file Path to the QML file defining the UI
43 //! \param target_window Name of the window to display in (empty for default)
44 //!
45 //! Creates a new UI component using the specified QML file for the given window.
46 //! Uses default IDs for header, footer, and main content elements.
47 DtVreHeaderFooterUIBase(DtPlayerStationApp& app, const std::string& file, const std::string& target_window = "");
48
49 //! \brief Detailed constructor
50 //! \param app Reference to the player station application
51 //! \param file Path to the QML file defining the UI
52 //! \param headerId ID of the header element in the QML
53 //! \param footerId ID of the footer element in the QML
54 //! \param mainContentId ID of the main content element in the QML
55 //! \param target_window Name of the window to display in
56 //!
57 //! Creates a new UI component using the specified QML file with custom IDs
58 //! for the header, footer, and main content elements. This allows for more
59 //! fine-grained control over UI structure and appearance.
60 DtVreHeaderFooterUIBase(DtPlayerStationApp& app, const std::string& file, const std::string& headerId,
61 const std::string& footerId, const std::string& mainContentId, const std::string& target_window);
62
63 //! \brief Virtual destructor
64 //!
65 //! Ensures proper cleanup of UI component resources.
66 virtual ~DtVreHeaderFooterUIBase() override;
67
68 //! \brief Core functionality methods
69 //! @{
70
71 //! \brief Initializes the main UI component
72 //!
73 //! Pure virtual method that must be implemented by derived classes to initialize
74 //! the UI component. This typically involves setting up signals/slots connections,
75 //! initial state, and other component-specific initialization.
76 virtual void initMain() = 0;
77
78 //! \brief Updates the UI component each frame
79 //! \param dt Time in seconds since the last update
80 //!
81 //! Pure virtual method that must be implemented by derived classes to handle
82 //! per-frame updates for the UI component. This is called once per frame
83 //! and allows for animations, state updates, and other time-based operations.
84 virtual void tick(double dt) = 0;
85 //! @}
86
87 //! \brief Visibility control methods
88 //! @{
89
90 //! \brief Sets the visibility of the entire UI component
91 //! \param visible True to show the component, false to hide it
92 //!
93 //! Controls the visibility of the root object of this UI component.
94 //! This affects the entire component, not individual elements within it.
95 virtual void setVisibility(bool visible);
96
97 //! \brief Checks if the UI component is visible
98 //! \return True if the component is visible, false otherwise
99 //!
100 //! Determines whether the UI component is currently visible to the user.
101 virtual bool isVisible();
102
103 //! \brief Closes the UI component
104 //!
105 //! Convenience method that hides the UI component by calling setVisibility(false).
106 virtual void close();
107
108 //! \brief Opens the UI component
109 //!
110 //! Convenience method that shows the UI component by calling setVisibility(true).
111 virtual void open();
112 //! @}
113
114 //! \brief Header control methods
115 //! @{
116
117 //! \brief Initializes the header portion of the UI
118 //!
119 //! Sets up the header elements and their initial state.
120 //! This is typically called during component initialization.
121 virtual void initHeader();
122
123 //! \brief Checks if the header is visible
124 //! \return True if the header is visible, false otherwise
125 //!
126 //! Determines whether the header portion of the UI is currently visible.
127 virtual bool isHeaderVisible();
128
129 //! \brief Sets the visibility of the header
130 //! \param visible True to show the header, false to hide it
131 //!
132 //! Controls the visibility of the header portion of the UI.
133 virtual void setHeaderVisiblility(bool visible);
134
135 //! \brief Sets the title displayed in the header
136 //! \param title Text to display as the menu title
137 //!
138 //! Updates the title text shown in the header area of the UI.
139 virtual void setMenuTitle(const QString& title);
140
141 //! \brief Sets the visibility of the cutout area in the header
142 //! \param visible True to show the cutout area, false to hide it
143 //!
144 //! Controls the visibility of the cutout area in the header,
145 //! which typically contains action buttons or status information.
146 virtual void setShowCutoutVisible(bool visible);
147
148 //! \brief Enables or disables a specific button in the header
149 //! \param id Identifier of the button to modify
150 //! \param enabled True to enable the button, false to disable it
151 //!
152 //! Controls whether a specific button in the header is enabled or disabled.
153 //! Disabled buttons are typically grayed out and do not respond to clicks.
154 virtual void setButtonEnabled(const std::string& id, bool enabled);
155
156 //! \brief Checks if a specific button is enabled
157 //! \param id Identifier of the button to check
158 //! \return True if the button is enabled, false if disabled
159 //!
160 //! Determines whether a specific button in the header is currently enabled.
161 virtual bool isButtonEnabled(const std::string& id);
162
163 //! \brief Enables or disables all cutout controls
164 //! \param enabled True to enable all controls, false to disable them
165 //!
166 //! Controls whether all buttons and controls in the cutout area are enabled or disabled.
167 virtual void setAllCutoutControlsEnabled(bool enabled);
168
169 //! \brief Sets the visibility of top-right controls
170 //! \param visible True to show the controls, false to hide them
171 //!
172 //! Controls the visibility of controls located in the top-right area of the header.
173 virtual void setShowTopRightControlsVisible(bool visible);
174 //! @}
175
176 //! \brief Footer control methods
177 //! @{
178
179 //! \brief Initializes the footer portion of the UI
180 //!
181 //! Sets up the footer elements and their initial state.
182 //! This is typically called during component initialization.
183 virtual void initFooter();
184
185 //! \brief Checks if the footer is visible
186 //! \return True if the footer is visible, false otherwise
187 //!
188 //! Determines whether the footer portion of the UI is currently visible.
189 virtual bool isFooterVisible();
190
191 //! \brief Sets the visibility of the footer
192 //! \param visible True to show the footer, false to hide it
193 //!
194 //! Controls the visibility of the footer portion of the UI.
195 virtual void setFooterVisiblility(bool visible);
196
197 //! \brief Sets the visibility of the back button in the footer
198 //! \param visible True to show the back button, false to hide it
199 //!
200 //! Controls the visibility of the back button located in the footer area.
201 virtual void setShowBottomBackButtonVisible(bool visible);
202 //! @}
203
204 //! \brief Main content control methods
205 //! @{
206
207 //! \brief Checks if the main content is visible
208 //! \return True if the main content is visible, false otherwise
209 //!
210 //! Determines whether the main content area of the UI is currently visible.
211 virtual bool isMainContentVisible();
212
213 //! \brief Sets the visibility of the main content
214 //! \param visible True to show the main content, false to hide it
215 //!
216 //! Controls the visibility of the main content area of the UI.
217 virtual void setMainContentVisibility(bool visible);
218 //! @}
219
220 //! \brief Message handling methods
221 //! @{
222
223 //! \brief Registers message handlers for this UI component
224 //!
225 //! Sets up handlers for messages that this UI component needs to process.
226 //! This is typically called during initialization or when the component becomes active.
228
229 //! \brief Deregisters message handlers for this UI component
230 //!
231 //! Removes handlers for messages that this UI component was processing.
232 //! This is typically called during cleanup or when the component becomes inactive.
234
235 //! \brief Handles back button click messages
236 //! \param msg Pointer to the button click message
237 //! \return Message handling result
238 //!
239 //! Processes messages generated when the back button is clicked.
240 //! This typically navigates back to a previous screen or state.
242
243 //! \brief Handles escape key press messages
244 //! \param msg Pointer to the key press message
245 //! \return Message handling result
246 //!
247 //! Processes messages generated when the escape key is pressed.
248 //! This typically closes dialogs or navigates back.
250 //! @}
251
252 //! \brief Gets the root UI element
253 //! \return Pointer to the root QQuickItem
254 //!
255 //! Provides access to the root QQuickItem of this UI component.
256 //! This can be used to directly manipulate the UI element tree if needed.
257 QQuickItem* root();
258
259public slots:
260 //! \brief Settings dialog slots
261 //! @{
262
263 //! \brief Called when the settings dialog is opened
264 //!
265 //! Handles the opening of the settings dialog, performing any necessary
266 //! initialization for the settings UI.
267 virtual void slot_settingsOpened();
268
269 //! \brief Called when the settings dialog is closed
270 //!
271 //! Handles the closing of the settings dialog, performing any necessary
272 //! cleanup or state updates.
273 virtual void slot_settingsClosed();
274
275 //! \brief Called when display engine configuration is clicked
276 //!
277 //! Handles navigation to the display engine configuration settings page.
279
280 //! \brief Called when weather and environment settings are clicked
281 //!
282 //! Handles navigation to the weather and environment settings page.
284
285 //! \brief Called when advanced visual settings are clicked
286 //!
287 //! Handles navigation to the advanced visual settings page.
289
290 //! \brief Called when the about option is clicked
291 //!
292 //! Handles navigation to the about dialog or page.
293 virtual void slot_aboutClicked();
294
295 //! \brief Called when the sound volume is changed
296 //! \param volume New volume level (typically 0.0 to 1.0)
297 //!
298 //! Handles changes to the sound volume setting.
299 virtual void slot_soundVolumeChanged(qreal volume);
300
301 //! \brief Called when sound enabled state is changed
302 //! \param enabled True if sound is enabled, false otherwise
303 //!
304 //! Handles changes to the sound enabled/disabled setting.
305 virtual void slot_soundEnabledChanged(bool enabled);
306 //! @}
307
308 //! \brief Exit confirmation dialog slots
309 //! @{
310
311 //! \brief Called when the exit confirmation dialog is opened
312 //!
313 //! Handles the opening of the exit confirmation dialog, preparing
314 //! the UI and any state needed for the confirmation process.
315 virtual void slot_exitOpened();
316
317 //! \brief Called when the exit confirmation dialog is closed
318 //!
319 //! Handles the closing of the exit confirmation dialog, performing
320 //! any necessary cleanup regardless of the user's choice.
321 virtual void slot_exitClosed();
322
323 //! \brief Called when exit is confirmed (Yes/OK clicked)
324 //!
325 //! Handles the user confirming the exit action, typically by
326 //! initiating the actual exit process.
327 virtual void slot_exitAccepted();
328
329 //! \brief Called when exit is rejected (No/Cancel clicked)
330 //!
331 //! Handles the user rejecting the exit action, typically by
332 //! returning to the previous state.
333 virtual void slot_exitRejected();
334 //! @}
335
336 //! \brief Playback control slots
337 //! @{
338
339 //! \brief Called when the play button is clicked
340 //!
341 //! Handles requests to start or resume playback of the simulation.
342 virtual void slot_playClicked();
343
344 //! \brief Called when the pause button is clicked
345 //!
346 //! Handles requests to pause the simulation.
347 virtual void slot_pauseClicked();
348
349 //! \brief Called when the rewind button is clicked
350 //!
351 //! Handles requests to rewind or reset the simulation to a starting point.
352 virtual void slot_rewindClicked();
353 //! @}
354
355 //! \brief Connection control slots
356 //! @{
357
358 //! \brief Called when the connection button is clicked
359 //!
360 //! Handles requests to manage connection settings or status.
362 //! @}
363
364 //! \brief Help system slots
365 //! @{
366
367 //! \brief Called when the help system is opened
368 //!
369 //! Handles the opening of the help dialog or overlay.
370 virtual void slot_helpOpened();
371
372 //! \brief Called when the help system is closed
373 //!
374 //! Handles the closing of the help dialog or overlay.
375 virtual void slot_helpClosed();
376 //! @}
377
378 //! \brief Navigation control slots
379 //! @{
380
381 //! \brief Called when the back button is clicked
382 //!
383 //! Handles navigation requests to go back to a previous screen or state.
384 virtual void slot_backClicked();
385 //! @}
386
387protected:
388 //! \brief Updates the running state
389 //! \param runState True if the simulation is running, false if paused
390 //!
391 //! Updates the UI to reflect the current running state of the simulation.
392 //! This base implementation does nothing and should be overridden by derived classes.
393 virtual void runningStateUpdated(bool runState) {};
394
395 //! \brief Closes settings pages
396 //! \param pageName Name of the page to keep open (empty to close all)
397 //!
398 //! Closes all settings pages, optionally keeping one specified page open.
399 //! If no page name is passed, all pages are closed. If a page name is
400 //! provided, every page except the specified one is closed.
401 virtual void closeAllSettingsPages(std::string pageName = "");
402
403 //! \brief Handles application mode updates
404 //! \param newAppMode Identifier of the new application mode
405 //! \param oldAppMode Identifier of the previous application mode
406 //!
407 //! Called when the application mode changes, allowing the UI
408 //! to update its state appropriately for the new mode.
409 virtual void appModeUpdated(const std::string& newAppMode, const std::string& oldAppMode);
410
411 //! \brief Updates the modal dialog state
412 //! \param open True if a modal dialog is open, false otherwise
413 //!
414 //! Notifies the system about the presence of a modal dialog or popup.
415 //! This allows other components to adjust their behavior appropriately
416 //! when modal dialogs are active.
417 virtual void updateModalState(bool open);
418
419 //! \brief Internal message handlers
420 //! @{
421
422 //! \brief Handles application mode change messages
423 //! \param msg Pointer to the application mode message
424 //! \return Message handling result
425 //!
426 //! Processes messages about changes to the application mode.
428
429 //! \brief Handles session play state messages
430 //! \param msg Pointer to the play state message
431 //! \return Message handling result
432 //!
433 //! Processes messages about changes to the session play state
434 //! (playing, paused, etc.).
436
437 //! \brief Handles help toggle messages
438 //! \param msg Pointer to the help toggle message
439 //! \return Message handling result
440 //!
441 //! Processes messages requesting to show or hide the help system.
443 //! @}
444
445protected:
446 //! \brief Reference to the player station application
447 //!
448 //! Provides access to application services and state.
450
451 //! \brief Pointer to the root QML item
452 //!
453 //! Reference to the root UI element for this component.
454 QQuickItem* myRoot;
455
456 //! \brief Name of the target window
457 //!
458 //! Identifies which window the UI should be displayed in.
459 std::string myTargetWindow;
460
461 //! \brief Path to the QML file
462 //!
463 //! Specifies the QML file that defines this UI component.
464 std::string myTargetFile;
465
466 //! \brief ID of the header element
467 //!
468 //! Identifies the header element in the QML structure.
469 std::string myHeaderId;
470
471 //! \brief ID of the footer element
472 //!
473 //! Identifies the footer element in the QML structure.
474 std::string myFooterId;
475
476 //! \brief ID of the main content element
477 //!
478 //! Identifies the main content element in the QML structure.
479 std::string myMainContentId;
480};
481} // namespace makVre
Main singleton responsible for managing QML files in the VREngage system.
Top-level class representing the VR-Engage application.
Definition playerStationApp.h:163
Abstract base class for all VREngage messages.
Definition vreMessage.h:50
Defines export macros for the VR-Engage Player Station library.
#define PLAYERSTATION_DLL
Definition export.h:24
Include export definitions for this library.
Definition glsVreMessageUtil.h:49
DtVreMessageResult
Enumeration of possible message handling results.
Definition vreMessage.h:33
Defines the base class for all VREngage messages.