VirtualBox

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

Last change on this file was 105780, checked in by vboxsync, 3 weeks ago

FE/Qt: Advanced Settings Dialog: Adjust title NLS for Preferences and VM Settings dialogs.

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