VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h@ 51215

Last change on this file since 51215 was 51215, checked in by vboxsync, 11 years ago

FE/Qt: 6660: Advanced extra-data management framework: Move WizardMode enum and linked stuff into corresponding places.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 11.1 KB
Line 
1/** @file
2 * VBox Qt GUI - UIExtraDataManager class declaration.
3 */
4
5/*
6 * Copyright (C) 2010-2014 Oracle Corporation
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15 */
16
17#ifndef ___UIExtraDataManager_h___
18#define ___UIExtraDataManager_h___
19
20/* Qt includes: */
21#include <QObject>
22#include <QMap>
23
24/* GUI includes: */
25#include "UIExtraDataDefs.h"
26
27/* COM includes: */
28#include "CEventListener.h"
29
30/* Forward declarations: */
31class UIExtraDataEventHandler;
32
33/* Type definitions: */
34typedef QMap<QString, QString> ExtraDataMap;
35
36/** Singleton QObject extension
37 * providing GUI with corresponding extra-data values,
38 * and notifying it whenever any of those values changed. */
39class UIExtraDataManager : public QObject
40{
41 Q_OBJECT;
42
43 /** Extra-data Manager constructor. */
44 UIExtraDataManager();
45 /** Extra-data Manager destructor. */
46 ~UIExtraDataManager();
47
48signals:
49
50 /** Notifies about GUI language change. */
51 void sigLanguageChange(QString strLanguage);
52
53 /** Notifies about Selector UI keyboard shortcut change. */
54 void sigSelectorUIShortcutChange();
55 /** Notifies about Runtime UI keyboard shortcut change. */
56 void sigRuntimeUIShortcutChange();
57
58 /** Notifies about HID LED sync state change. */
59 void sigHIDLedsSyncStateChange(bool fEnabled);
60
61#ifdef RT_OS_DARWIN
62 /** Mac OS X: Notifies about 'presentation mode' status change. */
63 void sigPresentationModeChange(bool fEnabled);
64 /** Mac OS X: Notifies about 'dock icon' appearance change. */
65 void sigDockIconAppearanceChange(bool fEnabled);
66#endif /* RT_OS_DARWIN */
67
68public:
69
70 /** Static Extra-data Manager instance/constructor. */
71 static UIExtraDataManager* instance();
72 /** Static Extra-data Manager destructor. */
73 static void destroy();
74
75 /** Returns version for which user wants to prevent BETA warning. */
76 QString preventBETAwarningForVersion() const;
77
78 /** Returns recent hard-drive folder. */
79 QString recentFolderForHardDrives() const;
80 /** Returns recent optical-disk folder. */
81 QString recentFolderForOpticalDisks() const;
82 /** Returns recent floppy-disk folder. */
83 QString recentFolderForFloppyDisks() const;
84 /** Defines recent hard-drive folder as @a strValue. */
85 void setRecentFolderForHardDrives(const QString &strValue);
86 /** Defines recent optical-disk folder as @a strValue. */
87 void setRecentFolderForOpticalDisks(const QString &strValue);
88 /** Defines recent floppy-disk folder as @a strValue. */
89 void setRecentFolderForFloppyDisks(const QString &strValue);
90
91 /** Returns recent hard-drive list. */
92 QStringList recentListOfHardDrives() const;
93 /** Returns recent optical-disk list. */
94 QStringList recentListOfOpticalDisks() const;
95 /** Returns recent floppy-disk list. */
96 QStringList recentListOfFloppyDisks() const;
97 /** Defines recent hard-drive list as @a value. */
98 void setRecentListOfHardDrives(const QStringList &value);
99 /** Defines recent optical-disk list as @a value. */
100 void setRecentListOfOpticalDisks(const QStringList &value);
101 /** Defines recent floppy-disk list as @a value. */
102 void setRecentListOfFloppyDisks(const QStringList &value);
103
104 /** Returns list of the supressed messages for the Message/Popup center frameworks. */
105 QStringList suppressedMessages() const;
106 /** Defines list of the supressed messages for the Message/Popup center frameworks as @a value. */
107 void setSuppressedMessages(const QStringList &value);
108
109 /** Returns list of the messages for the Message/Popup center frameworks with inverted check-box state. */
110 QStringList messagesWithInvertedOption() const;
111
112#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
113 /** Returns whether we should allow Application Update. */
114 bool shouldWeAllowApplicationUpdate() const;
115#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
116
117 /** Returns mode (basic/expert) for wizard of @a type. */
118 WizardMode modeForWizard(WizardType type);
119 /** Defines @a mode (basic/expert) for wizard of @a type. */
120 void setModeForWizard(WizardType type, WizardMode mode);
121
122 /** Returns whether this machine started for the first time. */
123 bool isFirstRun(const QString &strId) const;
124 /** Defines whether this machine started for the first time. */
125 void setFirstRun(bool fIsFirstRun, const QString &strId);
126
127 /** Returns whether we should show machine. */
128 bool shouldWeShowMachine(const QString &strID) const;
129 /** Returns whether we should show machine details. */
130 bool shouldWeShowMachineDetails(const QString &strID) const;
131
132 /** Returns whether we should allow machine reconfiguration. */
133 bool shouldWeAllowMachineReconfiguration(const QString &strID) const;
134 /** Returns whether we should allow machine snapshot operations. */
135 bool shouldWeAllowMachineSnapshotOperations(const QString &strID) const;
136
137 /** Returns whether we should automatically mount/unmount guest-screens. */
138 bool shouldWeAutoMountGuestScreens(const QString &strID) const;
139
140 /** Returns restricted Runtime UI menu types. */
141 RuntimeMenuType restrictedRuntimeMenuTypes(const QString &strID) const;
142#ifdef Q_WS_MAC
143 /** Mac OS X: Returns restricted Runtime UI action types for Application menu. */
144 RuntimeMenuApplicationActionType restrictedRuntimeMenuApplicationActionTypes(const QString &strID) const;
145#endif /* Q_WS_MAC */
146 /** Returns restricted Runtime UI action types for Machine menu. */
147 RuntimeMenuMachineActionType restrictedRuntimeMenuMachineActionTypes(const QString &strID) const;
148 /** Returns restricted Runtime UI action types for View menu. */
149 RuntimeMenuViewActionType restrictedRuntimeMenuViewActionTypes(const QString &strID) const;
150 /** Returns restricted Runtime UI action types for Devices menu. */
151 RuntimeMenuDevicesActionType restrictedRuntimeMenuDevicesActionTypes(const QString &strID) const;
152#ifdef VBOX_WITH_DEBUGGER_GUI
153 /** Returns restricted Runtime UI action types for Debugger menu. */
154 RuntimeMenuDebuggerActionType restrictedRuntimeMenuDebuggerActionTypes(const QString &strID) const;
155#endif /* VBOX_WITH_DEBUGGER_GUI */
156 /** Returns restricted Runtime UI action types for Help menu. */
157 RuntimeMenuHelpActionType restrictedRuntimeMenuHelpActionTypes(const QString &strID) const;
158
159 /** Returns restricted Runtime UI visual-state types. */
160 UIVisualStateType restrictedVisualStateTypes(const QString &strID) const;
161
162 /** Returns default machine close action. */
163 MachineCloseAction defaultMachineCloseAction(const QString &strID) const;
164 /** Returns restricted machine close actions. */
165 MachineCloseAction restrictedMachineCloseActions(const QString &strID) const;
166
167 /** Returns restricted Runtime UI status-bar indicators. */
168 QList<IndicatorType> restrictedStatusBarIndicators(const QString &strID) const;
169
170 /** Returns global settings pages. */
171 QList<GlobalSettingsPageType> restrictedGlobalSettingsPages() const;
172 /** Returns machine settings pages. */
173 QList<MachineSettingsPageType> restrictedMachineSettingsPages(const QString &strID) const;
174
175#ifndef Q_WS_MAC
176 /** Except Mac OS X: Returns redefined machine-window icon names. */
177 QStringList machineWindowIconNames(const QString &strID) const;
178 /** Except Mac OS X: Returns redefined machine-window name postfix. */
179 QString machineWindowNamePostfix(const QString &strID) const;
180#endif /* !Q_WS_MAC */
181
182 /** Returns redefined guru-meditation handler type. */
183 GuruMeditationHandlerType guruMeditationHandlerType(const QString &strID) const;
184
185 /** Returns Runtime UI HiDPI optimization type. */
186 HiDPIOptimizationType hiDPIOptimizationType(const QString &strID) const;
187
188private slots:
189
190 /** Handles 'extra-data change' event: */
191 void sltExtraDataChange(QString strMachineID, QString strKey, QString strValue);
192
193private:
194
195 /** Prepare Extra-data Manager. */
196 void prepare();
197 /** Prepare global extra-data map. */
198 void prepareGlobalExtraDataMap();
199 /** Prepare extra-data event-handler. */
200 void prepareExtraDataEventHandler();
201 /** Prepare Main event-listener. */
202 void prepareMainEventListener();
203
204 /** Cleanup Extra-data Manager. */
205 void cleanup();
206 /** Cleanup Main event-listener. */
207 void cleanupMainEventListener();
208 // /** Cleanup extra-data event-handler. */
209 // void cleanupExtraDataEventHandler();
210 // /** Cleanup extra-data map. */
211 // void cleanupExtraDataMap();
212
213 /** Hot-load machine extra-data map. */
214 void hotloadMachineExtraDataMap(const QString &strID) const;
215
216 /** Determines whether feature corresponding to passed @a strKey is allowed.
217 * If valid @a strID is set => applies to machine extra-data, otherwise => to global one. */
218 bool isFeatureAllowed(const QString &strKey, const QString &strID = QString()) const;
219 /** Determines whether feature corresponding to passed @a strKey is restricted.
220 * If valid @a strID is set => applies to machine extra-data, otherwise => to global one. */
221 bool isFeatureRestricted(const QString &strKey, const QString &strID = QString()) const;
222
223 /** Translates bool flag into 'allowed' value. */
224 QString toFeatureAllowed(bool fAllowed);
225 /** Translates bool flag into 'restricted' value. */
226 QString toFeatureRestricted(bool fRestricted);
227
228 /** Returns extra-data value corresponding to passed @a strKey as QString.
229 * If valid @a strID is set => applies to machine extra-data, otherwise => to global one. */
230 QString extraDataString(const QString &strKey, const QString &strID = QString()) const;
231 /** Defines extra-data value corresponding to passed @a strKey as strValue.
232 * If valid @a strID is set => applies to machine extra-data, otherwise => to global one. */
233 void setExtraDataString(const QString &strKey, const QString &strValue, const QString &strID = QString());
234
235 /** Returns extra-data value corresponding to passed @a strKey as QStringList.
236 * If valid @a strID is set => applies to machine extra-data, otherwise => to global one. */
237 QStringList extraDataStringList(const QString &strKey, const QString &strID = QString()) const;
238 /** Defines extra-data value corresponding to passed @a strKey as strValue.
239 * If valid @a strID is set => applies to machine extra-data, otherwise => to global one. */
240 void setExtraDataStringList(const QString &strKey, const QStringList &strValue, const QString &strID = QString());
241
242 /** Singleton Extra-data Manager instance. */
243 static UIExtraDataManager *m_pInstance;
244
245 /** Main event-listener instance. */
246 CEventListener m_listener;
247 /** Extra-data event-handler instance. */
248 UIExtraDataEventHandler *m_pHandler;
249
250 /** Extra-data map. */
251 mutable QMap<QString, ExtraDataMap> m_data;
252};
253
254/** Singleton Extra-data Manager 'official' name. */
255#define gEDataManager UIExtraDataManager::instance()
256
257#endif /* !___UIExtraDataManager_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