VirtualBox

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

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

FE/Qt: bugref:9049: Full and heavy cleanup for UIDefs.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.8 KB
Line 
1/* $Id: UIDefs.h 71428 2018-03-21 13:01:35Z 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/* COM includes: */
26#include "COMEnums.h"
27
28/* Define GUI log group: */
29// WORKAROUND:
30// This define should go *before* VBox/log.h include!
31#ifndef VBOX_WITH_PRECOMPILED_HEADERS
32# define LOG_GROUP LOG_GROUP_GUI
33#endif
34
35/* Other VBox includes: */
36#include <VBox/log.h>
37#include <VBox/com/defs.h>
38
39/* Defines: */
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
53
54
55/** Global namespace. */
56namespace UIDefs
57{
58 /** Additional Qt event types. */
59 enum UIEventType
60 {
61 ActivateActionEventType = QEvent::User + 101,
62#ifdef VBOX_WS_MAC
63 ShowWindowEventType,
64#endif
65#ifdef VBOX_GUI_USE_QGL
66 VHWACommandProcessType,
67#endif
68 };
69
70 /** Size formatting types. */
71 enum FormatSize
72 {
73 FormatSize_Round,
74 FormatSize_RoundDown,
75 FormatSize_RoundUp
76 };
77
78 /** Default guest additions image name. */
79 extern const char* GUI_GuestAdditionsName;
80 /** Default extension pack name. */
81 extern const char* GUI_ExtPackName;
82
83 /** Allowed VBox file extensions. */
84 extern QStringList VBoxFileExts;
85 /** Allowed VBox Extension Pack file extensions. */
86 extern QStringList VBoxExtPackFileExts;
87 /** Allowed OVF file extensions. */
88 extern QStringList OVFFileExts;
89 /** Allowed OPC file extensions. */
90 extern QStringList OPCFileExts;
91}
92using namespace UIDefs /* if header included */;
93
94
95#ifdef VBOX_WS_MAC
96/** Known macOS releases. */
97enum MacOSXRelease
98{
99 MacOSXRelease_Old,
100 MacOSXRelease_SnowLeopard,
101 MacOSXRelease_Lion,
102 MacOSXRelease_MountainLion,
103 MacOSXRelease_Mavericks,
104 MacOSXRelease_Yosemite,
105 MacOSXRelease_ElCapitan,
106 MacOSXRelease_New,
107};
108#endif /* VBOX_WS_MAC */
109
110
111/** Size suffixes. */
112enum SizeSuffix
113{
114 SizeSuffix_Byte = 0,
115 SizeSuffix_KiloByte,
116 SizeSuffix_MegaByte,
117 SizeSuffix_GigaByte,
118 SizeSuffix_TeraByte,
119 SizeSuffix_PetaByte,
120 SizeSuffix_Max
121};
122
123
124/** Storage-slot struct. */
125struct StorageSlot
126{
127 StorageSlot() : bus(KStorageBus_Null), port(0), device(0) {}
128 StorageSlot(const StorageSlot &other) : bus(other.bus), port(other.port), device(other.device) {}
129 StorageSlot(KStorageBus otherBus, LONG iPort, LONG iDevice) : bus(otherBus), port(iPort), device(iDevice) {}
130 StorageSlot& operator=(const StorageSlot &other) { bus = other.bus; port = other.port; device = other.device; return *this; }
131 bool operator==(const StorageSlot &other) const { return bus == other.bus && port == other.port && device == other.device; }
132 bool operator!=(const StorageSlot &other) const { return bus != other.bus || port != other.port || device != other.device; }
133 bool operator<(const StorageSlot &other) const { return (bus < other.bus) ||
134 (bus == other.bus && port < other.port) ||
135 (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 isNull() const { return bus == KStorageBus_Null; }
140 KStorageBus bus; LONG port; LONG device;
141};
142Q_DECLARE_METATYPE(StorageSlot);
143
144
145/** Storage-slot struct extension with exact controller name. */
146struct ExactStorageSlot : public StorageSlot
147{
148 ExactStorageSlot(const QString &strController,
149 KStorageBus enmBus, LONG iPort, LONG iDevice)
150 : StorageSlot(enmBus, iPort, iDevice)
151 , controller(strController)
152 {}
153 QString controller;
154};
155
156
157#endif /* !___UIDefs_h___ */
158
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use