1 | /* $Id: UIConverterBackendCOM.cpp 103803 2024-03-12 11:15:18Z 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 "UIConverter.h"
|
---|
34 | #include "UIIconPool.h"
|
---|
35 |
|
---|
36 | /* Other VBox includes: */
|
---|
37 | #include "iprt/assert.h"
|
---|
38 |
|
---|
39 | /* COM includes: */
|
---|
40 | #include "KAudioControllerType.h"
|
---|
41 | #include "KAuthType.h"
|
---|
42 | #include "KAudioDriverType.h"
|
---|
43 | #include "KChipsetType.h"
|
---|
44 | #include "KClipboardMode.h"
|
---|
45 | #include "KCloudMachineState.h"
|
---|
46 | #include "KDeviceType.h"
|
---|
47 | #include "KDnDMode.h"
|
---|
48 | #include "KGraphicsControllerType.h"
|
---|
49 | #include "KGuestSessionStatus.h"
|
---|
50 | #include "KMachineState.h"
|
---|
51 | #include "KMediumType.h"
|
---|
52 | #include "KMediumVariant.h"
|
---|
53 | #include "KMetricType.h"
|
---|
54 | #include "KNATProtocol.h"
|
---|
55 | #include "KNetworkAdapterType.h"
|
---|
56 | #include "KNetworkAttachmentType.h"
|
---|
57 | #include "KNetworkAdapterPromiscModePolicy.h"
|
---|
58 | #include "KParavirtProvider.h"
|
---|
59 | #include "KPointingHIDType.h"
|
---|
60 | #include "KAudioDriverType.h"
|
---|
61 | #include "KPortMode.h"
|
---|
62 | #include "KProcessStatus.h"
|
---|
63 | #include "KSessionState.h"
|
---|
64 | #include "KStorageBus.h"
|
---|
65 | #include "KStorageControllerType.h"
|
---|
66 | #include "KTpmType.h"
|
---|
67 | #include "KUSBControllerType.h"
|
---|
68 | #include "KUSBDeviceFilterAction.h"
|
---|
69 | #include "KUSBDeviceState.h"
|
---|
70 |
|
---|
71 | /* QIcon <= KCloudMachineState: */
|
---|
72 | template<> SHARED_LIBRARY_STUFF QIcon UIConverter::toIcon(const KCloudMachineState &state) const
|
---|
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<> SHARED_LIBRARY_STUFF QString UIConverter::toString(const KCloudMachineState &state) const
|
---|
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<> SHARED_LIBRARY_STUFF QColor UIConverter::toColor(const KMachineState &state) const
|
---|
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<> SHARED_LIBRARY_STUFF QIcon UIConverter::toIcon(const KMachineState &state) const
|
---|
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<> SHARED_LIBRARY_STUFF QString UIConverter::toString(const KMachineState &state) const
|
---|
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<> SHARED_LIBRARY_STUFF QString UIConverter::toString(const KSessionState &state) const
|
---|
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<> SHARED_LIBRARY_STUFF QString UIConverter::toString(const KParavirtProvider &type) const
|
---|
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<> SHARED_LIBRARY_STUFF QString UIConverter::toString(const KDeviceType &type) const
|
---|
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<> SHARED_LIBRARY_STUFF QString UIConverter::toString(const KClipboardMode &mode) const
|
---|
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<> SHARED_LIBRARY_STUFF QString UIConverter::toString(const KDnDMode &mode) const
|
---|
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<> SHARED_LIBRARY_STUFF QString UIConverter::toString(const KPointingHIDType &type) const
|
---|
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<> SHARED_LIBRARY_STUFF QString UIConverter::toString(const KGraphicsControllerType &type) const
|
---|
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 | case KGraphicsControllerType_QemuRamFB: return QApplication::translate("UICommon", "QemuRamFB", "GraphicsControllerType");
|
---|
320 | default: AssertMsgFailed(("No text for %d", type)); break;
|
---|
321 | }
|
---|
322 | return QString();
|
---|
323 | }
|
---|
324 |
|
---|
325 | /* KGraphicsControllerType <= QString: */
|
---|
326 | template<> SHARED_LIBRARY_STUFF KGraphicsControllerType UIConverter::fromString<KGraphicsControllerType>(const QString &strType) const
|
---|
327 | {
|
---|
328 | QHash<QString, KGraphicsControllerType> list;
|
---|
329 | list.insert(QApplication::translate("UICommon", "None", "GraphicsControllerType"), KGraphicsControllerType_Null);
|
---|
330 | list.insert(QApplication::translate("UICommon", "VBoxVGA", "GraphicsControllerType"), KGraphicsControllerType_VBoxVGA);
|
---|
331 | list.insert(QApplication::translate("UICommon", "VMSVGA", "GraphicsControllerType"), KGraphicsControllerType_VMSVGA);
|
---|
332 | list.insert(QApplication::translate("UICommon", "VBoxSVGA", "GraphicsControllerType"), KGraphicsControllerType_VBoxSVGA);
|
---|
333 | list.insert(QApplication::translate("UICommon", "QemuRamFB", "GraphicsControllerType"), KGraphicsControllerType_QemuRamFB);
|
---|
334 | if (!list.contains(strType))
|
---|
335 | {
|
---|
336 | AssertMsgFailed(("No value for '%s'", strType.toUtf8().constData()));
|
---|
337 | }
|
---|
338 | return list.value(strType, KGraphicsControllerType_Null);
|
---|
339 | }
|
---|
340 |
|
---|
341 | /* QString <= KMediumType: */
|
---|
342 | template<> SHARED_LIBRARY_STUFF QString UIConverter::toString(const KMediumType &type) const
|
---|
343 | {
|
---|
344 | switch (type)
|
---|
345 | {
|
---|
346 | case KMediumType_Normal: return QApplication::translate("UICommon", "Normal", "MediumType");
|
---|
347 | case KMediumType_Immutable: return QApplication::translate("UICommon", "Immutable", "MediumType");
|
---|
348 | case KMediumType_Writethrough: return QApplication::translate("UICommon", "Writethrough", "MediumType");
|
---|
349 | case KMediumType_Shareable: return QApplication::translate("UICommon", "Shareable", "MediumType");
|
---|
350 | case KMediumType_Readonly: return QApplication::translate("UICommon", "Readonly", "MediumType");
|
---|
351 | case KMediumType_MultiAttach: return QApplication::translate("UICommon", "Multi-attach", "MediumType");
|
---|
352 | default: AssertMsgFailed(("No text for %d", type)); break;
|
---|
353 | }
|
---|
354 | return QString();
|
---|
355 | }
|
---|
356 |
|
---|
357 | /* QString <= KMediumVariant: */
|
---|
358 | template<> SHARED_LIBRARY_STUFF QString UIConverter::toString(const KMediumVariant &variant) const
|
---|
359 | {
|
---|
360 | /* Note: KMediumVariant_Diff and KMediumVariant_Fixed are so far mutually exclusive: */
|
---|
361 | switch ((int)variant)
|
---|
362 | {
|
---|
363 | case KMediumVariant_Standard:
|
---|
364 | return QApplication::translate("UICommon", "Dynamically allocated storage", "MediumVariant");
|
---|
365 | case (KMediumVariant)(KMediumVariant_Standard | KMediumVariant_VdiZeroExpand):
|
---|
366 | return QApplication::translate("UICommon", "New dynamically allocated storage", "MediumVariant");
|
---|
367 | case (KMediumVariant)(KMediumVariant_Standard | KMediumVariant_Diff):
|
---|
368 | return QApplication::translate("UICommon", "Dynamically allocated differencing storage", "MediumVariant");
|
---|
369 | case (KMediumVariant)(KMediumVariant_Standard | KMediumVariant_Fixed):
|
---|
370 | return QApplication::translate("UICommon", "Fixed size storage", "MediumVariant");
|
---|
371 | case (KMediumVariant)(KMediumVariant_Standard | KMediumVariant_VmdkSplit2G):
|
---|
372 | return QApplication::translate("UICommon", "Dynamically allocated storage split into files of less than 2GB", "MediumVariant");
|
---|
373 | case (KMediumVariant)(KMediumVariant_Standard | KMediumVariant_VmdkSplit2G | KMediumVariant_Diff):
|
---|
374 | return QApplication::translate("UICommon", "Dynamically allocated differencing storage split into files of less than 2GB", "MediumVariant");
|
---|
375 | case (KMediumVariant)(KMediumVariant_Standard | KMediumVariant_Fixed | KMediumVariant_VmdkSplit2G):
|
---|
376 | return QApplication::translate("UICommon", "Fixed size storage split into files of less than 2GB", "MediumVariant");
|
---|
377 | case (KMediumVariant)(KMediumVariant_Standard | KMediumVariant_VmdkStreamOptimized):
|
---|
378 | return QApplication::translate("UICommon", "Dynamically allocated compressed storage", "MediumVariant");
|
---|
379 | case (KMediumVariant)(KMediumVariant_Standard | KMediumVariant_VmdkStreamOptimized | KMediumVariant_Diff):
|
---|
380 | return QApplication::translate("UICommon", "Dynamically allocated differencing compressed storage", "MediumVariant");
|
---|
381 | case (KMediumVariant)(KMediumVariant_Standard | KMediumVariant_Fixed | KMediumVariant_VmdkESX):
|
---|
382 | return QApplication::translate("UICommon", "Fixed size ESX storage", "MediumVariant");
|
---|
383 | case (KMediumVariant)(KMediumVariant_Standard | KMediumVariant_Fixed | KMediumVariant_VmdkRawDisk):
|
---|
384 | return QApplication::translate("UICommon", "Fixed size storage on raw disk", "MediumVariant");
|
---|
385 | default:
|
---|
386 | AssertMsgFailed(("No text for %d", variant)); break;
|
---|
387 | }
|
---|
388 | return QString();
|
---|
389 | }
|
---|
390 |
|
---|
391 | /* QString <= KNetworkAttachmentType: */
|
---|
392 | template<> SHARED_LIBRARY_STUFF QString UIConverter::toString(const KNetworkAttachmentType &type) const
|
---|
393 | {
|
---|
394 | switch (type)
|
---|
395 | {
|
---|
396 | case KNetworkAttachmentType_Null: return QApplication::translate("UICommon", "Not attached", "NetworkAttachmentType");
|
---|
397 | case KNetworkAttachmentType_NAT: return QApplication::translate("UICommon", "NAT", "NetworkAttachmentType");
|
---|
398 | case KNetworkAttachmentType_Bridged: return QApplication::translate("UICommon", "Bridged Adapter", "NetworkAttachmentType");
|
---|
399 | case KNetworkAttachmentType_Internal: return QApplication::translate("UICommon", "Internal Network", "NetworkAttachmentType");
|
---|
400 | #ifndef VBOX_WITH_VMNET
|
---|
401 | case KNetworkAttachmentType_HostOnly: return QApplication::translate("UICommon", "Host-only Adapter", "NetworkAttachmentType");
|
---|
402 | #else /* VBOX_WITH_VMNET */
|
---|
403 | case KNetworkAttachmentType_HostOnly: return QApplication::translate("UICommon", "Host-only Adapter [DEPRECATED]", "NetworkAttachmentType");
|
---|
404 | case KNetworkAttachmentType_HostOnlyNetwork: return QApplication::translate("UICommon", "Host-only Network", "NetworkAttachmentType");
|
---|
405 | #endif /* VBOX_WITH_VMNET */
|
---|
406 | case KNetworkAttachmentType_Generic: return QApplication::translate("UICommon", "Generic Driver", "NetworkAttachmentType");
|
---|
407 | case KNetworkAttachmentType_NATNetwork: return QApplication::translate("UICommon", "NAT Network", "NetworkAttachmentType");
|
---|
408 | #ifdef VBOX_WITH_CLOUD_NET
|
---|
409 | case KNetworkAttachmentType_Cloud: return QApplication::translate("UICommon", "Cloud Network [EXPERIMENTAL]", "NetworkAttachmentType");
|
---|
410 | #endif /* VBOX_WITH_CLOUD_NET */
|
---|
411 | default: AssertMsgFailed(("No text for %d", type)); break;
|
---|
412 | }
|
---|
413 | return QString();
|
---|
414 | }
|
---|
415 |
|
---|
416 | /* QString <= KNetworkAdapterType: */
|
---|
417 | template<> SHARED_LIBRARY_STUFF QString UIConverter::toString(const KNetworkAdapterType &type) const
|
---|
418 | {
|
---|
419 | switch (type)
|
---|
420 | {
|
---|
421 | case KNetworkAdapterType_Am79C970A: return QApplication::translate("UICommon", "PCnet-PCI II (Am79C970A)", "NetworkAdapterType");
|
---|
422 | case KNetworkAdapterType_Am79C973: return QApplication::translate("UICommon", "PCnet-FAST III (Am79C973)", "NetworkAdapterType");
|
---|
423 | case KNetworkAdapterType_I82540EM: return QApplication::translate("UICommon", "Intel PRO/1000 MT Desktop (82540EM)", "NetworkAdapterType");
|
---|
424 | case KNetworkAdapterType_I82543GC: return QApplication::translate("UICommon", "Intel PRO/1000 T Server (82543GC)", "NetworkAdapterType");
|
---|
425 | case KNetworkAdapterType_I82545EM: return QApplication::translate("UICommon", "Intel PRO/1000 MT Server (82545EM)", "NetworkAdapterType");
|
---|
426 | case KNetworkAdapterType_Virtio: return QApplication::translate("UICommon", "Paravirtualized Network (virtio-net)", "NetworkAdapterType");
|
---|
427 | case KNetworkAdapterType_Am79C960: return QApplication::translate("UICommon", "PCnet-ISA (Am79C960)", "NetworkAdapterType");
|
---|
428 | case KNetworkAdapterType_NE2000: return QApplication::translate("UICommon", "Novell NE2000 (NE2000)", "NetworkAdapterType");
|
---|
429 | case KNetworkAdapterType_NE1000: return QApplication::translate("UICommon", "Novell NE1000 (NE1000)", "NetworkAdapterType");
|
---|
430 | case KNetworkAdapterType_WD8013: return QApplication::translate("UICommon", "WD EtherCard Plus 16 (WD8013EBT)", "NetworkAdapterType");
|
---|
431 | case KNetworkAdapterType_WD8003: return QApplication::translate("UICommon", "WD EtherCard Plus (WD8013E)", "NetworkAdapterType");
|
---|
432 | case KNetworkAdapterType_ELNK2: return QApplication::translate("UICommon", "3Com EtherLink II (3C503)", "NetworkAdapterType");
|
---|
433 | case KNetworkAdapterType_ELNK1: return QApplication::translate("UICommon", "3Com EtherLink (3C501)", "NetworkAdapterType");
|
---|
434 | default: AssertMsgFailed(("No text for %d", type)); break;
|
---|
435 | }
|
---|
436 | return QString();
|
---|
437 | }
|
---|
438 |
|
---|
439 | /* QString <= KNetworkAdapterPromiscModePolicy: */
|
---|
440 | template<> SHARED_LIBRARY_STUFF QString UIConverter::toString(const KNetworkAdapterPromiscModePolicy &policy) const
|
---|
441 | {
|
---|
442 | switch (policy)
|
---|
443 | {
|
---|
444 | case KNetworkAdapterPromiscModePolicy_Deny:
|
---|
445 | return QApplication::translate("UICommon", "Deny", "NetworkAdapterPromiscModePolicy");
|
---|
446 | case KNetworkAdapterPromiscModePolicy_AllowNetwork:
|
---|
447 | return QApplication::translate("UICommon", "Allow VMs", "NetworkAdapterPromiscModePolicy");
|
---|
448 | case KNetworkAdapterPromiscModePolicy_AllowAll:
|
---|
449 | return QApplication::translate("UICommon", "Allow All", "NetworkAdapterPromiscModePolicy");
|
---|
450 | default:
|
---|
451 | AssertMsgFailed(("No text for %d", policy)); break;
|
---|
452 | }
|
---|
453 | return QString();
|
---|
454 | }
|
---|
455 |
|
---|
456 | /* QString <= KPortMode: */
|
---|
457 | template<> SHARED_LIBRARY_STUFF QString UIConverter::toString(const KPortMode &mode) const
|
---|
458 | {
|
---|
459 | switch (mode)
|
---|
460 | {
|
---|
461 | case KPortMode_Disconnected: return QApplication::translate("UICommon", "Disconnected", "PortMode");
|
---|
462 | case KPortMode_HostPipe: return QApplication::translate("UICommon", "Host Pipe", "PortMode");
|
---|
463 | case KPortMode_HostDevice: return QApplication::translate("UICommon", "Host Device", "PortMode");
|
---|
464 | case KPortMode_RawFile: return QApplication::translate("UICommon", "Raw File", "PortMode");
|
---|
465 | case KPortMode_TCP: return QApplication::translate("UICommon", "TCP", "PortMode");
|
---|
466 | default: AssertMsgFailed(("No text for %d", mode)); break;
|
---|
467 | }
|
---|
468 | return QString();
|
---|
469 | }
|
---|
470 |
|
---|
471 | /* KPortMode <= QString: */
|
---|
472 | template<> SHARED_LIBRARY_STUFF KPortMode UIConverter::fromString<KPortMode>(const QString &strMode) const
|
---|
473 | {
|
---|
474 | QHash<QString, KPortMode> list;
|
---|
475 | list.insert(QApplication::translate("UICommon", "Disconnected", "PortMode"), KPortMode_Disconnected);
|
---|
476 | list.insert(QApplication::translate("UICommon", "Host Pipe", "PortMode"), KPortMode_HostPipe);
|
---|
477 | list.insert(QApplication::translate("UICommon", "Host Device", "PortMode"), KPortMode_HostDevice);
|
---|
478 | list.insert(QApplication::translate("UICommon", "Raw File", "PortMode"), KPortMode_RawFile);
|
---|
479 | list.insert(QApplication::translate("UICommon", "TCP", "PortMode"), KPortMode_TCP);
|
---|
480 | if (!list.contains(strMode))
|
---|
481 | {
|
---|
482 | AssertMsgFailed(("No value for '%s'", strMode.toUtf8().constData()));
|
---|
483 | }
|
---|
484 | return list.value(strMode, KPortMode_Disconnected);
|
---|
485 | }
|
---|
486 |
|
---|
487 | /* QString <= KUSBControllerType: */
|
---|
488 | template<> SHARED_LIBRARY_STUFF QString UIConverter::toString(const KUSBControllerType &type) const
|
---|
489 | {
|
---|
490 | switch (type)
|
---|
491 | {
|
---|
492 | case KUSBControllerType_OHCI: return QApplication::translate("UICommon", "OHCI", "USBControllerType");
|
---|
493 | case KUSBControllerType_EHCI: return QApplication::translate("UICommon", "EHCI", "USBControllerType");
|
---|
494 | case KUSBControllerType_XHCI: return QApplication::translate("UICommon", "xHCI", "USBControllerType");
|
---|
495 | default: AssertMsgFailed(("No text for %d", type)); break;
|
---|
496 | }
|
---|
497 | return QString();
|
---|
498 | }
|
---|
499 |
|
---|
500 | /* QString <= KUSBDeviceState: */
|
---|
501 | template<> SHARED_LIBRARY_STUFF QString UIConverter::toString(const KUSBDeviceState &state) const
|
---|
502 | {
|
---|
503 | switch (state)
|
---|
504 | {
|
---|
505 | case KUSBDeviceState_NotSupported: return QApplication::translate("UICommon", "Not supported", "USBDeviceState");
|
---|
506 | case KUSBDeviceState_Unavailable: return QApplication::translate("UICommon", "Unavailable", "USBDeviceState");
|
---|
507 | case KUSBDeviceState_Busy: return QApplication::translate("UICommon", "Busy", "USBDeviceState");
|
---|
508 | case KUSBDeviceState_Available: return QApplication::translate("UICommon", "Available", "USBDeviceState");
|
---|
509 | case KUSBDeviceState_Held: return QApplication::translate("UICommon", "Held", "USBDeviceState");
|
---|
510 | case KUSBDeviceState_Captured: return QApplication::translate("UICommon", "Captured", "USBDeviceState");
|
---|
511 | default: AssertMsgFailed(("No text for %d", state)); break;
|
---|
512 | }
|
---|
513 | return QString();
|
---|
514 | }
|
---|
515 |
|
---|
516 | /* QString <= KUSBDeviceFilterAction: */
|
---|
517 | template<> SHARED_LIBRARY_STUFF QString UIConverter::toString(const KUSBDeviceFilterAction &action) const
|
---|
518 | {
|
---|
519 | switch (action)
|
---|
520 | {
|
---|
521 | case KUSBDeviceFilterAction_Ignore: return QApplication::translate("UICommon", "Ignore", "USBDeviceFilterAction");
|
---|
522 | case KUSBDeviceFilterAction_Hold: return QApplication::translate("UICommon", "Hold", "USBDeviceFilterAction");
|
---|
523 | default: AssertMsgFailed(("No text for %d", action)); break;
|
---|
524 | }
|
---|
525 | return QString();
|
---|
526 | }
|
---|
527 |
|
---|
528 | /* KUSBDeviceFilterAction <= QString: */
|
---|
529 | template<> SHARED_LIBRARY_STUFF KUSBDeviceFilterAction UIConverter::fromString<KUSBDeviceFilterAction>(const QString &strAction) const
|
---|
530 | {
|
---|
531 | QHash<QString, KUSBDeviceFilterAction> list;
|
---|
532 | list.insert(QApplication::translate("UICommon", "Ignore", "USBDeviceFilterAction"), KUSBDeviceFilterAction_Ignore);
|
---|
533 | list.insert(QApplication::translate("UICommon", "Hold", "USBDeviceFilterAction"), KUSBDeviceFilterAction_Hold);
|
---|
534 | if (!list.contains(strAction))
|
---|
535 | {
|
---|
536 | AssertMsgFailed(("No value for '%s'", strAction.toUtf8().constData()));
|
---|
537 | }
|
---|
538 | return list.value(strAction, KUSBDeviceFilterAction_Null);
|
---|
539 | }
|
---|
540 |
|
---|
541 | /* QString <= KAudioDriverType: */
|
---|
542 | template<> SHARED_LIBRARY_STUFF QString UIConverter::toString(const KAudioDriverType &type) const
|
---|
543 | {
|
---|
544 | switch (type)
|
---|
545 | {
|
---|
546 | case KAudioDriverType_Default: return QApplication::translate("UICommon", "Default", "AudioDriverType");
|
---|
547 | case KAudioDriverType_Null: return QApplication::translate("UICommon", "Null Audio", "AudioDriverType");
|
---|
548 | case KAudioDriverType_OSS: return QApplication::translate("UICommon", "OSS Audio", "AudioDriverType");
|
---|
549 | case KAudioDriverType_ALSA: return QApplication::translate("UICommon", "ALSA Audio", "AudioDriverType");
|
---|
550 | case KAudioDriverType_Pulse: return QApplication::translate("UICommon", "PulseAudio", "AudioDriverType");
|
---|
551 | case KAudioDriverType_WinMM: return QApplication::translate("UICommon", "Windows Multimedia", "AudioDriverType");
|
---|
552 | case KAudioDriverType_DirectSound: return QApplication::translate("UICommon", "Windows DirectSound", "AudioDriverType");
|
---|
553 | case KAudioDriverType_WAS: return QApplication::translate("UICommon", "Windows Audio Session", "AudioDriverType");
|
---|
554 | case KAudioDriverType_CoreAudio: return QApplication::translate("UICommon", "Core Audio", "AudioDriverType");
|
---|
555 | // case KAudioDriverType_MMPM:
|
---|
556 | case KAudioDriverType_SolAudio: return QApplication::translate("UICommon", "Solaris Audio", "AudioDriverType");
|
---|
557 | default: AssertMsgFailed(("No text for %d", type)); break;
|
---|
558 | }
|
---|
559 | return QString();
|
---|
560 | }
|
---|
561 |
|
---|
562 | /* KAudioDriverType <= QString: */
|
---|
563 | template<> SHARED_LIBRARY_STUFF KAudioDriverType UIConverter::fromString<KAudioDriverType>(const QString &strType) const
|
---|
564 | {
|
---|
565 | QHash<QString, KAudioDriverType> list;
|
---|
566 | list.insert(QApplication::translate("UICommon", "Default", "AudioDriverType"), KAudioDriverType_Default);
|
---|
567 | list.insert(QApplication::translate("UICommon", "Null Audio", "AudioDriverType"), KAudioDriverType_Null);
|
---|
568 | list.insert(QApplication::translate("UICommon", "OSS Audio", "AudioDriverType"), KAudioDriverType_OSS);
|
---|
569 | list.insert(QApplication::translate("UICommon", "ALSA Audio", "AudioDriverType"), KAudioDriverType_ALSA);
|
---|
570 | list.insert(QApplication::translate("UICommon", "PulseAudio", "AudioDriverType"), KAudioDriverType_Pulse);
|
---|
571 | list.insert(QApplication::translate("UICommon", "Windows Multimedia", "AudioDriverType"), KAudioDriverType_WinMM);
|
---|
572 | list.insert(QApplication::translate("UICommon", "Windows DirectSound", "AudioDriverType"), KAudioDriverType_DirectSound);
|
---|
573 | list.insert(QApplication::translate("UICommon", "Windows Audio Session", "AudioDriverType"), KAudioDriverType_WAS);
|
---|
574 | list.insert(QApplication::translate("UICommon", "Core Audio", "AudioDriverType"), KAudioDriverType_CoreAudio);
|
---|
575 | // list.insert(..., KAudioDriverType_MMPM);
|
---|
576 | list.insert(QApplication::translate("UICommon", "Solaris Audio", "AudioDriverType"), KAudioDriverType_SolAudio);
|
---|
577 | if (!list.contains(strType))
|
---|
578 | {
|
---|
579 | AssertMsgFailed(("No value for '%s'", strType.toUtf8().constData()));
|
---|
580 | }
|
---|
581 | return list.value(strType, KAudioDriverType_Null);
|
---|
582 | }
|
---|
583 |
|
---|
584 | /* QString <= KAudioControllerType: */
|
---|
585 | template<> SHARED_LIBRARY_STUFF QString UIConverter::toString(const KAudioControllerType &type) const
|
---|
586 | {
|
---|
587 | switch (type)
|
---|
588 | {
|
---|
589 | case KAudioControllerType_AC97: return QApplication::translate("UICommon", "ICH AC97", "AudioControllerType");
|
---|
590 | case KAudioControllerType_SB16: return QApplication::translate("UICommon", "SoundBlaster 16", "AudioControllerType");
|
---|
591 | case KAudioControllerType_HDA: return QApplication::translate("UICommon", "Intel HD Audio", "AudioControllerType");
|
---|
592 | case KAudioControllerType_VirtioSound: return QApplication::translate("UICommon", "Virtio-Sound", "AudioControllerType");
|
---|
593 | default: AssertMsgFailed(("No text for %d", type)); break;
|
---|
594 | }
|
---|
595 | return QString();
|
---|
596 | }
|
---|
597 |
|
---|
598 | /* KAudioControllerType <= QString: */
|
---|
599 | template<> SHARED_LIBRARY_STUFF KAudioControllerType UIConverter::fromString<KAudioControllerType>(const QString &strType) const
|
---|
600 | {
|
---|
601 | QHash<QString, KAudioControllerType> list;
|
---|
602 | list.insert(QApplication::translate("UICommon", "ICH AC97", "AudioControllerType"), KAudioControllerType_AC97);
|
---|
603 | list.insert(QApplication::translate("UICommon", "SoundBlaster 16", "AudioControllerType"), KAudioControllerType_SB16);
|
---|
604 | list.insert(QApplication::translate("UICommon", "Intel HD Audio", "AudioControllerType"), KAudioControllerType_HDA);
|
---|
605 | list.insert(QApplication::translate("UICommon", "Virtio-Sound", "AudioControllerType"), KAudioControllerType_VirtioSound);
|
---|
606 | if (!list.contains(strType))
|
---|
607 | {
|
---|
608 | AssertMsgFailed(("No value for '%s'", strType.toUtf8().constData()));
|
---|
609 | }
|
---|
610 | return list.value(strType, KAudioControllerType_AC97);
|
---|
611 | }
|
---|
612 |
|
---|
613 | /* QString <= KAuthType: */
|
---|
614 | template<> SHARED_LIBRARY_STUFF QString UIConverter::toString(const KAuthType &type) const
|
---|
615 | {
|
---|
616 | switch (type)
|
---|
617 | {
|
---|
618 | case KAuthType_Null: return QApplication::translate("UICommon", "Null", "AuthType");
|
---|
619 | case KAuthType_External: return QApplication::translate("UICommon", "External", "AuthType");
|
---|
620 | case KAuthType_Guest: return QApplication::translate("UICommon", "Guest", "AuthType");
|
---|
621 | default: AssertMsgFailed(("No text for %d", type)); break;
|
---|
622 | }
|
---|
623 | return QString();
|
---|
624 | }
|
---|
625 |
|
---|
626 | /* KAuthType <= QString: */
|
---|
627 | template<> SHARED_LIBRARY_STUFF KAuthType UIConverter::fromString<KAuthType>(const QString &strType) const
|
---|
628 | {
|
---|
629 | QHash<QString, KAuthType> list;
|
---|
630 | list.insert(QApplication::translate("UICommon", "Null", "AuthType"), KAuthType_Null);
|
---|
631 | list.insert(QApplication::translate("UICommon", "External", "AuthType"), KAuthType_External);
|
---|
632 | list.insert(QApplication::translate("UICommon", "Guest", "AuthType"), KAuthType_Guest);
|
---|
633 | if (!list.contains(strType))
|
---|
634 | {
|
---|
635 | AssertMsgFailed(("No value for '%s'", strType.toUtf8().constData()));
|
---|
636 | }
|
---|
637 | return list.value(strType, KAuthType_Null);
|
---|
638 | }
|
---|
639 |
|
---|
640 | /* QString <= KStorageBus: */
|
---|
641 | template<> SHARED_LIBRARY_STUFF QString UIConverter::toString(const KStorageBus &bus) const
|
---|
642 | {
|
---|
643 | switch (bus)
|
---|
644 | {
|
---|
645 | case KStorageBus_IDE: return QApplication::translate("UICommon", "IDE", "StorageBus");
|
---|
646 | case KStorageBus_SATA: return QApplication::translate("UICommon", "SATA", "StorageBus");
|
---|
647 | case KStorageBus_SCSI: return QApplication::translate("UICommon", "SCSI", "StorageBus");
|
---|
648 | case KStorageBus_Floppy: return QApplication::translate("UICommon", "Floppy", "StorageBus");
|
---|
649 | case KStorageBus_SAS: return QApplication::translate("UICommon", "SAS", "StorageBus");
|
---|
650 | case KStorageBus_USB: return QApplication::translate("UICommon", "USB", "StorageBus");
|
---|
651 | case KStorageBus_PCIe: return QApplication::translate("UICommon", "PCIe", "StorageBus");
|
---|
652 | case KStorageBus_VirtioSCSI: return QApplication::translate("UICommon", "virtio-scsi", "StorageBus");
|
---|
653 | default: AssertMsgFailed(("No text for %d", bus)); break;
|
---|
654 | }
|
---|
655 | return QString();
|
---|
656 | }
|
---|
657 |
|
---|
658 | /* KStorageBus <= QString: */
|
---|
659 | template<> SHARED_LIBRARY_STUFF KStorageBus UIConverter::fromString<KStorageBus>(const QString &strType) const
|
---|
660 | {
|
---|
661 | QHash<QString, KStorageBus> list;
|
---|
662 | list.insert(QApplication::translate("UICommon", "IDE", "StorageBus"), KStorageBus_IDE);
|
---|
663 | list.insert(QApplication::translate("UICommon", "SATA", "StorageBus"), KStorageBus_SATA);
|
---|
664 | list.insert(QApplication::translate("UICommon", "SCSI", "StorageBus"), KStorageBus_SCSI);
|
---|
665 | list.insert(QApplication::translate("UICommon", "Floppy", "StorageBus"), KStorageBus_Floppy);
|
---|
666 | list.insert(QApplication::translate("UICommon", "SAS", "StorageBus"), KStorageBus_SAS);
|
---|
667 | list.insert(QApplication::translate("UICommon", "USB", "StorageBus"), KStorageBus_USB);
|
---|
668 | list.insert(QApplication::translate("UICommon", "PCIe", "StorageBus"), KStorageBus_PCIe);
|
---|
669 | list.insert(QApplication::translate("UICommon", "virtio-scsi", "StorageBus"), KStorageBus_VirtioSCSI);
|
---|
670 | if (!list.contains(strType))
|
---|
671 | {
|
---|
672 | AssertMsgFailed(("No value for '%s'", strType.toUtf8().constData()));
|
---|
673 | }
|
---|
674 | return list.value(strType, KStorageBus_Null);
|
---|
675 | }
|
---|
676 |
|
---|
677 | /* QString <= KStorageControllerType: */
|
---|
678 | template<> SHARED_LIBRARY_STUFF QString UIConverter::toString(const KStorageControllerType &type) const
|
---|
679 | {
|
---|
680 | switch (type)
|
---|
681 | {
|
---|
682 | case KStorageControllerType_LsiLogic: return QApplication::translate("UICommon", "LsiLogic", "StorageControllerType");
|
---|
683 | case KStorageControllerType_BusLogic: return QApplication::translate("UICommon", "BusLogic", "StorageControllerType");
|
---|
684 | case KStorageControllerType_IntelAhci: return QApplication::translate("UICommon", "AHCI", "StorageControllerType");
|
---|
685 | case KStorageControllerType_PIIX3: return QApplication::translate("UICommon", "PIIX3", "StorageControllerType");
|
---|
686 | case KStorageControllerType_PIIX4: return QApplication::translate("UICommon", "PIIX4", "StorageControllerType");
|
---|
687 | case KStorageControllerType_ICH6: return QApplication::translate("UICommon", "ICH6", "StorageControllerType");
|
---|
688 | case KStorageControllerType_I82078: return QApplication::translate("UICommon", "I82078", "StorageControllerType");
|
---|
689 | case KStorageControllerType_LsiLogicSas: return QApplication::translate("UICommon", "LsiLogic SAS", "StorageControllerType");
|
---|
690 | case KStorageControllerType_USB: return QApplication::translate("UICommon", "USB", "StorageControllerType");
|
---|
691 | case KStorageControllerType_NVMe: return QApplication::translate("UICommon", "NVMe", "StorageControllerType");
|
---|
692 | case KStorageControllerType_VirtioSCSI: return QApplication::translate("UICommon", "virtio-scsi", "StorageControllerType");
|
---|
693 | default: AssertMsgFailed(("No text for %d", type)); break;
|
---|
694 | }
|
---|
695 | return QString();
|
---|
696 | }
|
---|
697 |
|
---|
698 | /* KStorageControllerType <= QString: */
|
---|
699 | template<> SHARED_LIBRARY_STUFF KStorageControllerType UIConverter::fromString<KStorageControllerType>(const QString &strType) const
|
---|
700 | {
|
---|
701 | QHash<QString, KStorageControllerType> list;
|
---|
702 | list.insert(QApplication::translate("UICommon", "LsiLogic", "StorageControllerType"), KStorageControllerType_LsiLogic);
|
---|
703 | list.insert(QApplication::translate("UICommon", "BusLogic", "StorageControllerType"), KStorageControllerType_BusLogic);
|
---|
704 | list.insert(QApplication::translate("UICommon", "AHCI", "StorageControllerType"), KStorageControllerType_IntelAhci);
|
---|
705 | list.insert(QApplication::translate("UICommon", "PIIX3", "StorageControllerType"), KStorageControllerType_PIIX3);
|
---|
706 | list.insert(QApplication::translate("UICommon", "PIIX4", "StorageControllerType"), KStorageControllerType_PIIX4);
|
---|
707 | list.insert(QApplication::translate("UICommon", "ICH6", "StorageControllerType"), KStorageControllerType_ICH6);
|
---|
708 | list.insert(QApplication::translate("UICommon", "I82078", "StorageControllerType"), KStorageControllerType_I82078);
|
---|
709 | list.insert(QApplication::translate("UICommon", "LsiLogic SAS", "StorageControllerType"), KStorageControllerType_LsiLogicSas);
|
---|
710 | list.insert(QApplication::translate("UICommon", "USB", "StorageControllerType"), KStorageControllerType_USB);
|
---|
711 | list.insert(QApplication::translate("UICommon", "NVMe", "StorageControllerType"), KStorageControllerType_NVMe);
|
---|
712 | list.insert(QApplication::translate("UICommon", "virtio-scsi", "StorageControllerType"), KStorageControllerType_VirtioSCSI);
|
---|
713 | if (!list.contains(strType))
|
---|
714 | {
|
---|
715 | AssertMsgFailed(("No value for '%s'", strType.toUtf8().constData()));
|
---|
716 | }
|
---|
717 | return list.value(strType, KStorageControllerType_Null);
|
---|
718 | }
|
---|
719 |
|
---|
720 | /* QString <= KChipsetType: */
|
---|
721 | template<> SHARED_LIBRARY_STUFF QString UIConverter::toString(const KChipsetType &type) const
|
---|
722 | {
|
---|
723 | switch (type)
|
---|
724 | {
|
---|
725 | case KChipsetType_PIIX3: return QApplication::translate("UICommon", "PIIX3", "ChipsetType");
|
---|
726 | case KChipsetType_ICH9: return QApplication::translate("UICommon", "ICH9", "ChipsetType");
|
---|
727 | case KChipsetType_ARMv8Virtual: return QApplication::translate("UICommon", "ARMv8Virtual", "ChipsetType");
|
---|
728 | default: AssertMsgFailed(("No text for %d", type)); break;
|
---|
729 | }
|
---|
730 | return QString();
|
---|
731 | }
|
---|
732 |
|
---|
733 | /* QString <= KTpmType: */
|
---|
734 | template<> SHARED_LIBRARY_STUFF QString UIConverter::toString(const KTpmType &type) const
|
---|
735 | {
|
---|
736 | switch (type)
|
---|
737 | {
|
---|
738 | case KTpmType_None: return QApplication::translate("UICommon", "None", "TpmType");
|
---|
739 | case KTpmType_v1_2: return QApplication::translate("UICommon", "v1.2", "TpmType");
|
---|
740 | case KTpmType_v2_0: return QApplication::translate("UICommon", "v2.0", "TpmType");
|
---|
741 | case KTpmType_Host: return QApplication::translate("UICommon", "Host", "TpmType");
|
---|
742 | case KTpmType_Swtpm: return QApplication::translate("UICommon", "SWTPM", "TpmType");
|
---|
743 | default: AssertMsgFailed(("No text for %d", type)); break;
|
---|
744 | }
|
---|
745 | return QString();
|
---|
746 | }
|
---|
747 |
|
---|
748 | /* QString <= KNATProtocol: */
|
---|
749 | template<> SHARED_LIBRARY_STUFF QString UIConverter::toString(const KNATProtocol &protocol) const
|
---|
750 | {
|
---|
751 | switch (protocol)
|
---|
752 | {
|
---|
753 | case KNATProtocol_UDP: return QApplication::translate("UICommon", "UDP", "NATProtocol");
|
---|
754 | case KNATProtocol_TCP: return QApplication::translate("UICommon", "TCP", "NATProtocol");
|
---|
755 | default: AssertMsgFailed(("No text for %d", protocol)); break;
|
---|
756 | }
|
---|
757 | return QString();
|
---|
758 | }
|
---|
759 |
|
---|
760 | /* QString <= KNATProtocol: */
|
---|
761 | template<> SHARED_LIBRARY_STUFF QString UIConverter::toInternalString(const KNATProtocol &protocol) const
|
---|
762 | {
|
---|
763 | QString strResult;
|
---|
764 | switch (protocol)
|
---|
765 | {
|
---|
766 | case KNATProtocol_UDP: strResult = "udp"; break;
|
---|
767 | case KNATProtocol_TCP: strResult = "tcp"; break;
|
---|
768 | default: AssertMsgFailed(("No text for protocol type=%d", protocol)); break;
|
---|
769 | }
|
---|
770 | return strResult;
|
---|
771 | }
|
---|
772 |
|
---|
773 | /* KNATProtocol <= QString: */
|
---|
774 | template<> SHARED_LIBRARY_STUFF KNATProtocol UIConverter::fromInternalString<KNATProtocol>(const QString &strProtocol) const
|
---|
775 | {
|
---|
776 | if (strProtocol.compare("udp", Qt::CaseInsensitive) == 0)
|
---|
777 | return KNATProtocol_UDP;
|
---|
778 | if (strProtocol.compare("tcp", Qt::CaseInsensitive) == 0)
|
---|
779 | return KNATProtocol_TCP;
|
---|
780 | AssertMsgFailedReturn(("No value for '%s'", strProtocol.toUtf8().constData()), KNATProtocol_UDP);
|
---|
781 | }
|
---|
782 |
|
---|
783 | /* QString <= KGuestSessionStatus: */
|
---|
784 | template<> SHARED_LIBRARY_STUFF QString UIConverter::toString(const KGuestSessionStatus &status) const
|
---|
785 | {
|
---|
786 | switch (status)
|
---|
787 | {
|
---|
788 | case KGuestSessionStatus_Undefined: return QApplication::translate("UICommon", "Undefined", "GuestSessionStatus");
|
---|
789 | case KGuestSessionStatus_Starting: return QApplication::translate("UICommon", "Starting", "GuestSessionStatus");
|
---|
790 | case KGuestSessionStatus_Started: return QApplication::translate("UICommon", "Started", "GuestSessionStatus");
|
---|
791 | case KGuestSessionStatus_Terminating: return QApplication::translate("UICommon", "Terminating", "GuestSessionStatus");
|
---|
792 | case KGuestSessionStatus_Terminated: return QApplication::translate("UICommon", "Terminated", "GuestSessionStatus");
|
---|
793 | case KGuestSessionStatus_TimedOutKilled: return QApplication::translate("UICommon", "Timed Out (Killed)", "GuestSessionStatus");
|
---|
794 | case KGuestSessionStatus_TimedOutAbnormally: return QApplication::translate("UICommon", "Timed Out (Abnormally)", "GuestSessionStatus");
|
---|
795 | case KGuestSessionStatus_Down: return QApplication::translate("UICommon", "Down", "GuestSessionStatus");
|
---|
796 | case KGuestSessionStatus_Error: return QApplication::translate("UICommon", "Error", "GuestSessionStatus");
|
---|
797 | default: AssertMsgFailed(("No text for %d", status)); break;
|
---|
798 | }
|
---|
799 | return QString();
|
---|
800 | }
|
---|
801 |
|
---|
802 | /* KGuestSessionStatus <= QString: */
|
---|
803 | template<> SHARED_LIBRARY_STUFF KGuestSessionStatus UIConverter::fromString<KGuestSessionStatus>(const QString &strStatus) const
|
---|
804 | {
|
---|
805 | QHash<QString, KGuestSessionStatus> list;
|
---|
806 | list.insert(QApplication::translate("UICommon", "Undefined", "GuestSessionStatus"), KGuestSessionStatus_Undefined);
|
---|
807 | list.insert(QApplication::translate("UICommon", "Starting", "GuestSessionStatus"), KGuestSessionStatus_Starting);
|
---|
808 | list.insert(QApplication::translate("UICommon", "Started", "GuestSessionStatus"), KGuestSessionStatus_Started);
|
---|
809 | list.insert(QApplication::translate("UICommon", "Terminating", "GuestSessionStatus"), KGuestSessionStatus_Terminating);
|
---|
810 | list.insert(QApplication::translate("UICommon", "Terminated", "GuestSessionStatus"), KGuestSessionStatus_Terminated);
|
---|
811 | list.insert(QApplication::translate("UICommon", "Timed Out (Killed)", "GuestSessionStatus"), KGuestSessionStatus_TimedOutKilled);
|
---|
812 | list.insert(QApplication::translate("UICommon", "Timed Out (Abnormally)", "GuestSessionStatus"), KGuestSessionStatus_TimedOutAbnormally);
|
---|
813 | list.insert(QApplication::translate("UICommon", "Down", "GuestSessionStatus"), KGuestSessionStatus_Down);
|
---|
814 | list.insert(QApplication::translate("UICommon", "Error", "GuestSessionStatus"), KGuestSessionStatus_Error);
|
---|
815 | if (!list.contains(strStatus))
|
---|
816 | {
|
---|
817 | AssertMsgFailed(("No value for '%s'", strStatus.toUtf8().constData()));
|
---|
818 | }
|
---|
819 | return list.value(strStatus, KGuestSessionStatus_Undefined);
|
---|
820 | }
|
---|
821 |
|
---|
822 | /* QString <= KProcessStatus: */
|
---|
823 | template<> SHARED_LIBRARY_STUFF QString UIConverter::toString(const KProcessStatus &status) const
|
---|
824 | {
|
---|
825 | switch (status)
|
---|
826 | {
|
---|
827 | case KProcessStatus_Undefined: return QApplication::translate("UICommon", "Undefined", "ProcessStatus");
|
---|
828 | case KProcessStatus_Starting: return QApplication::translate("UICommon", "Starting", "ProcessStatus");
|
---|
829 | case KProcessStatus_Started: return QApplication::translate("UICommon", "Started", "ProcessStatus");
|
---|
830 | case KProcessStatus_Paused: return QApplication::translate("UICommon", "Paused", "ProcessStatus");
|
---|
831 | case KProcessStatus_Terminating: return QApplication::translate("UICommon", "Terminating", "ProcessStatus");
|
---|
832 | case KProcessStatus_TerminatedNormally: return QApplication::translate("UICommon", "Terminated (Normally)", "ProcessStatus");
|
---|
833 | case KProcessStatus_TerminatedSignal: return QApplication::translate("UICommon", "Terminated (Signal)", "ProcessStatus");
|
---|
834 | case KProcessStatus_TerminatedAbnormally: return QApplication::translate("UICommon", "Terminated (Abnormally)", "ProcessStatus");
|
---|
835 | case KProcessStatus_TimedOutKilled: return QApplication::translate("UICommon", "Timed Out (Killed)", "ProcessStatus");
|
---|
836 | case KProcessStatus_TimedOutAbnormally: return QApplication::translate("UICommon", "Timed Out (Abnormally)", "ProcessStatus");
|
---|
837 | case KProcessStatus_Down: return QApplication::translate("UICommon", "Down", "ProcessStatus");
|
---|
838 | case KProcessStatus_Error: return QApplication::translate("UICommon", "Error", "ProcessStatus");
|
---|
839 | default: AssertMsgFailed(("No text for %d", status)); break;
|
---|
840 | }
|
---|
841 | return QString();
|
---|
842 | }
|
---|
843 |
|
---|
844 | /* KProcessStatus <= QString: */
|
---|
845 | template<> SHARED_LIBRARY_STUFF KProcessStatus UIConverter::fromString<KProcessStatus>(const QString &strStatus) const
|
---|
846 | {
|
---|
847 | QHash<QString, KProcessStatus> list;
|
---|
848 | list.insert(QApplication::translate("UICommon", "Undefined", "ProcessStatus"), KProcessStatus_Undefined);
|
---|
849 | list.insert(QApplication::translate("UICommon", "Starting", "ProcessStatus"), KProcessStatus_Starting);
|
---|
850 | list.insert(QApplication::translate("UICommon", "Started", "ProcessStatus"), KProcessStatus_Started);
|
---|
851 | list.insert(QApplication::translate("UICommon", "Paused", "ProcessStatus"), KProcessStatus_Paused);
|
---|
852 | list.insert(QApplication::translate("UICommon", "Terminating", "ProcessStatus"), KProcessStatus_Terminating);
|
---|
853 | list.insert(QApplication::translate("UICommon", "Terminated (Normally)", "ProcessStatus"), KProcessStatus_TerminatedNormally);
|
---|
854 | list.insert(QApplication::translate("UICommon", "Terminated (Signal)", "ProcessStatus"), KProcessStatus_TerminatedSignal);
|
---|
855 | list.insert(QApplication::translate("UICommon", "Terminated (Abnormally)", "ProcessStatus"), KProcessStatus_TerminatedAbnormally);
|
---|
856 | list.insert(QApplication::translate("UICommon", "Timed Out (Killed)", "ProcessStatus"), KProcessStatus_TimedOutKilled);
|
---|
857 | list.insert(QApplication::translate("UICommon", "Timed Out (Abnormally)", "ProcessStatus"), KProcessStatus_TimedOutAbnormally);
|
---|
858 | list.insert(QApplication::translate("UICommon", "Down", "ProcessStatus"), KProcessStatus_Down);
|
---|
859 | list.insert(QApplication::translate("UICommon", "Error", "ProcessStatus"), KProcessStatus_Error);
|
---|
860 | if (!list.contains(strStatus))
|
---|
861 | {
|
---|
862 | AssertMsgFailed(("No value for '%s'", strStatus.toUtf8().constData()));
|
---|
863 | }
|
---|
864 | return list.value(strStatus, KProcessStatus_Undefined);
|
---|
865 | }
|
---|
866 |
|
---|
867 | /* QString <= KMetricType: */
|
---|
868 | template<> SHARED_LIBRARY_STUFF QString UIConverter::toInternalString(const KMetricType &metricType) const
|
---|
869 | {
|
---|
870 | QString strResult;
|
---|
871 | switch (metricType)
|
---|
872 | {
|
---|
873 | case KMetricType_Invalid: strResult = "Invalid"; break;
|
---|
874 | case KMetricType_CpuUtilization: strResult = "CpuUtilization"; break;
|
---|
875 | case KMetricType_MemoryUtilization: strResult = "MemoryUtilization"; break;
|
---|
876 | case KMetricType_DiskBytesRead: strResult = "DiskBytesRead"; break;
|
---|
877 | case KMetricType_DiskBytesWritten: strResult = "DiskBytesWritten"; break;
|
---|
878 | case KMetricType_NetworksBytesIn: strResult = "NetworksBytesIn"; break;
|
---|
879 | case KMetricType_NetworksBytesOut: strResult = "NetworksBytesOut"; break;
|
---|
880 | default: AssertMsgFailed(("No text for metric type=%d", metricType)); break;
|
---|
881 | }
|
---|
882 | return strResult;
|
---|
883 | }
|
---|
884 |
|
---|
885 | /* KMetricType <= QString: */
|
---|
886 | template<> SHARED_LIBRARY_STUFF KMetricType UIConverter::fromInternalString<KMetricType>(const QString &strMetricType) const
|
---|
887 | {
|
---|
888 | if (strMetricType.compare("Invalid", Qt::CaseInsensitive) == 0)
|
---|
889 | return KMetricType_Invalid;
|
---|
890 | if (strMetricType.compare("CpuUtilization", Qt::CaseInsensitive) == 0)
|
---|
891 | return KMetricType_CpuUtilization;
|
---|
892 | if (strMetricType.compare("MemoryUtilization", Qt::CaseInsensitive) == 0)
|
---|
893 | return KMetricType_MemoryUtilization;
|
---|
894 | if (strMetricType.compare("DiskBytesRead", Qt::CaseInsensitive) == 0)
|
---|
895 | return KMetricType_DiskBytesRead;
|
---|
896 | if (strMetricType.compare("DiskBytesWritten", Qt::CaseInsensitive) == 0)
|
---|
897 | return KMetricType_DiskBytesWritten;
|
---|
898 | if (strMetricType.compare("NetworksBytesIn", Qt::CaseInsensitive) == 0)
|
---|
899 | return KMetricType_NetworksBytesIn;
|
---|
900 | if (strMetricType.compare("NetworksBytesOut", Qt::CaseInsensitive) == 0)
|
---|
901 | return KMetricType_NetworksBytesOut;
|
---|
902 | AssertMsgFailedReturn(("No value for '%s'", strMetricType.toUtf8().constData()), KMetricType_Invalid);
|
---|
903 | }
|
---|