VR-Engage  2.2
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 //!
57 //! Creates and displays a temporary notification with the specified text
58 //! that will automatically disappear after the specified lifetime (default 3 seconds).
59 //! If a notification is already visible, it will be replaced by this new one.
60 virtual void newNotification(const QString& text, double lifetime = 3.0);
61
62 //! \brief Initializes the notification system
63 //!
64 //! Ensures that the notification system is properly initialized before use.
65 //! This sets up the QML components and prepares the system for displaying
66 //! notifications. Called automatically when needed but can be called explicitly
67 //! to prepare the system in advance.
68 virtual void init();
69
70protected:
71 //! \brief Sets the text content of the notification
72 //! \param str Text string to display in the notification
73 //!
74 //! Updates the text content of the notification. This is typically
75 //! called internally by newNotification().
76 virtual void setText(const QString& str);
77
78 //! \brief Sets the lifetime of the notification
79 //! \param time Duration in seconds that the notification should remain visible
80 //!
81 //! Sets how long the notification will remain visible before automatically
82 //! disappearing. This is typically called internally by newNotification().
83 virtual void setLifetime(double time);
84
85 //! \brief Closes the notification
86 //!
87 //! Hides the notification UI element, typically called when the
88 //! notification lifetime expires or when a new notification replaces it.
89 virtual void close();
90
91 //! \brief Opens the notification
92 //!
93 //! Shows the notification UI element with the current text content.
94 //! This is typically called after setting the text and lifetime.
95 virtual void open();
96
97protected:
98 //! \brief Current text content of the notification
99 QString myText;
100
101 //! \brief Current lifetime of the notification in seconds
103
104 //! \brief Reference to the player station application
106
107 //! \brief Target window name for displaying the notification
108 std::string myTargetWindow;
109
110 //! \brief Pointer to the root QML item for the notification UI
111 QQuickItem* myRoot;
112};
113} // namespace makVre
Top-level class representing the VR-Engage application.
Definition playerStationApp.h:163
QString myText
Current text content of the notification.
Definition playerStationTempNotification.h:99
QQuickItem * myRoot
Pointer to the root QML item for the notification UI.
Definition playerStationTempNotification.h:111
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:102
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:108
DtPlayerStationTempNotification(DtPlayerStationApp &app, const std::string &target_window="")
Constructor.
virtual void close()
Closes the notification.
virtual ~DtPlayerStationTempNotification() override
Virtual destructor.
DtPlayerStationApp & myApp
Reference to the player station application.
Definition playerStationTempNotification.h:105
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