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