1 | /** @file
|
---|
2 | *
|
---|
3 | * VBox frontends: Qt4 GUI ("VirtualBox"):
|
---|
4 | * UISettingsDialog class declaration
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2006-2011 Oracle Corporation
|
---|
9 | *
|
---|
10 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
11 | * available from http://www.virtualbox.org. This file is free software;
|
---|
12 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
13 | * General Public License (GPL) as published by the Free Software
|
---|
14 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
15 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
16 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | */
|
---|
18 |
|
---|
19 | #ifndef __UISettingsDialog_h__
|
---|
20 | #define __UISettingsDialog_h__
|
---|
21 |
|
---|
22 | /* VBox includes: */
|
---|
23 | #include "QIMainDialog.h"
|
---|
24 | #include "QIWithRetranslateUI.h"
|
---|
25 | #include "UISettingsDialog.gen.h"
|
---|
26 | #include "UISettingsDefs.h"
|
---|
27 |
|
---|
28 | /* Forward declarations: */
|
---|
29 | class QIWidgetValidator;
|
---|
30 | class QProgressBar;
|
---|
31 | class QStackedWidget;
|
---|
32 | class QTimer;
|
---|
33 | class VBoxWarningPane;
|
---|
34 | class VBoxSettingsSelector;
|
---|
35 | class UISettingsPage;
|
---|
36 |
|
---|
37 | /* Using declarations: */
|
---|
38 | using namespace UISettingsDefs;
|
---|
39 |
|
---|
40 | /* Base dialog class for both Global & VM settings which encapsulates most of their similar functionalities */
|
---|
41 | class UISettingsDialog : public QIWithRetranslateUI<QIMainDialog>, public Ui::UISettingsDialog
|
---|
42 | {
|
---|
43 | Q_OBJECT;
|
---|
44 |
|
---|
45 | public:
|
---|
46 |
|
---|
47 | /* Settings Dialog Constructor/Destructor: */
|
---|
48 | UISettingsDialog(QWidget *pParent);
|
---|
49 | ~UISettingsDialog();
|
---|
50 |
|
---|
51 | /* Execute API: */
|
---|
52 | void execute();
|
---|
53 |
|
---|
54 | protected slots:
|
---|
55 |
|
---|
56 | /* Validation handler: */
|
---|
57 | virtual void sltRevalidate(QIWidgetValidator *pValidator);
|
---|
58 |
|
---|
59 | /* Category-change slot: */
|
---|
60 | virtual void sltCategoryChanged(int cId);
|
---|
61 |
|
---|
62 | /* Mark dialog as loaded: */
|
---|
63 | virtual void sltMarkLoaded();
|
---|
64 | /* Mark dialog as saved: */
|
---|
65 | virtual void sltMarkSaved();
|
---|
66 |
|
---|
67 | /* Handlers for process bar: */
|
---|
68 | void sltHandleProcessStarted();
|
---|
69 | void sltHandlePageProcessed();
|
---|
70 |
|
---|
71 | protected:
|
---|
72 |
|
---|
73 | /* Save/load API: */
|
---|
74 | virtual void loadData();
|
---|
75 | virtual void saveData();
|
---|
76 |
|
---|
77 | /* UI translator: */
|
---|
78 | virtual void retranslateUi();
|
---|
79 |
|
---|
80 | /* Dialog type: */
|
---|
81 | SettingsDialogType dialogType() { return m_dialogType; }
|
---|
82 | void setDialogType(SettingsDialogType settingsDialogType);
|
---|
83 | /* Dialog title: */
|
---|
84 | virtual QString title() const = 0;
|
---|
85 | /* Dialog title extension: */
|
---|
86 | virtual QString titleExtension() const;
|
---|
87 |
|
---|
88 | /* Setters for error/warning: */
|
---|
89 | void setError(const QString &strError);
|
---|
90 | void setWarning(const QString &strWarning);
|
---|
91 |
|
---|
92 | /* Add settings page: */
|
---|
93 | void addItem(const QString &strBigIcon, const QString &strBigIconDisabled,
|
---|
94 | const QString &strSmallIcon, const QString &strSmallIconDisabled,
|
---|
95 | int cId, const QString &strLink,
|
---|
96 | UISettingsPage* pSettingsPage = 0, int iParentId = -1);
|
---|
97 |
|
---|
98 | /* Settings page correlator: */
|
---|
99 | virtual void recorrelate(UISettingsPage *pSettingsPage) { Q_UNUSED(pSettingsPage); }
|
---|
100 |
|
---|
101 | /* Protected variables: */
|
---|
102 | VBoxSettingsSelector *m_pSelector;
|
---|
103 | QStackedWidget *m_pStack;
|
---|
104 |
|
---|
105 | private slots:
|
---|
106 |
|
---|
107 | /* Slot to handle validity-changes: */
|
---|
108 | void sltHandleValidityChanged(const QIWidgetValidator *pValidator);
|
---|
109 |
|
---|
110 | /* Slot to update whats-this: */
|
---|
111 | void sltUpdateWhatsThis(bool fGotFocus = false);
|
---|
112 |
|
---|
113 | /* Slot to handle reject: */
|
---|
114 | void reject();
|
---|
115 |
|
---|
116 | private:
|
---|
117 |
|
---|
118 | /* Event-handlers: */
|
---|
119 | bool eventFilter(QObject *pObject, QEvent *pEvent);
|
---|
120 | void showEvent(QShowEvent *pEvent);
|
---|
121 |
|
---|
122 | void assignValidator(UISettingsPage *pPage);
|
---|
123 |
|
---|
124 | /* Global Flags: */
|
---|
125 | SettingsDialogType m_dialogType;
|
---|
126 | bool m_fPolished;
|
---|
127 |
|
---|
128 | /* Loading/saving stuff: */
|
---|
129 | bool m_fLoaded;
|
---|
130 | bool m_fSaved;
|
---|
131 |
|
---|
132 | /* Status bar widget: */
|
---|
133 | QStackedWidget *m_pStatusBar;
|
---|
134 |
|
---|
135 | /* Process bar widget: */
|
---|
136 | QProgressBar *m_pProcessBar;
|
---|
137 |
|
---|
138 | /* Error & Warning stuff: */
|
---|
139 | bool m_fValid;
|
---|
140 | bool m_fSilent;
|
---|
141 | QString m_strErrorHint;
|
---|
142 | QString m_strWarningHint;
|
---|
143 | QString m_strErrorString;
|
---|
144 | QString m_strWarningString;
|
---|
145 | QPixmap m_errorIcon;
|
---|
146 | QPixmap m_warningIcon;
|
---|
147 | VBoxWarningPane *m_pWarningPane;
|
---|
148 |
|
---|
149 | /* Whats-This stuff: */
|
---|
150 | QTimer *m_pWhatsThisTimer;
|
---|
151 | QPointer<QWidget> m_pWhatsThisCandidate;
|
---|
152 |
|
---|
153 | QMap<int, int> m_pages;
|
---|
154 | #ifdef Q_WS_MAC
|
---|
155 | QList<QSize> m_sizeList;
|
---|
156 | #endif /* Q_WS_MAC */
|
---|
157 | };
|
---|
158 |
|
---|
159 | #endif // __UISettingsDialog_h__
|
---|
160 |
|
---|