VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjectItem.h@ 103977

Last change on this file since 103977 was 103704, checked in by vboxsync, 9 months ago

FE/Qt: Get rid of few iprt includes around whole the GUI.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.5 KB
Line 
1/* $Id: UINotificationObjectItem.h 103704 2024-03-06 15:15:36Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UINotificationObjectItem class declaration.
4 */
5
6/*
7 * Copyright (C) 2021-2023 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * SPDX-License-Identifier: GPL-3.0-only
26 */
27
28#ifndef FEQT_INCLUDED_SRC_notificationcenter_UINotificationObjectItem_h
29#define FEQT_INCLUDED_SRC_notificationcenter_UINotificationObjectItem_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34/* Qt includes: */
35#include <QWidget>
36
37/* VBox includes: */
38#include <iprt/cdefs.h> // for RT_OVERRIDE stuff
39
40/* Forward declarations: */
41class QHBoxLayout;
42class QLabel;
43class QProgressBar;
44class QVBoxLayout;
45class QIRichTextLabel;
46class QIToolButton;
47class UINotificationObject;
48class UINotificationProgress;
49#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
50class UINotificationDownloader;
51#endif
52
53/** QWidget-based notification-object item. */
54class UINotificationObjectItem : public QWidget
55{
56 Q_OBJECT;
57
58public:
59
60 /** Constructs notification-object item, passing @a pParent to the base-class.
61 * @param pObject Brings the notification-object this item created for. */
62 UINotificationObjectItem(QWidget *pParent, UINotificationObject *pObject = 0);
63
64protected:
65
66 /** Handles any Qt @a pEvent. */
67 virtual bool event(QEvent *pEvent) RT_OVERRIDE;
68
69 /** Handles paint @a pEvent. */
70 virtual void paintEvent(QPaintEvent *pEvent) RT_OVERRIDE;
71
72 /** Holds the notification-object this item created for. */
73 UINotificationObject *m_pObject;
74
75 /** Holds the main layout instance. */
76 QVBoxLayout *m_pLayoutMain;
77 /** Holds the upper layout instance. */
78 QHBoxLayout *m_pLayoutUpper;
79 /** Holds the name label instance. */
80 QLabel *m_pLabelName;
81 /** Holds the help button instance. */
82 QIToolButton *m_pButtonHelp;
83 /** Holds the forget button instance. */
84 QIToolButton *m_pButtonForget;
85 /** Holds the close button instance. */
86 QIToolButton *m_pButtonClose;
87 /** Holds the details label instance. */
88 QIRichTextLabel *m_pLabelDetails;
89
90 /** Holds whether item is hovered. */
91 bool m_fHovered;
92 /** Holds whether item is toggled. */
93 bool m_fToggled;
94
95private slots:
96
97 /** Handles help request. */
98 void sltHandleHelpRequest();
99};
100
101/** UINotificationObjectItem extension for notification-progress. */
102class UINotificationProgressItem : public UINotificationObjectItem
103{
104 Q_OBJECT;
105
106public:
107
108 /** Constructs notification-progress item, passing @a pParent to the base-class.
109 * @param pProgress Brings the notification-progress this item created for. */
110 UINotificationProgressItem(QWidget *pParent, UINotificationProgress *pProgress = 0);
111
112private slots:
113
114 /** Handles signal about progress started. */
115 void sltHandleProgressStarted();
116 /** Handles signal about progress changed.
117 * @param uPercent Brings new progress percentage value. */
118 void sltHandleProgressChange(ulong uPercent);
119 /** Handles signal about progress finished. */
120 void sltHandleProgressFinished();
121
122private:
123
124 /** Holds the notification-progress this item created for. */
125 UINotificationProgress *progress() const;
126
127 /** Updates details. */
128 void updateDetails();
129
130 /** Holds the progress-bar instance. */
131 QProgressBar *m_pProgressBar;
132};
133
134#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
135/** UINotificationObjectItem extension for notification-downloader. */
136class UINotificationDownloaderItem : public UINotificationObjectItem
137{
138 Q_OBJECT;
139
140public:
141
142 /** Constructs notification-downloader item, passing @a pParent to the base-class.
143 * @param pDownloader Brings the notification-downloader this item created for. */
144 UINotificationDownloaderItem(QWidget *pParent, UINotificationDownloader *pDownloader = 0);
145
146private slots:
147
148 /** Handles signal about progress started. */
149 void sltHandleProgressStarted();
150 /** Handles signal about progress changed.
151 * @param uPercent Brings new progress percentage value. */
152 void sltHandleProgressChange(ulong uPercent);
153 /** Handles signal about progress finished. */
154 void sltHandleProgressFinished();
155
156private:
157
158 /** Holds the notification-downloader this item created for. */
159 UINotificationDownloader *downloader() const;
160
161 /** Updates details. */
162 void updateDetails();
163
164 /** Holds the progress-bar instance. */
165 QProgressBar *m_pProgressBar;
166};
167#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
168
169/** Notification-object factory. */
170namespace UINotificationItem
171{
172 /** Creates notification-object of required type.
173 * @param pParent Brings the parent constructed item being attached to.
174 * @param pObject Brings the notification-object item being constructed for. */
175 UINotificationObjectItem *create(QWidget *pParent, UINotificationObject *pObject);
176}
177
178#endif /* !FEQT_INCLUDED_SRC_notificationcenter_UINotificationObjectItem_h */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette