VirtualBox

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

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

FE/Qt: 6660: Advanced extra-data management framework: Integrate GUI_RecentFolderHD, GUI_RecentFolderCD, GUI_RecentFolderFD, GUI_RecentListHD, GUI_RecentListCD, GUI_RecentListFD.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 10.0 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 strValue. */
98 void setRecentListOfHardDrives(const QStringList &strValue);
99 /** Defines recent optical-disk list as @a strValue. */
100 void setRecentListOfOpticalDisks(const QStringList &strValue);
101 /** Defines recent floppy-disk list as @a strValue. */
102 void setRecentListOfFloppyDisks(const QStringList &strValue);
103
104#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
105 /** Returns whether we should allow Application Update. */
106 bool shouldWeAllowApplicationUpdate() const;
107#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
108
109 /** Returns whether we should show machine. */
110 bool shouldWeShowMachine(const QString &strID) const;
111 /** Returns whether we should show machine details. */
112 bool shouldWeShowMachineDetails(const QString &strID) const;
113
114 /** Returns whether we should allow machine reconfiguration. */
115 bool shouldWeAllowMachineReconfiguration(const QString &strID) const;
116 /** Returns whether we should allow machine snapshot operations. */
117 bool shouldWeAllowMachineSnapshotOperations(const QString &strID) const;
118
119 /** Returns whether we should automatically mount/unmount guest-screens. */
120 bool shouldWeAutoMountGuestScreens(const QString &strID) const;
121
122 /** Returns restricted Runtime UI menu types. */
123 RuntimeMenuType restrictedRuntimeMenuTypes(const QString &strID) const;
124#ifdef Q_WS_MAC
125 /** Mac OS X: Returns restricted Runtime UI action types for Application menu. */
126 RuntimeMenuApplicationActionType restrictedRuntimeMenuApplicationActionTypes(const QString &strID) const;
127#endif /* Q_WS_MAC */
128 /** Returns restricted Runtime UI action types for Machine menu. */
129 RuntimeMenuMachineActionType restrictedRuntimeMenuMachineActionTypes(const QString &strID) const;
130 /** Returns restricted Runtime UI action types for View menu. */
131 RuntimeMenuViewActionType restrictedRuntimeMenuViewActionTypes(const QString &strID) const;
132 /** Returns restricted Runtime UI action types for Devices menu. */
133 RuntimeMenuDevicesActionType restrictedRuntimeMenuDevicesActionTypes(const QString &strID) const;
134#ifdef VBOX_WITH_DEBUGGER_GUI
135 /** Returns restricted Runtime UI action types for Debugger menu. */
136 RuntimeMenuDebuggerActionType restrictedRuntimeMenuDebuggerActionTypes(const QString &strID) const;
137#endif /* VBOX_WITH_DEBUGGER_GUI */
138 /** Returns restricted Runtime UI action types for Help menu. */
139 RuntimeMenuHelpActionType restrictedRuntimeMenuHelpActionTypes(const QString &strID) const;
140
141 /** Returns restricted Runtime UI visual-state types. */
142 UIVisualStateType restrictedVisualStateTypes(const QString &strID) const;
143
144 /** Returns default machine close action. */
145 MachineCloseAction defaultMachineCloseAction(const QString &strID) const;
146 /** Returns restricted machine close actions. */
147 MachineCloseAction restrictedMachineCloseActions(const QString &strID) const;
148
149 /** Returns restricted Runtime UI status-bar indicators. */
150 QList<IndicatorType> restrictedStatusBarIndicators(const QString &strID) const;
151
152 /** Returns global settings pages. */
153 QList<GlobalSettingsPageType> restrictedGlobalSettingsPages() const;
154 /** Returns machine settings pages. */
155 QList<MachineSettingsPageType> restrictedMachineSettingsPages(const QString &strID) const;
156
157#ifndef Q_WS_MAC
158 /** Except Mac OS X: Returns redefined machine-window icon names. */
159 QStringList machineWindowIconNames(const QString &strID) const;
160 /** Except Mac OS X: Returns redefined machine-window name postfix. */
161 QString machineWindowNamePostfix(const QString &strID) const;
162#endif /* !Q_WS_MAC */
163
164 /** Returns redefined guru-meditation handler type. */
165 GuruMeditationHandlerType guruMeditationHandlerType(const QString &strID) const;
166
167 /** Returns Runtime UI HiDPI optimization type. */
168 HiDPIOptimizationType hiDPIOptimizationType(const QString &strID) const;
169
170private slots:
171
172 /** Handles 'extra-data change' event: */
173 void sltExtraDataChange(QString strMachineID, QString strKey, QString strValue);
174
175private:
176
177 /** Prepare Extra-data Manager. */
178 void prepare();
179 /** Prepare global extra-data map. */
180 void prepareGlobalExtraDataMap();
181 /** Prepare extra-data event-handler. */
182 void prepareExtraDataEventHandler();
183 /** Prepare Main event-listener. */
184 void prepareMainEventListener();
185
186 /** Cleanup Extra-data Manager. */
187 void cleanup();
188 /** Cleanup Main event-listener. */
189 void cleanupMainEventListener();
190 // /** Cleanup extra-data event-handler. */
191 // void cleanupExtraDataEventHandler();
192 // /** Cleanup extra-data map. */
193 // void cleanupExtraDataMap();
194
195 /** Hot-load machine extra-data map. */
196 void hotloadMachineExtraDataMap(const QString &strID) const;
197
198 /** Determines whether feature corresponding to passed @a strKey is allowed.
199 * If valid @a strID is set => applies to machine extra-data, otherwise => to global one. */
200 bool isFeatureAllowed(const QString &strKey, const QString &strID = QString()) const;
201 /** Determines whether feature corresponding to passed @a strKey is restricted.
202 * If valid @a strID is set => applies to machine extra-data, otherwise => to global one. */
203 bool isFeatureRestricted(const QString &strKey, const QString &strID = QString()) const;
204
205 /** Returns extra-data value corresponding to passed @a strKey as QString.
206 * If valid @a strID is set => applies to machine extra-data, otherwise => to global one. */
207 QString extraDataString(const QString &strKey, const QString &strID = QString()) const;
208 /** Defines extra-data value corresponding to passed @a strKey as strValue.
209 * If valid @a strID is set => applies to machine extra-data, otherwise => to global one. */
210 void setExtraDataString(const QString &strKey, const QString &strValue, const QString &strID = QString());
211
212 /** Returns extra-data value corresponding to passed @a strKey as QStringList.
213 * If valid @a strID is set => applies to machine extra-data, otherwise => to global one. */
214 QStringList extraDataStringList(const QString &strKey, const QString &strID = QString()) const;
215 /** Defines extra-data value corresponding to passed @a strKey as strValue.
216 * If valid @a strID is set => applies to machine extra-data, otherwise => to global one. */
217 void setExtraDataStringList(const QString &strKey, const QStringList &strValue, const QString &strID = QString());
218
219 /** Singleton Extra-data Manager instance. */
220 static UIExtraDataManager *m_pInstance;
221
222 /** Main event-listener instance. */
223 CEventListener m_listener;
224 /** Extra-data event-handler instance. */
225 UIExtraDataEventHandler *m_pHandler;
226
227 /** Extra-data map. */
228 mutable QMap<QString, ExtraDataMap> m_data;
229};
230
231/** Singleton Extra-data Manager 'official' name. */
232#define gEDataManager UIExtraDataManager::instance()
233
234#endif /* !___UIExtraDataManager_h___ */
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette