VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDefs.h@ 74942

Last change on this file since 74942 was 71630, checked in by vboxsync, 6 years ago

FE/Qt: bugref:9049: Initial commit for VBoxGlobal library (for now it works on X11 only).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.9 KB
Line 
1/* $Id: UIDefs.h 71630 2018-04-03 16:37:08Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - Global definitions.
4 */
5
6/*
7 * Copyright (C) 2006-2018 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef ___UIDefs_h___
19#define ___UIDefs_h___
20
21/* Qt includes: */
22#include <QEvent>
23#include <QStringList>
24
25/* GUI includes: */
26#include "UILibraryDefs.h"
27
28/* COM includes: */
29#include "COMEnums.h"
30
31/* Define GUI log group: */
32// WORKAROUND:
33// This define should go *before* VBox/log.h include!
34#ifndef VBOX_WITH_PRECOMPILED_HEADERS
35# define LOG_GROUP LOG_GROUP_GUI
36#endif
37
38/* Other VBox includes: */
39#include <VBox/log.h>
40#include <VBox/com/defs.h>
41
42/* Defines: */
43#ifdef DEBUG
44# define AssertWrapperOk(w) \
45 AssertMsg (w.isOk(), (#w " is not okay (RC=0x%08X)", w.lastRC()))
46# define AssertWrapperOkMsg(w, m) \
47 AssertMsg (w.isOk(), (#w ": " m " (RC=0x%08X)", w.lastRC()))
48#else /* !DEBUG */
49# define AssertWrapperOk(w) do {} while (0)
50# define AssertWrapperOkMsg(w, m) do {} while (0)
51#endif /* !DEBUG */
52
53#ifndef SIZEOF_ARRAY
54# define SIZEOF_ARRAY(a) (sizeof(a) / sizeof(a[0]))
55#endif
56
57
58/** Global namespace. */
59namespace UIDefs
60{
61 /** Additional Qt event types. */
62 enum UIEventType
63 {
64 ActivateActionEventType = QEvent::User + 101,
65#ifdef VBOX_WS_MAC
66 ShowWindowEventType,
67#endif
68#ifdef VBOX_GUI_USE_QGL
69 VHWACommandProcessType,
70#endif
71 };
72
73 /** Size formatting types. */
74 enum FormatSize
75 {
76 FormatSize_Round,
77 FormatSize_RoundDown,
78 FormatSize_RoundUp
79 };
80
81 /** Default guest additions image name. */
82 SHARED_LIBRARY_STUFF extern const char* GUI_GuestAdditionsName;
83 /** Default extension pack name. */
84 SHARED_LIBRARY_STUFF extern const char* GUI_ExtPackName;
85
86 /** Allowed VBox file extensions. */
87 SHARED_LIBRARY_STUFF extern QStringList VBoxFileExts;
88 /** Allowed VBox Extension Pack file extensions. */
89 SHARED_LIBRARY_STUFF extern QStringList VBoxExtPackFileExts;
90 /** Allowed OVF file extensions. */
91 SHARED_LIBRARY_STUFF extern QStringList OVFFileExts;
92 /** Allowed OPC file extensions. */
93 SHARED_LIBRARY_STUFF extern QStringList OPCFileExts;
94}
95using namespace UIDefs /* if header included */;
96
97
98#ifdef VBOX_WS_MAC
99/** Known macOS releases. */
100enum MacOSXRelease
101{
102 MacOSXRelease_Old,
103 MacOSXRelease_SnowLeopard,
104 MacOSXRelease_Lion,
105 MacOSXRelease_MountainLion,
106 MacOSXRelease_Mavericks,
107 MacOSXRelease_Yosemite,
108 MacOSXRelease_ElCapitan,
109 MacOSXRelease_New,
110};
111#endif /* VBOX_WS_MAC */
112
113
114/** Size suffixes. */
115enum SizeSuffix
116{
117 SizeSuffix_Byte = 0,
118 SizeSuffix_KiloByte,
119 SizeSuffix_MegaByte,
120 SizeSuffix_GigaByte,
121 SizeSuffix_TeraByte,
122 SizeSuffix_PetaByte,
123 SizeSuffix_Max
124};
125
126
127/** Storage-slot struct. */
128struct StorageSlot
129{
130 StorageSlot() : bus(KStorageBus_Null), port(0), device(0) {}
131 StorageSlot(const StorageSlot &other) : bus(other.bus), port(other.port), device(other.device) {}
132 StorageSlot(KStorageBus otherBus, LONG iPort, LONG iDevice) : bus(otherBus), port(iPort), device(iDevice) {}
133 StorageSlot& operator=(const StorageSlot &other) { bus = other.bus; port = other.port; device = other.device; return *this; }
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 || port != other.port || device != other.device; }
136 bool operator<(const StorageSlot &other) const { return (bus < other.bus) ||
137 (bus == other.bus && port < other.port) ||
138 (bus == other.bus && port == other.port && device < other.device); }
139 bool operator>(const StorageSlot &other) const { return (bus > other.bus) ||
140 (bus == other.bus && port > other.port) ||
141 (bus == other.bus && port == other.port && device > other.device); }
142 bool isNull() const { return bus == KStorageBus_Null; }
143 KStorageBus bus; LONG port; LONG device;
144};
145Q_DECLARE_METATYPE(StorageSlot);
146
147
148/** Storage-slot struct extension with exact controller name. */
149struct ExactStorageSlot : public StorageSlot
150{
151 ExactStorageSlot(const QString &strController,
152 KStorageBus enmBus, LONG iPort, LONG iDevice)
153 : StorageSlot(enmBus, iPort, iDevice)
154 , controller(strController)
155 {}
156 QString controller;
157};
158
159
160#endif /* !___UIDefs_h___ */
161
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use