1 | /** @file
|
---|
2 | *
|
---|
3 | * VBox frontends: Qt GUI ("VirtualBox"):
|
---|
4 | * Global declarations and functions
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2006-2012 Oracle Corporation
|
---|
9 | *
|
---|
10 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
11 | * available from http://www.virtualbox.org. This file is free software;
|
---|
12 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
13 | * General Public License (GPL) as published by the Free Software
|
---|
14 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
15 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
16 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | */
|
---|
18 |
|
---|
19 | #ifndef __UIDefs_h__
|
---|
20 | #define __UIDefs_h__
|
---|
21 |
|
---|
22 | /* Qt includes: */
|
---|
23 | #include <QEvent>
|
---|
24 | #include <QStringList>
|
---|
25 |
|
---|
26 | /* COM includes: */
|
---|
27 | #include "COMEnums.h"
|
---|
28 |
|
---|
29 | /* Other VBox defines: */
|
---|
30 | #define LOG_GROUP LOG_GROUP_GUI
|
---|
31 |
|
---|
32 | /* Other VBox includes: */
|
---|
33 | #include <VBox/log.h>
|
---|
34 | #include <iprt/assert.h>
|
---|
35 | #include <iprt/alloc.h>
|
---|
36 |
|
---|
37 | /* Defines: */
|
---|
38 | #define MAC_LEOPARD_STYLE defined(Q_WS_MAC) && (QT_VERSION >= 0x040300)
|
---|
39 |
|
---|
40 | #ifdef DEBUG
|
---|
41 | # define AssertWrapperOk(w) \
|
---|
42 | AssertMsg (w.isOk(), (#w " is not okay (RC=0x%08X)", w.lastRC()))
|
---|
43 | # define AssertWrapperOkMsg(w, m) \
|
---|
44 | AssertMsg (w.isOk(), (#w ": " m " (RC=0x%08X)", w.lastRC()))
|
---|
45 | #else /* !DEBUG */
|
---|
46 | # define AssertWrapperOk(w) do {} while (0)
|
---|
47 | # define AssertWrapperOkMsg(w, m) do {} while (0)
|
---|
48 | #endif /* DEBUG */
|
---|
49 |
|
---|
50 | #ifndef SIZEOF_ARRAY
|
---|
51 | # define SIZEOF_ARRAY(a) (sizeof(a) / sizeof(a[0]))
|
---|
52 | #endif /* SIZEOF_ARRAY */
|
---|
53 |
|
---|
54 | /* Global UI namespace: */
|
---|
55 | namespace UIDefs
|
---|
56 | {
|
---|
57 | /* VM display rendering mode: */
|
---|
58 | enum RenderMode
|
---|
59 | {
|
---|
60 | InvalidRenderMode
|
---|
61 | , TimerMode
|
---|
62 | , QImageMode
|
---|
63 | , SDLMode
|
---|
64 | , DDRAWMode
|
---|
65 | , Quartz2DMode
|
---|
66 | #ifdef VBOX_GUI_USE_QGLFB
|
---|
67 | , QGLMode
|
---|
68 | #endif /* VBOX_GUI_USE_QGLFB */
|
---|
69 | };
|
---|
70 |
|
---|
71 | /* Additional Qt event types: */
|
---|
72 | enum UIEventType
|
---|
73 | {
|
---|
74 | ResizeEventType = QEvent::User + 101
|
---|
75 | , RepaintEventType
|
---|
76 | , SetRegionEventType
|
---|
77 | , ModifierKeyChangeEventType
|
---|
78 | , MediaEnumEventType
|
---|
79 | #ifdef Q_WS_WIN
|
---|
80 | , ShellExecuteEventType
|
---|
81 | #endif /* Q_WS_WIN */
|
---|
82 | , ActivateActionEventType
|
---|
83 | #ifdef Q_WS_MAC
|
---|
84 | , ShowWindowEventType
|
---|
85 | #endif /* Q_WS_MAC */
|
---|
86 | , AddVDMUrlsEventType
|
---|
87 | #ifdef VBOX_GUI_USE_QGL
|
---|
88 | , VHWACommandProcessType
|
---|
89 | #endif /* VBOX_GUI_USE_QGL */
|
---|
90 | };
|
---|
91 |
|
---|
92 | /* Size formatting types: */
|
---|
93 | enum FormatSize
|
---|
94 | {
|
---|
95 | FormatSize_Round,
|
---|
96 | FormatSize_RoundDown,
|
---|
97 | FormatSize_RoundUp
|
---|
98 | };
|
---|
99 |
|
---|
100 | /* Global declarations: */
|
---|
101 | extern const char* GUI_RenderMode;
|
---|
102 | extern const char* GUI_LanguageId;
|
---|
103 | extern const char* GUI_ExtPackName;
|
---|
104 | extern const char* GUI_PreventBetaWarning;
|
---|
105 | extern const char* GUI_RecentFolderHD;
|
---|
106 | extern const char* GUI_RecentFolderCD;
|
---|
107 | extern const char* GUI_RecentFolderFD;
|
---|
108 | extern const char* GUI_RecentListHD;
|
---|
109 | extern const char* GUI_RecentListCD;
|
---|
110 | extern const char* GUI_RecentListFD;
|
---|
111 |
|
---|
112 | /* Selector-window declarations: */
|
---|
113 | extern const char* GUI_Input_SelectorShortcuts;
|
---|
114 | extern const char* GUI_LastSelectorWindowPosition;
|
---|
115 | extern const char* GUI_SplitterSizes;
|
---|
116 | extern const char* GUI_Toolbar;
|
---|
117 | extern const char* GUI_Statusbar;
|
---|
118 | extern const char* GUI_PreviewUpdate;
|
---|
119 | extern const char* GUI_DetailsPageBoxes;
|
---|
120 | extern const char* GUI_SelectorVMPositions;
|
---|
121 | extern const char* GUI_LastVMSelected;
|
---|
122 | extern const char* GUI_LastItemSelected;
|
---|
123 | extern const char* GUI_GroupDefinitions;
|
---|
124 |
|
---|
125 | /* Machine-window declarations: */
|
---|
126 | extern const char* GUI_Input_MachineShortcuts;
|
---|
127 | extern const char* GUI_LastNormalWindowPosition;
|
---|
128 | extern const char* GUI_LastScaleWindowPosition;
|
---|
129 | extern const char* GUI_LastWindowState_Max;
|
---|
130 | extern const char* GUI_LastGuestSizeHint;
|
---|
131 | extern const char* GUI_LastGuestSizeHintWasFullscreen;
|
---|
132 | extern const char* GUI_Fullscreen;
|
---|
133 | extern const char* GUI_Seamless;
|
---|
134 | extern const char* GUI_Scale;
|
---|
135 | extern const char* GUI_VirtualScreenToHostScreen;
|
---|
136 | extern const char* GUI_AutoresizeGuest;
|
---|
137 | extern const char* GUI_SaveMountedAtRuntime;
|
---|
138 | extern const char* GUI_PassCAD;
|
---|
139 | extern const char* GUI_HideFromManager;
|
---|
140 |
|
---|
141 | /* Mini tool-bar declarations: */
|
---|
142 | extern const char* GUI_ShowMiniToolBar;
|
---|
143 | extern const char* GUI_MiniToolBarAlignment;
|
---|
144 | extern const char* GUI_MiniToolBarAutoHide;
|
---|
145 |
|
---|
146 | /* Close-dialog declarations: */
|
---|
147 | extern const char* GUI_RestrictedCloseActions;
|
---|
148 | extern const char* GUI_LastCloseAction;
|
---|
149 | extern const char* GUI_CloseActionHook;
|
---|
150 |
|
---|
151 | /* Wizards declarations: */
|
---|
152 | extern const char* GUI_FirstRun;
|
---|
153 | extern const char* GUI_HideDescriptionForWizards;
|
---|
154 | extern const char* GUI_Export_StorageType;
|
---|
155 | extern const char* GUI_Export_Username;
|
---|
156 | extern const char* GUI_Export_Hostname;
|
---|
157 | extern const char* GUI_Export_Bucket;
|
---|
158 |
|
---|
159 | /* Message-center declarations: */
|
---|
160 | extern const char* GUI_SuppressMessages;
|
---|
161 | extern const char* GUI_InvertMessageOption;
|
---|
162 |
|
---|
163 | /* Registration dialog declarations: */
|
---|
164 | extern const char* GUI_RegistrationDlgWinID;
|
---|
165 | extern const char* GUI_RegistrationData;
|
---|
166 |
|
---|
167 | /* Update manager declarations: */
|
---|
168 | extern const char* GUI_UpdateDate;
|
---|
169 | extern const char* GUI_UpdateCheckCount;
|
---|
170 |
|
---|
171 | /* Information dialog declarations: */
|
---|
172 | extern const char* GUI_InfoDlgState;
|
---|
173 |
|
---|
174 | #ifdef VBOX_WITH_DEBUGGER_GUI
|
---|
175 | /* Debugger GUI declarations: */
|
---|
176 | extern const char* GUI_DbgEnabled;
|
---|
177 | extern const char* GUI_DbgAutoShow;
|
---|
178 | #endif /* VBOX_WITH_DEBUGGER_GUI */
|
---|
179 |
|
---|
180 | #ifdef Q_WS_X11
|
---|
181 | /* License GUI declarations: */
|
---|
182 | extern const char* GUI_LicenseKey;
|
---|
183 | #endif /* Q_WS_X11 */
|
---|
184 |
|
---|
185 | #ifdef Q_WS_MAC
|
---|
186 | /* Mac dock declarations: */
|
---|
187 | extern const char* GUI_RealtimeDockIconUpdateEnabled;
|
---|
188 | extern const char* GUI_RealtimeDockIconUpdateMonitor;
|
---|
189 | extern const char* GUI_PresentationModeEnabled;
|
---|
190 | #endif /* Q_WS_MAC */
|
---|
191 |
|
---|
192 | #ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
193 | /* Video-acceleration declarations: */
|
---|
194 | extern const char* GUI_Accelerate2D_StretchLinear;
|
---|
195 | extern const char* GUI_Accelerate2D_PixformatYV12;
|
---|
196 | extern const char* GUI_Accelerate2D_PixformatUYVY;
|
---|
197 | extern const char* GUI_Accelerate2D_PixformatYUY2;
|
---|
198 | extern const char* GUI_Accelerate2D_PixformatAYUV;
|
---|
199 | #endif /* VBOX_WITH_VIDEOHWACCEL */
|
---|
200 |
|
---|
201 | #ifdef VBOX_GUI_WITH_SYSTRAY
|
---|
202 | /* Tray icon declarations: */
|
---|
203 | extern const char* GUI_TrayIconWinID;
|
---|
204 | extern const char* GUI_TrayIconEnabled;
|
---|
205 | extern const char* GUI_MainWindowCount;
|
---|
206 | #endif /* VBOX_GUI_WITH_SYSTRAY */
|
---|
207 |
|
---|
208 | /* File extensions declarations: */
|
---|
209 | extern QStringList VBoxFileExts;
|
---|
210 | extern QStringList VBoxExtPackFileExts;
|
---|
211 | extern QStringList OVFFileExts;
|
---|
212 | }
|
---|
213 | using namespace UIDefs /* globally */;
|
---|
214 |
|
---|
215 | struct StorageSlot
|
---|
216 | {
|
---|
217 | StorageSlot() : bus(KStorageBus_Null), port(0), device(0) {}
|
---|
218 | StorageSlot(const StorageSlot &other) : bus(other.bus), port(other.port), device(other.device) {}
|
---|
219 | StorageSlot(KStorageBus otherBus, LONG iPort, LONG iDevice) : bus(otherBus), port(iPort), device(iDevice) {}
|
---|
220 | StorageSlot& operator=(const StorageSlot &other) { bus = other.bus; port = other.port; device = other.device; return *this; }
|
---|
221 | bool operator==(const StorageSlot &other) const { return bus == other.bus && port == other.port && device == other.device; }
|
---|
222 | bool operator!=(const StorageSlot &other) const { return bus != other.bus || port != other.port || device != other.device; }
|
---|
223 | bool operator<(const StorageSlot &other) const { return (bus < other.bus) ||
|
---|
224 | (bus == other.bus && port < other.port) ||
|
---|
225 | (bus == other.bus && port == other.port && device < other.device); }
|
---|
226 | bool operator>(const StorageSlot &other) const { return (bus > other.bus) ||
|
---|
227 | (bus == other.bus && port > other.port) ||
|
---|
228 | (bus == other.bus && port == other.port && device > other.device); }
|
---|
229 | bool isNull() const { return bus == KStorageBus_Null; }
|
---|
230 | KStorageBus bus; LONG port; LONG device;
|
---|
231 | };
|
---|
232 | Q_DECLARE_METATYPE(StorageSlot);
|
---|
233 |
|
---|
234 | /* Details element type: */
|
---|
235 | enum DetailsElementType
|
---|
236 | {
|
---|
237 | DetailsElementType_General,
|
---|
238 | DetailsElementType_System,
|
---|
239 | DetailsElementType_Preview,
|
---|
240 | DetailsElementType_Display,
|
---|
241 | DetailsElementType_Storage,
|
---|
242 | DetailsElementType_Audio,
|
---|
243 | DetailsElementType_Network,
|
---|
244 | DetailsElementType_Serial,
|
---|
245 | #ifdef VBOX_WITH_PARALLEL_PORTS
|
---|
246 | DetailsElementType_Parallel,
|
---|
247 | #endif /* VBOX_WITH_PARALLEL_PORTS */
|
---|
248 | DetailsElementType_USB,
|
---|
249 | DetailsElementType_SF,
|
---|
250 | DetailsElementType_Description
|
---|
251 | };
|
---|
252 | Q_DECLARE_METATYPE(DetailsElementType);
|
---|
253 |
|
---|
254 | #endif // __UIDefs_h__
|
---|
255 |
|
---|