1 | /* $Id: UIWarningPane.h 76553 2019-01-01 01:45:53Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UIWarningPane class declaration.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2009-2019 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | #ifndef ___UIWarningPane_h___
|
---|
19 | #define ___UIWarningPane_h___
|
---|
20 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
21 | # pragma once
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | /* Qt includes: */
|
---|
25 | #include <QWidget>
|
---|
26 |
|
---|
27 | /* GUI includes: */
|
---|
28 | #include "UILibraryDefs.h"
|
---|
29 |
|
---|
30 | /* Forward declarations: */
|
---|
31 | class QHBoxLayout;
|
---|
32 | class QEvent;
|
---|
33 | class QLabel;
|
---|
34 | class QObject;
|
---|
35 | class QString;
|
---|
36 | class QTimer;
|
---|
37 | class QWidget;
|
---|
38 | class UIPageValidator;
|
---|
39 |
|
---|
40 | /** QWidget subclass used a settings dialog warning-pane. */
|
---|
41 | class SHARED_LIBRARY_STUFF UIWarningPane : public QWidget
|
---|
42 | {
|
---|
43 | Q_OBJECT;
|
---|
44 |
|
---|
45 | signals:
|
---|
46 |
|
---|
47 | /** Notifies about hover enter event.
|
---|
48 | * @param pValidator Brings the validator reference. */
|
---|
49 | void sigHoverEnter(UIPageValidator *pValidator);
|
---|
50 | /** Notifies about hover leave event.
|
---|
51 | * @param pValidator Brings the validator reference. */
|
---|
52 | void sigHoverLeave(UIPageValidator *pValidator);
|
---|
53 |
|
---|
54 | public:
|
---|
55 |
|
---|
56 | /** Constructs warning-pane passing @a pParent to the base-class. */
|
---|
57 | UIWarningPane(QWidget *pParent = 0);
|
---|
58 |
|
---|
59 | /** Defines current @a strWarningLabel text. */
|
---|
60 | void setWarningLabel(const QString &strWarningLabel);
|
---|
61 |
|
---|
62 | /** Registers corresponding @a pValidator. */
|
---|
63 | void registerValidator(UIPageValidator *pValidator);
|
---|
64 |
|
---|
65 | protected:
|
---|
66 |
|
---|
67 | /** Preprocesses Qt @a pEvent for passed @a pObject. */
|
---|
68 | virtual bool eventFilter(QObject *pObject, QEvent *pEvent) /* override */;
|
---|
69 |
|
---|
70 | private slots:
|
---|
71 |
|
---|
72 | /** Handles hover timer timeout. */
|
---|
73 | void sltHandleHoverTimer();
|
---|
74 |
|
---|
75 | private:
|
---|
76 |
|
---|
77 | /** Prepares all. */
|
---|
78 | void prepare();
|
---|
79 |
|
---|
80 | /** Holds the icon layout instance. */
|
---|
81 | QHBoxLayout *m_pIconLayout;
|
---|
82 | /** Holds the text label instance. */
|
---|
83 | QLabel *m_pTextLabel;
|
---|
84 |
|
---|
85 | /** Holds the page validators list. */
|
---|
86 | QList<UIPageValidator*> m_validators;
|
---|
87 | /** Holds the page icons list. */
|
---|
88 | QList<QLabel*> m_icons;
|
---|
89 | /** Holds the icons hovered-states list. */
|
---|
90 | QList<bool> m_hovered;
|
---|
91 |
|
---|
92 | /** Holds the hover timer instance. */
|
---|
93 | QTimer *m_pHoverTimer;
|
---|
94 | /** Holds the hovered icon-label position. */
|
---|
95 | int m_iHoveredIconLabelPosition;
|
---|
96 | };
|
---|
97 |
|
---|
98 | #endif /* !___UIWarningPane_h___ */
|
---|