VR-Engage  2.2
Loading...
Searching...
No Matches
vreAppPage.h
Go to the documentation of this file.
1/******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4******************************************************************************/
5
6//! \file vreAppPage.h
7//! \brief Defines the main application UI page for VR-Engage
8//!
9//! This file contains the DtVreAppPage class which implements the main application
10//! page for VR-Engage. It provides the UI elements and functionality for the in-game
11//! screen, including access to session management, role selection, and application
12//! control. This page is displayed when a user is engaged with a role in the simulation.
13
14#pragma once
15
18
19#include <QObject>
20
21class QQuickItem;
22
23namespace makVre
24{
26
27//! \brief Structure containing state values for the application page
28//!
29//! DtVreAppPageValues stores the current state information displayed in the
30//! application page. This includes engagement status, session information,
31//! and currently loaded terrain and scenario data.
33{
34 //! \brief Current application state name
35 std::string myCurrentState;
36
37 //! \brief Whether the user is currently engaged with a role
39
40 //! \brief Whether the user is currently in a session
42
43 //! \brief Whether the simulation is currently running
45
46 //! \brief Currently loaded scenario name
47 std::string myScenario;
48
49 //! \brief Currently loaded terrain name
50 std::string myTerrain;
51};
52
53//! \brief Main application page for the VR-Engage in-game interface
54//!
55//! DtVreAppPage implements the main application page displayed when a user
56//! is engaged with a role in VR-Engage. It provides access to session management,
57//! role selection, and application control through a QML-based user interface.
58//! The page includes information about the current entity, role, session, and
59//! scenario, and provides buttons for navigation to other parts of the application.
61{
62 Q_OBJECT
63
64public:
65 //! \brief Constructor
66 //! \param app Reference to the player station application
67 //! \param target_window Target window name for this page (empty for default)
68 //!
69 //! Creates a new application page instance associated with the specified
70 //! player station application. The optional target_window parameter allows
71 //! specifying which window should display this page.
72 DtVreAppPage(DtPlayerStationApp& app, const std::string& target_window = "");
73
74 //! \brief Destructor
75 //!
76 //! Cleans up resources used by the application page.
77 virtual ~DtVreAppPage() override;
78
79 //! \brief Updates the page state
80 //! \param dt Time elapsed since the last update in seconds
81 //!
82 //! Called once per frame to update the page state. This method can be used
83 //! to handle animations, timers, or other time-dependent functionality.
84 virtual void tick(double dt) override;
85
86 //! \brief Initializes the main QML content
87 //!
88 //! Sets up the main QML content for the page, including connecting signals
89 //! and slots between C++ and QML. This is called during page initialization
90 //! after the QML has been loaded.
91 virtual void initMain() override;
92
93 //! \brief Sets the visibility of the page
94 //! \param visible True to show the page, false to hide it
95 //!
96 //! Overrides the base class implementation to update page information
97 //! when the page becomes visible. This ensures that the displayed information
98 //! is current whenever the page is shown.
99 virtual void setVisibility(bool visible) override;
100
101 //! \brief Sets the enabled state of the Choose Role button
102 //! \param enable True to enable the button, false to disable it
103 //!
104 //! Controls whether the Choose Role button is interactive. The button is
105 //! typically disabled in lockdown mode or when there is no network connection.
106 virtual void setChooseRoleBtnState(bool enable);
107
108 //! \brief Sets the enabled state of the Return button
109 //! \param enable True to enable the button, false to disable it
110 //!
111 //! Controls whether the Return button is interactive. The button is
112 //! typically disabled when the user is not engaged with a role.
113 virtual void setReturnBtnState(bool enable);
114
115 //! \brief Sets the enabled state of the Choose Session button and dialog
116 //! \param enableBtn True to enable the button, false to disable it
117 //! \param enableDialog True to show a confirmation dialog, false for direct action
118 //!
119 //! Controls whether the Choose Session button is interactive and whether
120 //! it should show a confirmation dialog when clicked. The dialog is typically
121 //! enabled when the user is already in a session.
122 virtual void setChooseSessionBtnState(bool enableBtn, bool enableDialog);
123
124 //! \brief Updates the displayed terrain information
125 //! \param terrain Name of the current terrain
126 //!
127 //! Sets the terrain name displayed in the UI. This shows the currently
128 //! loaded terrain database used by the simulation.
129 virtual void setTerrain(const std::string& terrain);
130
131 //! \brief Updates the displayed scenario information
132 //! \param scenario Name of the current scenario
133 //!
134 //! Sets the scenario name displayed in the UI. This shows the currently
135 //! loaded scenario file used by the simulation.
136 virtual void setScenario(const std::string& scenario);
137
138 //! \brief Updates the displayed session type information
139 //! \param type Type of the current session
140 //!
141 //! Sets the session type displayed in the UI (e.g., "Unhosted",
142 //! "Self-hosted", or "Externally Hosted").
143 virtual void setSessionType(const QString& type);
144
145 //! \brief Refreshes all menu information
146 //!
147 //! Updates all displayed information in the UI, including entity details,
148 //! role information, scenario data, and session state. Called when the
149 //! page becomes visible or when information changes.
150 virtual void refreshMenus();
151
152public slots:
153 //! \brief Slot called when the Return button is clicked
154 //!
155 //! Handles the Return button click event. This sends a UIBackButtonClickedMessage
156 //! to the message system to request returning to the previous screen.
157 virtual void slot_returnClicked();
158
159 //! \brief Slot called when the Choose Role button is clicked
160 //!
161 //! Handles the Choose Role button click event. This sends a UIChooseRoleButtonClickedMessage
162 //! to the message system to request displaying the Choose Role interface.
164
165 //! \brief Slot called when the Choose Session button is clicked
166 //!
167 //! Handles the Choose Session button click event. This displays the Choose Session
168 //! dialog to allow selecting a different simulation session.
170
171 //! \brief Slot called when the Choose Session dialog is opened
172 //!
173 //! Handles the Choose Session dialog open event. This is used to set up
174 //! the dialog and connect signals for its interactions.
176
177 //! \brief Slot called when the Choose Session dialog is closed
178 //!
179 //! Handles the Choose Session dialog close event. This is used to clean up
180 //! any temporary resources and disconnect signals.
182
183 //! \brief Slot called when the Choose Session dialog is accepted
184 //!
185 //! Handles the Choose Session dialog accept event (e.g., OK button clicked).
186 //! This closes the dialog and sends a UIChooseSessionButtonClickedMessage to
187 //! the message system to request changing to the selected session.
189
190 //! \brief Slot called when the Choose Session dialog is rejected
191 //!
192 //! Handles the Choose Session dialog reject event (e.g., Cancel button clicked).
193 //! This closes the dialog without making any changes to the session.
195
196 //! \brief Slot called when the Exit dialog is opened
197 //!
198 //! Handles the Exit dialog open event. This checks application settings to
199 //! determine whether to show the dialog or exit immediately, and connects
200 //! signals for dialog interactions.
202
203 //! \brief Slot called when the Exit dialog is accepted
204 //!
205 //! Handles the Exit dialog accept event (e.g., OK button clicked).
206 //! This updates application settings and exits the application.
208
209 //! \brief Slot called when the Exit dialog is rejected
210 //!
211 //! Handles the Exit dialog reject event (e.g., Cancel button clicked).
212 //! This closes the dialog without exiting the application.
214
215 //! \brief Slot called when the Exit dialog is closed
216 //!
217 //! Handles the Exit dialog close event. This is used to clean up
218 //! any temporary resources and disconnect signals.
220
221protected:
222 //! \brief Updates the UI when the running state changes
223 //! \param runState New running state of the simulation
224 //!
225 //! Overrides the base class implementation to update the status panel
226 //! when the simulation running state changes. This ensures that the UI
227 //! reflects the current state of the simulation (running or paused).
228 virtual void runningStateUpdated(bool runState) override;
229};
230} // namespace makVre
Top-level class representing the VR-Engage application.
Definition playerStationApp.h:163
DtVreAppPage(DtPlayerStationApp &app, const std::string &target_window="")
Constructor.
virtual void setSessionType(const QString &type)
Updates the displayed session type information.
virtual void setTerrain(const std::string &terrain)
Updates the displayed terrain information.
virtual void slot_chooseSessionAccepted()
Slot called when the Choose Session dialog is accepted.
virtual void slot_appMenuExitRejected()
Slot called when the Exit dialog is rejected.
virtual void slot_returnClicked()
Slot called when the Return button is clicked.
virtual void tick(double dt) override
Updates the page state.
virtual void slot_chooseSessionClicked()
Slot called when the Choose Session button is clicked.
virtual void setVisibility(bool visible) override
Sets the visibility of the page.
virtual void slot_chooseSessionOpened()
Slot called when the Choose Session dialog is opened.
virtual void initMain() override
Initializes the main QML content.
virtual void slot_appMenuExitClosed()
Slot called when the Exit dialog is closed.
virtual void slot_chooseSessionClosed()
Slot called when the Choose Session dialog is closed.
virtual void runningStateUpdated(bool runState) override
Updates the UI when the running state changes.
virtual void setChooseSessionBtnState(bool enableBtn, bool enableDialog)
Sets the enabled state of the Choose Session button and dialog.
virtual void slot_appMenuExitOpened()
Slot called when the Exit dialog is opened.
virtual void slot_appMenuExitAccepted()
Slot called when the Exit dialog is accepted.
virtual void refreshMenus()
Refreshes all menu information.
virtual void slot_chooseSessionRejected()
Slot called when the Choose Session dialog is rejected.
virtual void setChooseRoleBtnState(bool enable)
Sets the enabled state of the Choose Role button.
virtual void slot_chooseRoleClicked()
Slot called when the Choose Role button is clicked.
virtual void setScenario(const std::string &scenario)
Updates the displayed scenario information.
virtual ~DtVreAppPage() override
Destructor.
virtual void setReturnBtnState(bool enable)
Sets the enabled state of the Return button.
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
Structure containing state values for the application page.
Definition vreAppPage.h:33
bool myIsRunning
Whether the simulation is currently running.
Definition vreAppPage.h:44
std::string myTerrain
Currently loaded terrain name.
Definition vreAppPage.h:50
std::string myScenario
Currently loaded scenario name.
Definition vreAppPage.h:47
std::string myCurrentState
Current application state name.
Definition vreAppPage.h:35
bool myInSession
Whether the user is currently in a session.
Definition vreAppPage.h:41
bool myIsEngaged
Whether the user is currently engaged with a role.
Definition vreAppPage.h:38