1 | /* $Id: UIDefs.h 98999 2023-03-16 10:40:45Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - Global definitions.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2023 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | */
|
---|
27 |
|
---|
28 | #ifndef FEQT_INCLUDED_SRC_globals_UIDefs_h
|
---|
29 | #define FEQT_INCLUDED_SRC_globals_UIDefs_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | /* Define GUI log group: */
|
---|
35 | // WORKAROUND:
|
---|
36 | // This define should go *before* VBox/log.h include!
|
---|
37 | #ifndef LOG_GROUP
|
---|
38 | # define LOG_GROUP LOG_GROUP_GUI
|
---|
39 | #endif
|
---|
40 |
|
---|
41 | /* Qt includes: */
|
---|
42 | #include <QEvent>
|
---|
43 | #include <QStringList>
|
---|
44 |
|
---|
45 | /* GUI includes: */
|
---|
46 | #include "UILibraryDefs.h"
|
---|
47 |
|
---|
48 | /* COM includes: */
|
---|
49 | #include "COMEnums.h"
|
---|
50 |
|
---|
51 | /* Other VBox includes: */
|
---|
52 | #include <VBox/log.h>
|
---|
53 | #include <VBox/com/defs.h>
|
---|
54 |
|
---|
55 | /* Defines: */
|
---|
56 | #ifdef RT_STRICT
|
---|
57 | # define AssertWrapperOk(w) AssertMsg(w.isOk(), (#w " is not okay (RC=0x%08X)", w.lastRC()))
|
---|
58 | # define AssertWrapperOkMsg(w, m) AssertMsg(w.isOk(), (#w ": " m " (RC=0x%08X)", w.lastRC()))
|
---|
59 | #else
|
---|
60 | # define AssertWrapperOk(w) do {} while (0)
|
---|
61 | # define AssertWrapperOkMsg(w, m) do {} while (0)
|
---|
62 | #endif
|
---|
63 |
|
---|
64 |
|
---|
65 | /** Global namespace. */
|
---|
66 | namespace UIDefs
|
---|
67 | {
|
---|
68 | /** Additional Qt event types. */
|
---|
69 | enum UIEventType
|
---|
70 | {
|
---|
71 | ActivateActionEventType = QEvent::User + 101,
|
---|
72 | #ifdef VBOX_WS_MAC
|
---|
73 | ShowWindowEventType,
|
---|
74 | #endif
|
---|
75 | };
|
---|
76 |
|
---|
77 | /** Size formatting types. */
|
---|
78 | enum FormatSize
|
---|
79 | {
|
---|
80 | FormatSize_Round,
|
---|
81 | FormatSize_RoundDown,
|
---|
82 | FormatSize_RoundUp
|
---|
83 | };
|
---|
84 |
|
---|
85 | /** Default guest additions image name. */
|
---|
86 | SHARED_LIBRARY_STUFF extern const char* GUI_GuestAdditionsName;
|
---|
87 | /** Default extension pack name. */
|
---|
88 | SHARED_LIBRARY_STUFF extern const char* GUI_ExtPackName;
|
---|
89 |
|
---|
90 | /** Allowed VBox file extensions. */
|
---|
91 | SHARED_LIBRARY_STUFF extern QStringList VBoxFileExts;
|
---|
92 | /** Allowed VBox Extension Pack file extensions. */
|
---|
93 | SHARED_LIBRARY_STUFF extern QStringList VBoxExtPackFileExts;
|
---|
94 | /** Allowed OVF file extensions. */
|
---|
95 | SHARED_LIBRARY_STUFF extern QStringList OVFFileExts;
|
---|
96 |
|
---|
97 | /** Holds environment variable name for Desktop Watchdog / Synthetic Test policy type. */
|
---|
98 | SHARED_LIBRARY_STUFF extern const char *VBox_DesktopWatchdogPolicy_SynthTest;
|
---|
99 | }
|
---|
100 | using namespace UIDefs /* if header included */;
|
---|
101 |
|
---|
102 |
|
---|
103 | /** Size suffixes. */
|
---|
104 | enum SizeSuffix
|
---|
105 | {
|
---|
106 | SizeSuffix_Byte = 0,
|
---|
107 | SizeSuffix_KiloByte,
|
---|
108 | SizeSuffix_MegaByte,
|
---|
109 | SizeSuffix_GigaByte,
|
---|
110 | SizeSuffix_TeraByte,
|
---|
111 | SizeSuffix_PetaByte,
|
---|
112 | SizeSuffix_Max
|
---|
113 | };
|
---|
114 |
|
---|
115 |
|
---|
116 | /** VM launch modes. */
|
---|
117 | enum UILaunchMode
|
---|
118 | {
|
---|
119 | UILaunchMode_Invalid,
|
---|
120 | UILaunchMode_Default,
|
---|
121 | UILaunchMode_Headless,
|
---|
122 | UILaunchMode_Separate
|
---|
123 | };
|
---|
124 |
|
---|
125 |
|
---|
126 | /** Storage-slot struct. */
|
---|
127 | struct StorageSlot
|
---|
128 | {
|
---|
129 | StorageSlot() : bus(KStorageBus_Null), port(0), device(0) {}
|
---|
130 | StorageSlot(const StorageSlot &other) : bus(other.bus), port(other.port), device(other.device) {}
|
---|
131 | StorageSlot(KStorageBus otherBus, LONG iPort, LONG iDevice) : bus(otherBus), port(iPort), device(iDevice) {}
|
---|
132 | StorageSlot& operator=(const StorageSlot &other) { bus = other.bus; port = other.port; device = other.device; return *this; }
|
---|
133 | bool operator==(const StorageSlot &other) const { return bus == other.bus && port == other.port && device == other.device; }
|
---|
134 | bool operator!=(const StorageSlot &other) const { return bus != other.bus || port != other.port || device != other.device; }
|
---|
135 | bool operator<(const StorageSlot &other) const { return (bus < other.bus) ||
|
---|
136 | (bus == other.bus && port < other.port) ||
|
---|
137 | (bus == other.bus && port == other.port && device < other.device); }
|
---|
138 | bool operator>(const StorageSlot &other) const { return (bus > other.bus) ||
|
---|
139 | (bus == other.bus && port > other.port) ||
|
---|
140 | (bus == other.bus && port == other.port && device > other.device); }
|
---|
141 | bool isNull() const { return bus == KStorageBus_Null; }
|
---|
142 | KStorageBus bus; LONG port; LONG device;
|
---|
143 | };
|
---|
144 | Q_DECLARE_METATYPE(StorageSlot);
|
---|
145 |
|
---|
146 |
|
---|
147 | /** Storage-slot struct extension with exact controller name. */
|
---|
148 | struct ExactStorageSlot : public StorageSlot
|
---|
149 | {
|
---|
150 | ExactStorageSlot(const QString &strController,
|
---|
151 | KStorageBus enmBus, LONG iPort, LONG iDevice)
|
---|
152 | : StorageSlot(enmBus, iPort, iDevice)
|
---|
153 | , controller(strController)
|
---|
154 | {}
|
---|
155 | QString controller;
|
---|
156 | };
|
---|
157 |
|
---|
158 |
|
---|
159 | /** Desktop Watchdog / Synthetic Test policy type. */
|
---|
160 | enum DesktopWatchdogPolicy_SynthTest
|
---|
161 | {
|
---|
162 | DesktopWatchdogPolicy_SynthTest_Disabled,
|
---|
163 | DesktopWatchdogPolicy_SynthTest_ManagerOnly,
|
---|
164 | DesktopWatchdogPolicy_SynthTest_MachineOnly,
|
---|
165 | DesktopWatchdogPolicy_SynthTest_Both
|
---|
166 | };
|
---|
167 | Q_DECLARE_METATYPE(DesktopWatchdogPolicy_SynthTest);
|
---|
168 |
|
---|
169 |
|
---|
170 | #endif /* !FEQT_INCLUDED_SRC_globals_UIDefs_h */
|
---|