VR-Engage  2.3
Loading...
Searching...
No Matches
vreLoadingPlayerPage.h
Go to the documentation of this file.
1/******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4******************************************************************************/
5
6//! \file vreLoadingPlayerPage.h
7//! \brief Defines the loading overlay shown during player station initialization
8//!
9//! This file contains the DtVreLoadingPlayerPage class which provides a simple
10//! loading screen between role selection and engaged gameplay. It displays
11//! a centered status text and spinner while the LOADING_PLAYER_STATE drives
12//! component initialization and readiness polling.
13
14#pragma once
15
18
19#include <QObject>
20
21class QQuickItem;
22
23namespace makVre
24{
26
27//! \brief Loading overlay shown during player station creation
28//!
29//! DtVreLoadingPlayerPage wraps loadingPlayerPage.qml and provides C++ methods
30//! for updating the status text and controlling fade animations. It follows
31//! the HeaderFooterBaseUI pattern: the header and footer remain visible to
32//! keep the app looking alive, while the content area shows a black background
33//! with a centered spinner and status message.
34//!
35//! DtLoadingPlayerState drives this page by calling setStatusText() at each
36//! phase transition. On completion, beginFadeOut() triggers a fade-to-black
37//! before the state transitions to ENGAGED_STATE.
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 DtVreLoadingPlayerPage(DtPlayerStationApp& app, const std::string& target_window = "");
47
48 //! \brief Virtual destructor
49 virtual ~DtVreLoadingPlayerPage() override;
50
51 //! \brief Updates the page each frame
52 //! \param dt Time in seconds since the last update
53 //!
54 //! Drives the petal spinner animation by accumulating wall-clock time
55 //! and advancing the active petal index at the interval configured in
56 //! QML. Handles frame stalls gracefully by stepping multiple petals
57 //! when dt exceeds the interval.
58 virtual void tick(double dt) override;
59
60 //! \brief Initializes the main UI elements after QML loads
61 virtual void initMain() override;
62
63 //! \brief Controls page visibility
64 //! \param visible True to show the page, false to hide it
65 //!
66 //! When showing the page, resets the fade state and triggers the
67 //! fade-in animation. When hiding, resets the fade overlay.
68 virtual void setVisibility(bool visible) override;
69
70 //! \brief Sets the status text shown on the loading screen
71 //! \param text The status message to display (e.g. "Creating components...")
72 virtual void setStatusText(const QString& text);
73
74 //! \brief Updates the header title bar with the current role and entity
75 //!
76 //! Reads the current attach entity and station name from the app and
77 //! formats them into the header title. Called automatically from
78 //! setVisibility(true) and can be called again when the role changes
79 //! (e.g., during an embarkation chain load).
80 virtual void updateHeaderTitle();
81
82 //! \brief Begins the fade-out-to-black animation
83 //!
84 //! Called by DtLoadingPlayerState when initialization is complete.
85 //! After the animation finishes the QML emits fadeOutFinished().
86 virtual void beginFadeOut();
87
88 //! \brief Checks whether the fade-out animation has completed
89 //! \return True if the fade-out is finished and the page is ready to hide
90 bool isFadeOutComplete() const;
91
92 //! \brief Checks whether the fade-in animation has completed
93 //! \return True if the fade-in is finished and the page is fully visible
94 bool isFadeInComplete() const;
95
96public slots:
97 //! \brief Called when the QML fade-out animation finishes
99
100 //! \brief Called when the QML fade-in animation finishes
102
103protected:
104 //! \brief Tracks whether the fade-out animation has completed
106
107 //! \brief Tracks whether the fade-in animation has completed
109
110 //! \brief Accumulated time for the petal spinner animation (seconds)
112
113 //! \brief Current active petal index (0-7), advanced every 500ms
115};
116} // 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.
void slot_fadeInFinished()
Called when the QML fade-in animation finishes.
double myAnimationAccumulator
Accumulated time for the petal spinner animation (seconds)
Definition vreLoadingPlayerPage.h:111
DtVreLoadingPlayerPage(DtPlayerStationApp &app, const std::string &target_window="")
Constructor.
int myActivePetal
Current active petal index (0-7), advanced every 500ms.
Definition vreLoadingPlayerPage.h:114
void slot_fadeOutFinished()
Called when the QML fade-out animation finishes.
bool myFadeInComplete
Tracks whether the fade-in animation has completed.
Definition vreLoadingPlayerPage.h:108
virtual ~DtVreLoadingPlayerPage() override
Virtual destructor.
virtual void setStatusText(const QString &text)
Sets the status text shown on the loading screen.
bool isFadeOutComplete() const
Checks whether the fade-out animation has completed.
virtual void setVisibility(bool visible) override
Controls page visibility.
bool myFadeOutComplete
Tracks whether the fade-out animation has completed.
Definition vreLoadingPlayerPage.h:105
virtual void updateHeaderTitle()
Updates the header title bar with the current role and entity.
virtual void tick(double dt) override
Updates the page each frame.
bool isFadeInComplete() const
Checks whether the fade-in animation has completed.
virtual void initMain() override
Initializes the main UI elements after QML loads.
virtual void beginFadeOut()
Begins the fade-out-to-black animation.
Defines export macros for the VR-Engage Player Station library.
#define PLAYERSTATION_DLL
Definition export.h:24
!
Definition glsVreMessageUtil.h:50
Defines the thin base class for VR-Engage QML page components.