VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/settings/UIAdvancedSettingsDialog.h

Last change on this file was 104363, checked in by vboxsync, 5 weeks ago

FE/Qt. Build fix.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 10.2 KB
Line 
1/* $Id: UIAdvancedSettingsDialog.h 104363 2024-04-18 17:10:19Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UIAdvancedSettingsDialog class declaration.
4 */
5
6/*
7 * Copyright (C) 2006-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_settings_UIAdvancedSettingsDialog_h
29#define FEQT_INCLUDED_SRC_settings_UIAdvancedSettingsDialog_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34/* Qt includes: */
35#include <QMainWindow>
36#include <QVariant>
37
38/* GUI includes: */
39#include "UISettingsDefs.h"
40
41/* Forward declarations: */
42class QGridLayout;
43class QProgressBar;
44class QShowEvent;
45class QStackedWidget;
46class QTimer;
47class QIDialogButtonBox;
48class UIFilterEditor;
49class UIModeCheckBox;
50class UISettingsPage;
51class UISettingsPageFrame;
52class UISettingsPageValidator;
53class UISettingsSelector;
54class UISettingsSerializer;
55class UISettingsWarningPane;
56class UIVerticalScrollArea;
57
58/* Using declarations: */
59using namespace UISettingsDefs;
60
61/** QMainWindow subclass used as
62 * base dialog class for both Global Preferences & Machine Settings
63 * dialogs, which encapsulates most of their common functionality. */
64class SHARED_LIBRARY_STUFF UIAdvancedSettingsDialog : public QMainWindow
65{
66 Q_OBJECT;
67
68signals:
69
70 /** Notifies listeners about dialog should be closed. */
71 void sigClose();
72
73public:
74
75 /** Dialog types. */
76 enum DialogType { Type_Global, Type_Machine };
77
78 /** Constructs settings dialog passing @a pParent to the base-class.
79 * @param strCategory Brings the name of category to be opened.
80 * @param strControl Brings the name of control to be focused. */
81 UIAdvancedSettingsDialog(QWidget *pParent,
82 const QString &strCategory,
83 const QString &strControl);
84 /** Destructs settings dialog. */
85 virtual ~UIAdvancedSettingsDialog() RT_OVERRIDE;
86
87 /** Loads the dialog data. */
88 virtual bool load() = 0;
89 /** Saves the dialog data. */
90 virtual void save() = 0;
91
92protected slots:
93
94 /** Hides the modal dialog and sets the result code to Accepted. */
95 virtual void accept();
96 /** Hides the modal dialog and sets the result code to Rejected. */
97 virtual void reject();
98
99 /** Handles category change to @a cId. */
100 virtual void sltCategoryChanged(int cId);
101 /** Repeats handling for category change to cached @a m_iPageId. */
102 virtual void sltCategoryChangedRepeat() { sltCategoryChanged(m_iPageId); }
103
104 /** Handles serializartion start. */
105 virtual void sltHandleSerializationStarted();
106 /** Handles serializartion progress change to @a iValue. */
107 virtual void sltHandleSerializationProgressChange(int iValue);
108 /** Handle serializartion finished. */
109 virtual void sltHandleSerializationFinished();
110
111protected slots:
112
113 /** Handles translation event. */
114 virtual void sltRetranslateUI();
115
116protected:
117
118 /** Preprocesses Qt @a pEvent for passed @a pObject. */
119 virtual bool eventFilter(QObject *pObject, QEvent *pEvent) RT_OVERRIDE;
120
121 /** Handles show @a pEvent. */
122 virtual void showEvent(QShowEvent *pEvent) RT_OVERRIDE;
123 /** Handles first show event. */
124 virtual void polishEvent();
125 /** Handles close @a pEvent. */
126 virtual void closeEvent(QCloseEvent *pEvent) RT_OVERRIDE;
127
128 /** Selects page and tab.
129 * @param fKeepPreviousByDefault Brings whether we should keep current page/tab by default. */
130 void choosePageAndTab(bool fKeepPreviousByDefault = false);
131
132 /** Loads the dialog @a data. */
133 void loadData(QVariant &data);
134 /** Saves the dialog @a data. */
135 void saveData(QVariant &data);
136
137 /** Returns configuration access level. */
138 ConfigurationAccessLevel configurationAccessLevel() const { return m_enmConfigurationAccessLevel; }
139 /** Defines configuration access level. */
140 void setConfigurationAccessLevel(ConfigurationAccessLevel enmConfigurationAccessLevel);
141
142 /** Returns the serialize process instance. */
143 UISettingsSerializer *serializeProcess() const { return m_pSerializeProcess; }
144 /** Returns whether the serialization is in progress. */
145 bool isSerializationInProgress() const { return m_fSerializationIsInProgress; }
146
147 /** Returns dialog optional flags. */
148 QMap<QString, QVariant> optionalFlags() const { return m_flags; }
149 /** Defines dialog optional @a flags. */
150 void setOptionalFlags(const QMap<QString, QVariant> &flags);
151
152 /** Returns the dialog title extension. */
153 virtual QString titleExtension() const = 0;
154 /** Returns the dialog title. */
155 virtual QString title() const = 0;
156
157 /** Adds an item (page).
158 * @param strBigIcon Brings the big icon.
159 * @param strMediumIcon Brings the medium icon.
160 * @param strSmallIcon Brings the small icon.
161 * @param cId Brings the page ID.
162 * @param strLink Brings the page link.
163 * @param pSettingsPage Brings the page reference.
164 * @param iParentId Brings the page parent ID. */
165 void addItem(const QString &strBigIcon, const QString &strMediumIcon, const QString &strSmallIcon,
166 int cId, const QString &strLink,
167 UISettingsPage* pSettingsPage = 0, int iParentId = -1);
168
169 /** Verifies data integrity between certain @a pSettingsPage and other pages. */
170 virtual void recorrelate(UISettingsPage *pSettingsPage) { Q_UNUSED(pSettingsPage); }
171
172 /** Inserts an item to the map m_pageHelpKeywords. */
173 void addPageHelpKeyword(int iPageType, const QString &strHelpKeyword);
174
175 /** Validates data correctness. */
176 void revalidate();
177
178 /** Returns whether settings were changed. */
179 bool isSettingsChanged();
180
181 /** Holds the name of category to be opened. */
182 QString m_strCategory;
183 /** Holds the name of control to be focused. */
184 QString m_strControl;
185
186 /** Holds the page selector instance. */
187 UISettingsSelector *m_pSelector;
188
189private slots:
190
191 /** Handles request to close dialog as QWidget, not QWindow.
192 * No need for QWindow destruction functionality.
193 * Parent will handle destruction itself. */
194 void sltClose();
195
196 /** Handles validity change for certain @a pValidator. */
197 void sltHandleValidityChange(UISettingsPageValidator *pValidator);
198
199 /** Handles hover enter for warning pane specified by @a pValidator. */
200 void sltHandleWarningPaneHovered(UISettingsPageValidator *pValidator);
201 /** Handles hover leave for warning pane specified by @a pValidator. */
202 void sltHandleWarningPaneUnhovered(UISettingsPageValidator *pValidator);
203
204 /** Handles experience mode checkbox change. */
205 void sltHandleExperienceModeCheckBoxChanged();
206 /** Handles experience mode change. */
207 void sltHandleExperienceModeChanged();
208
209 /** Applies filtering rules, which can be changed as
210 * a result of changes in experience mode and filter editor. */
211 void sltApplyFilteringRules();
212 /** Handles frame visivility changes. */
213 void sltHandleFrameVisibilityChange(bool fVisible);
214
215 /** Handles signal about vertical scroll-area wheel-event. */
216 void sltHandleVerticalScrollAreaWheelEvent();
217
218private:
219
220 /** @name Prepare/cleanup cascade.
221 * @{ */
222 /** Prepares all. */
223 void prepare();
224 /** Prepares selector. */
225 void prepareSelector();
226 /** Prepare scroll-area. */
227 void prepareScrollArea();
228 /** Prepare button-box. */
229 void prepareButtonBox();
230
231 /** Cleanups all. */
232 void cleanup();
233 /** @} */
234
235 /** Holds configuration access level. */
236 ConfigurationAccessLevel m_enmConfigurationAccessLevel;
237
238 /** Holds the serialize process instance. */
239 UISettingsSerializer *m_pSerializeProcess;
240
241 /** Holds whether dialog is polished. */
242 bool m_fPolished;
243 /** Holds whether the serialization is in progress. */
244 bool m_fSerializationIsInProgress;
245 /** Holds whether there were no serialization errors. */
246 bool m_fSerializationClean;
247 /** Holds whether the dialod had emitted signal to be closed. */
248 bool m_fClosed;
249
250 /** Holds the current page ID. */
251 int m_iPageId;
252
253 /** Holds the dialog optional flags. */
254 QMap<QString, QVariant> m_flags;
255
256 /** Holds the status-bar widget instance. */
257 QStackedWidget *m_pStatusBar;
258 /** Holds the process-bar widget instance. */
259 QProgressBar *m_pProcessBar;
260 /** Holds the warning-pane instance. */
261 UISettingsWarningPane *m_pWarningPane;
262
263 /** Holds whether settings dialog is valid (no errors, can be warnings). */
264 bool m_fValid;
265 /** Holds whether settings dialog is silent (no errors and no warnings). */
266 bool m_fSilent;
267
268 /** Holds the warning hint. */
269 QString m_strWarningHint;
270
271 /** Holds the map of settings page frames. */
272 QMap<int, UISettingsPageFrame*> m_frames;
273
274 /** Stores the help tag per page. */
275 QMap<int, QString> m_pageHelpKeywords;
276
277 /** Holds the 'sticky scrolling timer' instance. */
278 QTimer *m_pScrollingTimer;
279
280 /** @name Widgets
281 * @{ */
282 /** Holds the main layout instance. */
283 QGridLayout *m_pLayoutMain;
284
285 /** Holds the mode checkbox instance. */
286 UIModeCheckBox *m_pCheckBoxMode;
287
288 /** Holds the filter editor instance. */
289 UIFilterEditor *m_pEditorFilter;
290
291 /** Holds the scroll-area instance. */
292 UIVerticalScrollArea *m_pScrollArea;
293 /** Holds the scroll-viewport instance. */
294 QWidget *m_pScrollViewport;
295
296 /** Holds the button-box instance. */
297 QIDialogButtonBox *m_pButtonBox;
298 /** @} */
299};
300
301#endif /* !FEQT_INCLUDED_SRC_settings_UIAdvancedSettingsDialog_h */
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use