1 | /* $Id: UIWarningPane.h 98103 2023-01-17 14:15:46Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UIWarningPane class declaration.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2009-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_widgets_UIWarningPane_h
|
---|
29 | #define FEQT_INCLUDED_SRC_widgets_UIWarningPane_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | /* Qt includes: */
|
---|
35 | #include <QWidget>
|
---|
36 |
|
---|
37 | /* GUI includes: */
|
---|
38 | #include "UILibraryDefs.h"
|
---|
39 |
|
---|
40 | /* Forward declarations: */
|
---|
41 | class QHBoxLayout;
|
---|
42 | class QEvent;
|
---|
43 | class QLabel;
|
---|
44 | class QObject;
|
---|
45 | class QString;
|
---|
46 | class QTimer;
|
---|
47 | class QWidget;
|
---|
48 | class UIPageValidator;
|
---|
49 |
|
---|
50 | /** QWidget subclass used a settings dialog warning-pane. */
|
---|
51 | class SHARED_LIBRARY_STUFF UIWarningPane : public QWidget
|
---|
52 | {
|
---|
53 | Q_OBJECT;
|
---|
54 |
|
---|
55 | signals:
|
---|
56 |
|
---|
57 | /** Notifies about hover enter event.
|
---|
58 | * @param pValidator Brings the validator reference. */
|
---|
59 | void sigHoverEnter(UIPageValidator *pValidator);
|
---|
60 | /** Notifies about hover leave event.
|
---|
61 | * @param pValidator Brings the validator reference. */
|
---|
62 | void sigHoverLeave(UIPageValidator *pValidator);
|
---|
63 |
|
---|
64 | public:
|
---|
65 |
|
---|
66 | /** Constructs warning-pane passing @a pParent to the base-class. */
|
---|
67 | UIWarningPane(QWidget *pParent = 0);
|
---|
68 |
|
---|
69 | /** Defines current @a strWarningLabel text. */
|
---|
70 | void setWarningLabel(const QString &strWarningLabel);
|
---|
71 |
|
---|
72 | /** Registers corresponding @a pValidator. */
|
---|
73 | void registerValidator(UIPageValidator *pValidator);
|
---|
74 |
|
---|
75 | protected:
|
---|
76 |
|
---|
77 | /** Preprocesses Qt @a pEvent for passed @a pObject. */
|
---|
78 | virtual bool eventFilter(QObject *pObject, QEvent *pEvent) RT_OVERRIDE;
|
---|
79 |
|
---|
80 | private slots:
|
---|
81 |
|
---|
82 | /** Handles hover timer timeout. */
|
---|
83 | void sltHandleHoverTimer();
|
---|
84 |
|
---|
85 | private:
|
---|
86 |
|
---|
87 | /** Prepares all. */
|
---|
88 | void prepare();
|
---|
89 |
|
---|
90 | /** Holds the icon layout instance. */
|
---|
91 | QHBoxLayout *m_pIconLayout;
|
---|
92 | /** Holds the text label instance. */
|
---|
93 | QLabel *m_pTextLabel;
|
---|
94 |
|
---|
95 | /** Holds the page validators list. */
|
---|
96 | QList<UIPageValidator*> m_validators;
|
---|
97 | /** Holds the page icons list. */
|
---|
98 | QList<QLabel*> m_icons;
|
---|
99 | /** Holds the icons hovered-states list. */
|
---|
100 | QList<bool> m_hovered;
|
---|
101 |
|
---|
102 | /** Holds the hover timer instance. */
|
---|
103 | QTimer *m_pHoverTimer;
|
---|
104 | /** Holds the hovered icon-label position. */
|
---|
105 | int m_iHoveredIconLabelPosition;
|
---|
106 | };
|
---|
107 |
|
---|
108 | #endif /* !FEQT_INCLUDED_SRC_widgets_UIWarningPane_h */
|
---|