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 "UIDefs.h"
|
---|
26 |
|
---|
27 | /* COM includes: */
|
---|
28 | #include "CEventListener.h"
|
---|
29 |
|
---|
30 | /* Forward declarations: */
|
---|
31 | class UIExtraDataEventHandler;
|
---|
32 |
|
---|
33 | /* Type definitions: */
|
---|
34 | typedef 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. */
|
---|
39 | class UIExtraDataManager : public QObject
|
---|
40 | {
|
---|
41 | Q_OBJECT;
|
---|
42 |
|
---|
43 | /** Extra-data Manager constructor. */
|
---|
44 | UIExtraDataManager();
|
---|
45 | /** Extra-data Manager destructor. */
|
---|
46 | ~UIExtraDataManager();
|
---|
47 |
|
---|
48 | signals:
|
---|
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 |
|
---|
68 | public:
|
---|
69 |
|
---|
70 | /** Static Extra-data Manager instance/constructor. */
|
---|
71 | static UIExtraDataManager* instance();
|
---|
72 | /** Static Extra-data Manager destructor. */
|
---|
73 | static void destroy();
|
---|
74 |
|
---|
75 | #ifdef VBOX_GUI_WITH_NETWORK_MANAGER
|
---|
76 | /** Returns whether we should allow Application Update. */
|
---|
77 | bool shouldWeAllowApplicationUpdate() const;
|
---|
78 | #endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
|
---|
79 |
|
---|
80 | /** Returns whether we should show machine. */
|
---|
81 | bool shouldWeShowMachine(const QString &strID) const;
|
---|
82 | /** Returns whether we should show machine details. */
|
---|
83 | bool shouldWeShowMachineDetails(const QString &strID) const;
|
---|
84 |
|
---|
85 | /** Returns whether we should allow machine reconfiguration. */
|
---|
86 | bool shouldWeAllowMachineReconfiguration(const QString &strID) const;
|
---|
87 | /** Returns whether we should allow machine snapshot operations. */
|
---|
88 | bool shouldWeAllowMachineSnapshotOperations(const QString &strID) const;
|
---|
89 |
|
---|
90 | /** Returns whether we should automatically mount/unmount guest-screens. */
|
---|
91 | bool shouldWeAutoMountGuestScreens(const QString &strID) const;
|
---|
92 |
|
---|
93 | /** Returns restricted Runtime UI menu types. */
|
---|
94 | RuntimeMenuType restrictedRuntimeMenuTypes(const QString &strID) const;
|
---|
95 | #ifdef Q_WS_MAC
|
---|
96 | /** Mac OS X: Returns restricted Runtime UI action types for Application menu. */
|
---|
97 | RuntimeMenuApplicationActionType restrictedRuntimeMenuApplicationActionTypes(const QString &strID) const;
|
---|
98 | #endif /* Q_WS_MAC */
|
---|
99 | /** Returns restricted Runtime UI action types for Machine menu. */
|
---|
100 | RuntimeMenuMachineActionType restrictedRuntimeMenuMachineActionTypes(const QString &strID) const;
|
---|
101 | /** Returns restricted Runtime UI action types for View menu. */
|
---|
102 | RuntimeMenuViewActionType restrictedRuntimeMenuViewActionTypes(const QString &strID) const;
|
---|
103 | /** Returns restricted Runtime UI action types for Devices menu. */
|
---|
104 | RuntimeMenuDevicesActionType restrictedRuntimeMenuDevicesActionTypes(const QString &strID) const;
|
---|
105 | #ifdef VBOX_WITH_DEBUGGER_GUI
|
---|
106 | /** Returns restricted Runtime UI action types for Debugger menu. */
|
---|
107 | RuntimeMenuDebuggerActionType restrictedRuntimeMenuDebuggerActionTypes(const QString &strID) const;
|
---|
108 | #endif /* VBOX_WITH_DEBUGGER_GUI */
|
---|
109 | /** Returns restricted Runtime UI action types for Help menu. */
|
---|
110 | RuntimeMenuHelpActionType restrictedRuntimeMenuHelpActionTypes(const QString &strID) const;
|
---|
111 |
|
---|
112 | /** Returns restricted Runtime UI visual-state types. */
|
---|
113 | UIVisualStateType restrictedVisualStateTypes(const QString &strID) const;
|
---|
114 |
|
---|
115 | /** Returns default machine close action. */
|
---|
116 | MachineCloseAction defaultMachineCloseAction(const QString &strID) const;
|
---|
117 | /** Returns restricted machine close actions. */
|
---|
118 | MachineCloseAction restrictedMachineCloseActions(const QString &strID) const;
|
---|
119 |
|
---|
120 | /** Returns restricted Runtime UI status-bar indicators. */
|
---|
121 | QList<IndicatorType> restrictedStatusBarIndicators(const QString &strID) const;
|
---|
122 |
|
---|
123 | /** Returns global settings pages. */
|
---|
124 | QList<GlobalSettingsPageType> restrictedGlobalSettingsPages() const;
|
---|
125 | /** Returns machine settings pages. */
|
---|
126 | QList<MachineSettingsPageType> restrictedMachineSettingsPages(const QString &strID) const;
|
---|
127 |
|
---|
128 | #ifndef Q_WS_MAC
|
---|
129 | /** Except Mac OS X: Returns redefined machine-window icon names. */
|
---|
130 | QStringList machineWindowIconNames(const QString &strID) const;
|
---|
131 | #endif /* !Q_WS_MAC */
|
---|
132 |
|
---|
133 | /** Returns redefined guru-meditation handler type. */
|
---|
134 | GuruMeditationHandlerType guruMeditationHandlerType(const QString &strID) const;
|
---|
135 |
|
---|
136 | private:
|
---|
137 |
|
---|
138 | /** Prepare Extra-data Manager. */
|
---|
139 | void prepare();
|
---|
140 | /** Prepare Main event-listener. */
|
---|
141 | void prepareMainEventListener();
|
---|
142 | /** Prepare extra-data event-handler. */
|
---|
143 | void prepareExtraDataEventHandler();
|
---|
144 | /** Prepare global extra-data map. */
|
---|
145 | void prepareGlobalExtraDataMap();
|
---|
146 |
|
---|
147 | /** Cleanup Extra-data Manager. */
|
---|
148 | void cleanup();
|
---|
149 | /** Cleanup Main event-listener. */
|
---|
150 | void cleanupMainEventListener();
|
---|
151 | // /** Cleanup extra-data event-handler. */
|
---|
152 | // void cleanupExtraDataEventHandler();
|
---|
153 | // /** Cleanup extra-data map. */
|
---|
154 | // void cleanupExtraDataMap();
|
---|
155 |
|
---|
156 | /** Hot-load machine extra-data map. */
|
---|
157 | void hotloadMachineExtraDataMap(const QString &strID) const;
|
---|
158 |
|
---|
159 | /** Determines whether feature corresponding to passed @a strKey is allowed.
|
---|
160 | * If valid @a strID is set => applies to machine extra-data, otherwise => to global one. */
|
---|
161 | bool isFeatureAllowed(const QString &strKey, const QString &strID = QString()) const;
|
---|
162 |
|
---|
163 | /** Returns extra-data value corresponding to passed @a strKey as QString.
|
---|
164 | * If valid @a strID is set => applies to machine extra-data, otherwise => to global one. */
|
---|
165 | QString extraDataString(const QString &strKey, const QString &strID = QString()) const;
|
---|
166 |
|
---|
167 | /** Returns extra-data value corresponding to passed @a strKey as QStringList.
|
---|
168 | * If valid @a strID is set => applies to machine extra-data, otherwise => to global one. */
|
---|
169 | QStringList extraDataStringList(const QString &strKey, const QString &strID = QString()) const;
|
---|
170 |
|
---|
171 | /** Singleton Extra-data Manager instance. */
|
---|
172 | static UIExtraDataManager *m_pInstance;
|
---|
173 |
|
---|
174 | /** Main event-listener instance. */
|
---|
175 | CEventListener m_listener;
|
---|
176 | /** Extra-data event-handler instance. */
|
---|
177 | UIExtraDataEventHandler *m_pHandler;
|
---|
178 |
|
---|
179 | /** Extra-data map. */
|
---|
180 | mutable QMap<QString, ExtraDataMap> m_data;
|
---|
181 | };
|
---|
182 |
|
---|
183 | /** Singleton Extra-data Manager 'official' name. */
|
---|
184 | #define gEDataManager UIExtraDataManager::instance()
|
---|
185 |
|
---|
186 | #endif /* !___UIExtraDataManager_h___ */
|
---|