VR-Engage  2.3
Loading...
Searching...
No Matches
DtVirtualRealitySettingsLogic.h
Go to the documentation of this file.
1/*******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4*******************************************************************************/
5
6//! \file DtVirtualRealitySettingsLogic.h
7//! \brief Defines the business logic for the Virtual Reality settings GUI
8//!
9//! This file contains the DtVirtualRealitySettingsLogic class which implements
10//! the business logic for the Virtual Reality settings user interface. It acts as
11//! a mediator between the UI (DtVirtualRealitySettingsInterface) and the underlying
12//! VR system settings, handling data flow and state synchronization in both directions.
13
14#pragma once
15
17
18#include "vrvVirtualReality/DtVirtualRealitySettingsRecord.h"
19
20#include <vrvCoreQt/DtFileCacheInterface.h>
21#include <vrvUtil/DtSignalConnectionManager.h>
22
23namespace makVrv
24{
25class DtDe;
26class DtObserver;
28class DtPersistenceControlsInterface;
29class DtSettingsBackup;
30
31//! \brief Business logic for the Virtual Reality settings user interface
32//!
33//! This class implements the business logic for the Virtual Reality settings
34//! user interface. It serves as a mediator between the UI components and the
35//! underlying VR system settings. The class connects to UI signals to handle
36//! user inputs and updates the system settings accordingly. It also listens for
37//! changes in the VR system and updates the UI to reflect those changes, ensuring
38//! bidirectional synchronization.
40{
41private:
42 //! \brief Default constructor (private)
43 //!
44 //! This constructor is private to prevent creating the logic without the
45 //! required dependencies.
47
48 //! \brief Copy constructor (private)
49 //! \param other The object to copy from
50 //!
51 //! This constructor is private to prevent copying the logic object,
52 //! as it maintains connections and state that shouldn't be duplicated.
54
55 //! \brief Assignment operator (private)
56 //! \param other The object to assign from
57 //! \return Reference to this object
58 //!
59 //! This operator is private to prevent assigning the logic object,
60 //! as it maintains connections and state that shouldn't be duplicated.
62
63public:
64 //! \brief Constructor
65 //! \param de Reference to the display engine
66 //! \param gui Reference to the VR settings GUI interface
67 //! \param persistenceGui Reference to the persistence controls interface
68 //!
69 //! Initializes the logic with references to the display engine, settings GUI, and
70 //! persistence controls. It establishes connections between the GUI signals and
71 //! the corresponding logic slots, as well as connections from the VR settings
72 //! to update the GUI when settings change from other sources.
74 DtDe& de, DtVirtualRealitySettingsInterface& gui, DtPersistenceControlsInterface& persistenceGui);
75
76 //! \brief Virtual destructor
77 //!
78 //! Cleans up resources and disconnects signal connections established
79 //! during the lifetime of this object.
81
82 //! \brief Updates the GUI to reflect the current VR settings
83 //!
84 //! Retrieves the current settings from the VR system and updates
85 //! all GUI controls to match those settings. This method is called
86 //! during initialization and whenever the settings are changed
87 //! from outside the GUI.
88 virtual void sendSettingsToGui();
89
90protected:
91 //! \name UI Change Handler Methods
92 //! @{
93
94 //! \brief Handles changes to the VR enabled state from the UI
95 //!
96 //! This slot is called when the user toggles the VR enabled checkbox in the UI.
97 //! It updates the VR system settings to match the new state selected by the user.
98 //!
99 //! \param enabled New enabled state (true if enabled, false if disabled)
100 virtual void slot_enabledChanged(bool enabled);
101
102 //! \brief Handles changes to the mirroring mode from the UI
103 //! \param view New mirroring mode selected by the user
104 //!
105 //! This slot is called when the user selects a different mirroring mode
106 //! from the dropdown in the UI. It updates the VR system settings to use
107 //! the new mirroring mode.
108 virtual void slot_mirroringChanged(makArchives::DtVirtualRealitySettingsRecord::DtMirroring view);
109
110 //! \brief Handles changes to the mirror channel from the UI
111 //! \param channelName Name of the channel selected by the user
112 //!
113 //! This slot is called when the user selects a different mirror channel
114 //! from the dropdown in the UI. It updates the VR system settings to use
115 //! the new mirror channel.
116 virtual void slot_mirrorChannelChanged(std::string channelName);
117
118 //! \brief Handles changes to the attached observer from the UI
119 //! \param observer Name of the observer selected by the user
120 //!
121 //! This slot is called when the user selects a different observer
122 //! from the dropdown in the UI. It updates the VR system settings to
123 //! attach the HMD view to the selected observer.
124 virtual void slot_attachedObserverChanged(std::string observer);
125
126 //! \brief Handles changes to the flip overlays setting from the UI
127 //! \param flip New flip overlays state (true if enabled, false if disabled)
128 //!
129 //! This slot is called when the user toggles the flip overlays checkbox
130 //! in the UI. It updates the VR system settings to apply or remove
131 //! the vertical flip to overlays as requested.
132 virtual void slot_flipOverlaysChanged(bool flip);
133 //@ }
134
135 //! \name Settings Change Handler Methods
136 //! @{
137 //! \brief this function is called when the settings manager changes whether or not VR is enabled so the gui can be
138 //! updated
139 virtual void slot_enabledUpdated(bool enabled);
140
141 //! \brief this function is called when the settings manager changes the mirror setting so the gui can be updated
142 virtual void slot_mirroringUpdated(makArchives::DtVirtualRealitySettingsRecord::DtMirroring view);
143
144 //! \brief this function is called when the settings manager changes the mirror channel so the gui can be updated
145 virtual void slot_mirrorChannelUpdated(std::string enabled);
146
147 //! \brief this function is called when the settings manager changes the available channels so the gui can be updated
148 virtual void slot_channelsUpdated();
149
150 //! \brief this function is called when the settings manager changes the available observers so the gui can be
151 //! updated
152 virtual void slot_observersUpdated();
153
154 //! \brief this function is called when an observer is removed and needs to be taken out of GUI list
155 virtual void slot_observerRemoved(const DtObserver* obs);
156
157 //! \brief this function is called with the settings manager changes the attached observer so the gui can be updated
158 virtual void slot_attachedObserverUpdated(std::string observerName);
159
160 //! \brief this function is called when the settings manager changes the flip overlays setting so the gui can be
161 //! updated
162 virtual void slot_flipOverlaysUpdated(bool flip);
163 //@ }
164
165 //! \name Persistence slots
166 //@ {
167 //! \brief this function is called when the import settings button is pressed
168 void on_import();
169
170 //! \brief this function is called when the export settings button is pressed
171 void on_export();
172
173 //! \brief this function is called when the import file path chosen button is pressed
174 void on_importFilePathChosen(const std::string& filePath);
175
176 //! \brief this function is called when the export path chosen button is pressed
177 void on_exportFilePathChosen(const std::string& filePath);
178 //@ }
179
180 //! \brief Called when settings are restored. Resets GUI if the restored
181 //! object type is of this class
182 virtual void settingsRestored(const DtSettingsBackup*);
183
184protected:
185 DtDe& myDe;
187 DtPersistenceControlsInterface& myPersistenceControls;
188 DtSignalConnectionManager myConnections;
189};
190} // namespace makVrv
Interface for virtual reality settings GUI interaction.
Definition DtVirtualRealitySettingsInterface.h:36
virtual void slot_observerRemoved(const DtObserver *obs)
this function is called when an observer is removed and needs to be taken out of GUI list
DtVirtualRealitySettingsLogic()
Default constructor (private)
virtual void slot_enabledChanged(bool enabled)
Handles changes to the VR enabled state from the UI.
DtVirtualRealitySettingsLogic & operator=(const DtVirtualRealitySettingsLogic &other)
Assignment operator (private)
virtual void slot_mirroringUpdated(makArchives::DtVirtualRealitySettingsRecord::DtMirroring view)
this function is called when the settings manager changes the mirror setting so the gui can be update...
virtual void slot_enabledUpdated(bool enabled)
this function is called when the settings manager changes the mirror setting so the gui can be update...
void on_import()
this function is called when the import settings button is pressed
virtual void slot_attachedObserverChanged(std::string observer)
Handles changes to the attached observer from the UI.
virtual void slot_flipOverlaysChanged(bool flip)
Handles changes to the flip overlays setting from the UI.
DtVirtualRealitySettingsLogic(DtDe &de, DtVirtualRealitySettingsInterface &gui, DtPersistenceControlsInterface &persistenceGui)
Constructor.
void on_importFilePathChosen(const std::string &filePath)
this function is called when the import file path chosen button is pressed
virtual void slot_attachedObserverUpdated(std::string observerName)
this function is called with the settings manager changes the attached observer so the gui can be upd...
DtVirtualRealitySettingsInterface & myInterface
this function is called when the import settings button is pressed
Definition DtVirtualRealitySettingsLogic.h:186
virtual void slot_mirrorChannelChanged(std::string channelName)
Handles changes to the mirror channel from the UI.
DtDe & myDe
this function is called when the import settings button is pressed
Definition DtVirtualRealitySettingsLogic.h:185
DtSignalConnectionManager myConnections
this function is called when the import settings button is pressed
Definition DtVirtualRealitySettingsLogic.h:188
DtVirtualRealitySettingsLogic(const DtVirtualRealitySettingsLogic &other)
Copy constructor (private)
virtual void sendSettingsToGui()
Updates the GUI to reflect the current VR settings.
DtPersistenceControlsInterface & myPersistenceControls
this function is called when the import settings button is pressed
Definition DtVirtualRealitySettingsLogic.h:187
virtual void slot_mirroringChanged(makArchives::DtVirtualRealitySettingsRecord::DtMirroring view)
Handles changes to the mirroring mode from the UI.
virtual void slot_observersUpdated()
this function is called when the settings manager changes the available observers so the gui can be u...
virtual void slot_channelsUpdated()
this function is called when the settings manager changes the available channels so the gui can be up...
virtual void slot_flipOverlaysUpdated(bool flip)
this function is called when the settings manager changes the flip overlays setting so the gui can be...
virtual void settingsRestored(const DtSettingsBackup *)
Called when settings are restored. Resets GUI if the restored object type is of this class.
virtual ~DtVirtualRealitySettingsLogic()
Virtual destructor.
void on_export()
this function is called when the export settings button is pressed
void on_exportFilePathChosen(const std::string &filePath)
this function is called when the export path chosen button is pressed
virtual void slot_mirrorChannelUpdated(std::string enabled)
this function is called when the settings manager changes the mirror channel so the gui can be update...
Definition appLauncherComponent.h:28
makVrv::DtDe * de()
Gets the display element pointer used by the plugin.
Main header file for the VRV Virtual Reality Qt module.