VR-Engage  2.3
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 DtVreSelectConnectionPage(DtPlayerStationApp& app, const std::string& target_window = "");
61
62 //! \brief Destructor
63 virtual ~DtVreSelectConnectionPage() override;
64
65 //! \brief Initializes the main content of the page
66 virtual void initMain() override;
67
68 //! \brief Updates the page each frame
69 //! \param dt Time in seconds since the last update
70 virtual void tick(double dt) override;
71
72 //! \brief Handles network disconnection messages
73 //! \param msg Pointer to the network disconnected message
74 //! \return Message handling result
76
77 //! \brief Handles network connection messages
78 //! \param msg Pointer to the network connected message
79 //! \return Message handling result
81
82 //! \brief Sets the visibility of the page
83 //! \param visible True to show the page, false to hide it
84 virtual void setVisibility(bool visible) override;
85
86protected:
87 //! \brief When on connection page, clicking connection button navigates back
88 virtual void onConnectionClicked() override;
89
90 //! \brief Updates the page when the application mode changes
91 //! \param newAppMode Identifier of the new application mode
92 //! \param oldAppMode Identifier of the previous application mode
93 virtual void onAppModeChanged(const std::string& newAppMode, const std::string& oldAppMode) override;
94
95protected:
96 //! \brief Slot called when drivers are about to auto-start
97 //!
98 //! Called when the display engine signals that drivers are about to be
99 //! automatically started. This triggers requests for connection information
100 //! from the network thread to update the available connections.
102
103protected:
104 //! \brief Flag indicating network connection status
105 //!
106 //! True when the network is connected, false when disconnected.
107 //! Used to control UI elements based on connectivity state.
109};
110
111//! \brief QML interface for the connection selection page
112//!
113//! DtVreSelectConnectionPageQML provides the interface between the C++ backend
114//! and the QML frontend of the connection selection page. It manages the list
115//! of available connection drivers and handles communication between the UI
116//! and the underlying connection system.
118{
119 Q_OBJECT;
120
121 //! \brief List of available connection drivers
122 //!
123 //! QML property that exposes the list of available connection drivers
124 //! to the QML frontend. Can be accessed and modified from QML.
125 Q_PROPERTY(QVariantList drivers READ getDrivers WRITE setDrivers NOTIFY driversChanged);
126
127public:
128 //! \brief Constructor
129 //! \param parent Optional parent QObject for memory management
130 //!
131 //! Creates a new QML interface for the connection selection page.
132 //! Registers message handlers and requests connection information.
133 explicit DtVreSelectConnectionPageQML(QObject* parent = nullptr);
134
135 //! \brief Destructor
136 //!
137 //! Cleans up resources and unregisters message handlers.
139
140 //! \brief Gets the list of available connection drivers
141 //! \return List of connection drivers as QVariantList
142 //!
143 //! Returns the current list of available connection drivers (DIS, HLA)
144 //! for display in the QML interface. Each driver contains information
145 //! about the connection protocol and its configuration options.
146 virtual QVariantList getDrivers();
147
148 //! \brief Invokable method to navigate back
149 //!
150 //! QML-invokable method that handles back navigation requests from the UI.
151 //! This is typically connected to back buttons in the QML interface.
152 virtual Q_INVOKABLE void back();
153
154protected:
155 //! \brief Handles HLA connection information messages
156 //! \param msg Pointer to the HLA connection info message
157 //! \return Message handling result
158 //!
159 //! Processes messages containing information about available HLA
160 //! connections and updates the driver list accordingly.
162
163 //! \brief Handles DIS connection information messages
164 //! \param msg Pointer to the DIS connection info message
165 //! \return Message handling result
166 //!
167 //! Processes messages containing information about available DIS
168 //! connections and updates the driver list accordingly.
170
171public slots:
172 //! \brief Sets the list of connection drivers
173 //! \param list New list of connection drivers
174 //!
175 //! Updates the internal list of connection drivers and notifies
176 //! the QML interface of the change.
177 void setDrivers(QVariantList list);
178
179 //! \brief Adds a connection driver to the list
180 //! \param driver Pointer to the driver to add
181 //!
182 //! Adds a new connection driver to the list of available drivers
183 //! and updates the QML interface.
185
186signals:
187 //! \brief Signal emitted when the driver list changes
188 //! \param list Updated list of drivers
189 //!
190 //! Notifies the QML interface that the list of available
191 //! connection drivers has changed.
192 void driversChanged(QVariantList list);
193
194 //! \brief Signal emitted when all drivers have finished loading
195 //!
196 //! Notifies the QML interface that all connection drivers have
197 //! finished loading and the UI can be updated accordingly.
199
200protected:
201 //! \brief List of available connection drivers
202 //!
203 //! Stores the current list of available connection drivers that
204 //! can be selected and configured by the user.
205 QList<DtVreSelectConnectionPageDriver*> myDrivers;
206
207 //! \brief Pointer to the player station application
208 //!
209 //! Provides access to application services and state. Not owned
210 //! by this class, simply a convenience pointer.
212};
213
214} // namespace makVre
Top-level class representing the VR-Engage application.
Definition playerStationApp.h:155
DtVreBaseUI(DtPlayerStationApp &app, const std::string &file, const std::string &target_window="")
Constructor.
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
virtual void onConnectionClicked() override
When on connection page, clicking connection button navigates back.
bool myIsNetworkConnected
Flag indicating network connection status.
Definition vreSelectConnectionPage.h:108
virtual void tick(double dt) override
Updates the page each frame.
virtual ~DtVreSelectConnectionPage() override
Destructor.
virtual void onAppModeChanged(const std::string &newAppMode, const std::string &oldAppMode) override
Updates the page when the application mode changes.
virtual DtVreMessageResult handleNetworkDisconnected(DtVreMessage *msg)
Handles network disconnection messages.
virtual void setVisibility(bool visible) override
Sets the visibility 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.
QList< DtVreSelectConnectionPageDriver * > myDrivers
List of available connection drivers.
Definition vreSelectConnectionPage.h:205
virtual QVariantList getDrivers()
Gets the list of available connection drivers.
DtPlayerStationApp * myApp
Pointer to the player station application.
Definition vreSelectConnectionPage.h:211
QVariantList drivers
List of available connection drivers.
Definition vreSelectConnectionPage.h:125
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
!
Definition glsVreMessageUtil.h:50
DtVreMessageResult
Enumeration of possible message handling results.
Definition vreMessage.h:33
Definition appLauncherComponent.h:28
Defines the thin base class for VR-Engage QML page components.
Defines the base class for all VREngage messages.