VR-Engage  2.2
Loading...
Searching...
No Matches
vreLoadingPage.h
Go to the documentation of this file.
1/******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4******************************************************************************/
5
6//! \file vreLoadingPage.h
7//! \brief Defines the loading page UI component for VR-Engage
8//!
9//! This file contains the DtVreLoadingPage class which provides the UI component
10//! for displaying loading progress during resource-intensive operations.
11//! It presents a progress bar, status messages, and visual elements to inform
12//! the user about the current loading status and estimated completion time.
13
14#pragma once
15
18
19#include <QObject>
20
21class QQuickItem;
22class QTcpServer;
23class QTcpSocket;
24
25namespace makVre
26{
27//! \brief Forward declaration of the player station application class
29
30//! \brief UI component for displaying loading progress in VR-Engage
31//!
32//! DtVreLoadingPage provides a user interface for displaying loading progress
33//! during resource-intensive operations like terrain or scenario loading.
34//! It includes a progress bar, status text, and timer functionality to show
35//! both current progress and estimated time remaining. The page inherits from
36//! DtVreHeaderFooterUIBase to maintain consistent UI styling with the rest
37//! of the application.
39{
40 Q_OBJECT;
41
42public:
43 //! \brief Constructor
44 //! \param app Reference to the player station application
45 //! \param target_window Name of the window to display in (empty for default)
46 //!
47 //! Creates a new loading page UI component associated with the given application
48 //! and target window. The component starts hidden and must be shown explicitly.
49 DtVreLoadingPage(DtPlayerStationApp& app, const std::string& target_window = "");
50
51 //! \brief Virtual destructor
52 //!
53 //! Ensures proper cleanup of loading page resources.
54 virtual ~DtVreLoadingPage() override;
55
56 //! \brief Updates the loading page each frame
57 //! \param dt Time in seconds since the last update
58 //!
59 //! Called once per frame to update the loading page UI elements.
60 //! This may include progress bar animations, timer updates, and
61 //! any other time-dependent visual effects.
62 virtual void tick(double dt) override;
63
64 //! \brief Initializes the loading page UI
65 //!
66 //! Sets up the UI elements, connects signals and slots, and prepares
67 //! the loading page for display. This is called automatically during
68 //! construction but can be called again if the UI needs to be reset.
69 virtual void initMain() override;
70
71 //! \brief Sets the visibility of the loading page
72 //! \param visible True to show the page, false to hide it
73 //!
74 //! Controls whether the loading page is visible to the user.
75 //! This override ensures any updated information about the page
76 //! is properly handled when visibility changes.
77 virtual void setVisibility(bool visible) override;
78
79 //! \brief Sets the maximum expected loading time
80 //! \param ms Maximum loading time in milliseconds
81 //!
82 //! Sets the maximum time value for the progress bar, establishing the scale
83 //! against which elapsed time is measured. This affects the visual width
84 //! of the progress bar and any time remaining calculations.
85 virtual void setMaximumTime(int ms);
86
87 //! \brief Sets the current elapsed loading time
88 //! \param ms Current elapsed time in milliseconds
89 //!
90 //! Updates the elapsed time displayed on the loading page and the current
91 //! position of the progress bar. This should be a value between 0 and the
92 //! maximum time set with setMaximumTime().
93 virtual void setElapsedTime(int ms);
94
95 //! \brief Sets the progress bar percentage directly
96 //! \param percent Progress percentage (0-100)
97 //!
98 //! Updates the progress bar to display the specified percentage of completion.
99 //! This is an alternative to setElapsedTime() that allows setting the progress
100 //! directly as a percentage rather than calculating it from elapsed time.
101 virtual void setProgress(int percent = 100);
102
103 //! \brief Sets the text displayed on the loading bar
104 //! \param msg Text message to display
105 //!
106 //! Updates the status text displayed on or near the loading bar.
107 //! This is typically used to indicate the current operation being performed,
108 //! such as "Loading terrain..." or "Initializing entities...".
109 virtual void setLoadingBarText(const QString& msg);
110
111 //! \brief Resets the progress bar to initial state
112 //!
113 //! Resets the position of the progress bar and the elapsed time to zero.
114 //! This is typically called when starting a new loading operation or
115 //! when restarting the current one.
116 virtual void resetProgressBar();
117
118 //! \brief Gets the current elapsed loading time
119 //! \return Current elapsed time in milliseconds
120 //!
121 //! Returns the current elapsed time being displayed on the loading page.
122 //! This may be used to calculate progress percentages or time remaining.
123 virtual int getElapsedTime() const;
124
125 //! \brief Gets the random seed for loading screen imagery
126 //! \return Seed value for random image generation
127 //!
128 //! Returns the random seed value used for generating visual elements
129 //! on the loading screen. This allows for consistent visuals across
130 //! multiple instances or loading operations.
131 virtual int getImageSeed() const;
132
133 //! \brief Starts the loading timer
134 //!
135 //! Begins the timer that tracks elapsed loading time. This is typically
136 //! called when a loading operation begins to provide accurate timing.
137 virtual void startTimer();
138
139 //! \brief Restarts the loading timer
140 //!
141 //! Resets and restarts the timer that tracks elapsed loading time.
142 //! This is useful when a loading operation is restarted or when
143 //! switching between different loading phases.
144 virtual void restartTimer();
145
146 //! \brief Stops the loading timer
147 //!
148 //! Pauses the timer that tracks elapsed loading time. This is typically
149 //! called when a loading operation completes or is paused.
150 virtual void stopTimer();
151};
152} // namespace makVre
Top-level class representing the VR-Engage application.
Definition playerStationApp.h:163
virtual ~DtVreLoadingPage() override
Virtual destructor.
virtual void setProgress(int percent=100)
Sets the progress bar percentage directly.
virtual int getImageSeed() const
Gets the random seed for loading screen imagery.
virtual void setMaximumTime(int ms)
Sets the maximum expected loading time.
virtual void setVisibility(bool visible) override
Sets the visibility of the loading page.
virtual void setLoadingBarText(const QString &msg)
Sets the text displayed on the loading bar.
virtual void restartTimer()
Restarts the loading timer.
virtual int getElapsedTime() const
Gets the current elapsed loading time.
virtual void startTimer()
Starts the loading timer.
virtual void resetProgressBar()
Resets the progress bar to initial state.
virtual void setElapsedTime(int ms)
Sets the current elapsed loading time.
DtVreLoadingPage(DtPlayerStationApp &app, const std::string &target_window="")
Constructor.
virtual void tick(double dt) override
Updates the loading page each frame.
virtual void stopTimer()
Stops the loading timer.
virtual void initMain() override
Initializes the loading page UI.
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