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