VR-Engage  2.3
Loading...
Searching...
No Matches
playerStationTempNotification.h
Go to the documentation of this file.
1/******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4******************************************************************************/
5
6//! \file playerStationTempNotification.h
7//! \brief Defines a UI component for temporary notifications in VR-Engage
8//!
9//! This file contains the DtPlayerStationTempNotification class which provides
10//! a system for displaying temporary notifications to the user. These notifications
11//! appear for a specified duration before automatically disappearing, making them
12//! suitable for transient information or alerts.
13
14#pragma once
15
17
18#include <QObject>
19
20//! \brief Forward declaration of QQuickItem
21class QQuickItem;
22
23namespace makVre
24{
25//! \brief Forward declaration of the player station application class
27
28//! \brief Temporary notification UI component for VR-Engage
29//!
30//! DtPlayerStationTempNotification provides a UI component for displaying
31//! temporary notifications to the user. These notifications appear on screen
32//! for a specified duration before automatically disappearing. This is useful
33//! for providing feedback about events or state changes that don't require
34//! persistent notification.
36{
37 Q_OBJECT;
38
39public:
40 //! \brief Constructor
41 //! \param app Reference to the player station application
42 //! \param target_window Name of the target window to display in (empty for default)
43 //!
44 //! Creates a new temporary notification component associated with the
45 //! specified player station application and target window.
46 DtPlayerStationTempNotification(DtPlayerStationApp& app, const std::string& target_window = "");
47
48 //! \brief Virtual destructor
49 //!
50 //! Ensures proper cleanup of notification resources.
52
53 //! \brief Displays a new temporary notification
54 //! \param text Content of the notification to display
55 //! \param lifetime Duration in seconds that the notification should remain visible,
56 //! or a nonpositive value to keep it visible until replaced or closed
57 //!
58 //! Creates and displays a temporary notification with the specified text
59 //! that will automatically disappear after the specified lifetime (default 3 seconds).
60 //! A nonpositive lifetime keeps the notification visible until replaced or closed.
61 //! If a notification is already visible, it will be replaced by this new one.
62 virtual void newNotification(const QString& text, double lifetime = 3.0);
63
64 //! \brief Initializes the notification system
65 //!
66 //! Ensures that the notification system is properly initialized before use.
67 //! This sets up the QML components and prepares the system for displaying
68 //! notifications. Called automatically when needed but can be called explicitly
69 //! to prepare the system in advance.
70 virtual void init();
71
72protected:
73 //! \brief Sets the text content of the notification
74 //! \param str Text string to display in the notification
75 //!
76 //! Updates the text content of the notification. This is typically
77 //! called internally by newNotification().
78 virtual void setText(const QString& str);
79
80 //! \brief Sets the lifetime of the notification
81 //! \param time Duration in seconds that the notification should remain visible
82 //!
83 //! Sets how long the notification will remain visible before automatically
84 //! disappearing. This is typically called internally by newNotification().
85 virtual void setLifetime(double time);
86
87 //! \brief Closes the notification
88 //!
89 //! Hides the notification UI element, typically called when the
90 //! notification lifetime expires or when a new notification replaces it.
91 virtual void close();
92
93 //! \brief Opens the notification
94 //!
95 //! Shows the notification UI element with the current text content.
96 //! This is typically called after setting the text and lifetime.
97 virtual void open();
98
99protected:
100 //! \brief Current text content of the notification
101 QString myText;
102
103 //! \brief Current lifetime of the notification in seconds
105
106 //! \brief Reference to the player station application
108
109 //! \brief Target window name for displaying the notification
110 std::string myTargetWindow;
111
112 //! \brief Pointer to the root QML item for the notification UI
113 QQuickItem* myRoot;
114
115 //! \brief True when a notification must open after asynchronous QML loading.
117};
118} // namespace makVre
Top-level class representing the VR-Engage application.
Definition playerStationApp.h:155
QString myText
Current text content of the notification.
Definition playerStationTempNotification.h:101
QQuickItem * myRoot
Pointer to the root QML item for the notification UI.
Definition playerStationTempNotification.h:113
virtual void newNotification(const QString &text, double lifetime=3.0)
Displays a new temporary notification.
virtual void init()
Initializes the notification system.
virtual void setLifetime(double time)
Sets the lifetime of the notification.
double myLifetime
Current lifetime of the notification in seconds.
Definition playerStationTempNotification.h:104
virtual void open()
Opens the notification.
virtual void setText(const QString &str)
Sets the text content of the notification.
std::string myTargetWindow
Target window name for displaying the notification.
Definition playerStationTempNotification.h:110
DtPlayerStationTempNotification(DtPlayerStationApp &app, const std::string &target_window="")
Constructor.
bool myOpenWhenInitialized
True when a notification must open after asynchronous QML loading.
Definition playerStationTempNotification.h:116
virtual void close()
Closes the notification.
virtual ~DtPlayerStationTempNotification() override
Virtual destructor.
DtPlayerStationApp & myApp
Reference to the player station application.
Definition playerStationTempNotification.h:107
Defines export macros for the VR-Engage Player Station library.
#define PLAYERSTATION_DLL
Definition export.h:24
!
Definition glsVreMessageUtil.h:50