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