VR-Engage  2.2
Loading...
Searching...
No Matches
vreSelectConnectionPage.h
Go to the documentation of this file.
1/*******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4*******************************************************************************/
5
6//! \file vreSelectConnectionPage.h
7//! \brief Defines the connection selection page for VR-Engage
8//!
9//! This file contains the DtVreSelectConnectionPage class which provides the UI
10//! for configuring and selecting network connections (DIS or HLA) for the
11//! VR-Engage application. It allows users to choose between different network
12//! protocols and configure their connection parameters.
13
14#pragma once
15
18
19#include <QObject>
20
22
23class QQuickItem;
24class QStringList;
25
26namespace makVrv
27{
28class DtVrlinkDriver;
29}
30
31namespace makVre
32{
33//! \brief Forward declaration of the player station application class
35
36//! \brief Forward declaration of the connection page driver base class
38
39//! \brief Forward declaration of the DIS-specific connection driver class
41
42//! \brief Forward declaration of the HLA-specific connection driver class
44
45//! \brief UI page for selecting and configuring network connections
46//!
47//! DtVreSelectConnectionPage provides a user interface for selecting and configuring
48//! network connections in VR-Engage. It displays available connection protocols
49//! (DIS and HLA) and allows users to configure connection parameters. This page
50//! is typically shown during the initial setup phase or when changing connection
51//! settings.
53{
54 Q_OBJECT;
55
56public:
57 //! \brief Constructor
58 //! \param app Reference to the player station application
59 //! \param target_window Name of the window to display in (empty for default)
60 //!
61 //! Creates a new connection selection page UI for the specified application
62 //! and target window. Initializes network message handlers and connections.
63 DtVreSelectConnectionPage(DtPlayerStationApp& app, const std::string& target_window = "");
64
65 //! \brief Destructor
66 //!
67 //! Cleans up resources, disconnects signals, and unregisters message handlers.
68 virtual ~DtVreSelectConnectionPage() override;
69
70 //! \brief Initializes the main content of the page
71 //!
72 //! Sets up the main content area of the page, including the page title
73 //! and application mode properties. Called during initialization.
74 virtual void initMain() override;
75
76 //! \brief Updates the page each frame
77 //! \param dt Time in seconds since the last update
78 //!
79 //! Called once per frame to update any time-dependent elements on the page.
80 virtual void tick(double dt) override;
81 //! \brief Handles connection button clicks
82 //!
83 //! Called when the connection button is clicked. Sends a back button
84 //! clicked message to the system to handle the navigation.
85 virtual void slot_connectionClicked() override;
86
87 //! \brief Handles network disconnection messages
88 //! \param msg Pointer to the network disconnected message
89 //! \return Message handling result
90 //!
91 //! Processes messages indicating that the network connection has been
92 //! disconnected and updates the UI state accordingly.
94
95 //! \brief Handles network connection messages
96 //! \param msg Pointer to the network connected message
97 //! \return Message handling result
98 //!
99 //! Processes messages indicating that a network connection has been
100 //! established and updates the UI state accordingly.
102
103 //! \brief Sets the visibility of the page
104 //! \param visible True to show the page, false to hide it
105 //!
106 //! Controls whether the connection selection page is visible. When made
107 //! visible, this method updates the page title and application mode.
108 virtual void setVisibility(bool visible) override;
109
110 //! \brief Initializes the footer area of the page
111 //!
112 //! Sets up the footer area of the page, including configuring the back button
113 //! based on the current application state. Called during initialization.
114 virtual void initFooter() override;
115
116 //! \brief Handles application mode changes
117 //! \param newAppMode Identifier of the new application mode
118 //! \param oldAppMode Identifier of the previous application mode
119 //!
120 //! Updates the page when the application mode changes, ensuring the UI
121 //! reflects the current mode appropriately.
122 virtual void appModeUpdated(const std::string& newAppMode, const std::string& oldAppMode) override;
123
124protected:
125 //! \brief Slot called when drivers are about to auto-start
126 //!
127 //! Called when the display engine signals that drivers are about to be
128 //! automatically started. This triggers requests for connection information
129 //! from the network thread to update the available connections.
131
132protected:
133 //! \brief Flag indicating network connection status
134 //!
135 //! True when the network is connected, false when disconnected.
136 //! Used to control UI elements based on connectivity state.
138};
139
140//! \brief QML interface for the connection selection page
141//!
142//! DtVreSelectConnectionPageQML provides the interface between the C++ backend
143//! and the QML frontend of the connection selection page. It manages the list
144//! of available connection drivers and handles communication between the UI
145//! and the underlying connection system.
147{
148 Q_OBJECT;
149
150 //! \brief List of available connection drivers
151 //!
152 //! QML property that exposes the list of available connection drivers
153 //! to the QML frontend. Can be accessed and modified from QML.
154 Q_PROPERTY(QVariantList drivers READ getDrivers WRITE setDrivers NOTIFY driversChanged);
155
156public:
157 //! \brief Constructor
158 //! \param parent Optional parent QObject for memory management
159 //!
160 //! Creates a new QML interface for the connection selection page.
161 //! Registers message handlers and requests connection information.
162 explicit DtVreSelectConnectionPageQML(QObject* parent = nullptr);
163
164 //! \brief Destructor
165 //!
166 //! Cleans up resources and unregisters message handlers.
168
169 //! \brief Gets the list of available connection drivers
170 //! \return List of connection drivers as QVariantList
171 //!
172 //! Returns the current list of available connection drivers (DIS, HLA)
173 //! for display in the QML interface. Each driver contains information
174 //! about the connection protocol and its configuration options.
175 virtual QVariantList getDrivers();
176
177 //! \brief Invokable method to navigate back
178 //!
179 //! QML-invokable method that handles back navigation requests from the UI.
180 //! This is typically connected to back buttons in the QML interface.
181 virtual Q_INVOKABLE void back();
182
183protected:
184 //! \brief Handles HLA connection information messages
185 //! \param msg Pointer to the HLA connection info message
186 //! \return Message handling result
187 //!
188 //! Processes messages containing information about available HLA
189 //! connections and updates the driver list accordingly.
191
192 //! \brief Handles DIS connection information messages
193 //! \param msg Pointer to the DIS connection info message
194 //! \return Message handling result
195 //!
196 //! Processes messages containing information about available DIS
197 //! connections and updates the driver list accordingly.
199
200public slots:
201 //! \brief Sets the list of connection drivers
202 //! \param list New list of connection drivers
203 //!
204 //! Updates the internal list of connection drivers and notifies
205 //! the QML interface of the change.
206 void setDrivers(QVariantList list);
207
208 //! \brief Adds a connection driver to the list
209 //! \param driver Pointer to the driver to add
210 //!
211 //! Adds a new connection driver to the list of available drivers
212 //! and updates the QML interface.
214
215signals:
216 //! \brief Signal emitted when the driver list changes
217 //! \param list Updated list of drivers
218 //!
219 //! Notifies the QML interface that the list of available
220 //! connection drivers has changed.
221 void driversChanged(QVariantList list);
222
223 //! \brief Signal emitted when all drivers have finished loading
224 //!
225 //! Notifies the QML interface that all connection drivers have
226 //! finished loading and the UI can be updated accordingly.
228
229protected:
230 //! \brief List of available connection drivers
231 //!
232 //! Stores the current list of available connection drivers that
233 //! can be selected and configured by the user.
234 QList<DtVreSelectConnectionPageDriver*> myDrivers;
235
236 //! \brief Pointer to the player station application
237 //!
238 //! Provides access to application services and state. Not owned
239 //! by this class, simply a convenience pointer.
241};
242
243} // namespace makVre
Top-level class representing the VR-Engage application.
Definition playerStationApp.h:163
Abstract base class for all VREngage messages.
Definition vreMessage.h:50
DIS protocol connection driver for the connection selection UI.
Definition vreSelectConnectionPageDriverDIS.h:38
HLA protocol connection driver for the connection selection UI.
Definition vreSelectConnectionPageDriverHLA.h:32
Base class for connection drivers in the connection selection UI.
Definition vreSelectConnectionPageDriver.h:35
bool myIsNetworkConnected
Flag indicating network connection status.
Definition vreSelectConnectionPage.h:137
virtual void tick(double dt) override
Updates the page each frame.
virtual ~DtVreSelectConnectionPage() override
Destructor.
virtual DtVreMessageResult handleNetworkDisconnected(DtVreMessage *msg)
Handles network disconnection messages.
virtual void setVisibility(bool visible) override
Sets the visibility of the page.
virtual void initFooter() override
Initializes the footer area of the page.
DtVreSelectConnectionPage(DtPlayerStationApp &app, const std::string &target_window="")
Constructor.
void slot_aboutToAutoStartDrivers()
Slot called when drivers are about to auto-start.
virtual DtVreMessageResult handleNetworkConnected(DtVreMessage *msg)
Handles network connection messages.
virtual void initMain() override
Initializes the main content of the page.
virtual void appModeUpdated(const std::string &newAppMode, const std::string &oldAppMode) override
Handles application mode changes.
virtual void slot_connectionClicked() override
Handles connection button clicks.
QList< DtVreSelectConnectionPageDriver * > myDrivers
List of available connection drivers.
Definition vreSelectConnectionPage.h:234
virtual QVariantList getDrivers()
Gets the list of available connection drivers.
DtPlayerStationApp * myApp
Pointer to the player station application.
Definition vreSelectConnectionPage.h:240
QVariantList drivers
List of available connection drivers.
Definition vreSelectConnectionPage.h:154
virtual ~DtVreSelectConnectionPageQML() override
Destructor.
virtual DtVreMessageResult handleDISDriverMessage(DtVreMessage *msg)
Handles DIS connection information messages.
virtual Q_INVOKABLE void back()
Invokable method to navigate back.
void driversDoneLoading()
Signal emitted when all drivers have finished loading.
void driversChanged(QVariantList list)
Signal emitted when the driver list changes.
void addDriver(DtVreSelectConnectionPageDriver *driver)
Adds a connection driver to the list.
void setDrivers(QVariantList list)
Sets the list of connection drivers.
DtVreSelectConnectionPageQML(QObject *parent=nullptr)
Constructor.
virtual DtVreMessageResult handleHLADriverMessage(DtVreMessage *msg)
Handles HLA connection information messages.
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
Definition appLauncherComponent.h:28
Defines the base class for all VREngage messages.