1 | /* $Id: UIMediumDefs.h 76553 2019-01-01 01:45:53Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UIMedium related declarations.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2019 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 ___UIMediumDefs_h___
|
---|
19 | #define ___UIMediumDefs_h___
|
---|
20 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
21 | # pragma once
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | /* Qt includes: */
|
---|
25 | #include <QString>
|
---|
26 |
|
---|
27 | /* GUI includes: */
|
---|
28 | #include "UILibraryDefs.h"
|
---|
29 |
|
---|
30 | /* COM includes: */
|
---|
31 | #include "COMEnums.h"
|
---|
32 | #include "CVirtualBox.h"
|
---|
33 |
|
---|
34 | /* Other VBox includes: */
|
---|
35 | #include <VBox/com/defs.h>
|
---|
36 |
|
---|
37 | /* Forward declarations: */
|
---|
38 | class CVirtualBox;
|
---|
39 |
|
---|
40 |
|
---|
41 | /** Medium formats. */
|
---|
42 | enum UIMediumFormat
|
---|
43 | {
|
---|
44 | UIMediumFormat_VDI,
|
---|
45 | UIMediumFormat_VMDK,
|
---|
46 | UIMediumFormat_VHD,
|
---|
47 | UIMediumFormat_Parallels,
|
---|
48 | UIMediumFormat_QED,
|
---|
49 | UIMediumFormat_QCOW,
|
---|
50 | };
|
---|
51 |
|
---|
52 | /** UIMediumDefs namespace. */
|
---|
53 | namespace UIMediumDefs
|
---|
54 | {
|
---|
55 | /** UIMedium types. */
|
---|
56 | enum UIMediumDeviceType
|
---|
57 | {
|
---|
58 | UIMediumDeviceType_HardDisk,
|
---|
59 | UIMediumDeviceType_DVD,
|
---|
60 | UIMediumDeviceType_Floppy,
|
---|
61 | UIMediumDeviceType_All,
|
---|
62 | UIMediumDeviceType_Invalid
|
---|
63 | };
|
---|
64 |
|
---|
65 | /** Converts global medium type (KDeviceType) to local (UIMediumDeviceType). */
|
---|
66 | SHARED_LIBRARY_STUFF UIMediumDeviceType mediumTypeToLocal(KDeviceType globalType);
|
---|
67 | /** Convert local medium type (UIMediumDeviceType) to global (KDeviceType). */
|
---|
68 | SHARED_LIBRARY_STUFF KDeviceType mediumTypeToGlobal(UIMediumDeviceType localType);
|
---|
69 |
|
---|
70 | /** Returns medium formats which are currently supported by @a comVBox for the given @a enmDeviceType. */
|
---|
71 | QList<QPair<QString, QString> > MediumBackends(const CVirtualBox &comVBox, KDeviceType enmDeviceType);
|
---|
72 | /** Returns which hard disk formats are currently supported by @a comVBox. */
|
---|
73 | QList<QPair<QString, QString> > HDDBackends(const CVirtualBox &comVBox);
|
---|
74 | /** Returns which optical disk formats are currently supported by @a comVBox. */
|
---|
75 | QList<QPair<QString, QString> > DVDBackends(const CVirtualBox &comVBox);
|
---|
76 | /** Returns which floppy disk formats are currently supported by @a comVBox. */
|
---|
77 | QList<QPair<QString, QString> > FloppyBackends(const CVirtualBox &comVBox);
|
---|
78 |
|
---|
79 | /** Returns the first file extension of the list of file extension support for the @a enmDeviceType. */
|
---|
80 | QString getPreferredExtensionForMedium(KDeviceType enmDeviceType);
|
---|
81 | QVector<CMediumFormat> getFormatsForDeviceType(KDeviceType enmDeviceType);
|
---|
82 | }
|
---|
83 | /* Using this namespace globally: */
|
---|
84 | using namespace UIMediumDefs;
|
---|
85 |
|
---|
86 | /** Medium-target. */
|
---|
87 | struct UIMediumTarget
|
---|
88 | {
|
---|
89 | /** Medium-target types. */
|
---|
90 | enum UIMediumTargetType
|
---|
91 | {
|
---|
92 | UIMediumTargetType_WithID,
|
---|
93 | UIMediumTargetType_WithLocation,
|
---|
94 | UIMediumTargetType_CreateAdHocVISO,
|
---|
95 | UIMediumTargetType_CreateFloppyDisk
|
---|
96 | };
|
---|
97 |
|
---|
98 | /** Medium-target constructor. */
|
---|
99 | UIMediumTarget(const QString &strName = QString(), LONG iPort = 0, LONG iDevice = 0,
|
---|
100 | UIMediumDeviceType aMediumType = UIMediumDeviceType_Invalid,
|
---|
101 | UIMediumTargetType aType = UIMediumTargetType_WithID, const QString &strData = QString())
|
---|
102 | : name(strName), port(iPort), device(iDevice)
|
---|
103 | , mediumType(aMediumType)
|
---|
104 | , type(aType), data(strData)
|
---|
105 | {}
|
---|
106 |
|
---|
107 | /** Determines controller name. */
|
---|
108 | QString name;
|
---|
109 | /** Determines controller port. */
|
---|
110 | LONG port;
|
---|
111 | /** Determines controller device. */
|
---|
112 | LONG device;
|
---|
113 |
|
---|
114 | /** Determines medium-target medium-type. */
|
---|
115 | UIMediumDeviceType mediumType;
|
---|
116 |
|
---|
117 | /** Determines medium-target type. */
|
---|
118 | UIMediumTargetType type;
|
---|
119 | /** Depending on medium-target type holds <i>ID</i> or <i>location</i>. */
|
---|
120 | QString data;
|
---|
121 | };
|
---|
122 |
|
---|
123 | /* Let QMetaType know about our types: */
|
---|
124 | Q_DECLARE_METATYPE(UIMediumDeviceType);
|
---|
125 | Q_DECLARE_METATYPE(UIMediumTarget);
|
---|
126 |
|
---|
127 | #endif /* !___UIMediumDefs_h___ */
|
---|