1 | /* $Id: UIConverterBackendCOM.cpp 98103 2023-01-17 14:15:46Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UIConverterBackendCOM implementation.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2012-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 | /* Qt includes: */
|
---|
29 | #include <QApplication>
|
---|
30 | #include <QHash>
|
---|
31 |
|
---|
32 | /* GUI includes: */
|
---|
33 | #include "UIConverterBackend.h"
|
---|
34 | #include "UIIconPool.h"
|
---|
35 |
|
---|
36 | /* COM includes: */
|
---|
37 | #include "COMEnums.h"
|
---|
38 |
|
---|
39 |
|
---|
40 | /* Determines if <Object of type X> can be converted to object of other type.
|
---|
41 | * These functions returns 'true' for all allowed conversions. */
|
---|
42 | template<> bool canConvert<KCloudMachineState>() { return true; }
|
---|
43 | template<> bool canConvert<KMachineState>() { return true; }
|
---|
44 | template<> bool canConvert<KSessionState>() { return true; }
|
---|
45 | template<> bool canConvert<KParavirtProvider>() { return true; }
|
---|
46 | template<> bool canConvert<KDeviceType>() { return true; }
|
---|
47 | template<> bool canConvert<KClipboardMode>() { return true; }
|
---|
48 | template<> bool canConvert<KDnDMode>() { return true; }
|
---|
49 | template<> bool canConvert<KPointingHIDType>() { return true; }
|
---|
50 | template<> bool canConvert<KGraphicsControllerType>() { return true; }
|
---|
51 | template<> bool canConvert<KMediumType>() { return true; }
|
---|
52 | template<> bool canConvert<KMediumVariant>() { return true; }
|
---|
53 | template<> bool canConvert<KNetworkAttachmentType>() { return true; }
|
---|
54 | template<> bool canConvert<KNetworkAdapterType>() { return true; }
|
---|
55 | template<> bool canConvert<KNetworkAdapterPromiscModePolicy>() { return true; }
|
---|
56 | template<> bool canConvert<KPortMode>() { return true; }
|
---|
57 | template<> bool canConvert<KUSBControllerType>() { return true; }
|
---|
58 | template<> bool canConvert<KUSBDeviceState>() { return true; }
|
---|
59 | template<> bool canConvert<KUSBDeviceFilterAction>() { return true; }
|
---|
60 | template<> bool canConvert<KAudioDriverType>() { return true; }
|
---|
61 | template<> bool canConvert<KAudioControllerType>() { return true; }
|
---|
62 | template<> bool canConvert<KAuthType>() { return true; }
|
---|
63 | template<> bool canConvert<KStorageBus>() { return true; }
|
---|
64 | template<> bool canConvert<KStorageControllerType>() { return true; }
|
---|
65 | template<> bool canConvert<KChipsetType>() { return true; }
|
---|
66 | template<> bool canConvert<KTpmType>() { return true; }
|
---|
67 | template<> bool canConvert<KNATProtocol>() { return true; }
|
---|
68 | template<> bool canConvert<KGuestSessionStatus>() { return true; }
|
---|
69 | template<> bool canConvert<KProcessStatus>() { return true; }
|
---|
70 |
|
---|
71 | /* QIcon <= KCloudMachineState: */
|
---|
72 | template<> QIcon toIcon(const KCloudMachineState &state)
|
---|
73 | {
|
---|
74 | switch (state)
|
---|
75 | {
|
---|
76 | case KCloudMachineState_Provisioning: return UIIconPool::iconSet(":/state_running_16px.png");
|
---|
77 | case KCloudMachineState_Running: return UIIconPool::iconSet(":/state_running_16px.png");
|
---|
78 | case KCloudMachineState_Starting: return UIIconPool::iconSet(":/state_running_16px.png");
|
---|
79 | case KCloudMachineState_Stopping: return UIIconPool::iconSet(":/state_saving_16px.png");
|
---|
80 | case KCloudMachineState_Stopped: return UIIconPool::iconSet(":/state_saved_16px.png");
|
---|
81 | case KCloudMachineState_CreatingImage: return UIIconPool::iconSet(":/state_saved_16px.png");
|
---|
82 | case KCloudMachineState_Terminating: return UIIconPool::iconSet(":/state_discarding_16px.png");
|
---|
83 | case KCloudMachineState_Terminated: return UIIconPool::iconSet(":/state_powered_off_16px.png");
|
---|
84 | default: AssertMsgFailed(("No icon for %d", state)); break;
|
---|
85 | }
|
---|
86 | return QIcon();
|
---|
87 | }
|
---|
88 |
|
---|
89 | /* QString <= KCloudMachineState: */
|
---|
90 | template<> QString toString(const KCloudMachineState &state)
|
---|
91 | {
|
---|
92 | switch (state)
|
---|
93 | {
|
---|
94 | case KCloudMachineState_Provisioning: return QApplication::translate("UICommon", "Provisioning", "CloudMachineState");
|
---|
95 | case KCloudMachineState_Running: return QApplication::translate("UICommon", "Running", "CloudMachineState");
|
---|
96 | case KCloudMachineState_Starting: return QApplication::translate("UICommon", "Starting", "CloudMachineState");
|
---|
97 | case KCloudMachineState_Stopping: return QApplication::translate("UICommon", "Stopping", "CloudMachineState");
|
---|
98 | case KCloudMachineState_Stopped: return QApplication::translate("UICommon", "Stopped", "CloudMachineState");
|
---|
99 | case KCloudMachineState_CreatingImage: return QApplication::translate("UICommon", "Creating Image", "CloudMachineState");
|
---|
100 | case KCloudMachineState_Terminating: return QApplication::translate("UICommon", "Terminating", "CloudMachineState");
|
---|
101 | case KCloudMachineState_Terminated: return QApplication::translate("UICommon", "Terminated", "CloudMachineState");
|
---|
102 | default: AssertMsgFailed(("No text for %d", state)); break;
|
---|
103 | }
|
---|
104 | return QString();
|
---|
105 | }
|
---|
106 |
|
---|
107 | /* QColor <= KMachineState: */
|
---|
108 | template<> QColor toColor(const KMachineState &state)
|
---|
109 | {
|
---|
110 | switch (state)
|
---|
111 | {
|
---|
112 | case KMachineState_PoweredOff: return QColor(Qt::gray);
|
---|
113 | case KMachineState_Saved: return QColor(Qt::yellow);
|
---|
114 | case KMachineState_Teleported: return QColor(Qt::red);
|
---|
115 | case KMachineState_Aborted: return QColor(Qt::darkRed);
|
---|
116 | case KMachineState_AbortedSaved: return QColor(Qt::yellow);
|
---|
117 | case KMachineState_Running: return QColor(Qt::green);
|
---|
118 | case KMachineState_Paused: return QColor(Qt::darkGreen);
|
---|
119 | case KMachineState_Stuck: return QColor(Qt::darkMagenta);
|
---|
120 | case KMachineState_Teleporting: return QColor(Qt::blue);
|
---|
121 | case KMachineState_Snapshotting: return QColor(Qt::green);
|
---|
122 | case KMachineState_OnlineSnapshotting: return QColor(Qt::green);
|
---|
123 | case KMachineState_LiveSnapshotting: return QColor(Qt::green);
|
---|
124 | case KMachineState_Starting: return QColor(Qt::green);
|
---|
125 | case KMachineState_Stopping: return QColor(Qt::green);
|
---|
126 | case KMachineState_Saving: return QColor(Qt::green);
|
---|
127 | case KMachineState_Restoring: return QColor(Qt::green);
|
---|
128 | case KMachineState_TeleportingPausedVM: return QColor(Qt::blue);
|
---|
129 | case KMachineState_TeleportingIn: return QColor(Qt::blue);
|
---|
130 | case KMachineState_DeletingSnapshotOnline: return QColor(Qt::green);
|
---|
131 | case KMachineState_DeletingSnapshotPaused: return QColor(Qt::darkGreen);
|
---|
132 | case KMachineState_RestoringSnapshot: return QColor(Qt::green);
|
---|
133 | case KMachineState_DeletingSnapshot: return QColor(Qt::green);
|
---|
134 | case KMachineState_SettingUp: return QColor(Qt::green);
|
---|
135 | // case KMachineState_FirstOnline:
|
---|
136 | // case KMachineState_LastOnline:
|
---|
137 | // case KMachineState_FirstTransient:
|
---|
138 | // case KMachineState_LastTransient:
|
---|
139 | default: AssertMsgFailed(("No color for %d", state)); break;
|
---|
140 | }
|
---|
141 | return QColor();
|
---|
142 | }
|
---|
143 |
|
---|
144 | /* QIcon <= KMachineState: */
|
---|
145 | template<> QIcon toIcon(const KMachineState &state)
|
---|
146 | {
|
---|
147 | switch (state)
|
---|
148 | {
|
---|
149 | case KMachineState_PoweredOff: return UIIconPool::iconSet(":/state_powered_off_16px.png");
|
---|
150 | case KMachineState_Saved: return UIIconPool::iconSet(":/state_saved_16px.png");
|
---|
151 | case KMachineState_Teleported: return UIIconPool::iconSet(":/state_saved_16px.png");
|
---|
152 | case KMachineState_Aborted: return UIIconPool::iconSet(":/state_aborted_16px.png");
|
---|
153 | case KMachineState_AbortedSaved: return UIIconPool::iconSet(":/state_aborted_saved_16px.png");
|
---|
154 | case KMachineState_Running: return UIIconPool::iconSet(":/state_running_16px.png");
|
---|
155 | case KMachineState_Paused: return UIIconPool::iconSet(":/state_paused_16px.png");
|
---|
156 | case KMachineState_Stuck: return UIIconPool::iconSet(":/state_stuck_16px.png");
|
---|
157 | case KMachineState_Teleporting: return UIIconPool::iconSet(":/state_running_16px.png");
|
---|
158 | case KMachineState_Snapshotting: return UIIconPool::iconSet(":/state_saving_16px.png");
|
---|
159 | case KMachineState_OnlineSnapshotting: return UIIconPool::iconSet(":/state_running_16px.png");
|
---|
160 | case KMachineState_LiveSnapshotting: return UIIconPool::iconSet(":/state_running_16px.png");
|
---|
161 | case KMachineState_Starting: return UIIconPool::iconSet(":/state_running_16px.png");
|
---|
162 | case KMachineState_Stopping: return UIIconPool::iconSet(":/state_running_16px.png");
|
---|
163 | case KMachineState_Saving: return UIIconPool::iconSet(":/state_saving_16px.png");
|
---|
164 | case KMachineState_Restoring: return UIIconPool::iconSet(":/state_restoring_16px.png");
|
---|
165 | case KMachineState_TeleportingPausedVM: return UIIconPool::iconSet(":/state_saving_16px.png");
|
---|
166 | case KMachineState_TeleportingIn: return UIIconPool::iconSet(":/state_restoring_16px.png");
|
---|
167 | case KMachineState_DeletingSnapshotOnline: return UIIconPool::iconSet(":/state_discarding_16px.png");
|
---|
168 | case KMachineState_DeletingSnapshotPaused: return UIIconPool::iconSet(":/state_discarding_16px.png");
|
---|
169 | case KMachineState_RestoringSnapshot: return UIIconPool::iconSet(":/state_discarding_16px.png");
|
---|
170 | case KMachineState_DeletingSnapshot: return UIIconPool::iconSet(":/state_discarding_16px.png");
|
---|
171 | case KMachineState_SettingUp: return UIIconPool::iconSet(":/vm_settings_16px.png"); /// @todo Change icon!
|
---|
172 | // case KMachineState_FirstOnline:
|
---|
173 | // case KMachineState_LastOnline:
|
---|
174 | // case KMachineState_FirstTransient:
|
---|
175 | // case KMachineState_LastTransient:
|
---|
176 | default: AssertMsgFailed(("No icon for %d", state)); break;
|
---|
177 | }
|
---|
178 | return QIcon();
|
---|
179 | }
|
---|
180 |
|
---|
181 | /* QString <= KMachineState: */
|
---|
182 | template<> QString toString(const KMachineState &state)
|
---|
183 | {
|
---|
184 | switch (state)
|
---|
185 | {
|
---|
186 | case KMachineState_PoweredOff: return QApplication::translate("UICommon", "Powered Off", "MachineState");
|
---|
187 | case KMachineState_Saved: return QApplication::translate("UICommon", "Saved", "MachineState");
|
---|
188 | case KMachineState_Teleported: return QApplication::translate("UICommon", "Teleported", "MachineState");
|
---|
189 | case KMachineState_Aborted: return QApplication::translate("UICommon", "Aborted", "MachineState");
|
---|
190 | case KMachineState_AbortedSaved: return QApplication::translate("UICommon", "Aborted-Saved", "MachineState");
|
---|
191 | case KMachineState_Running: return QApplication::translate("UICommon", "Running", "MachineState");
|
---|
192 | case KMachineState_Paused: return QApplication::translate("UICommon", "Paused", "MachineState");
|
---|
193 | case KMachineState_Stuck: return QApplication::translate("UICommon", "Guru Meditation", "MachineState");
|
---|
194 | case KMachineState_Teleporting: return QApplication::translate("UICommon", "Teleporting", "MachineState");
|
---|
195 | case KMachineState_Snapshotting: return QApplication::translate("UICommon", "Taking Snapshot", "MachineState");
|
---|
196 | case KMachineState_OnlineSnapshotting: return QApplication::translate("UICommon", "Taking Online Snapshot", "MachineState");
|
---|
197 | case KMachineState_LiveSnapshotting: return QApplication::translate("UICommon", "Taking Live Snapshot", "MachineState");
|
---|
198 | case KMachineState_Starting: return QApplication::translate("UICommon", "Starting", "MachineState");
|
---|
199 | case KMachineState_Stopping: return QApplication::translate("UICommon", "Stopping", "MachineState");
|
---|
200 | case KMachineState_Saving: return QApplication::translate("UICommon", "Saving", "MachineState");
|
---|
201 | case KMachineState_Restoring: return QApplication::translate("UICommon", "Restoring", "MachineState");
|
---|
202 | case KMachineState_TeleportingPausedVM: return QApplication::translate("UICommon", "Teleporting Paused VM", "MachineState");
|
---|
203 | case KMachineState_TeleportingIn: return QApplication::translate("UICommon", "Teleporting", "MachineState");
|
---|
204 | case KMachineState_DeletingSnapshotOnline: return QApplication::translate("UICommon", "Deleting Snapshot", "MachineState");
|
---|
205 | case KMachineState_DeletingSnapshotPaused: return QApplication::translate("UICommon", "Deleting Snapshot", "MachineState");
|
---|
206 | case KMachineState_RestoringSnapshot: return QApplication::translate("UICommon", "Restoring Snapshot", "MachineState");
|
---|
207 | case KMachineState_DeletingSnapshot: return QApplication::translate("UICommon", "Deleting Snapshot", "MachineState");
|
---|
208 | case KMachineState_SettingUp: return QApplication::translate("UICommon", "Setting Up", "MachineState");
|
---|
209 | // case KMachineState_FirstOnline:
|
---|
210 | // case KMachineState_LastOnline:
|
---|
211 | // case KMachineState_FirstTransient:
|
---|
212 | // case KMachineState_LastTransient:
|
---|
213 | default: AssertMsgFailed(("No text for %d", state)); break;
|
---|
214 | }
|
---|
215 | return QString();
|
---|
216 | }
|
---|
217 |
|
---|
218 | /* QString <= KSessionState: */
|
---|
219 | template<> QString toString(const KSessionState &state)
|
---|
220 | {
|
---|
221 | switch (state)
|
---|
222 | {
|
---|
223 | case KSessionState_Unlocked: return QApplication::translate("UICommon", "Unlocked", "SessionState");
|
---|
224 | case KSessionState_Locked: return QApplication::translate("UICommon", "Locked", "SessionState");
|
---|
225 | case KSessionState_Spawning: return QApplication::translate("UICommon", "Spawning", "SessionState");
|
---|
226 | case KSessionState_Unlocking: return QApplication::translate("UICommon", "Unlocking", "SessionState");
|
---|
227 | default: AssertMsgFailed(("No text for %d", state)); break;
|
---|
228 | }
|
---|
229 | return QString();
|
---|
230 | }
|
---|
231 |
|
---|
232 | /* QString <= KParavirtProvider: */
|
---|
233 | template<> QString toString(const KParavirtProvider &type)
|
---|
234 | {
|
---|
235 | switch (type)
|
---|
236 | {
|
---|
237 | case KParavirtProvider_None: return QApplication::translate("UICommon", "None", "ParavirtProvider");
|
---|
238 | case KParavirtProvider_Default: return QApplication::translate("UICommon", "Default", "ParavirtProvider");
|
---|
239 | case KParavirtProvider_Legacy: return QApplication::translate("UICommon", "Legacy", "ParavirtProvider");
|
---|
240 | case KParavirtProvider_Minimal: return QApplication::translate("UICommon", "Minimal", "ParavirtProvider");
|
---|
241 | case KParavirtProvider_HyperV: return QApplication::translate("UICommon", "Hyper-V", "ParavirtProvider");
|
---|
242 | case KParavirtProvider_KVM: return QApplication::translate("UICommon", "KVM", "ParavirtProvider");
|
---|
243 | default: AssertMsgFailed(("No text for %d", type)); break;
|
---|
244 | }
|
---|
245 | return QString();
|
---|
246 | }
|
---|
247 |
|
---|
248 | /* QString <= KDeviceType: */
|
---|
249 | template<> QString toString(const KDeviceType &type)
|
---|
250 | {
|
---|
251 | switch (type)
|
---|
252 | {
|
---|
253 | case KDeviceType_Null: return QApplication::translate("UICommon", "None", "DeviceType");
|
---|
254 | case KDeviceType_Floppy: return QApplication::translate("UICommon", "Floppy", "DeviceType");
|
---|
255 | case KDeviceType_DVD: return QApplication::translate("UICommon", "Optical", "DeviceType");
|
---|
256 | case KDeviceType_HardDisk: return QApplication::translate("UICommon", "Hard Disk", "DeviceType");
|
---|
257 | case KDeviceType_Network: return QApplication::translate("UICommon", "Network", "DeviceType");
|
---|
258 | case KDeviceType_USB: return QApplication::translate("UICommon", "USB", "DeviceType");
|
---|
259 | case KDeviceType_SharedFolder: return QApplication::translate("UICommon", "Shared Folder", "DeviceType");
|
---|
260 | default: AssertMsgFailed(("No text for %d", type)); break;
|
---|
261 | }
|
---|
262 | return QString();
|
---|
263 | }
|
---|
264 |
|
---|
265 | /* QString <= KClipboardMode: */
|
---|
266 | template<> QString toString(const KClipboardMode &mode)
|
---|
267 | {
|
---|
268 | switch (mode)
|
---|
269 | {
|
---|
270 | case KClipboardMode_Disabled: return QApplication::translate("UICommon", "Disabled", "ClipboardType");
|
---|
271 | case KClipboardMode_HostToGuest: return QApplication::translate("UICommon", "Host To Guest", "ClipboardType");
|
---|
272 | case KClipboardMode_GuestToHost: return QApplication::translate("UICommon", "Guest To Host", "ClipboardType");
|
---|
273 | case KClipboardMode_Bidirectional: return QApplication::translate("UICommon", "Bidirectional", "ClipboardType");
|
---|
274 | default: AssertMsgFailed(("No text for %d", mode)); break;
|
---|
275 | }
|
---|
276 | return QString();
|
---|
277 | }
|
---|
278 |
|
---|
279 | /* QString <= KDnDMode: */
|
---|
280 | template<> QString toString(const KDnDMode &mode)
|
---|
281 | {
|
---|
282 | switch (mode)
|
---|
283 | {
|
---|
284 | case KDnDMode_Disabled: return QApplication::translate("UICommon", "Disabled", "DragAndDropType");
|
---|
285 | case KDnDMode_HostToGuest: return QApplication::translate("UICommon", "Host To Guest", "DragAndDropType");
|
---|
286 | case KDnDMode_GuestToHost: return QApplication::translate("UICommon", "Guest To Host", "DragAndDropType");
|
---|
287 | case KDnDMode_Bidirectional: return QApplication::translate("UICommon", "Bidirectional", "DragAndDropType");
|
---|
288 | default: AssertMsgFailed(("No text for %d", mode)); break;
|
---|
289 | }
|
---|
290 | return QString();
|
---|
291 | }
|
---|
292 |
|
---|
293 | /* QString <= KPointingHIDType: */
|
---|
294 | template<> QString toString(const KPointingHIDType &type)
|
---|
295 | {
|
---|
296 | switch (type)
|
---|
297 | {
|
---|
298 | case KPointingHIDType_None: return QApplication::translate("UICommon", "None", "PointingHIDType");
|
---|
299 | case KPointingHIDType_PS2Mouse: return QApplication::translate("UICommon", "PS/2 Mouse", "PointingHIDType");
|
---|
300 | case KPointingHIDType_USBMouse: return QApplication::translate("UICommon", "USB Mouse", "PointingHIDType");
|
---|
301 | case KPointingHIDType_USBTablet: return QApplication::translate("UICommon", "USB Tablet", "PointingHIDType");
|
---|
302 | case KPointingHIDType_ComboMouse: return QApplication::translate("UICommon", "PS/2 and USB Mouse", "PointingHIDType");
|
---|
303 | case KPointingHIDType_USBMultiTouch: return QApplication::translate("UICommon", "USB Multi-Touch Tablet", "PointingHIDType");
|
---|
304 | case KPointingHIDType_USBMultiTouchScreenPlusPad: return QApplication::translate("UICommon", "USB MT TouchScreen and TouchPad", "PointingHIDType");
|
---|
305 | default: AssertMsgFailed(("No text for %d", type)); break;
|
---|
306 | }
|
---|
307 | return QString();
|
---|
308 | }
|
---|
309 |
|
---|
310 | /* QString <= KGraphicsControllerType: */
|
---|
311 | template<> QString toString(const KGraphicsControllerType &type)
|
---|
312 | {
|
---|
313 | switch (type)
|
---|
314 | {
|
---|
315 | case KGraphicsControllerType_Null: return QApplication::translate("UICommon", "None", "GraphicsControllerType");
|
---|
316 | case KGraphicsControllerType_VBoxVGA: return QApplication::translate("UICommon", "VBoxVGA", "GraphicsControllerType");
|
---|
317 | case KGraphicsControllerType_VMSVGA: return QApplication::translate("UICommon", "VMSVGA", "GraphicsControllerType");
|
---|
318 | case KGraphicsControllerType_VBoxSVGA: return QApplication::translate("UICommon", "VBoxSVGA", "GraphicsControllerType");
|
---|
319 | default: AssertMsgFailed(("No text for %d", type)); break;
|
---|
320 | }
|
---|
321 | return QString();
|
---|
322 | }
|
---|
323 |
|
---|
324 | /* KGraphicsControllerType <= QString: */
|
---|
325 | template<> KGraphicsControllerType fromString<KGraphicsControllerType>(const QString &strType)
|
---|
326 | {
|
---|
327 | QHash<QString, KGraphicsControllerType> list;
|
---|
328 | list.insert(QApplication::translate("UICommon", "None", "GraphicsControllerType"), KGraphicsControllerType_Null);
|
---|
329 | list.insert(QApplication::translate("UICommon", "VBoxVGA", "GraphicsControllerType"), KGraphicsControllerType_VBoxVGA);
|
---|
330 | list.insert(QApplication::translate("UICommon", "VMSVGA", "GraphicsControllerType"), KGraphicsControllerType_VMSVGA);
|
---|
331 | list.insert(QApplication::translate("UICommon", "VBoxSVGA", "GraphicsControllerType"), KGraphicsControllerType_VBoxSVGA);
|
---|
332 | if (!list.contains(strType))
|
---|
333 | {
|
---|
334 | AssertMsgFailed(("No value for '%s'", strType.toUtf8().constData()));
|
---|
335 | }
|
---|
336 | return list.value(strType, KGraphicsControllerType_Null);
|
---|
337 | }
|
---|
338 |
|
---|
339 | /* QString <= KMediumType: */
|
---|
340 | template<> QString toString(const KMediumType &type)
|
---|
341 | {
|
---|
342 | switch (type)
|
---|
343 | {
|
---|
344 | case KMediumType_Normal: return QApplication::translate("UICommon", "Normal", "MediumType");
|
---|
345 | case KMediumType_Immutable: return QApplication::translate("UICommon", "Immutable", "MediumType");
|
---|
346 | case KMediumType_Writethrough: return QApplication::translate("UICommon", "Writethrough", "MediumType");
|
---|
347 | case KMediumType_Shareable: return QApplication::translate("UICommon", "Shareable", "MediumType");
|
---|
348 | case KMediumType_Readonly: return QApplication::translate("UICommon", "Readonly", "MediumType");
|
---|
349 | case KMediumType_MultiAttach: return QApplication::translate("UICommon", "Multi-attach", "MediumType");
|
---|
350 | default: AssertMsgFailed(("No text for %d", type)); break;
|
---|
351 | }
|
---|
352 | return QString();
|
---|
353 | }
|
---|
354 |
|
---|
355 | /* QString <= KMediumVariant: */
|
---|
356 | template<> QString toString(const KMediumVariant &variant)
|
---|
357 | {
|
---|
358 | /* Note: KMediumVariant_Diff and KMediumVariant_Fixed are so far mutually exclusive: */
|
---|
359 | switch ((int)variant)
|
---|
360 | {
|
---|
361 | case KMediumVariant_Standard:
|
---|
362 | return QApplication::translate("UICommon", "Dynamically allocated storage", "MediumVariant");
|
---|
363 | case (KMediumVariant)(KMediumVariant_Standard | KMediumVariant_VdiZeroExpand):
|
---|
364 | return QApplication::translate("UICommon", "New dynamically allocated storage", "MediumVariant");
|
---|
365 | case (KMediumVariant)(KMediumVariant_Standard | KMediumVariant_Diff):
|
---|
366 | return QApplication::translate("UICommon", "Dynamically allocated differencing storage", "MediumVariant");
|
---|
367 | case (KMediumVariant)(KMediumVariant_Standard | KMediumVariant_Fixed):
|
---|
368 | return QApplication::translate("UICommon", "Fixed size storage", "MediumVariant");
|
---|
369 | case (KMediumVariant)(KMediumVariant_Standard | KMediumVariant_VmdkSplit2G):
|
---|
370 | return QApplication::translate("UICommon", "Dynamically allocated storage split into files of less than 2GB", "MediumVariant");
|
---|
371 | case (KMediumVariant)(KMediumVariant_Standard | KMediumVariant_VmdkSplit2G | KMediumVariant_Diff):
|
---|
372 | return QApplication::translate("UICommon", "Dynamically allocated differencing storage split into files of less than 2GB", "MediumVariant");
|
---|
373 | case (KMediumVariant)(KMediumVariant_Standard | KMediumVariant_Fixed | KMediumVariant_VmdkSplit2G):
|
---|
374 | return QApplication::translate("UICommon", "Fixed size storage split into files of less than 2GB", "MediumVariant");
|
---|
375 | case (KMediumVariant)(KMediumVariant_Standard | KMediumVariant_VmdkStreamOptimized):
|
---|
376 | return QApplication::translate("UICommon", "Dynamically allocated compressed storage", "MediumVariant");
|
---|
377 | case (KMediumVariant)(KMediumVariant_Standard | KMediumVariant_VmdkStreamOptimized | KMediumVariant_Diff):
|
---|
378 | return QApplication::translate("UICommon", "Dynamically allocated differencing compressed storage", "MediumVariant");
|
---|
379 | case (KMediumVariant)(KMediumVariant_Standard | KMediumVariant_Fixed | KMediumVariant_VmdkESX):
|
---|
380 | return QApplication::translate("UICommon", "Fixed size ESX storage", "MediumVariant");
|
---|
381 | case (KMediumVariant)(KMediumVariant_Standard | KMediumVariant_Fixed | KMediumVariant_VmdkRawDisk):
|
---|
382 | return QApplication::translate("UICommon", "Fixed size storage on raw disk", "MediumVariant");
|
---|
383 | default:
|
---|
384 | AssertMsgFailed(("No text for %d", variant)); break;
|
---|
385 | }
|
---|
386 | return QString();
|
---|
387 | }
|
---|
388 |
|
---|
389 | /* QString <= KNetworkAttachmentType: */
|
---|
390 | template<> QString toString(const KNetworkAttachmentType &type)
|
---|
391 | {
|
---|
392 | switch (type)
|
---|
393 | {
|
---|
394 | case KNetworkAttachmentType_Null: return QApplication::translate("UICommon", "Not attached", "NetworkAttachmentType");
|
---|
395 | case KNetworkAttachmentType_NAT: return QApplication::translate("UICommon", "NAT", "NetworkAttachmentType");
|
---|
396 | case KNetworkAttachmentType_Bridged: return QApplication::translate("UICommon", "Bridged Adapter", "NetworkAttachmentType");
|
---|
397 | case KNetworkAttachmentType_Internal: return QApplication::translate("UICommon", "Internal Network", "NetworkAttachmentType");
|
---|
398 | #ifndef VBOX_WITH_VMNET
|
---|
399 | case KNetworkAttachmentType_HostOnly: return QApplication::translate("UICommon", "Host-only Adapter", "NetworkAttachmentType");
|
---|
400 | #else /* VBOX_WITH_VMNET */
|
---|
401 | case KNetworkAttachmentType_HostOnly: return QApplication::translate("UICommon", "Host-only Adapter [DEPRECATED]", "NetworkAttachmentType");
|
---|
402 | case KNetworkAttachmentType_HostOnlyNetwork: return QApplication::translate("UICommon", "Host-only Network", "NetworkAttachmentType");
|
---|
403 | #endif /* VBOX_WITH_VMNET */
|
---|
404 | case KNetworkAttachmentType_Generic: return QApplication::translate("UICommon", "Generic Driver", "NetworkAttachmentType");
|
---|
405 | case KNetworkAttachmentType_NATNetwork: return QApplication::translate("UICommon", "NAT Network", "NetworkAttachmentType");
|
---|
406 | #ifdef VBOX_WITH_CLOUD_NET
|
---|
407 | case KNetworkAttachmentType_Cloud: return QApplication::translate("UICommon", "Cloud Network [EXPERIMENTAL]", "NetworkAttachmentType");
|
---|
408 | #endif /* VBOX_WITH_CLOUD_NET */
|
---|
409 | default: AssertMsgFailed(("No text for %d", type)); break;
|
---|
410 | }
|
---|
411 | return QString();
|
---|
412 | }
|
---|
413 |
|
---|
414 | /* QString <= KNetworkAdapterType: */
|
---|
415 | template<> QString toString(const KNetworkAdapterType &type)
|
---|
416 | {
|
---|
417 | switch (type)
|
---|
418 | {
|
---|
419 | case KNetworkAdapterType_Am79C970A: return QApplication::translate("UICommon", "PCnet-PCI II (Am79C970A)", "NetworkAdapterType");
|
---|
420 | case KNetworkAdapterType_Am79C973: return QApplication::translate("UICommon", "PCnet-FAST III (Am79C973)", "NetworkAdapterType");
|
---|
421 | case KNetworkAdapterType_I82540EM: return QApplication::translate("UICommon", "Intel PRO/1000 MT Desktop (82540EM)", "NetworkAdapterType");
|
---|
422 | case KNetworkAdapterType_I82543GC: return QApplication::translate("UICommon", "Intel PRO/1000 T Server (82543GC)", "NetworkAdapterType");
|
---|
423 | case KNetworkAdapterType_I82545EM: return QApplication::translate("UICommon", "Intel PRO/1000 MT Server (82545EM)", "NetworkAdapterType");
|
---|
424 | case KNetworkAdapterType_Virtio: return QApplication::translate("UICommon", "Paravirtualized Network (virtio-net)", "NetworkAdapterType");
|
---|
425 | case KNetworkAdapterType_Am79C960: return QApplication::translate("UICommon", "PCnet-ISA (Am79C960)", "NetworkAdapterType");
|
---|
426 | case KNetworkAdapterType_NE2000: return QApplication::translate("UICommon", "Novell NE2000 (NE2000)", "NetworkAdapterType");
|
---|
427 | case KNetworkAdapterType_NE1000: return QApplication::translate("UICommon", "Novell NE1000 (NE1000)", "NetworkAdapterType");
|
---|
428 | case KNetworkAdapterType_WD8013: return QApplication::translate("UICommon", "WD EtherCard Plus 16 (WD8013EBT)", "NetworkAdapterType");
|
---|
429 | case KNetworkAdapterType_WD8003: return QApplication::translate("UICommon", "WD EtherCard Plus (WD8013E)", "NetworkAdapterType");
|
---|
430 | case KNetworkAdapterType_ELNK2: return QApplication::translate("UICommon", "3Com EtherLink II (3C503)", "NetworkAdapterType");
|
---|
431 | case KNetworkAdapterType_ELNK1: return QApplication::translate("UICommon", "3Com EtherLink (3C501)", "NetworkAdapterType");
|
---|
432 | default: AssertMsgFailed(("No text for %d", type)); break;
|
---|
433 | }
|
---|
434 | return QString();
|
---|
435 | }
|
---|
436 |
|
---|
437 | /* QString <= KNetworkAdapterPromiscModePolicy: */
|
---|
438 | template<> QString toString(const KNetworkAdapterPromiscModePolicy &policy)
|
---|
439 | {
|
---|
440 | switch (policy)
|
---|
441 | {
|
---|
442 | case KNetworkAdapterPromiscModePolicy_Deny:
|
---|
443 | return QApplication::translate("UICommon", "Deny", "NetworkAdapterPromiscModePolicy");
|
---|
444 | case KNetworkAdapterPromiscModePolicy_AllowNetwork:
|
---|
445 | return QApplication::translate("UICommon", "Allow VMs", "NetworkAdapterPromiscModePolicy");
|
---|
446 | case KNetworkAdapterPromiscModePolicy_AllowAll:
|
---|
447 | return QApplication::translate("UICommon", "Allow All", "NetworkAdapterPromiscModePolicy");
|
---|
448 | default:
|
---|
449 | AssertMsgFailed(("No text for %d", policy)); break;
|
---|
450 | }
|
---|
451 | return QString();
|
---|
452 | }
|
---|
453 |
|
---|
454 | /* QString <= KPortMode: */
|
---|
455 | template<> QString toString(const KPortMode &mode)
|
---|
456 | {
|
---|
457 | switch (mode)
|
---|
458 | {
|
---|
459 | case KPortMode_Disconnected: return QApplication::translate("UICommon", "Disconnected", "PortMode");
|
---|
460 | case KPortMode_HostPipe: return QApplication::translate("UICommon", "Host Pipe", "PortMode");
|
---|
461 | case KPortMode_HostDevice: return QApplication::translate("UICommon", "Host Device", "PortMode");
|
---|
462 | case KPortMode_RawFile: return QApplication::translate("UICommon", "Raw File", "PortMode");
|
---|
463 | case KPortMode_TCP: return QApplication::translate("UICommon", "TCP", "PortMode");
|
---|
464 | default: AssertMsgFailed(("No text for %d", mode)); break;
|
---|
465 | }
|
---|
466 | return QString();
|
---|
467 | }
|
---|
468 |
|
---|
469 | /* KPortMode <= QString: */
|
---|
470 | template<> KPortMode fromString<KPortMode>(const QString &strMode)
|
---|
471 | {
|
---|
472 | QHash<QString, KPortMode> list;
|
---|
473 | list.insert(QApplication::translate("UICommon", "Disconnected", "PortMode"), KPortMode_Disconnected);
|
---|
474 | list.insert(QApplication::translate("UICommon", "Host Pipe", "PortMode"), KPortMode_HostPipe);
|
---|
475 | list.insert(QApplication::translate("UICommon", "Host Device", "PortMode"), KPortMode_HostDevice);
|
---|
476 | list.insert(QApplication::translate("UICommon", "Raw File", "PortMode"), KPortMode_RawFile);
|
---|
477 | list.insert(QApplication::translate("UICommon", "TCP", "PortMode"), KPortMode_TCP);
|
---|
478 | if (!list.contains(strMode))
|
---|
479 | {
|
---|
480 | AssertMsgFailed(("No value for '%s'", strMode.toUtf8().constData()));
|
---|
481 | }
|
---|
482 | return list.value(strMode, KPortMode_Disconnected);
|
---|
483 | }
|
---|
484 |
|
---|
485 | /* QString <= KUSBControllerType: */
|
---|
486 | template<> QString toString(const KUSBControllerType &type)
|
---|
487 | {
|
---|
488 | switch (type)
|
---|
489 | {
|
---|
490 | case KUSBControllerType_OHCI: return QApplication::translate("UICommon", "OHCI", "USBControllerType");
|
---|
491 | case KUSBControllerType_EHCI: return QApplication::translate("UICommon", "EHCI", "USBControllerType");
|
---|
492 | case KUSBControllerType_XHCI: return QApplication::translate("UICommon", "xHCI", "USBControllerType");
|
---|
493 | default: AssertMsgFailed(("No text for %d", type)); break;
|
---|
494 | }
|
---|
495 | return QString();
|
---|
496 | }
|
---|
497 |
|
---|
498 | /* QString <= KUSBDeviceState: */
|
---|
499 | template<> QString toString(const KUSBDeviceState &state)
|
---|
500 | {
|
---|
501 | switch (state)
|
---|
502 | {
|
---|
503 | case KUSBDeviceState_NotSupported: return QApplication::translate("UICommon", "Not supported", "USBDeviceState");
|
---|
504 | case KUSBDeviceState_Unavailable: return QApplication::translate("UICommon", "Unavailable", "USBDeviceState");
|
---|
505 | case KUSBDeviceState_Busy: return QApplication::translate("UICommon", "Busy", "USBDeviceState");
|
---|
506 | case KUSBDeviceState_Available: return QApplication::translate("UICommon", "Available", "USBDeviceState");
|
---|
507 | case KUSBDeviceState_Held: return QApplication::translate("UICommon", "Held", "USBDeviceState");
|
---|
508 | case KUSBDeviceState_Captured: return QApplication::translate("UICommon", "Captured", "USBDeviceState");
|
---|
509 | default: AssertMsgFailed(("No text for %d", state)); break;
|
---|
510 | }
|
---|
511 | return QString();
|
---|
512 | }
|
---|
513 |
|
---|
514 | /* QString <= KUSBDeviceFilterAction: */
|
---|
515 | template<> QString toString(const KUSBDeviceFilterAction &action)
|
---|
516 | {
|
---|
517 | switch (action)
|
---|
518 | {
|
---|
519 | case KUSBDeviceFilterAction_Ignore: return QApplication::translate("UICommon", "Ignore", "USBDeviceFilterAction");
|
---|
520 | case KUSBDeviceFilterAction_Hold: return QApplication::translate("UICommon", "Hold", "USBDeviceFilterAction");
|
---|
521 | default: AssertMsgFailed(("No text for %d", action)); break;
|
---|
522 | }
|
---|
523 | return QString();
|
---|
524 | }
|
---|
525 |
|
---|
526 | /* KUSBDeviceFilterAction <= QString: */
|
---|
527 | template<> KUSBDeviceFilterAction fromString<KUSBDeviceFilterAction>(const QString &strAction)
|
---|
528 | {
|
---|
529 | QHash<QString, KUSBDeviceFilterAction> list;
|
---|
530 | list.insert(QApplication::translate("UICommon", "Ignore", "USBDeviceFilterAction"), KUSBDeviceFilterAction_Ignore);
|
---|
531 | list.insert(QApplication::translate("UICommon", "Hold", "USBDeviceFilterAction"), KUSBDeviceFilterAction_Hold);
|
---|
532 | if (!list.contains(strAction))
|
---|
533 | {
|
---|
534 | AssertMsgFailed(("No value for '%s'", strAction.toUtf8().constData()));
|
---|
535 | }
|
---|
536 | return list.value(strAction, KUSBDeviceFilterAction_Null);
|
---|
537 | }
|
---|
538 |
|
---|
539 | /* QString <= KAudioDriverType: */
|
---|
540 | template<> QString toString(const KAudioDriverType &type)
|
---|
541 | {
|
---|
542 | switch (type)
|
---|
543 | {
|
---|
544 | case KAudioDriverType_Default: return QApplication::translate("UICommon", "Default", "AudioDriverType");
|
---|
545 | case KAudioDriverType_Null: return QApplication::translate("UICommon", "Null Audio", "AudioDriverType");
|
---|
546 | case KAudioDriverType_OSS: return QApplication::translate("UICommon", "OSS Audio", "AudioDriverType");
|
---|
547 | case KAudioDriverType_ALSA: return QApplication::translate("UICommon", "ALSA Audio", "AudioDriverType");
|
---|
548 | case KAudioDriverType_Pulse: return QApplication::translate("UICommon", "PulseAudio", "AudioDriverType");
|
---|
549 | case KAudioDriverType_WinMM: return QApplication::translate("UICommon", "Windows Multimedia", "AudioDriverType");
|
---|
550 | case KAudioDriverType_DirectSound: return QApplication::translate("UICommon", "Windows DirectSound", "AudioDriverType");
|
---|
551 | case KAudioDriverType_WAS: return QApplication::translate("UICommon", "Windows Audio Session", "AudioDriverType");
|
---|
552 | case KAudioDriverType_CoreAudio: return QApplication::translate("UICommon", "Core Audio", "AudioDriverType");
|
---|
553 | // case KAudioDriverType_MMPM:
|
---|
554 | case KAudioDriverType_SolAudio: return QApplication::translate("UICommon", "Solaris Audio", "AudioDriverType");
|
---|
555 | default: AssertMsgFailed(("No text for %d", type)); break;
|
---|
556 | }
|
---|
557 | return QString();
|
---|
558 | }
|
---|
559 |
|
---|
560 | /* KAudioDriverType <= QString: */
|
---|
561 | template<> KAudioDriverType fromString<KAudioDriverType>(const QString &strType)
|
---|
562 | {
|
---|
563 | QHash<QString, KAudioDriverType> list;
|
---|
564 | list.insert(QApplication::translate("UICommon", "Default", "AudioDriverType"), KAudioDriverType_Default);
|
---|
565 | list.insert(QApplication::translate("UICommon", "Null Audio", "AudioDriverType"), KAudioDriverType_Null);
|
---|
566 | list.insert(QApplication::translate("UICommon", "OSS Audio", "AudioDriverType"), KAudioDriverType_OSS);
|
---|
567 | list.insert(QApplication::translate("UICommon", "ALSA Audio", "AudioDriverType"), KAudioDriverType_ALSA);
|
---|
568 | list.insert(QApplication::translate("UICommon", "PulseAudio", "AudioDriverType"), KAudioDriverType_Pulse);
|
---|
569 | list.insert(QApplication::translate("UICommon", "Windows Multimedia", "AudioDriverType"), KAudioDriverType_WinMM);
|
---|
570 | list.insert(QApplication::translate("UICommon", "Windows DirectSound", "AudioDriverType"), KAudioDriverType_DirectSound);
|
---|
571 | list.insert(QApplication::translate("UICommon", "Windows Audio Session", "AudioDriverType"), KAudioDriverType_WAS);
|
---|
572 | list.insert(QApplication::translate("UICommon", "Core Audio", "AudioDriverType"), KAudioDriverType_CoreAudio);
|
---|
573 | // list.insert(..., KAudioDriverType_MMPM);
|
---|
574 | list.insert(QApplication::translate("UICommon", "Solaris Audio", "AudioDriverType"), KAudioDriverType_SolAudio);
|
---|
575 | if (!list.contains(strType))
|
---|
576 | {
|
---|
577 | AssertMsgFailed(("No value for '%s'", strType.toUtf8().constData()));
|
---|
578 | }
|
---|
579 | return list.value(strType, KAudioDriverType_Null);
|
---|
580 | }
|
---|
581 |
|
---|
582 | /* QString <= KAudioControllerType: */
|
---|
583 | template<> QString toString(const KAudioControllerType &type)
|
---|
584 | {
|
---|
585 | switch (type)
|
---|
586 | {
|
---|
587 | case KAudioControllerType_AC97: return QApplication::translate("UICommon", "ICH AC97", "AudioControllerType");
|
---|
588 | case KAudioControllerType_SB16: return QApplication::translate("UICommon", "SoundBlaster 16", "AudioControllerType");
|
---|
589 | case KAudioControllerType_HDA: return QApplication::translate("UICommon", "Intel HD Audio", "AudioControllerType");
|
---|
590 | default: AssertMsgFailed(("No text for %d", type)); break;
|
---|
591 | }
|
---|
592 | return QString();
|
---|
593 | }
|
---|
594 |
|
---|
595 | /* KAudioControllerType <= QString: */
|
---|
596 | template<> KAudioControllerType fromString<KAudioControllerType>(const QString &strType)
|
---|
597 | {
|
---|
598 | QHash<QString, KAudioControllerType> list;
|
---|
599 | list.insert(QApplication::translate("UICommon", "ICH AC97", "AudioControllerType"), KAudioControllerType_AC97);
|
---|
600 | list.insert(QApplication::translate("UICommon", "SoundBlaster 16", "AudioControllerType"), KAudioControllerType_SB16);
|
---|
601 | list.insert(QApplication::translate("UICommon", "Intel HD Audio", "AudioControllerType"), KAudioControllerType_HDA);
|
---|
602 | if (!list.contains(strType))
|
---|
603 | {
|
---|
604 | AssertMsgFailed(("No value for '%s'", strType.toUtf8().constData()));
|
---|
605 | }
|
---|
606 | return list.value(strType, KAudioControllerType_AC97);
|
---|
607 | }
|
---|
608 |
|
---|
609 | /* QString <= KAuthType: */
|
---|
610 | template<> QString toString(const KAuthType &type)
|
---|
611 | {
|
---|
612 | switch (type)
|
---|
613 | {
|
---|
614 | case KAuthType_Null: return QApplication::translate("UICommon", "Null", "AuthType");
|
---|
615 | case KAuthType_External: return QApplication::translate("UICommon", "External", "AuthType");
|
---|
616 | case KAuthType_Guest: return QApplication::translate("UICommon", "Guest", "AuthType");
|
---|
617 | default: AssertMsgFailed(("No text for %d", type)); break;
|
---|
618 | }
|
---|
619 | return QString();
|
---|
620 | }
|
---|
621 |
|
---|
622 | /* KAuthType <= QString: */
|
---|
623 | template<> KAuthType fromString<KAuthType>(const QString &strType)
|
---|
624 | {
|
---|
625 | QHash<QString, KAuthType> list;
|
---|
626 | list.insert(QApplication::translate("UICommon", "Null", "AuthType"), KAuthType_Null);
|
---|
627 | list.insert(QApplication::translate("UICommon", "External", "AuthType"), KAuthType_External);
|
---|
628 | list.insert(QApplication::translate("UICommon", "Guest", "AuthType"), KAuthType_Guest);
|
---|
629 | if (!list.contains(strType))
|
---|
630 | {
|
---|
631 | AssertMsgFailed(("No value for '%s'", strType.toUtf8().constData()));
|
---|
632 | }
|
---|
633 | return list.value(strType, KAuthType_Null);
|
---|
634 | }
|
---|
635 |
|
---|
636 | /* QString <= KStorageBus: */
|
---|
637 | template<> QString toString(const KStorageBus &bus)
|
---|
638 | {
|
---|
639 | switch (bus)
|
---|
640 | {
|
---|
641 | case KStorageBus_IDE: return QApplication::translate("UICommon", "IDE", "StorageBus");
|
---|
642 | case KStorageBus_SATA: return QApplication::translate("UICommon", "SATA", "StorageBus");
|
---|
643 | case KStorageBus_SCSI: return QApplication::translate("UICommon", "SCSI", "StorageBus");
|
---|
644 | case KStorageBus_Floppy: return QApplication::translate("UICommon", "Floppy", "StorageBus");
|
---|
645 | case KStorageBus_SAS: return QApplication::translate("UICommon", "SAS", "StorageBus");
|
---|
646 | case KStorageBus_USB: return QApplication::translate("UICommon", "USB", "StorageBus");
|
---|
647 | case KStorageBus_PCIe: return QApplication::translate("UICommon", "PCIe", "StorageBus");
|
---|
648 | case KStorageBus_VirtioSCSI: return QApplication::translate("UICommon", "virtio-scsi", "StorageBus");
|
---|
649 | default: AssertMsgFailed(("No text for %d", bus)); break;
|
---|
650 | }
|
---|
651 | return QString();
|
---|
652 | }
|
---|
653 |
|
---|
654 | /* KStorageBus <= QString: */
|
---|
655 | template<> KStorageBus fromString<KStorageBus>(const QString &strType)
|
---|
656 | {
|
---|
657 | QHash<QString, KStorageBus> list;
|
---|
658 | list.insert(QApplication::translate("UICommon", "IDE", "StorageBus"), KStorageBus_IDE);
|
---|
659 | list.insert(QApplication::translate("UICommon", "SATA", "StorageBus"), KStorageBus_SATA);
|
---|
660 | list.insert(QApplication::translate("UICommon", "SCSI", "StorageBus"), KStorageBus_SCSI);
|
---|
661 | list.insert(QApplication::translate("UICommon", "Floppy", "StorageBus"), KStorageBus_Floppy);
|
---|
662 | list.insert(QApplication::translate("UICommon", "SAS", "StorageBus"), KStorageBus_SAS);
|
---|
663 | list.insert(QApplication::translate("UICommon", "USB", "StorageBus"), KStorageBus_USB);
|
---|
664 | list.insert(QApplication::translate("UICommon", "PCIe", "StorageBus"), KStorageBus_PCIe);
|
---|
665 | list.insert(QApplication::translate("UICommon", "virtio-scsi", "StorageBus"), KStorageBus_VirtioSCSI);
|
---|
666 | if (!list.contains(strType))
|
---|
667 | {
|
---|
668 | AssertMsgFailed(("No value for '%s'", strType.toUtf8().constData()));
|
---|
669 | }
|
---|
670 | return list.value(strType, KStorageBus_Null);
|
---|
671 | }
|
---|
672 |
|
---|
673 | /* QString <= KStorageControllerType: */
|
---|
674 | template<> QString toString(const KStorageControllerType &type)
|
---|
675 | {
|
---|
676 | switch (type)
|
---|
677 | {
|
---|
678 | case KStorageControllerType_LsiLogic: return QApplication::translate("UICommon", "LsiLogic", "StorageControllerType");
|
---|
679 | case KStorageControllerType_BusLogic: return QApplication::translate("UICommon", "BusLogic", "StorageControllerType");
|
---|
680 | case KStorageControllerType_IntelAhci: return QApplication::translate("UICommon", "AHCI", "StorageControllerType");
|
---|
681 | case KStorageControllerType_PIIX3: return QApplication::translate("UICommon", "PIIX3", "StorageControllerType");
|
---|
682 | case KStorageControllerType_PIIX4: return QApplication::translate("UICommon", "PIIX4", "StorageControllerType");
|
---|
683 | case KStorageControllerType_ICH6: return QApplication::translate("UICommon", "ICH6", "StorageControllerType");
|
---|
684 | case KStorageControllerType_I82078: return QApplication::translate("UICommon", "I82078", "StorageControllerType");
|
---|
685 | case KStorageControllerType_LsiLogicSas: return QApplication::translate("UICommon", "LsiLogic SAS", "StorageControllerType");
|
---|
686 | case KStorageControllerType_USB: return QApplication::translate("UICommon", "USB", "StorageControllerType");
|
---|
687 | case KStorageControllerType_NVMe: return QApplication::translate("UICommon", "NVMe", "StorageControllerType");
|
---|
688 | case KStorageControllerType_VirtioSCSI: return QApplication::translate("UICommon", "virtio-scsi", "StorageControllerType");
|
---|
689 | default: AssertMsgFailed(("No text for %d", type)); break;
|
---|
690 | }
|
---|
691 | return QString();
|
---|
692 | }
|
---|
693 |
|
---|
694 | /* KStorageControllerType <= QString: */
|
---|
695 | template<> KStorageControllerType fromString<KStorageControllerType>(const QString &strType)
|
---|
696 | {
|
---|
697 | QHash<QString, KStorageControllerType> list;
|
---|
698 | list.insert(QApplication::translate("UICommon", "LsiLogic", "StorageControllerType"), KStorageControllerType_LsiLogic);
|
---|
699 | list.insert(QApplication::translate("UICommon", "BusLogic", "StorageControllerType"), KStorageControllerType_BusLogic);
|
---|
700 | list.insert(QApplication::translate("UICommon", "AHCI", "StorageControllerType"), KStorageControllerType_IntelAhci);
|
---|
701 | list.insert(QApplication::translate("UICommon", "PIIX3", "StorageControllerType"), KStorageControllerType_PIIX3);
|
---|
702 | list.insert(QApplication::translate("UICommon", "PIIX4", "StorageControllerType"), KStorageControllerType_PIIX4);
|
---|
703 | list.insert(QApplication::translate("UICommon", "ICH6", "StorageControllerType"), KStorageControllerType_ICH6);
|
---|
704 | list.insert(QApplication::translate("UICommon", "I82078", "StorageControllerType"), KStorageControllerType_I82078);
|
---|
705 | list.insert(QApplication::translate("UICommon", "LsiLogic SAS", "StorageControllerType"), KStorageControllerType_LsiLogicSas);
|
---|
706 | list.insert(QApplication::translate("UICommon", "USB", "StorageControllerType"), KStorageControllerType_USB);
|
---|
707 | list.insert(QApplication::translate("UICommon", "NVMe", "StorageControllerType"), KStorageControllerType_NVMe);
|
---|
708 | list.insert(QApplication::translate("UICommon", "virtio-scsi", "StorageControllerType"), KStorageControllerType_VirtioSCSI);
|
---|
709 | if (!list.contains(strType))
|
---|
710 | {
|
---|
711 | AssertMsgFailed(("No value for '%s'", strType.toUtf8().constData()));
|
---|
712 | }
|
---|
713 | return list.value(strType, KStorageControllerType_Null);
|
---|
714 | }
|
---|
715 |
|
---|
716 | /* QString <= KChipsetType: */
|
---|
717 | template<> QString toString(const KChipsetType &type)
|
---|
718 | {
|
---|
719 | switch (type)
|
---|
720 | {
|
---|
721 | case KChipsetType_PIIX3: return QApplication::translate("UICommon", "PIIX3", "ChipsetType");
|
---|
722 | case KChipsetType_ICH9: return QApplication::translate("UICommon", "ICH9", "ChipsetType");
|
---|
723 | default: AssertMsgFailed(("No text for %d", type)); break;
|
---|
724 | }
|
---|
725 | return QString();
|
---|
726 | }
|
---|
727 |
|
---|
728 | /* QString <= KTpmType: */
|
---|
729 | template<> QString toString(const KTpmType &type)
|
---|
730 | {
|
---|
731 | switch (type)
|
---|
732 | {
|
---|
733 | case KTpmType_None: return QApplication::translate("UICommon", "None", "TpmType");
|
---|
734 | case KTpmType_v1_2: return QApplication::translate("UICommon", "v1.2", "TpmType");
|
---|
735 | case KTpmType_v2_0: return QApplication::translate("UICommon", "v2.0", "TpmType");
|
---|
736 | case KTpmType_Host: return QApplication::translate("UICommon", "Host", "TpmType");
|
---|
737 | case KTpmType_Swtpm: return QApplication::translate("UICommon", "SWTPM", "TpmType");
|
---|
738 | default: AssertMsgFailed(("No text for %d", type)); break;
|
---|
739 | }
|
---|
740 | return QString();
|
---|
741 | }
|
---|
742 |
|
---|
743 | /* QString <= KNATProtocol: */
|
---|
744 | template<> QString toString(const KNATProtocol &protocol)
|
---|
745 | {
|
---|
746 | switch (protocol)
|
---|
747 | {
|
---|
748 | case KNATProtocol_UDP: return QApplication::translate("UICommon", "UDP", "NATProtocol");
|
---|
749 | case KNATProtocol_TCP: return QApplication::translate("UICommon", "TCP", "NATProtocol");
|
---|
750 | default: AssertMsgFailed(("No text for %d", protocol)); break;
|
---|
751 | }
|
---|
752 | return QString();
|
---|
753 | }
|
---|
754 |
|
---|
755 | /* QString <= KNATProtocol: */
|
---|
756 | template<> QString toInternalString(const KNATProtocol &protocol)
|
---|
757 | {
|
---|
758 | QString strResult;
|
---|
759 | switch (protocol)
|
---|
760 | {
|
---|
761 | case KNATProtocol_UDP: strResult = "udp"; break;
|
---|
762 | case KNATProtocol_TCP: strResult = "tcp"; break;
|
---|
763 | default: AssertMsgFailed(("No text for protocol type=%d", protocol)); break;
|
---|
764 | }
|
---|
765 | return strResult;
|
---|
766 | }
|
---|
767 |
|
---|
768 | /* KNATProtocol <= QString: */
|
---|
769 | template<> KNATProtocol fromInternalString<KNATProtocol>(const QString &strProtocol)
|
---|
770 | {
|
---|
771 | if (strProtocol.compare("udp", Qt::CaseInsensitive) == 0)
|
---|
772 | return KNATProtocol_UDP;
|
---|
773 | if (strProtocol.compare("tcp", Qt::CaseInsensitive) == 0)
|
---|
774 | return KNATProtocol_TCP;
|
---|
775 | AssertMsgFailedReturn(("No value for '%s'", strProtocol.toUtf8().constData()), KNATProtocol_UDP);
|
---|
776 | }
|
---|
777 |
|
---|
778 | /* QString <= KGuestSessionStatus: */
|
---|
779 | template<> QString toString(const KGuestSessionStatus &status)
|
---|
780 | {
|
---|
781 | switch (status)
|
---|
782 | {
|
---|
783 | case KGuestSessionStatus_Undefined: return QApplication::translate("UICommon", "Undefined", "GuestSessionStatus");
|
---|
784 | case KGuestSessionStatus_Starting: return QApplication::translate("UICommon", "Starting", "GuestSessionStatus");
|
---|
785 | case KGuestSessionStatus_Started: return QApplication::translate("UICommon", "Started", "GuestSessionStatus");
|
---|
786 | case KGuestSessionStatus_Terminating: return QApplication::translate("UICommon", "Terminating", "GuestSessionStatus");
|
---|
787 | case KGuestSessionStatus_Terminated: return QApplication::translate("UICommon", "Terminated", "GuestSessionStatus");
|
---|
788 | case KGuestSessionStatus_TimedOutKilled: return QApplication::translate("UICommon", "Timed Out (Killed)", "GuestSessionStatus");
|
---|
789 | case KGuestSessionStatus_TimedOutAbnormally: return QApplication::translate("UICommon", "Timed Out (Abnormally)", "GuestSessionStatus");
|
---|
790 | case KGuestSessionStatus_Down: return QApplication::translate("UICommon", "Down", "GuestSessionStatus");
|
---|
791 | case KGuestSessionStatus_Error: return QApplication::translate("UICommon", "Error", "GuestSessionStatus");
|
---|
792 | default: AssertMsgFailed(("No text for %d", status)); break;
|
---|
793 | }
|
---|
794 | return QString();
|
---|
795 | }
|
---|
796 |
|
---|
797 | /* KGuestSessionStatus <= QString: */
|
---|
798 | template<> KGuestSessionStatus fromString<KGuestSessionStatus>(const QString &strStatus)
|
---|
799 | {
|
---|
800 | QHash<QString, KGuestSessionStatus> list;
|
---|
801 | list.insert(QApplication::translate("UICommon", "Undefined", "GuestSessionStatus"), KGuestSessionStatus_Undefined);
|
---|
802 | list.insert(QApplication::translate("UICommon", "Starting", "GuestSessionStatus"), KGuestSessionStatus_Starting);
|
---|
803 | list.insert(QApplication::translate("UICommon", "Started", "GuestSessionStatus"), KGuestSessionStatus_Started);
|
---|
804 | list.insert(QApplication::translate("UICommon", "Terminating", "GuestSessionStatus"), KGuestSessionStatus_Terminating);
|
---|
805 | list.insert(QApplication::translate("UICommon", "Terminated", "GuestSessionStatus"), KGuestSessionStatus_Terminated);
|
---|
806 | list.insert(QApplication::translate("UICommon", "Timed Out (Killed)", "GuestSessionStatus"), KGuestSessionStatus_TimedOutKilled);
|
---|
807 | list.insert(QApplication::translate("UICommon", "Timed Out (Abnormally)", "GuestSessionStatus"), KGuestSessionStatus_TimedOutAbnormally);
|
---|
808 | list.insert(QApplication::translate("UICommon", "Down", "GuestSessionStatus"), KGuestSessionStatus_Down);
|
---|
809 | list.insert(QApplication::translate("UICommon", "Error", "GuestSessionStatus"), KGuestSessionStatus_Error);
|
---|
810 | if (!list.contains(strStatus))
|
---|
811 | {
|
---|
812 | AssertMsgFailed(("No value for '%s'", strStatus.toUtf8().constData()));
|
---|
813 | }
|
---|
814 | return list.value(strStatus, KGuestSessionStatus_Undefined);
|
---|
815 | }
|
---|
816 |
|
---|
817 | /* QString <= KProcessStatus: */
|
---|
818 | template<> QString toString(const KProcessStatus &status)
|
---|
819 | {
|
---|
820 | switch (status)
|
---|
821 | {
|
---|
822 | case KProcessStatus_Undefined: return QApplication::translate("UICommon", "Undefined", "ProcessStatus");
|
---|
823 | case KProcessStatus_Starting: return QApplication::translate("UICommon", "Starting", "ProcessStatus");
|
---|
824 | case KProcessStatus_Started: return QApplication::translate("UICommon", "Started", "ProcessStatus");
|
---|
825 | case KProcessStatus_Paused: return QApplication::translate("UICommon", "Paused", "ProcessStatus");
|
---|
826 | case KProcessStatus_Terminating: return QApplication::translate("UICommon", "Terminating", "ProcessStatus");
|
---|
827 | case KProcessStatus_TerminatedNormally: return QApplication::translate("UICommon", "Terminated (Normally)", "ProcessStatus");
|
---|
828 | case KProcessStatus_TerminatedSignal: return QApplication::translate("UICommon", "Terminated (Signal)", "ProcessStatus");
|
---|
829 | case KProcessStatus_TerminatedAbnormally: return QApplication::translate("UICommon", "Terminated (Abnormally)", "ProcessStatus");
|
---|
830 | case KProcessStatus_TimedOutKilled: return QApplication::translate("UICommon", "Timed Out (Killed)", "ProcessStatus");
|
---|
831 | case KProcessStatus_TimedOutAbnormally: return QApplication::translate("UICommon", "Timed Out (Abnormally)", "ProcessStatus");
|
---|
832 | case KProcessStatus_Down: return QApplication::translate("UICommon", "Down", "ProcessStatus");
|
---|
833 | case KProcessStatus_Error: return QApplication::translate("UICommon", "Error", "ProcessStatus");
|
---|
834 | default: AssertMsgFailed(("No text for %d", status)); break;
|
---|
835 | }
|
---|
836 | return QString();
|
---|
837 | }
|
---|
838 |
|
---|
839 | /* KProcessStatus <= QString: */
|
---|
840 | template<> KProcessStatus fromString<KProcessStatus>(const QString &strStatus)
|
---|
841 | {
|
---|
842 | QHash<QString, KProcessStatus> list;
|
---|
843 | list.insert(QApplication::translate("UICommon", "Undefined", "ProcessStatus"), KProcessStatus_Undefined);
|
---|
844 | list.insert(QApplication::translate("UICommon", "Starting", "ProcessStatus"), KProcessStatus_Starting);
|
---|
845 | list.insert(QApplication::translate("UICommon", "Started", "ProcessStatus"), KProcessStatus_Started);
|
---|
846 | list.insert(QApplication::translate("UICommon", "Paused", "ProcessStatus"), KProcessStatus_Paused);
|
---|
847 | list.insert(QApplication::translate("UICommon", "Terminating", "ProcessStatus"), KProcessStatus_Terminating);
|
---|
848 | list.insert(QApplication::translate("UICommon", "Terminated (Normally)", "ProcessStatus"), KProcessStatus_TerminatedNormally);
|
---|
849 | list.insert(QApplication::translate("UICommon", "Terminated (Signal)", "ProcessStatus"), KProcessStatus_TerminatedSignal);
|
---|
850 | list.insert(QApplication::translate("UICommon", "Terminated (Abnormally)", "ProcessStatus"), KProcessStatus_TerminatedAbnormally);
|
---|
851 | list.insert(QApplication::translate("UICommon", "Timed Out (Killed)", "ProcessStatus"), KProcessStatus_TimedOutKilled);
|
---|
852 | list.insert(QApplication::translate("UICommon", "Timed Out (Abnormally)", "ProcessStatus"), KProcessStatus_TimedOutAbnormally);
|
---|
853 | list.insert(QApplication::translate("UICommon", "Down", "ProcessStatus"), KProcessStatus_Down);
|
---|
854 | list.insert(QApplication::translate("UICommon", "Error", "ProcessStatus"), KProcessStatus_Error);
|
---|
855 | if (!list.contains(strStatus))
|
---|
856 | {
|
---|
857 | AssertMsgFailed(("No value for '%s'", strStatus.toUtf8().constData()));
|
---|
858 | }
|
---|
859 | return list.value(strStatus, KProcessStatus_Undefined);
|
---|
860 | }
|
---|