VR-Engage  2.2
Loading...
Searching...
No Matches
vreSelectConnectionPageDriver.h
Go to the documentation of this file.
1/*******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4*******************************************************************************/
5
6//! \file vreSelectConnectionPageDriver.h
7//! \brief Defines the base class for connection drivers in VR-Engage
8//!
9//! This file contains the DtVreSelectConnectionPageDriver class which serves as
10//! the base class for specific connection protocol drivers (DIS, HLA) in the
11//! VR-Engage connection system. It provides common properties and functionality
12//! for connection drivers, including name, type, auto-connect, and active state.
13
14#pragma once
15
17
19
20#include <QObject>
21
22class QQuickItem;
23
24namespace makVre
25{
26//! \brief Base class for connection drivers in the connection selection UI
27//!
28//! DtVreSelectConnectionPageDriver serves as the abstract base class for specific
29//! connection protocol drivers (such as DIS or HLA) in the VR-Engage connection system.
30//! It provides common properties like driver name, type, auto-connect state, and active
31//! connection state that are shared across all driver implementations. This class
32//! exposes these properties to QML for the connection selection UI, and handles
33//! updates to the backend connection system when the properties change.
35{
36 Q_OBJECT;
37
38 //! \brief Name of the connection driver
39 //!
40 //! QML property for the display name of this connection driver.
41 //! This is typically used in the UI to identify the driver to the user.
42 Q_PROPERTY(QString driverName READ getDriverName WRITE setDriverName NOTIFY driverNameChanged);
43
44 //! \brief Type of the connection driver
45 //!
46 //! QML property for the type of this connection driver (e.g., "DIS" or "HLA").
47 //! This identifies the protocol used by this driver.
48 Q_PROPERTY(QString driverType READ getDriverType WRITE setDriverType NOTIFY driverTypeChanged);
49
50 //! \brief Auto-connect state of the driver
51 //!
52 //! QML property indicating whether this driver should automatically
53 //! connect on application startup.
54 Q_PROPERTY(bool autoConnect READ isAutoConnect WRITE setAutoConnect NOTIFY autoConnectChanged);
55
56 //! \brief Active connection state
57 //!
58 //! QML property indicating whether this driver is currently the
59 //! active connection for the application.
61
62public:
63 //! \brief Constructor
64 //! \param parent Optional parent QObject for memory management
65 //!
66 //! Creates a new connection driver with default property values.
67 //! Sets initial state with empty names and false flags.
68 explicit DtVreSelectConnectionPageDriver(QObject* parent = nullptr);
69
70 //! \brief Destructor
71 //!
72 //! Cleans up resources used by the connection driver.
74
75 //! \brief Gets the name of the driver
76 //! \return Name of the driver as a QString
77 //!
78 //! Returns the display name of this connection driver.
79 QString getDriverName() const;
80
81 //! \brief Gets the type of the driver
82 //! \return Type of the driver as a QString
83 //!
84 //! Returns the type identifier of this connection driver (e.g., "DIS" or "HLA").
85 QString getDriverType() const;
86
87 //! \brief Checks if the driver should auto-connect
88 //! \return True if the driver should auto-connect, false otherwise
89 //!
90 //! Determines whether this driver should automatically connect
91 //! when the application starts up.
92 bool isAutoConnect() const;
93
94 //! \brief Checks if the driver is the active connection
95 //! \return True if the driver is the active connection, false otherwise
96 //!
97 //! Determines whether this driver is currently the active
98 //! connection for the application.
99 bool isActiveConnection() const;
100
101 //! \brief Sets driver data from a message
102 //! \param msg Pointer to the message containing driver data
103 //!
104 //! Pure virtual method that must be implemented by derived classes to
105 //! parse and apply data from a message. This allows different driver types
106 //! to handle their specific configuration data differently.
107 virtual void setData(makVre::DtVreMessage* msg) = 0;
108
109 //! \brief Saves the current driver configuration
110 //!
111 //! QML-invokable method that saves the current driver configuration.
112 //! Each driver type can implement this differently to handle its specific
113 //! configuration data. The base implementation does nothing and is
114 //! intended to be overridden by derived classes.
115 virtual Q_INVOKABLE void save() {}; // Set this as empty so we can invoke this in our set AutoConnect
116
117public slots:
118 //! \brief Sets the name of the driver
119 //! \param name New name for the driver
120 //!
121 //! Updates the driver name and emits the driverNameChanged signal.
122 virtual void setDriverName(const QString& name);
123
124 //! \brief Sets the type of the driver
125 //! \param type New type for the driver
126 //!
127 //! Updates the driver type and emits the driverTypeChanged signal.
128 virtual void setDriverType(const QString& type);
129
130 //! \brief Sets the auto-connect state of the driver
131 //! \param autoConnect New auto-connect state
132 //!
133 //! Updates the auto-connect state, emits the autoConnectChanged signal,
134 //! calls save(), and sends an update message to the network thread to
135 //! persist the change. If the value hasn't changed, this is a no-op.
136 virtual void setAutoConnect(const bool autoConnect);
137
138 //! \brief Sets the active connection state of the driver
139 //! \param activeConnection New active connection state
140 //!
141 //! Updates the active connection state, emits the activeConnectionChanged signal,
142 //! calls save(), and sends an update message to the network thread to make this
143 //! driver the active connection. If the value hasn't changed, this is a no-op.
144 virtual void setActiveConnection(const bool activeConnection);
145
146signals:
147 //! \brief Signal emitted when the driver name changes
148 //! \param name New driver name
149 //!
150 //! Notifies the QML interface that the driver name has changed.
151 void driverNameChanged(QString name);
152
153 //! \brief Signal emitted when the driver type changes
154 //! \param type New driver type
155 //!
156 //! Notifies the QML interface that the driver type has changed.
157 void driverTypeChanged(QString type);
158
159 //! \brief Signal emitted when the auto-connect state changes
160 //! \param autoConnect New auto-connect state
161 //!
162 //! Notifies the QML interface that the auto-connect state has changed.
164
165 //! \brief Signal emitted when the active connection state changes
166 //! \param activeConnection New active connection state
167 //!
168 //! Notifies the QML interface that the active connection state has changed.
170
171protected:
172 //! \brief Name of the connection driver
173 //!
174 //! Stores the display name of this connection driver for UI presentation.
176
177 //! \brief Type of the connection driver
178 //!
179 //! Stores the type of this connection driver (e.g., "DIS" or "HLA").
181
182 //! \brief Auto-connect state flag
183 //!
184 //! When true, indicates that this driver should automatically connect
185 //! when the application starts up.
187
188 //! \brief Active connection state flag
189 //!
190 //! When true, indicates that this driver is currently the active
191 //! connection for the application.
193};
194
195} // namespace makVre
Abstract base class for all VREngage messages.
Definition vreMessage.h:50
virtual void setActiveConnection(const bool activeConnection)
Sets the active connection state of the driver.
bool isAutoConnect() const
Checks if the driver should auto-connect.
virtual ~DtVreSelectConnectionPageDriver() override
Destructor.
void activeConnectionChanged(bool activeConnection)
Signal emitted when the active connection state changes.
bool isActiveConnection() const
Checks if the driver is the active connection.
void autoConnectChanged(bool autoConnect)
Signal emitted when the auto-connect state changes.
bool autoConnect
Auto-connect state of the driver.
Definition vreSelectConnectionPageDriver.h:54
QString getDriverName() const
Gets the name of the driver.
bool activeConnection
Active connection state.
Definition vreSelectConnectionPageDriver.h:60
bool myAutoConnect
Auto-connect state flag.
Definition vreSelectConnectionPageDriver.h:186
virtual Q_INVOKABLE void save()
Saves the current driver configuration.
Definition vreSelectConnectionPageDriver.h:115
virtual void setAutoConnect(const bool autoConnect)
Sets the auto-connect state of the driver.
QString driverName
Name of the connection driver.
Definition vreSelectConnectionPageDriver.h:42
QString driverType
Type of the connection driver.
Definition vreSelectConnectionPageDriver.h:48
QString getDriverType() const
Gets the type of the driver.
QString myDriverName
Name of the connection driver.
Definition vreSelectConnectionPageDriver.h:175
virtual void setData(makVre::DtVreMessage *msg)=0
Sets driver data from a message.
bool myActiveConnection
Active connection state flag.
Definition vreSelectConnectionPageDriver.h:192
virtual void setDriverType(const QString &type)
Sets the type of the driver.
void driverTypeChanged(QString type)
Signal emitted when the driver type changes.
DtVreSelectConnectionPageDriver(QObject *parent=nullptr)
Constructor.
virtual void setDriverName(const QString &name)
Sets the name of the driver.
QString myDriverType
Type of the connection driver.
Definition vreSelectConnectionPageDriver.h:180
void driverNameChanged(QString name)
Signal emitted when the driver name changes.
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
Defines the base class for all VREngage messages.