[41695] | 1 | /** @file
|
---|
| 2 | *
|
---|
| 3 | * VBox frontends: Qt GUI ("VirtualBox"):
|
---|
| 4 | * Global declarations and functions
|
---|
| 5 | */
|
---|
[25177] | 6 |
|
---|
[41695] | 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 | */
|
---|
[25177] | 18 |
|
---|
[41689] | 19 | #ifndef __UIDefs_h__
|
---|
| 20 | #define __UIDefs_h__
|
---|
[25177] | 21 |
|
---|
[41695] | 22 | /* Qt includes: */
|
---|
[25177] | 23 | #include <QEvent>
|
---|
[41689] | 24 | #include <QStringList>
|
---|
[25177] | 25 |
|
---|
[41819] | 26 | /* COM includes: */
|
---|
| 27 | #include "COMEnums.h"
|
---|
| 28 |
|
---|
[41695] | 29 | /* Other VBox defines: */
|
---|
[25177] | 30 | #define LOG_GROUP LOG_GROUP_GUI
|
---|
[41689] | 31 |
|
---|
[41695] | 32 | /* Other VBox includes: */
|
---|
[25177] | 33 | #include <VBox/log.h>
|
---|
| 34 | #include <iprt/assert.h>
|
---|
| 35 | #include <iprt/alloc.h>
|
---|
| 36 |
|
---|
[41695] | 37 | /* Defines: */
|
---|
[41689] | 38 | #define MAC_LEOPARD_STYLE defined(Q_WS_MAC) && (QT_VERSION >= 0x040300)
|
---|
| 39 |
|
---|
[25177] | 40 | #ifdef DEBUG
|
---|
[41689] | 41 | # define AssertWrapperOk(w) \
|
---|
[25177] | 42 | AssertMsg (w.isOk(), (#w " is not okay (RC=0x%08X)", w.lastRC()))
|
---|
[41689] | 43 | # define AssertWrapperOkMsg(w, m) \
|
---|
[25177] | 44 | AssertMsg (w.isOk(), (#w ": " m " (RC=0x%08X)", w.lastRC()))
|
---|
[41695] | 45 | #else /* !DEBUG */
|
---|
[41689] | 46 | # define AssertWrapperOk(w) do {} while (0)
|
---|
| 47 | # define AssertWrapperOkMsg(w, m) do {} while (0)
|
---|
[41695] | 48 | #endif /* DEBUG */
|
---|
[25177] | 49 |
|
---|
| 50 | #ifndef SIZEOF_ARRAY
|
---|
[41689] | 51 | # define SIZEOF_ARRAY(a) (sizeof(a) / sizeof(a[0]))
|
---|
[41695] | 52 | #endif /* SIZEOF_ARRAY */
|
---|
[25177] | 53 |
|
---|
[41695] | 54 | /* Global UI namespace: */
|
---|
[41689] | 55 | namespace UIDefs
|
---|
[38575] | 56 | {
|
---|
[41695] | 57 | /* VM display rendering mode: */
|
---|
[25177] | 58 | enum RenderMode
|
---|
| 59 | {
|
---|
[41689] | 60 | InvalidRenderMode
|
---|
| 61 | , TimerMode
|
---|
| 62 | , QImageMode
|
---|
| 63 | , SDLMode
|
---|
| 64 | , DDRAWMode
|
---|
| 65 | , Quartz2DMode
|
---|
[27682] | 66 | #ifdef VBOX_GUI_USE_QGLFB
|
---|
[25177] | 67 | , QGLMode
|
---|
[41695] | 68 | #endif /* VBOX_GUI_USE_QGLFB */
|
---|
[25177] | 69 | };
|
---|
| 70 |
|
---|
[41695] | 71 | /* Additional Qt event types: */
|
---|
[41689] | 72 | enum UIEventType
|
---|
[25177] | 73 | {
|
---|
[34740] | 74 | ResizeEventType = QEvent::User + 101
|
---|
[25318] | 75 | , RepaintEventType
|
---|
| 76 | , SetRegionEventType
|
---|
| 77 | , ModifierKeyChangeEventType
|
---|
| 78 | , MediaEnumEventType
|
---|
[41689] | 79 | #ifdef Q_WS_WIN
|
---|
[25318] | 80 | , ShellExecuteEventType
|
---|
[41695] | 81 | #endif /* Q_WS_WIN */
|
---|
[30677] | 82 | , ActivateActionEventType
|
---|
[41689] | 83 | #ifdef Q_WS_MAC
|
---|
[25318] | 84 | , ShowWindowEventType
|
---|
[41695] | 85 | #endif /* Q_WS_MAC */
|
---|
[25318] | 86 | , AddVDMUrlsEventType
|
---|
[25177] | 87 | #ifdef VBOX_GUI_USE_QGL
|
---|
[25318] | 88 | , VHWACommandProcessType
|
---|
[41695] | 89 | #endif /* VBOX_GUI_USE_QGL */
|
---|
[25177] | 90 | };
|
---|
| 91 |
|
---|
[41695] | 92 | /* Size formatting types: */
|
---|
[25177] | 93 | enum FormatSize
|
---|
| 94 | {
|
---|
| 95 | FormatSize_Round,
|
---|
| 96 | FormatSize_RoundDown,
|
---|
| 97 | FormatSize_RoundUp
|
---|
| 98 | };
|
---|
| 99 |
|
---|
[41695] | 100 | /* Global declarations: */
|
---|
[41689] | 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 |
|
---|
[41695] | 112 | /* Selector-window declarations: */
|
---|
[41689] | 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;
|
---|
[42526] | 122 | extern const char* GUI_LastItemSelected;
|
---|
| 123 | extern const char* GUI_GroupDefinitions;
|
---|
[41689] | 124 |
|
---|
[41695] | 125 | /* Machine-window declarations: */
|
---|
[41689] | 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 |
|
---|
[41695] | 140 | /* Mini tool-bar declarations: */
|
---|
[41689] | 141 | extern const char* GUI_ShowMiniToolBar;
|
---|
| 142 | extern const char* GUI_MiniToolBarAlignment;
|
---|
| 143 | extern const char* GUI_MiniToolBarAutoHide;
|
---|
| 144 |
|
---|
[41695] | 145 | /* Close-dialog declarations: */
|
---|
[41689] | 146 | extern const char* GUI_RestrictedCloseActions;
|
---|
| 147 | extern const char* GUI_LastCloseAction;
|
---|
| 148 | extern const char* GUI_CloseActionHook;
|
---|
| 149 |
|
---|
[41695] | 150 | /* Wizards declarations: */
|
---|
[41689] | 151 | extern const char* GUI_FirstRun;
|
---|
| 152 | extern const char* GUI_HideDescriptionForWizards;
|
---|
| 153 | extern const char* GUI_Export_StorageType;
|
---|
| 154 | extern const char* GUI_Export_Username;
|
---|
| 155 | extern const char* GUI_Export_Hostname;
|
---|
| 156 | extern const char* GUI_Export_Bucket;
|
---|
| 157 |
|
---|
[41695] | 158 | /* Message-center declarations: */
|
---|
[41689] | 159 | extern const char* GUI_SuppressMessages;
|
---|
| 160 | extern const char* GUI_InvertMessageOption;
|
---|
| 161 |
|
---|
[41695] | 162 | /* Registration dialog declarations: */
|
---|
[41689] | 163 | extern const char* GUI_RegistrationDlgWinID;
|
---|
| 164 | extern const char* GUI_RegistrationData;
|
---|
| 165 |
|
---|
[41695] | 166 | /* Update manager declarations: */
|
---|
[41689] | 167 | extern const char* GUI_UpdateDate;
|
---|
| 168 | extern const char* GUI_UpdateCheckCount;
|
---|
| 169 |
|
---|
[41695] | 170 | /* Information dialog declarations: */
|
---|
[41689] | 171 | extern const char* GUI_InfoDlgState;
|
---|
| 172 |
|
---|
| 173 | #ifdef VBOX_WITH_DEBUGGER_GUI
|
---|
[41695] | 174 | /* Debugger GUI declarations: */
|
---|
[41689] | 175 | extern const char* GUI_DbgEnabled;
|
---|
| 176 | extern const char* GUI_DbgAutoShow;
|
---|
[41695] | 177 | #endif /* VBOX_WITH_DEBUGGER_GUI */
|
---|
[41689] | 178 |
|
---|
[25177] | 179 | #ifdef Q_WS_X11
|
---|
[41695] | 180 | /* License GUI declarations: */
|
---|
[41689] | 181 | extern const char* GUI_LicenseKey;
|
---|
[41695] | 182 | #endif /* Q_WS_X11 */
|
---|
[41689] | 183 |
|
---|
[25177] | 184 | #ifdef Q_WS_MAC
|
---|
[41695] | 185 | /* Mac dock declarations: */
|
---|
[41689] | 186 | extern const char* GUI_RealtimeDockIconUpdateEnabled;
|
---|
| 187 | extern const char* GUI_RealtimeDockIconUpdateMonitor;
|
---|
| 188 | extern const char* GUI_PresentationModeEnabled;
|
---|
[41695] | 189 | #endif /* Q_WS_MAC */
|
---|
[25583] | 190 |
|
---|
| 191 | #ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
[41695] | 192 | /* Video-acceleration declarations: */
|
---|
[41689] | 193 | extern const char* GUI_Accelerate2D_StretchLinear;
|
---|
| 194 | extern const char* GUI_Accelerate2D_PixformatYV12;
|
---|
| 195 | extern const char* GUI_Accelerate2D_PixformatUYVY;
|
---|
| 196 | extern const char* GUI_Accelerate2D_PixformatYUY2;
|
---|
| 197 | extern const char* GUI_Accelerate2D_PixformatAYUV;
|
---|
[41695] | 198 | #endif /* VBOX_WITH_VIDEOHWACCEL */
|
---|
[32741] | 199 |
|
---|
[41689] | 200 | #ifdef VBOX_GUI_WITH_SYSTRAY
|
---|
[41695] | 201 | /* Tray icon declarations: */
|
---|
[41689] | 202 | extern const char* GUI_TrayIconWinID;
|
---|
| 203 | extern const char* GUI_TrayIconEnabled;
|
---|
| 204 | extern const char* GUI_MainWindowCount;
|
---|
[41695] | 205 | #endif /* VBOX_GUI_WITH_SYSTRAY */
|
---|
[34064] | 206 |
|
---|
[41695] | 207 | /* File extensions declarations: */
|
---|
[41689] | 208 | extern QStringList VBoxFileExts;
|
---|
| 209 | extern QStringList VBoxExtPackFileExts;
|
---|
| 210 | extern QStringList OVFFileExts;
|
---|
| 211 | }
|
---|
[41695] | 212 | using namespace UIDefs /* globally */;
|
---|
[25177] | 213 |
|
---|
[41819] | 214 | struct StorageSlot
|
---|
| 215 | {
|
---|
| 216 | StorageSlot() : bus(KStorageBus_Null), port(0), device(0) {}
|
---|
| 217 | StorageSlot(const StorageSlot &other) : bus(other.bus), port(other.port), device(other.device) {}
|
---|
| 218 | StorageSlot(KStorageBus otherBus, LONG iPort, LONG iDevice) : bus(otherBus), port(iPort), device(iDevice) {}
|
---|
| 219 | StorageSlot& operator=(const StorageSlot &other) { bus = other.bus; port = other.port; device = other.device; return *this; }
|
---|
| 220 | bool operator==(const StorageSlot &other) const { return bus == other.bus && port == other.port && device == other.device; }
|
---|
| 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) ||
|
---|
| 223 | (bus == other.bus && port < other.port) ||
|
---|
| 224 | (bus == other.bus && port == other.port && device < other.device); }
|
---|
| 225 | bool operator>(const StorageSlot &other) const { return (bus > other.bus) ||
|
---|
| 226 | (bus == other.bus && port > other.port) ||
|
---|
| 227 | (bus == other.bus && port == other.port && device > other.device); }
|
---|
| 228 | bool isNull() const { return bus == KStorageBus_Null; }
|
---|
| 229 | KStorageBus bus; LONG port; LONG device;
|
---|
| 230 | };
|
---|
| 231 | Q_DECLARE_METATYPE(StorageSlot);
|
---|
| 232 |
|
---|
[42526] | 233 | /* Details element type: */
|
---|
| 234 | enum DetailsElementType
|
---|
| 235 | {
|
---|
| 236 | DetailsElementType_General,
|
---|
| 237 | DetailsElementType_System,
|
---|
| 238 | DetailsElementType_Preview,
|
---|
| 239 | DetailsElementType_Display,
|
---|
| 240 | DetailsElementType_Storage,
|
---|
| 241 | DetailsElementType_Audio,
|
---|
| 242 | DetailsElementType_Network,
|
---|
| 243 | DetailsElementType_Serial,
|
---|
| 244 | #ifdef VBOX_WITH_PARALLEL_PORTS
|
---|
| 245 | DetailsElementType_Parallel,
|
---|
| 246 | #endif /* VBOX_WITH_PARALLEL_PORTS */
|
---|
| 247 | DetailsElementType_USB,
|
---|
| 248 | DetailsElementType_SF,
|
---|
| 249 | DetailsElementType_Description
|
---|
| 250 | };
|
---|
| 251 | Q_DECLARE_METATYPE(DetailsElementType);
|
---|
| 252 |
|
---|
[41689] | 253 | #endif // __UIDefs_h__
|
---|
[25177] | 254 |
|
---|