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
RevLine 
[55401]1/* $Id: UIDefs.h 71630 2018-04-03 16:37:08Z vboxsync $ */
[41695]2/** @file
[51187]3 * VBox Qt GUI - Global definitions.
[41695]4 */
[25177]5
[41695]6/*
[71428]7 * Copyright (C) 2006-2018 Oracle Corporation
[41695]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 */
[25177]17
[49505]18#ifndef ___UIDefs_h___
19#define ___UIDefs_h___
[25177]20
[41695]21/* Qt includes: */
[25177]22#include <QEvent>
[41689]23#include <QStringList>
[25177]24
[71630]25/* GUI includes: */
26#include "UILibraryDefs.h"
27
[41819]28/* COM includes: */
29#include "COMEnums.h"
30
[71428]31/* Define GUI log group: */
32// WORKAROUND:
33// This define should go *before* VBox/log.h include!
[52722]34#ifndef VBOX_WITH_PRECOMPILED_HEADERS
[71428]35# define LOG_GROUP LOG_GROUP_GUI
[52722]36#endif
[71428]37
[41695]38/* Other VBox includes: */
[25177]39#include <VBox/log.h>
[54554]40#include <VBox/com/defs.h>
[25177]41
[41695]42/* Defines: */
[25177]43#ifdef DEBUG
[41689]44# define AssertWrapperOk(w) \
[25177]45 AssertMsg (w.isOk(), (#w " is not okay (RC=0x%08X)", w.lastRC()))
[41689]46# define AssertWrapperOkMsg(w, m) \
[25177]47 AssertMsg (w.isOk(), (#w ": " m " (RC=0x%08X)", w.lastRC()))
[41695]48#else /* !DEBUG */
[41689]49# define AssertWrapperOk(w) do {} while (0)
50# define AssertWrapperOkMsg(w, m) do {} while (0)
[71428]51#endif /* !DEBUG */
[25177]52
53#ifndef SIZEOF_ARRAY
[41689]54# define SIZEOF_ARRAY(a) (sizeof(a) / sizeof(a[0]))
[71428]55#endif
[25177]56
[71428]57
[51187]58/** Global namespace. */
[41689]59namespace UIDefs
[38575]60{
[71428]61 /** Additional Qt event types. */
[41689]62 enum UIEventType
[25177]63 {
[71428]64 ActivateActionEventType = QEvent::User + 101,
[60362]65#ifdef VBOX_WS_MAC
[71428]66 ShowWindowEventType,
67#endif
[25177]68#ifdef VBOX_GUI_USE_QGL
[71428]69 VHWACommandProcessType,
70#endif
[25177]71 };
72
[71428]73 /** Size formatting types. */
[25177]74 enum FormatSize
75 {
76 FormatSize_Round,
77 FormatSize_RoundDown,
78 FormatSize_RoundUp
79 };
80
[71428]81 /** Default guest additions image name. */
[71630]82 SHARED_LIBRARY_STUFF extern const char* GUI_GuestAdditionsName;
[71428]83 /** Default extension pack name. */
[71630]84 SHARED_LIBRARY_STUFF extern const char* GUI_ExtPackName;
[51189]85
[71428]86 /** Allowed VBox file extensions. */
[71630]87 SHARED_LIBRARY_STUFF extern QStringList VBoxFileExts;
[71428]88 /** Allowed VBox Extension Pack file extensions. */
[71630]89 SHARED_LIBRARY_STUFF extern QStringList VBoxExtPackFileExts;
[71428]90 /** Allowed OVF file extensions. */
[71630]91 SHARED_LIBRARY_STUFF extern QStringList OVFFileExts;
[71428]92 /** Allowed OPC file extensions. */
[71630]93 SHARED_LIBRARY_STUFF extern QStringList OPCFileExts;
[41689]94}
[51187]95using namespace UIDefs /* if header included */;
[25177]96
[71428]97
[60362]98#ifdef VBOX_WS_MAC
[71428]99/** Known macOS releases. */
[49363]100enum MacOSXRelease
101{
[57951]102 MacOSXRelease_Old,
[49363]103 MacOSXRelease_SnowLeopard,
104 MacOSXRelease_Lion,
105 MacOSXRelease_MountainLion,
[52957]106 MacOSXRelease_Mavericks,
[57951]107 MacOSXRelease_Yosemite,
[57953]108 MacOSXRelease_ElCapitan,
[57951]109 MacOSXRelease_New,
[49363]110};
[60362]111#endif /* VBOX_WS_MAC */
[49363]112
[71428]113
114/** Size suffixes. */
[51187]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
[71428]126
127/** Storage-slot struct. */
[41819]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
[71428]147
148/** Storage-slot struct extension with exact controller name. */
[64604]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
[71428]159
[49505]160#endif /* !___UIDefs_h___ */
[71428]161
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use