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