UIConverterBackendGlobal.cpp revision 70536965e536331aa13b95c62f0c0bdaf51213e7
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync/* $Id$ */
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync/** @file
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync *
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync * VBox frontends: Qt GUI ("VirtualBox"):
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync * UIConverterBackendGlobal implementation
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync */
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync/*
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync * Copyright (C) 2012 Oracle Corporation
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync *
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync * available from http://www.virtualbox.org. This file is free software;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync * you can redistribute it and/or modify it under the terms of the GNU
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync * General Public License (GPL) as published by the Free Software
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync */
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync/* Qt includes: */
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync#include <QApplication>
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync#include <QHash>
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync/* GUI includes: */
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync#include "UIConverterBackend.h"
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync#include "VBoxGlobal.h"
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync/* COM includes: */
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync#include "CSystemProperties.h"
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync/* Determines if <Object of type X> can be converted to object of other type.
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync * These functions returns 'true' for all allowed conversions. */
b7e694c031e36f70134c1d25506fd910dc413a52vboxsynctemplate<> bool canConvert<SizeSuffix>() { return true; }
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsynctemplate<> bool canConvert<StorageSlot>() { return true; }
a2e7eb192429e7fbcc89511fdb4e9faa984c30d6vboxsynctemplate<> bool canConvert<RuntimeMenuType>() { return true; }
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync#ifdef Q_WS_MAC
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsynctemplate<> bool canConvert<RuntimeMenuApplicationActionType>() { return true; }
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync#endif /* Q_WS_MAC */
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsynctemplate<> bool canConvert<RuntimeMenuMachineActionType>() { return true; }
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsynctemplate<> bool canConvert<RuntimeMenuViewActionType>() { return true; }
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsynctemplate<> bool canConvert<RuntimeMenuDevicesActionType>() { return true; }
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync#ifdef VBOX_WITH_DEBUGGER_GUI
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsynctemplate<> bool canConvert<RuntimeMenuDebuggerActionType>() { return true; }
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync#endif /* VBOX_WITH_DEBUGGER_GUI */
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsynctemplate<> bool canConvert<RuntimeMenuHelpActionType>() { return true; }
f7fc64d533369ec29bd0f79f3f80e2f56aac2fc4vboxsynctemplate<> bool canConvert<UIVisualStateType>() { return true; }
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsynctemplate<> bool canConvert<DetailsElementType>() { return true; }
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsynctemplate<> bool canConvert<GlobalSettingsPageType>() { return true; }
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsynctemplate<> bool canConvert<MachineSettingsPageType>() { return true; }
c47fa4987358016899f59a10bfba217a1cc8ba47vboxsynctemplate<> bool canConvert<IndicatorType>() { return true; }
44466decabf6fa586dbe8f1fb56b88386e77f659vboxsynctemplate<> bool canConvert<MachineCloseAction>() { return true; }
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync
b7e694c031e36f70134c1d25506fd910dc413a52vboxsync/* QString <= SizeSuffix: */
b7e694c031e36f70134c1d25506fd910dc413a52vboxsynctemplate<> QString toString(const SizeSuffix &sizeSuffix)
b7e694c031e36f70134c1d25506fd910dc413a52vboxsync{
b7e694c031e36f70134c1d25506fd910dc413a52vboxsync QString strResult;
b7e694c031e36f70134c1d25506fd910dc413a52vboxsync switch (sizeSuffix)
b7e694c031e36f70134c1d25506fd910dc413a52vboxsync {
b7e694c031e36f70134c1d25506fd910dc413a52vboxsync case SizeSuffix_Byte: strResult = QApplication::translate("VBoxGlobal", "B", "size suffix Bytes"); break;
b7e694c031e36f70134c1d25506fd910dc413a52vboxsync case SizeSuffix_KiloByte: strResult = QApplication::translate("VBoxGlobal", "KB", "size suffix KBytes=1024 Bytes"); break;
b7e694c031e36f70134c1d25506fd910dc413a52vboxsync case SizeSuffix_MegaByte: strResult = QApplication::translate("VBoxGlobal", "MB", "size suffix MBytes=1024 KBytes"); break;
b7e694c031e36f70134c1d25506fd910dc413a52vboxsync case SizeSuffix_GigaByte: strResult = QApplication::translate("VBoxGlobal", "GB", "size suffix GBytes=1024 MBytes"); break;
b7e694c031e36f70134c1d25506fd910dc413a52vboxsync case SizeSuffix_TeraByte: strResult = QApplication::translate("VBoxGlobal", "TB", "size suffix TBytes=1024 GBytes"); break;
b7e694c031e36f70134c1d25506fd910dc413a52vboxsync case SizeSuffix_PetaByte: strResult = QApplication::translate("VBoxGlobal", "PB", "size suffix PBytes=1024 TBytes"); break;
b7e694c031e36f70134c1d25506fd910dc413a52vboxsync default:
b7e694c031e36f70134c1d25506fd910dc413a52vboxsync {
b7e694c031e36f70134c1d25506fd910dc413a52vboxsync AssertMsgFailed(("No text for size suffix=%d", sizeSuffix));
b7e694c031e36f70134c1d25506fd910dc413a52vboxsync break;
b7e694c031e36f70134c1d25506fd910dc413a52vboxsync }
b7e694c031e36f70134c1d25506fd910dc413a52vboxsync }
b7e694c031e36f70134c1d25506fd910dc413a52vboxsync return strResult;
b7e694c031e36f70134c1d25506fd910dc413a52vboxsync}
b7e694c031e36f70134c1d25506fd910dc413a52vboxsync
b7e694c031e36f70134c1d25506fd910dc413a52vboxsync/* SizeSuffix <= QString: */
b7e694c031e36f70134c1d25506fd910dc413a52vboxsynctemplate<> SizeSuffix fromString<SizeSuffix>(const QString &strSizeSuffix)
b7e694c031e36f70134c1d25506fd910dc413a52vboxsync{
b7e694c031e36f70134c1d25506fd910dc413a52vboxsync QHash<QString, SizeSuffix> list;
b7e694c031e36f70134c1d25506fd910dc413a52vboxsync list.insert(QApplication::translate("VBoxGlobal", "B", "size suffix Bytes"), SizeSuffix_Byte);
b7e694c031e36f70134c1d25506fd910dc413a52vboxsync list.insert(QApplication::translate("VBoxGlobal", "KB", "size suffix KBytes=1024 Bytes"), SizeSuffix_KiloByte);
b7e694c031e36f70134c1d25506fd910dc413a52vboxsync list.insert(QApplication::translate("VBoxGlobal", "MB", "size suffix MBytes=1024 KBytes"), SizeSuffix_MegaByte);
b7e694c031e36f70134c1d25506fd910dc413a52vboxsync list.insert(QApplication::translate("VBoxGlobal", "GB", "size suffix GBytes=1024 MBytes"), SizeSuffix_GigaByte);
b7e694c031e36f70134c1d25506fd910dc413a52vboxsync list.insert(QApplication::translate("VBoxGlobal", "TB", "size suffix TBytes=1024 GBytes"), SizeSuffix_TeraByte);
b7e694c031e36f70134c1d25506fd910dc413a52vboxsync list.insert(QApplication::translate("VBoxGlobal", "PB", "size suffix PBytes=1024 TBytes"), SizeSuffix_PetaByte);
b7e694c031e36f70134c1d25506fd910dc413a52vboxsync if (!list.contains(strSizeSuffix))
b7e694c031e36f70134c1d25506fd910dc413a52vboxsync {
b7e694c031e36f70134c1d25506fd910dc413a52vboxsync AssertMsgFailed(("No value for '%s'", strSizeSuffix.toAscii().constData()));
b7e694c031e36f70134c1d25506fd910dc413a52vboxsync }
b7e694c031e36f70134c1d25506fd910dc413a52vboxsync return list.value(strSizeSuffix);
b7e694c031e36f70134c1d25506fd910dc413a52vboxsync}
b7e694c031e36f70134c1d25506fd910dc413a52vboxsync
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync/* QString <= StorageSlot: */
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsynctemplate<> QString toString(const StorageSlot &storageSlot)
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync{
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync QString strResult;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync switch (storageSlot.bus)
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync {
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync case KStorageBus_IDE:
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync {
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync int iMaxPort = vboxGlobal().virtualBox().GetSystemProperties().GetMaxPortCountForStorageBus(storageSlot.bus);
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync int iMaxDevice = vboxGlobal().virtualBox().GetSystemProperties().GetMaxDevicesPerPortForStorageBus(storageSlot.bus);
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync if (storageSlot.port < 0 || storageSlot.port > iMaxPort)
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync {
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync AssertMsgFailed(("No text for bus=%d & port=%d", storageSlot.bus, storageSlot.port));
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync break;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync }
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync if (storageSlot.device < 0 || storageSlot.device > iMaxDevice)
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync {
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync AssertMsgFailed(("No text for bus=%d & port=%d & device=%d", storageSlot.bus, storageSlot.port, storageSlot.device));
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync break;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync }
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync if (storageSlot.port == 0 && storageSlot.device == 0)
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync strResult = QApplication::translate("VBoxGlobal", "IDE Primary Master", "StorageSlot");
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync else if (storageSlot.port == 0 && storageSlot.device == 1)
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync strResult = QApplication::translate("VBoxGlobal", "IDE Primary Slave", "StorageSlot");
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync else if (storageSlot.port == 1 && storageSlot.device == 0)
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync strResult = QApplication::translate("VBoxGlobal", "IDE Secondary Master", "StorageSlot");
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync else if (storageSlot.port == 1 && storageSlot.device == 1)
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync strResult = QApplication::translate("VBoxGlobal", "IDE Secondary Slave", "StorageSlot");
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync break;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync }
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync case KStorageBus_SATA:
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync {
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync int iMaxPort = vboxGlobal().virtualBox().GetSystemProperties().GetMaxPortCountForStorageBus(storageSlot.bus);
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync if (storageSlot.port < 0 || storageSlot.port > iMaxPort)
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync {
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync AssertMsgFailed(("No text for bus=%d & port=%d", storageSlot.bus, storageSlot.port));
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync break;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync }
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync if (storageSlot.device != 0)
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync {
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync AssertMsgFailed(("No text for bus=%d & port=%d & device=%d", storageSlot.bus, storageSlot.port, storageSlot.device));
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync break;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync }
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync strResult = QApplication::translate("VBoxGlobal", "SATA Port %1", "StorageSlot").arg(storageSlot.port);
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync break;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync }
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync case KStorageBus_SCSI:
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync {
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync int iMaxPort = vboxGlobal().virtualBox().GetSystemProperties().GetMaxPortCountForStorageBus(storageSlot.bus);
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync if (storageSlot.port < 0 || storageSlot.port > iMaxPort)
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync {
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync AssertMsgFailed(("No text for bus=%d & port=%d", storageSlot.bus, storageSlot.port));
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync break;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync }
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync if (storageSlot.device != 0)
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync {
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync AssertMsgFailed(("No text for bus=%d & port=%d & device=%d", storageSlot.bus, storageSlot.port, storageSlot.device));
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync break;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync }
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync strResult = QApplication::translate("VBoxGlobal", "SCSI Port %1", "StorageSlot").arg(storageSlot.port);
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync break;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync }
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync case KStorageBus_SAS:
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync {
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync int iMaxPort = vboxGlobal().virtualBox().GetSystemProperties().GetMaxPortCountForStorageBus(storageSlot.bus);
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync if (storageSlot.port < 0 || storageSlot.port > iMaxPort)
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync {
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync AssertMsgFailed(("No text for bus=%d & port=%d", storageSlot.bus, storageSlot.port));
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync break;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync }
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync if (storageSlot.device != 0)
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync {
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync AssertMsgFailed(("No text for bus=%d & port=%d & device=%d", storageSlot.bus, storageSlot.port, storageSlot.device));
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync break;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync }
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync strResult = QApplication::translate("VBoxGlobal", "SAS Port %1", "StorageSlot").arg(storageSlot.port);
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync break;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync }
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync case KStorageBus_Floppy:
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync {
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync int iMaxDevice = vboxGlobal().virtualBox().GetSystemProperties().GetMaxDevicesPerPortForStorageBus(storageSlot.bus);
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync if (storageSlot.port != 0)
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync {
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync AssertMsgFailed(("No text for bus=%d & port=%d", storageSlot.bus, storageSlot.port));
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync break;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync }
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync if (storageSlot.device < 0 || storageSlot.device > iMaxDevice)
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync {
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync AssertMsgFailed(("No text for bus=%d & port=%d & device=%d", storageSlot.bus, storageSlot.port, storageSlot.device));
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync break;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync }
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync strResult = QApplication::translate("VBoxGlobal", "Floppy Device %1", "StorageSlot").arg(storageSlot.device);
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync break;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync }
35779b5ff92d92bc215bf98458583ed33162762fvboxsync case KStorageBus_USB:
35779b5ff92d92bc215bf98458583ed33162762fvboxsync {
35779b5ff92d92bc215bf98458583ed33162762fvboxsync int iMaxPort = vboxGlobal().virtualBox().GetSystemProperties().GetMaxPortCountForStorageBus(storageSlot.bus);
35779b5ff92d92bc215bf98458583ed33162762fvboxsync if (storageSlot.port < 0 || storageSlot.port > iMaxPort)
35779b5ff92d92bc215bf98458583ed33162762fvboxsync {
35779b5ff92d92bc215bf98458583ed33162762fvboxsync AssertMsgFailed(("No text for bus=%d & port=%d", storageSlot.bus, storageSlot.port));
35779b5ff92d92bc215bf98458583ed33162762fvboxsync break;
35779b5ff92d92bc215bf98458583ed33162762fvboxsync }
35779b5ff92d92bc215bf98458583ed33162762fvboxsync if (storageSlot.device != 0)
35779b5ff92d92bc215bf98458583ed33162762fvboxsync {
35779b5ff92d92bc215bf98458583ed33162762fvboxsync AssertMsgFailed(("No text for bus=%d & port=%d & device=%d", storageSlot.bus, storageSlot.port, storageSlot.device));
35779b5ff92d92bc215bf98458583ed33162762fvboxsync break;
35779b5ff92d92bc215bf98458583ed33162762fvboxsync }
35779b5ff92d92bc215bf98458583ed33162762fvboxsync strResult = QApplication::translate("VBoxGlobal", "USB Port %1", "StorageSlot").arg(storageSlot.port);
35779b5ff92d92bc215bf98458583ed33162762fvboxsync break;
35779b5ff92d92bc215bf98458583ed33162762fvboxsync }
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync default:
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync {
47be935062ff4d81085d342ce6f28d1317c2e9c2vboxsync AssertMsgFailed(("No text for bus=%d & port=%d & device=%d", storageSlot.bus, storageSlot.port, storageSlot.device));
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync break;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync }
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync }
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync return strResult;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync}
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync/* StorageSlot <= QString: */
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsynctemplate<> StorageSlot fromString<StorageSlot>(const QString &strStorageSlot)
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync{
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync QHash<int, QString> list;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync list[0] = QApplication::translate("VBoxGlobal", "IDE Primary Master", "StorageSlot");
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync list[1] = QApplication::translate("VBoxGlobal", "IDE Primary Slave", "StorageSlot");
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync list[2] = QApplication::translate("VBoxGlobal", "IDE Secondary Master", "StorageSlot");
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync list[3] = QApplication::translate("VBoxGlobal", "IDE Secondary Slave", "StorageSlot");
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync list[4] = QApplication::translate("VBoxGlobal", "SATA Port %1", "StorageSlot");
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync list[5] = QApplication::translate("VBoxGlobal", "SCSI Port %1", "StorageSlot");
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync list[6] = QApplication::translate("VBoxGlobal", "SAS Port %1", "StorageSlot");
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync list[7] = QApplication::translate("VBoxGlobal", "Floppy Device %1", "StorageSlot");
70536965e536331aa13b95c62f0c0bdaf51213e7vboxsync list[8] = QApplication::translate("VBoxGlobal", "USB Port %1", "StorageSlot");
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync int index = -1;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync QRegExp regExp;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync for (int i = 0; i < list.size(); ++i)
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync {
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync regExp = QRegExp(i >= 0 && i <= 3 ? list[i] : list[i].arg("(\\d+)"));
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync if (regExp.indexIn(strStorageSlot) != -1)
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync {
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync index = i;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync break;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync }
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync }
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync StorageSlot result;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync switch (index)
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync {
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync case 0:
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync case 1:
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync case 2:
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync case 3:
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync {
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync KStorageBus bus = KStorageBus_IDE;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync int iMaxPort = vboxGlobal().virtualBox().GetSystemProperties().GetMaxPortCountForStorageBus(bus);
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync int iMaxDevice = vboxGlobal().virtualBox().GetSystemProperties().GetMaxDevicesPerPortForStorageBus(bus);
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync LONG iPort = index / iMaxPort;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync LONG iDevice = index % iMaxPort;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync if (iPort < 0 || iPort > iMaxPort)
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync {
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync AssertMsgFailed(("No storage slot for text='%s'", strStorageSlot.toAscii().constData()));
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync break;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync }
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync if (iDevice < 0 || iDevice > iMaxDevice)
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync {
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync AssertMsgFailed(("No storage slot for text='%s'", strStorageSlot.toAscii().constData()));
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync break;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync }
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync result.bus = bus;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync result.port = iPort;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync result.device = iDevice;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync break;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync }
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync case 4:
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync {
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync KStorageBus bus = KStorageBus_SATA;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync int iMaxPort = vboxGlobal().virtualBox().GetSystemProperties().GetMaxPortCountForStorageBus(bus);
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync LONG iPort = regExp.cap(1).toInt();
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync LONG iDevice = 0;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync if (iPort < 0 || iPort > iMaxPort)
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync {
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync AssertMsgFailed(("No storage slot for text='%s'", strStorageSlot.toAscii().constData()));
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync break;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync }
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync result.bus = bus;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync result.port = iPort;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync result.device = iDevice;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync break;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync }
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync case 5:
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync {
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync KStorageBus bus = KStorageBus_SCSI;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync int iMaxPort = vboxGlobal().virtualBox().GetSystemProperties().GetMaxPortCountForStorageBus(bus);
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync LONG iPort = regExp.cap(1).toInt();
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync LONG iDevice = 0;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync if (iPort < 0 || iPort > iMaxPort)
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync {
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync AssertMsgFailed(("No storage slot for text='%s'", strStorageSlot.toAscii().constData()));
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync break;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync }
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync result.bus = bus;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync result.port = iPort;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync result.device = iDevice;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync break;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync }
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync case 6:
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync {
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync KStorageBus bus = KStorageBus_SAS;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync int iMaxPort = vboxGlobal().virtualBox().GetSystemProperties().GetMaxPortCountForStorageBus(bus);
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync LONG iPort = regExp.cap(1).toInt();
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync LONG iDevice = 0;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync if (iPort < 0 || iPort > iMaxPort)
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync {
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync AssertMsgFailed(("No storage slot for text='%s'", strStorageSlot.toAscii().constData()));
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync break;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync }
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync result.bus = bus;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync result.port = iPort;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync result.device = iDevice;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync break;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync }
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync case 7:
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync {
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync KStorageBus bus = KStorageBus_Floppy;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync int iMaxDevice = vboxGlobal().virtualBox().GetSystemProperties().GetMaxDevicesPerPortForStorageBus(bus);
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync LONG iPort = 0;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync LONG iDevice = regExp.cap(1).toInt();
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync if (iDevice < 0 || iDevice > iMaxDevice)
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync {
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync AssertMsgFailed(("No storage slot for text='%s'", strStorageSlot.toAscii().constData()));
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync break;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync }
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync result.bus = bus;
70536965e536331aa13b95c62f0c0bdaf51213e7vboxsync result.port = iPort;
70536965e536331aa13b95c62f0c0bdaf51213e7vboxsync result.device = iDevice;
70536965e536331aa13b95c62f0c0bdaf51213e7vboxsync break;
70536965e536331aa13b95c62f0c0bdaf51213e7vboxsync }
70536965e536331aa13b95c62f0c0bdaf51213e7vboxsync case 8:
70536965e536331aa13b95c62f0c0bdaf51213e7vboxsync {
70536965e536331aa13b95c62f0c0bdaf51213e7vboxsync KStorageBus bus = KStorageBus_USB;
70536965e536331aa13b95c62f0c0bdaf51213e7vboxsync int iMaxPort = vboxGlobal().virtualBox().GetSystemProperties().GetMaxPortCountForStorageBus(bus);
70536965e536331aa13b95c62f0c0bdaf51213e7vboxsync LONG iPort = regExp.cap(1).toInt();
70536965e536331aa13b95c62f0c0bdaf51213e7vboxsync LONG iDevice = 0;
70536965e536331aa13b95c62f0c0bdaf51213e7vboxsync if (iPort < 0 || iPort > iMaxPort)
70536965e536331aa13b95c62f0c0bdaf51213e7vboxsync {
70536965e536331aa13b95c62f0c0bdaf51213e7vboxsync AssertMsgFailed(("No storage slot for text='%s'", strStorageSlot.toAscii().constData()));
70536965e536331aa13b95c62f0c0bdaf51213e7vboxsync break;
70536965e536331aa13b95c62f0c0bdaf51213e7vboxsync }
70536965e536331aa13b95c62f0c0bdaf51213e7vboxsync result.bus = bus;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync result.port = iPort;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync result.device = iDevice;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync break;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync }
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync default:
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync {
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync AssertMsgFailed(("No storage slot for text='%s'", strStorageSlot.toAscii().constData()));
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync break;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync }
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync }
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync return result;
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync}
1c88e893e641d60853d1c2b516f8b01c767f6667vboxsync
a2e7eb192429e7fbcc89511fdb4e9faa984c30d6vboxsync/* QString <= RuntimeMenuType: */
a2e7eb192429e7fbcc89511fdb4e9faa984c30d6vboxsynctemplate<> QString toInternalString(const RuntimeMenuType &runtimeMenuType)
a2e7eb192429e7fbcc89511fdb4e9faa984c30d6vboxsync{
a2e7eb192429e7fbcc89511fdb4e9faa984c30d6vboxsync QString strResult;
a2e7eb192429e7fbcc89511fdb4e9faa984c30d6vboxsync switch (runtimeMenuType)
a2e7eb192429e7fbcc89511fdb4e9faa984c30d6vboxsync {
a2e7eb192429e7fbcc89511fdb4e9faa984c30d6vboxsync case RuntimeMenuType_Machine: strResult = "Machine"; break;
a2e7eb192429e7fbcc89511fdb4e9faa984c30d6vboxsync case RuntimeMenuType_View: strResult = "View"; break;
a2e7eb192429e7fbcc89511fdb4e9faa984c30d6vboxsync case RuntimeMenuType_Devices: strResult = "Devices"; break;
a2e7eb192429e7fbcc89511fdb4e9faa984c30d6vboxsync case RuntimeMenuType_Debug: strResult = "Debug"; break;
a2e7eb192429e7fbcc89511fdb4e9faa984c30d6vboxsync case RuntimeMenuType_Help: strResult = "Help"; break;
a2e7eb192429e7fbcc89511fdb4e9faa984c30d6vboxsync case RuntimeMenuType_All: strResult = "All"; break;
a2e7eb192429e7fbcc89511fdb4e9faa984c30d6vboxsync default:
a2e7eb192429e7fbcc89511fdb4e9faa984c30d6vboxsync {
a2e7eb192429e7fbcc89511fdb4e9faa984c30d6vboxsync AssertMsgFailed(("No text for indicator type=%d", runtimeMenuType));
a2e7eb192429e7fbcc89511fdb4e9faa984c30d6vboxsync break;
a2e7eb192429e7fbcc89511fdb4e9faa984c30d6vboxsync }
a2e7eb192429e7fbcc89511fdb4e9faa984c30d6vboxsync }
a2e7eb192429e7fbcc89511fdb4e9faa984c30d6vboxsync return strResult;
a2e7eb192429e7fbcc89511fdb4e9faa984c30d6vboxsync}
a2e7eb192429e7fbcc89511fdb4e9faa984c30d6vboxsync
a2e7eb192429e7fbcc89511fdb4e9faa984c30d6vboxsync/* RuntimeMenuType <= QString: */
a2e7eb192429e7fbcc89511fdb4e9faa984c30d6vboxsynctemplate<> RuntimeMenuType fromInternalString<RuntimeMenuType>(const QString &strRuntimeMenuType)
a2e7eb192429e7fbcc89511fdb4e9faa984c30d6vboxsync{
a2e7eb192429e7fbcc89511fdb4e9faa984c30d6vboxsync /* Here we have some fancy stuff allowing us
a2e7eb192429e7fbcc89511fdb4e9faa984c30d6vboxsync * to search through the keys using 'case-insensitive' rule: */
a2e7eb192429e7fbcc89511fdb4e9faa984c30d6vboxsync QStringList keys; QList<RuntimeMenuType> values;
a2e7eb192429e7fbcc89511fdb4e9faa984c30d6vboxsync keys << "Machine"; values << RuntimeMenuType_Machine;
a2e7eb192429e7fbcc89511fdb4e9faa984c30d6vboxsync keys << "View"; values << RuntimeMenuType_View;
a2e7eb192429e7fbcc89511fdb4e9faa984c30d6vboxsync keys << "Devices"; values << RuntimeMenuType_Devices;
a2e7eb192429e7fbcc89511fdb4e9faa984c30d6vboxsync keys << "Debug"; values << RuntimeMenuType_Debug;
a2e7eb192429e7fbcc89511fdb4e9faa984c30d6vboxsync keys << "Help"; values << RuntimeMenuType_Help;
a2e7eb192429e7fbcc89511fdb4e9faa984c30d6vboxsync keys << "All"; values << RuntimeMenuType_All;
a2e7eb192429e7fbcc89511fdb4e9faa984c30d6vboxsync /* Invalid type for unknown words: */
a2e7eb192429e7fbcc89511fdb4e9faa984c30d6vboxsync if (!keys.contains(strRuntimeMenuType, Qt::CaseInsensitive))
a2e7eb192429e7fbcc89511fdb4e9faa984c30d6vboxsync return RuntimeMenuType_Invalid;
a2e7eb192429e7fbcc89511fdb4e9faa984c30d6vboxsync /* Corresponding type for known words: */
a2e7eb192429e7fbcc89511fdb4e9faa984c30d6vboxsync return values.at(keys.indexOf(QRegExp(strRuntimeMenuType, Qt::CaseInsensitive)));
a2e7eb192429e7fbcc89511fdb4e9faa984c30d6vboxsync}
a2e7eb192429e7fbcc89511fdb4e9faa984c30d6vboxsync
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync#ifdef Q_WS_MAC
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync/* QString <= RuntimeMenuApplicationActionType: */
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsynctemplate<> QString toInternalString(const RuntimeMenuApplicationActionType &runtimeMenuApplicationActionType)
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync{
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync QString strResult;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync switch (runtimeMenuApplicationActionType)
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync {
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync case RuntimeMenuApplicationActionType_About: strResult = "About"; break;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync case RuntimeMenuApplicationActionType_All: strResult = "All"; break;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync default:
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync {
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync AssertMsgFailed(("No text for action type=%d", runtimeMenuApplicationActionType));
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync break;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync }
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync }
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync return strResult;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync}
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync/* RuntimeMenuApplicationActionType <= QString: */
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsynctemplate<> RuntimeMenuApplicationActionType fromInternalString<RuntimeMenuApplicationActionType>(const QString &strRuntimeMenuApplicationActionType)
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync{
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync /* Here we have some fancy stuff allowing us
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync * to search through the keys using 'case-insensitive' rule: */
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync QStringList keys; QList<RuntimeMenuApplicationActionType> values;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync keys << "About"; values << RuntimeMenuApplicationActionType_About;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync keys << "All"; values << RuntimeMenuApplicationActionType_All;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync /* Invalid type for unknown words: */
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync if (!keys.contains(strRuntimeMenuApplicationActionType, Qt::CaseInsensitive))
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync return RuntimeMenuApplicationActionType_Invalid;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync /* Corresponding type for known words: */
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync return values.at(keys.indexOf(QRegExp(strRuntimeMenuApplicationActionType, Qt::CaseInsensitive)));
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync}
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync#endif /* Q_WS_MAC */
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync/* QString <= RuntimeMenuMachineActionType: */
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsynctemplate<> QString toInternalString(const RuntimeMenuMachineActionType &runtimeMenuMachineActionType)
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync{
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync QString strResult;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync switch (runtimeMenuMachineActionType)
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync {
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync case RuntimeMenuMachineActionType_SettingsDialog: strResult = "SettingsDialog"; break;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync case RuntimeMenuMachineActionType_TakeSnapshot: strResult = "TakeSnapshot"; break;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync case RuntimeMenuMachineActionType_TakeScreenshot: strResult = "TakeScreenshot"; break;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync case RuntimeMenuMachineActionType_InformationDialog: strResult = "InformationDialog"; break;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync case RuntimeMenuMachineActionType_MouseIntegration: strResult = "MouseIntegration"; break;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync case RuntimeMenuMachineActionType_TypeCAD: strResult = "TypeCAD"; break;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync#ifdef Q_WS_X11
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync case RuntimeMenuMachineActionType_TypeCABS: strResult = "TypeCABS"; break;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync#endif /* Q_WS_X11 */
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync case RuntimeMenuMachineActionType_Pause: strResult = "Pause"; break;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync case RuntimeMenuMachineActionType_Reset: strResult = "Reset"; break;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync case RuntimeMenuMachineActionType_SaveState: strResult = "SaveState"; break;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync case RuntimeMenuMachineActionType_Shutdown: strResult = "Shutdown"; break;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync case RuntimeMenuMachineActionType_PowerOff: strResult = "PowerOff"; break;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync#ifndef Q_WS_MAC
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync case RuntimeMenuMachineActionType_Close: strResult = "Close"; break;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync#endif /* !Q_WS_MAC */
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync case RuntimeMenuMachineActionType_All: strResult = "All"; break;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync default:
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync {
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync AssertMsgFailed(("No text for action type=%d", runtimeMenuMachineActionType));
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync break;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync }
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync }
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync return strResult;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync}
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync/* RuntimeMenuMachineActionType <= QString: */
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsynctemplate<> RuntimeMenuMachineActionType fromInternalString<RuntimeMenuMachineActionType>(const QString &strRuntimeMenuMachineActionType)
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync{
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync /* Here we have some fancy stuff allowing us
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync * to search through the keys using 'case-insensitive' rule: */
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync QStringList keys; QList<RuntimeMenuMachineActionType> values;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync keys << "SettingsDialog"; values << RuntimeMenuMachineActionType_SettingsDialog;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync keys << "TakeSnapshot"; values << RuntimeMenuMachineActionType_TakeSnapshot;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync keys << "TakeScreenshot"; values << RuntimeMenuMachineActionType_TakeScreenshot;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync keys << "InformationDialog"; values << RuntimeMenuMachineActionType_InformationDialog;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync keys << "MouseIntegration"; values << RuntimeMenuMachineActionType_MouseIntegration;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync keys << "TypeCAD"; values << RuntimeMenuMachineActionType_TypeCAD;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync#ifdef Q_WS_X11
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync keys << "TypeCABS"; values << RuntimeMenuMachineActionType_TypeCABS;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync#endif /* Q_WS_X11 */
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync keys << "Pause"; values << RuntimeMenuMachineActionType_Pause;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync keys << "Reset"; values << RuntimeMenuMachineActionType_Reset;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync keys << "SaveState"; values << RuntimeMenuMachineActionType_SaveState;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync keys << "Shutdown"; values << RuntimeMenuMachineActionType_Shutdown;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync keys << "PowerOff"; values << RuntimeMenuMachineActionType_PowerOff;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync#ifndef Q_WS_MAC
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync keys << "Close"; values << RuntimeMenuMachineActionType_Close;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync#endif /* !Q_WS_MAC */
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync keys << "All"; values << RuntimeMenuMachineActionType_All;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync /* Invalid type for unknown words: */
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync if (!keys.contains(strRuntimeMenuMachineActionType, Qt::CaseInsensitive))
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync return RuntimeMenuMachineActionType_Invalid;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync /* Corresponding type for known words: */
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync return values.at(keys.indexOf(QRegExp(strRuntimeMenuMachineActionType, Qt::CaseInsensitive)));
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync}
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync/* QString <= RuntimeMenuViewActionType: */
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsynctemplate<> QString toInternalString(const RuntimeMenuViewActionType &runtimeMenuViewActionType)
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync{
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync QString strResult;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync switch (runtimeMenuViewActionType)
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync {
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync case RuntimeMenuViewActionType_Fullscreen: strResult = "Fullscreen"; break;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync case RuntimeMenuViewActionType_Seamless: strResult = "Seamless"; break;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync case RuntimeMenuViewActionType_Scale: strResult = "Scale"; break;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync case RuntimeMenuViewActionType_GuestAutoresize: strResult = "GuestAutoresize"; break;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync case RuntimeMenuViewActionType_AdjustWindow: strResult = "AdjustWindow"; break;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync case RuntimeMenuViewActionType_Multiscreen: strResult = "Multiscreen"; break;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync case RuntimeMenuViewActionType_All: strResult = "All"; break;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync default:
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync {
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync AssertMsgFailed(("No text for action type=%d", runtimeMenuViewActionType));
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync break;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync }
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync }
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync return strResult;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync}
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync/* RuntimeMenuViewActionType <= QString: */
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsynctemplate<> RuntimeMenuViewActionType fromInternalString<RuntimeMenuViewActionType>(const QString &strRuntimeMenuViewActionType)
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync{
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync /* Here we have some fancy stuff allowing us
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync * to search through the keys using 'case-insensitive' rule: */
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync QStringList keys; QList<RuntimeMenuViewActionType> values;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync keys << "Fullscreen"; values << RuntimeMenuViewActionType_Fullscreen;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync keys << "Seamless"; values << RuntimeMenuViewActionType_Seamless;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync keys << "Scale"; values << RuntimeMenuViewActionType_Scale;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync keys << "GuestAutoresize"; values << RuntimeMenuViewActionType_GuestAutoresize;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync keys << "AdjustWindow"; values << RuntimeMenuViewActionType_AdjustWindow;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync keys << "Multiscreen"; values << RuntimeMenuViewActionType_Multiscreen;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync keys << "All"; values << RuntimeMenuViewActionType_All;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync /* Invalid type for unknown words: */
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync if (!keys.contains(strRuntimeMenuViewActionType, Qt::CaseInsensitive))
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync return RuntimeMenuViewActionType_Invalid;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync /* Corresponding type for known words: */
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync return values.at(keys.indexOf(QRegExp(strRuntimeMenuViewActionType, Qt::CaseInsensitive)));
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync}
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync/* QString <= RuntimeMenuDevicesActionType: */
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsynctemplate<> QString toInternalString(const RuntimeMenuDevicesActionType &runtimeMenuDevicesActionType)
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync{
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync QString strResult;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync switch (runtimeMenuDevicesActionType)
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync {
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync case RuntimeMenuDevicesActionType_OpticalDevices: strResult = "OpticalDevices"; break;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync case RuntimeMenuDevicesActionType_FloppyDevices: strResult = "FloppyDevices"; break;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync case RuntimeMenuDevicesActionType_USBDevices: strResult = "USBDevices"; break;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync case RuntimeMenuDevicesActionType_WebCams: strResult = "WebCams"; break;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync case RuntimeMenuDevicesActionType_SharedClipboard: strResult = "SharedClipboard"; break;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync case RuntimeMenuDevicesActionType_DragAndDrop: strResult = "DragAndDrop"; break;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync case RuntimeMenuDevicesActionType_NetworkSettings: strResult = "NetworkSettings"; break;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync case RuntimeMenuDevicesActionType_SharedFoldersSettings: strResult = "SharedFoldersSettings"; break;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync case RuntimeMenuDevicesActionType_VRDEServer: strResult = "VRDEServer"; break;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync case RuntimeMenuDevicesActionType_VideoCapture: strResult = "VideoCapture"; break;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync case RuntimeMenuDevicesActionType_InstallGuestTools: strResult = "InstallGuestTools"; break;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync case RuntimeMenuDevicesActionType_All: strResult = "All"; break;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync default:
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync {
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync AssertMsgFailed(("No text for action type=%d", runtimeMenuDevicesActionType));
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync break;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync }
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync }
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync return strResult;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync}
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync/* RuntimeMenuDevicesActionType <= QString: */
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsynctemplate<> RuntimeMenuDevicesActionType fromInternalString<RuntimeMenuDevicesActionType>(const QString &strRuntimeMenuDevicesActionType)
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync{
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync /* Here we have some fancy stuff allowing us
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync * to search through the keys using 'case-insensitive' rule: */
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync QStringList keys; QList<RuntimeMenuDevicesActionType> values;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync keys << "OpticalDevices"; values << RuntimeMenuDevicesActionType_OpticalDevices;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync keys << "FloppyDevices"; values << RuntimeMenuDevicesActionType_FloppyDevices;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync keys << "USBDevices"; values << RuntimeMenuDevicesActionType_USBDevices;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync keys << "WebCams"; values << RuntimeMenuDevicesActionType_WebCams;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync keys << "SharedClipboard"; values << RuntimeMenuDevicesActionType_SharedClipboard;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync keys << "DragAndDrop"; values << RuntimeMenuDevicesActionType_DragAndDrop;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync keys << "NetworkSettings"; values << RuntimeMenuDevicesActionType_NetworkSettings;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync keys << "SharedFoldersSettings"; values << RuntimeMenuDevicesActionType_SharedFoldersSettings;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync keys << "VRDEServer"; values << RuntimeMenuDevicesActionType_VRDEServer;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync keys << "VideoCapture"; values << RuntimeMenuDevicesActionType_VideoCapture;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync keys << "InstallGuestTools"; values << RuntimeMenuDevicesActionType_InstallGuestTools;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync keys << "All"; values << RuntimeMenuDevicesActionType_All;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync /* Invalid type for unknown words: */
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync if (!keys.contains(strRuntimeMenuDevicesActionType, Qt::CaseInsensitive))
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync return RuntimeMenuDevicesActionType_Invalid;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync /* Corresponding type for known words: */
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync return values.at(keys.indexOf(QRegExp(strRuntimeMenuDevicesActionType, Qt::CaseInsensitive)));
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync}
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync#ifdef VBOX_WITH_DEBUGGER_GUI
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync/* QString <= RuntimeMenuDebuggerActionType: */
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsynctemplate<> QString toInternalString(const RuntimeMenuDebuggerActionType &runtimeMenuDebuggerActionType)
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync{
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync QString strResult;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync switch (runtimeMenuDebuggerActionType)
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync {
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync case RuntimeMenuDebuggerActionType_Statistics: strResult = "Statistics"; break;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync case RuntimeMenuDebuggerActionType_CommandLine: strResult = "CommandLine"; break;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync case RuntimeMenuDebuggerActionType_Logging: strResult = "Logging"; break;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync case RuntimeMenuDebuggerActionType_LogDialog: strResult = "LogDialog"; break;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync case RuntimeMenuDebuggerActionType_All: strResult = "All"; break;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync default:
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync {
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync AssertMsgFailed(("No text for action type=%d", runtimeMenuDebuggerActionType));
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync break;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync }
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync }
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync return strResult;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync}
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync/* RuntimeMenuDebuggerActionType <= QString: */
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsynctemplate<> RuntimeMenuDebuggerActionType fromInternalString<RuntimeMenuDebuggerActionType>(const QString &strRuntimeMenuDebuggerActionType)
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync{
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync /* Here we have some fancy stuff allowing us
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync * to search through the keys using 'case-insensitive' rule: */
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync QStringList keys; QList<RuntimeMenuDebuggerActionType> values;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync keys << "Statistics"; values << RuntimeMenuDebuggerActionType_Statistics;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync keys << "CommandLine"; values << RuntimeMenuDebuggerActionType_CommandLine;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync keys << "Logging"; values << RuntimeMenuDebuggerActionType_Logging;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync keys << "LogDialog"; values << RuntimeMenuDebuggerActionType_LogDialog;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync keys << "All"; values << RuntimeMenuDebuggerActionType_All;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync /* Invalid type for unknown words: */
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync if (!keys.contains(strRuntimeMenuDebuggerActionType, Qt::CaseInsensitive))
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync return RuntimeMenuDebuggerActionType_Invalid;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync /* Corresponding type for known words: */
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync return values.at(keys.indexOf(QRegExp(strRuntimeMenuDebuggerActionType, Qt::CaseInsensitive)));
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync}
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync#endif /* VBOX_WITH_DEBUGGER_GUI */
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync/* QString <= RuntimeMenuHelpActionType: */
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsynctemplate<> QString toInternalString(const RuntimeMenuHelpActionType &runtimeMenuHelpActionType)
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync{
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync QString strResult;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync switch (runtimeMenuHelpActionType)
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync {
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync case RuntimeMenuHelpActionType_Contents: strResult = "Contents"; break;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync case RuntimeMenuHelpActionType_WebSite: strResult = "WebSite"; break;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync case RuntimeMenuHelpActionType_ResetWarnings: strResult = "ResetWarnings"; break;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync case RuntimeMenuHelpActionType_NetworkAccessManager: strResult = "NetworkAccessManager"; break;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync#ifndef Q_WS_MAC
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync case RuntimeMenuHelpActionType_About: strResult = "About"; break;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync#endif /* !Q_WS_MAC */
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync case RuntimeMenuHelpActionType_All: strResult = "All"; break;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync default:
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync {
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync AssertMsgFailed(("No text for action type=%d", runtimeMenuHelpActionType));
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync break;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync }
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync }
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync return strResult;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync}
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync/* RuntimeMenuHelpActionType <= QString: */
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsynctemplate<> RuntimeMenuHelpActionType fromInternalString<RuntimeMenuHelpActionType>(const QString &strRuntimeMenuHelpActionType)
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync{
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync /* Here we have some fancy stuff allowing us
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync * to search through the keys using 'case-insensitive' rule: */
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync QStringList keys; QList<RuntimeMenuHelpActionType> values;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync keys << "Contents"; values << RuntimeMenuHelpActionType_Contents;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync keys << "WebSite"; values << RuntimeMenuHelpActionType_WebSite;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync keys << "ResetWarnings"; values << RuntimeMenuHelpActionType_ResetWarnings;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync keys << "NetworkAccessManager"; values << RuntimeMenuHelpActionType_NetworkAccessManager;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync#ifndef Q_WS_MAC
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync keys << "About"; values << RuntimeMenuHelpActionType_About;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync#endif /* !Q_WS_MAC */
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync keys << "All"; values << RuntimeMenuHelpActionType_All;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync /* Invalid type for unknown words: */
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync if (!keys.contains(strRuntimeMenuHelpActionType, Qt::CaseInsensitive))
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync return RuntimeMenuHelpActionType_Invalid;
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync /* Corresponding type for known words: */
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync return values.at(keys.indexOf(QRegExp(strRuntimeMenuHelpActionType, Qt::CaseInsensitive)));
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync}
878731e72e401b7e2a0434e5ab36ca633c7f2586vboxsync
f7fc64d533369ec29bd0f79f3f80e2f56aac2fc4vboxsync/* QString <= UIVisualStateType: */
f7fc64d533369ec29bd0f79f3f80e2f56aac2fc4vboxsynctemplate<> QString toInternalString(const UIVisualStateType &visualStateType)
f7fc64d533369ec29bd0f79f3f80e2f56aac2fc4vboxsync{
f7fc64d533369ec29bd0f79f3f80e2f56aac2fc4vboxsync QString strResult;
f7fc64d533369ec29bd0f79f3f80e2f56aac2fc4vboxsync switch (visualStateType)
f7fc64d533369ec29bd0f79f3f80e2f56aac2fc4vboxsync {
f7fc64d533369ec29bd0f79f3f80e2f56aac2fc4vboxsync case UIVisualStateType_Normal: strResult = "Normal"; break;
f7fc64d533369ec29bd0f79f3f80e2f56aac2fc4vboxsync case UIVisualStateType_Fullscreen: strResult = "Fullscreen"; break;
f7fc64d533369ec29bd0f79f3f80e2f56aac2fc4vboxsync case UIVisualStateType_Seamless: strResult = "Seamless"; break;
f7fc64d533369ec29bd0f79f3f80e2f56aac2fc4vboxsync case UIVisualStateType_Scale: strResult = "Scale"; break;
f7fc64d533369ec29bd0f79f3f80e2f56aac2fc4vboxsync case UIVisualStateType_All: strResult = "All"; break;
f7fc64d533369ec29bd0f79f3f80e2f56aac2fc4vboxsync default:
f7fc64d533369ec29bd0f79f3f80e2f56aac2fc4vboxsync {
f7fc64d533369ec29bd0f79f3f80e2f56aac2fc4vboxsync AssertMsgFailed(("No text for visual state type=%d", visualStateType));
f7fc64d533369ec29bd0f79f3f80e2f56aac2fc4vboxsync break;
f7fc64d533369ec29bd0f79f3f80e2f56aac2fc4vboxsync }
f7fc64d533369ec29bd0f79f3f80e2f56aac2fc4vboxsync }
f7fc64d533369ec29bd0f79f3f80e2f56aac2fc4vboxsync return strResult;
f7fc64d533369ec29bd0f79f3f80e2f56aac2fc4vboxsync}
f7fc64d533369ec29bd0f79f3f80e2f56aac2fc4vboxsync
f7fc64d533369ec29bd0f79f3f80e2f56aac2fc4vboxsync/* UIVisualStateType <= QString: */
f7fc64d533369ec29bd0f79f3f80e2f56aac2fc4vboxsynctemplate<> UIVisualStateType fromInternalString<UIVisualStateType>(const QString &strVisualStateType)
f7fc64d533369ec29bd0f79f3f80e2f56aac2fc4vboxsync{
f7fc64d533369ec29bd0f79f3f80e2f56aac2fc4vboxsync /* Here we have some fancy stuff allowing us
f7fc64d533369ec29bd0f79f3f80e2f56aac2fc4vboxsync * to search through the keys using 'case-insensitive' rule: */
f7fc64d533369ec29bd0f79f3f80e2f56aac2fc4vboxsync QStringList keys; QList<UIVisualStateType> values;
f7fc64d533369ec29bd0f79f3f80e2f56aac2fc4vboxsync keys << "Normal"; values << UIVisualStateType_Normal;
f7fc64d533369ec29bd0f79f3f80e2f56aac2fc4vboxsync keys << "Fullscreen"; values << UIVisualStateType_Fullscreen;
f7fc64d533369ec29bd0f79f3f80e2f56aac2fc4vboxsync keys << "Seamless"; values << UIVisualStateType_Seamless;
f7fc64d533369ec29bd0f79f3f80e2f56aac2fc4vboxsync keys << "Scale"; values << UIVisualStateType_Scale;
f7fc64d533369ec29bd0f79f3f80e2f56aac2fc4vboxsync keys << "All"; values << UIVisualStateType_All;
f7fc64d533369ec29bd0f79f3f80e2f56aac2fc4vboxsync /* Invalid type for unknown words: */
f7fc64d533369ec29bd0f79f3f80e2f56aac2fc4vboxsync if (!keys.contains(strVisualStateType, Qt::CaseInsensitive))
f7fc64d533369ec29bd0f79f3f80e2f56aac2fc4vboxsync return UIVisualStateType_Invalid;
f7fc64d533369ec29bd0f79f3f80e2f56aac2fc4vboxsync /* Corresponding type for known words: */
f7fc64d533369ec29bd0f79f3f80e2f56aac2fc4vboxsync return values.at(keys.indexOf(QRegExp(strVisualStateType, Qt::CaseInsensitive)));
f7fc64d533369ec29bd0f79f3f80e2f56aac2fc4vboxsync}
f7fc64d533369ec29bd0f79f3f80e2f56aac2fc4vboxsync
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync/* QString <= DetailsElementType: */
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsynctemplate<> QString toString(const DetailsElementType &detailsElementType)
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync{
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync QString strResult;
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync switch (detailsElementType)
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync {
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync case DetailsElementType_General: strResult = QApplication::translate("VBoxGlobal", "General", "DetailsElementType"); break;
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync case DetailsElementType_Preview: strResult = QApplication::translate("VBoxGlobal", "Preview", "DetailsElementType"); break;
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync case DetailsElementType_System: strResult = QApplication::translate("VBoxGlobal", "System", "DetailsElementType"); break;
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync case DetailsElementType_Display: strResult = QApplication::translate("VBoxGlobal", "Display", "DetailsElementType"); break;
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync case DetailsElementType_Storage: strResult = QApplication::translate("VBoxGlobal", "Storage", "DetailsElementType"); break;
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync case DetailsElementType_Audio: strResult = QApplication::translate("VBoxGlobal", "Audio", "DetailsElementType"); break;
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync case DetailsElementType_Network: strResult = QApplication::translate("VBoxGlobal", "Network", "DetailsElementType"); break;
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync case DetailsElementType_Serial: strResult = QApplication::translate("VBoxGlobal", "Serial ports", "DetailsElementType"); break;
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync#ifdef VBOX_WITH_PARALLEL_PORTS
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync case DetailsElementType_Parallel: strResult = QApplication::translate("VBoxGlobal", "Parallel ports", "DetailsElementType"); break;
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync#endif /* VBOX_WITH_PARALLEL_PORTS */
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync case DetailsElementType_USB: strResult = QApplication::translate("VBoxGlobal", "USB", "DetailsElementType"); break;
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync case DetailsElementType_SF: strResult = QApplication::translate("VBoxGlobal", "Shared folders", "DetailsElementType"); break;
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync case DetailsElementType_Description: strResult = QApplication::translate("VBoxGlobal", "Description", "DetailsElementType"); break;
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync default:
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync {
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync AssertMsgFailed(("No text for details element type=%d", detailsElementType));
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync break;
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync }
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync }
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync return strResult;
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync}
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync/* DetailsElementType <= QString: */
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsynctemplate<> DetailsElementType fromString<DetailsElementType>(const QString &strDetailsElementType)
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync{
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync QHash<QString, DetailsElementType> list;
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync list.insert(QApplication::translate("VBoxGlobal", "General", "DetailsElementType"), DetailsElementType_General);
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync list.insert(QApplication::translate("VBoxGlobal", "Preview", "DetailsElementType"), DetailsElementType_Preview);
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync list.insert(QApplication::translate("VBoxGlobal", "System", "DetailsElementType"), DetailsElementType_System);
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync list.insert(QApplication::translate("VBoxGlobal", "Display", "DetailsElementType"), DetailsElementType_Display);
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync list.insert(QApplication::translate("VBoxGlobal", "Storage", "DetailsElementType"), DetailsElementType_Storage);
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync list.insert(QApplication::translate("VBoxGlobal", "Audio", "DetailsElementType"), DetailsElementType_Audio);
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync list.insert(QApplication::translate("VBoxGlobal", "Network", "DetailsElementType"), DetailsElementType_Network);
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync list.insert(QApplication::translate("VBoxGlobal", "Serial ports", "DetailsElementType"), DetailsElementType_Serial);
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync#ifdef VBOX_WITH_PARALLEL_PORTS
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync list.insert(QApplication::translate("VBoxGlobal", "Parallel ports", "DetailsElementType"), DetailsElementType_Parallel);
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync#endif /* VBOX_WITH_PARALLEL_PORTS */
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync list.insert(QApplication::translate("VBoxGlobal", "USB", "DetailsElementType"), DetailsElementType_USB);
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync list.insert(QApplication::translate("VBoxGlobal", "Shared folders", "DetailsElementType"), DetailsElementType_SF);
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync list.insert(QApplication::translate("VBoxGlobal", "Description", "DetailsElementType"), DetailsElementType_Description);
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync if (!list.contains(strDetailsElementType))
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync {
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync AssertMsgFailed(("No value for '%s'", strDetailsElementType.toAscii().constData()));
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync }
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync return list.value(strDetailsElementType);
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync}
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync/* QString <= DetailsElementType: */
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsynctemplate<> QString toInternalString(const DetailsElementType &detailsElementType)
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync{
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync QString strResult;
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync switch (detailsElementType)
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync {
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync case DetailsElementType_General: strResult = "general"; break;
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync case DetailsElementType_Preview: strResult = "preview"; break;
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync case DetailsElementType_System: strResult = "system"; break;
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync case DetailsElementType_Display: strResult = "display"; break;
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync case DetailsElementType_Storage: strResult = "storage"; break;
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync case DetailsElementType_Audio: strResult = "audio"; break;
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync case DetailsElementType_Network: strResult = "network"; break;
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync case DetailsElementType_Serial: strResult = "serialPorts"; break;
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync#ifdef VBOX_WITH_PARALLEL_PORTS
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync case DetailsElementType_Parallel: strResult = "parallelPorts"; break;
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync#endif /* VBOX_WITH_PARALLEL_PORTS */
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync case DetailsElementType_USB: strResult = "usb"; break;
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync case DetailsElementType_SF: strResult = "sharedFolders"; break;
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync case DetailsElementType_Description: strResult = "description"; break;
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync default:
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync {
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync AssertMsgFailed(("No text for details element type=%d", detailsElementType));
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync break;
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync }
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync }
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync return strResult;
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync}
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync/* DetailsElementType <= QString: */
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsynctemplate<> DetailsElementType fromInternalString<DetailsElementType>(const QString &strDetailsElementType)
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync{
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync QHash<QString, DetailsElementType> list;
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync list.insert("general", DetailsElementType_General);
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync list.insert("preview", DetailsElementType_Preview);
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync list.insert("system", DetailsElementType_System);
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync list.insert("display", DetailsElementType_Display);
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync list.insert("storage", DetailsElementType_Storage);
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync list.insert("audio", DetailsElementType_Audio);
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync list.insert("network", DetailsElementType_Network);
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync list.insert("serialPorts", DetailsElementType_Serial);
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync#ifdef VBOX_WITH_PARALLEL_PORTS
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync list.insert("parallelPorts", DetailsElementType_Parallel);
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync#endif /* VBOX_WITH_PARALLEL_PORTS */
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync list.insert("usb", DetailsElementType_USB);
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync list.insert("sharedFolders", DetailsElementType_SF);
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync list.insert("description", DetailsElementType_Description);
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync if (!list.contains(strDetailsElementType))
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync {
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync AssertMsgFailed(("No value for '%s'", strDetailsElementType.toAscii().constData()));
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync }
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync return list.value(strDetailsElementType);
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync}
cdaeb34871aa28b96c0d80b474f3c8f9805d0388vboxsync
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync/* QString <= GlobalSettingsPageType: */
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsynctemplate<> QString toInternalString(const GlobalSettingsPageType &globalSettingsPageType)
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync{
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync QString strResult;
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync switch (globalSettingsPageType)
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync {
01cf171066ef2de68c8629d973d9c0dfa6d34cc3vboxsync case GlobalSettingsPageType_General: strResult = "General"; break;
01cf171066ef2de68c8629d973d9c0dfa6d34cc3vboxsync case GlobalSettingsPageType_Input: strResult = "Input"; break;
dca2831bb7bb894093fa34f4c5962f419e0a03cavboxsync#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
01cf171066ef2de68c8629d973d9c0dfa6d34cc3vboxsync case GlobalSettingsPageType_Update: strResult = "Update"; break;
dca2831bb7bb894093fa34f4c5962f419e0a03cavboxsync#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
01cf171066ef2de68c8629d973d9c0dfa6d34cc3vboxsync case GlobalSettingsPageType_Language: strResult = "Language"; break;
01cf171066ef2de68c8629d973d9c0dfa6d34cc3vboxsync case GlobalSettingsPageType_Display: strResult = "Display"; break;
01cf171066ef2de68c8629d973d9c0dfa6d34cc3vboxsync case GlobalSettingsPageType_Network: strResult = "Network"; break;
01cf171066ef2de68c8629d973d9c0dfa6d34cc3vboxsync case GlobalSettingsPageType_Extensions: strResult = "Extensions"; break;
dca2831bb7bb894093fa34f4c5962f419e0a03cavboxsync#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
01cf171066ef2de68c8629d973d9c0dfa6d34cc3vboxsync case GlobalSettingsPageType_Proxy: strResult = "Proxy"; break;
dca2831bb7bb894093fa34f4c5962f419e0a03cavboxsync#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync default:
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync {
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync AssertMsgFailed(("No text for settings page type=%d", globalSettingsPageType));
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync break;
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync }
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync }
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync return strResult;
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync}
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync/* GlobalSettingsPageType <= QString: */
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsynctemplate<> GlobalSettingsPageType fromInternalString<GlobalSettingsPageType>(const QString &strGlobalSettingsPageType)
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync{
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync /* Here we have some fancy stuff allowing us
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync * to search through the keys using 'case-insensitive' rule: */
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync QStringList keys; QList<GlobalSettingsPageType> values;
01cf171066ef2de68c8629d973d9c0dfa6d34cc3vboxsync keys << "General"; values << GlobalSettingsPageType_General;
01cf171066ef2de68c8629d973d9c0dfa6d34cc3vboxsync keys << "Input"; values << GlobalSettingsPageType_Input;
dca2831bb7bb894093fa34f4c5962f419e0a03cavboxsync#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
01cf171066ef2de68c8629d973d9c0dfa6d34cc3vboxsync keys << "Update"; values << GlobalSettingsPageType_Update;
dca2831bb7bb894093fa34f4c5962f419e0a03cavboxsync#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
01cf171066ef2de68c8629d973d9c0dfa6d34cc3vboxsync keys << "Language"; values << GlobalSettingsPageType_Language;
01cf171066ef2de68c8629d973d9c0dfa6d34cc3vboxsync keys << "Display"; values << GlobalSettingsPageType_Display;
01cf171066ef2de68c8629d973d9c0dfa6d34cc3vboxsync keys << "Network"; values << GlobalSettingsPageType_Network;
01cf171066ef2de68c8629d973d9c0dfa6d34cc3vboxsync keys << "Extensions"; values << GlobalSettingsPageType_Extensions;
dca2831bb7bb894093fa34f4c5962f419e0a03cavboxsync#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
01cf171066ef2de68c8629d973d9c0dfa6d34cc3vboxsync keys << "Proxy"; values << GlobalSettingsPageType_Proxy;
dca2831bb7bb894093fa34f4c5962f419e0a03cavboxsync#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync /* Invalid type for unknown words: */
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync if (!keys.contains(strGlobalSettingsPageType, Qt::CaseInsensitive))
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync return GlobalSettingsPageType_Invalid;
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync /* Corresponding type for known words: */
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync return values.at(keys.indexOf(QRegExp(strGlobalSettingsPageType, Qt::CaseInsensitive)));
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync}
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync
63b160c24e7bb0b9f49a64c29d1ee77a02284034vboxsync/* QPixmap <= GlobalSettingsPageType: */
63b160c24e7bb0b9f49a64c29d1ee77a02284034vboxsynctemplate<> QPixmap toWarningPixmap(const GlobalSettingsPageType &type)
63b160c24e7bb0b9f49a64c29d1ee77a02284034vboxsync{
63b160c24e7bb0b9f49a64c29d1ee77a02284034vboxsync switch (type)
63b160c24e7bb0b9f49a64c29d1ee77a02284034vboxsync {
63b160c24e7bb0b9f49a64c29d1ee77a02284034vboxsync case GlobalSettingsPageType_General: return QPixmap(":/machine_warning_16px.png");
63b160c24e7bb0b9f49a64c29d1ee77a02284034vboxsync case GlobalSettingsPageType_Input: return QPixmap(":/hostkey_warning_16px.png");
dca2831bb7bb894093fa34f4c5962f419e0a03cavboxsync#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
63b160c24e7bb0b9f49a64c29d1ee77a02284034vboxsync case GlobalSettingsPageType_Update: return QPixmap(":/refresh_warning_16px.png");
dca2831bb7bb894093fa34f4c5962f419e0a03cavboxsync#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
63b160c24e7bb0b9f49a64c29d1ee77a02284034vboxsync case GlobalSettingsPageType_Language: return QPixmap(":/site_warning_16px.png");
63b160c24e7bb0b9f49a64c29d1ee77a02284034vboxsync case GlobalSettingsPageType_Display: return QPixmap(":/vrdp_warning_16px.png");
63b160c24e7bb0b9f49a64c29d1ee77a02284034vboxsync case GlobalSettingsPageType_Network: return QPixmap(":/nw_warning_16px.png");
63b160c24e7bb0b9f49a64c29d1ee77a02284034vboxsync case GlobalSettingsPageType_Extensions: return QPixmap(":/extension_pack_warning_16px.png");
dca2831bb7bb894093fa34f4c5962f419e0a03cavboxsync#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
63b160c24e7bb0b9f49a64c29d1ee77a02284034vboxsync case GlobalSettingsPageType_Proxy: return QPixmap(":/proxy_warning_16px.png");
dca2831bb7bb894093fa34f4c5962f419e0a03cavboxsync#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
63b160c24e7bb0b9f49a64c29d1ee77a02284034vboxsync default: AssertMsgFailed(("No pixmap for %d", type)); break;
63b160c24e7bb0b9f49a64c29d1ee77a02284034vboxsync }
63b160c24e7bb0b9f49a64c29d1ee77a02284034vboxsync return QPixmap();
63b160c24e7bb0b9f49a64c29d1ee77a02284034vboxsync}
63b160c24e7bb0b9f49a64c29d1ee77a02284034vboxsync
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync/* QString <= MachineSettingsPageType: */
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsynctemplate<> QString toInternalString(const MachineSettingsPageType &machineSettingsPageType)
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync{
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync QString strResult;
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync switch (machineSettingsPageType)
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync {
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync case MachineSettingsPageType_General: strResult = "General"; break;
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync case MachineSettingsPageType_System: strResult = "System"; break;
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync case MachineSettingsPageType_Display: strResult = "Display"; break;
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync case MachineSettingsPageType_Storage: strResult = "Storage"; break;
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync case MachineSettingsPageType_Audio: strResult = "Audio"; break;
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync case MachineSettingsPageType_Network: strResult = "Network"; break;
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync case MachineSettingsPageType_Ports: strResult = "Ports"; break;
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync case MachineSettingsPageType_Serial: strResult = "Serial"; break;
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync case MachineSettingsPageType_Parallel: strResult = "Parallel"; break;
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync case MachineSettingsPageType_USB: strResult = "USB"; break;
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync case MachineSettingsPageType_SF: strResult = "SharedFolders"; break;
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync default:
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync {
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync AssertMsgFailed(("No text for settings page type=%d", machineSettingsPageType));
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync break;
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync }
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync }
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync return strResult;
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync}
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync/* MachineSettingsPageType <= QString: */
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsynctemplate<> MachineSettingsPageType fromInternalString<MachineSettingsPageType>(const QString &strMachineSettingsPageType)
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync{
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync /* Here we have some fancy stuff allowing us
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync * to search through the keys using 'case-insensitive' rule: */
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync QStringList keys; QList<MachineSettingsPageType> values;
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync keys << "General"; values << MachineSettingsPageType_General;
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync keys << "System"; values << MachineSettingsPageType_System;
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync keys << "Display"; values << MachineSettingsPageType_Display;
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync keys << "Storage"; values << MachineSettingsPageType_Storage;
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync keys << "Audio"; values << MachineSettingsPageType_Audio;
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync keys << "Network"; values << MachineSettingsPageType_Network;
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync keys << "Ports"; values << MachineSettingsPageType_Ports;
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync keys << "Serial"; values << MachineSettingsPageType_Serial;
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync keys << "Parallel"; values << MachineSettingsPageType_Parallel;
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync keys << "USB"; values << MachineSettingsPageType_USB;
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync keys << "SharedFolders"; values << MachineSettingsPageType_SF;
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync /* Invalid type for unknown words: */
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync if (!keys.contains(strMachineSettingsPageType, Qt::CaseInsensitive))
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync return MachineSettingsPageType_Invalid;
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync /* Corresponding type for known words: */
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync return values.at(keys.indexOf(QRegExp(strMachineSettingsPageType, Qt::CaseInsensitive)));
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync}
d3528480b4dc7bff388e35890c0e12129ae74ab8vboxsync
63b160c24e7bb0b9f49a64c29d1ee77a02284034vboxsync/* QPixmap <= MachineSettingsPageType: */
63b160c24e7bb0b9f49a64c29d1ee77a02284034vboxsynctemplate<> QPixmap toWarningPixmap(const MachineSettingsPageType &type)
63b160c24e7bb0b9f49a64c29d1ee77a02284034vboxsync{
63b160c24e7bb0b9f49a64c29d1ee77a02284034vboxsync switch (type)
63b160c24e7bb0b9f49a64c29d1ee77a02284034vboxsync {
63b160c24e7bb0b9f49a64c29d1ee77a02284034vboxsync case MachineSettingsPageType_General: return QPixmap(":/machine_warning_16px.png");
63b160c24e7bb0b9f49a64c29d1ee77a02284034vboxsync case MachineSettingsPageType_System: return QPixmap(":/chipset_warning_16px.png");
63b160c24e7bb0b9f49a64c29d1ee77a02284034vboxsync case MachineSettingsPageType_Display: return QPixmap(":/vrdp_warning_16px.png");
63b160c24e7bb0b9f49a64c29d1ee77a02284034vboxsync case MachineSettingsPageType_Storage: return QPixmap(":/hd_warning_16px.png");
63b160c24e7bb0b9f49a64c29d1ee77a02284034vboxsync case MachineSettingsPageType_Audio: return QPixmap(":/sound_warning_16px.png");
63b160c24e7bb0b9f49a64c29d1ee77a02284034vboxsync case MachineSettingsPageType_Network: return QPixmap(":/nw_warning_16px.png");
63b160c24e7bb0b9f49a64c29d1ee77a02284034vboxsync case MachineSettingsPageType_Ports: return QPixmap(":/serial_port_warning_16px.png");
63b160c24e7bb0b9f49a64c29d1ee77a02284034vboxsync case MachineSettingsPageType_Serial: return QPixmap(":/serial_port_warning_16px.png");
63b160c24e7bb0b9f49a64c29d1ee77a02284034vboxsync case MachineSettingsPageType_Parallel: return QPixmap(":/parallel_port_warning_16px.png");
63b160c24e7bb0b9f49a64c29d1ee77a02284034vboxsync case MachineSettingsPageType_USB: return QPixmap(":/usb_warning_16px.png");
63b160c24e7bb0b9f49a64c29d1ee77a02284034vboxsync case MachineSettingsPageType_SF: return QPixmap(":/sf_warning_16px.png");
63b160c24e7bb0b9f49a64c29d1ee77a02284034vboxsync default: AssertMsgFailed(("No pixmap for %d", type)); break;
63b160c24e7bb0b9f49a64c29d1ee77a02284034vboxsync }
63b160c24e7bb0b9f49a64c29d1ee77a02284034vboxsync return QPixmap();
63b160c24e7bb0b9f49a64c29d1ee77a02284034vboxsync}
63b160c24e7bb0b9f49a64c29d1ee77a02284034vboxsync
c47fa4987358016899f59a10bfba217a1cc8ba47vboxsync/* QString <= IndicatorType: */
c47fa4987358016899f59a10bfba217a1cc8ba47vboxsynctemplate<> QString toInternalString(const IndicatorType &indicatorType)
c47fa4987358016899f59a10bfba217a1cc8ba47vboxsync{
c47fa4987358016899f59a10bfba217a1cc8ba47vboxsync QString strResult;
c47fa4987358016899f59a10bfba217a1cc8ba47vboxsync switch (indicatorType)
c47fa4987358016899f59a10bfba217a1cc8ba47vboxsync {
c47fa4987358016899f59a10bfba217a1cc8ba47vboxsync case IndicatorType_HardDisks: strResult = "HardDisks"; break;
c47fa4987358016899f59a10bfba217a1cc8ba47vboxsync case IndicatorType_OpticalDisks: strResult = "OpticalDisks"; break;
c47fa4987358016899f59a10bfba217a1cc8ba47vboxsync case IndicatorType_FloppyDisks: strResult = "FloppyDisks"; break;
c47fa4987358016899f59a10bfba217a1cc8ba47vboxsync case IndicatorType_Network: strResult = "Network"; break;
c47fa4987358016899f59a10bfba217a1cc8ba47vboxsync case IndicatorType_USB: strResult = "USB"; break;
c47fa4987358016899f59a10bfba217a1cc8ba47vboxsync case IndicatorType_SharedFolders: strResult = "SharedFolders"; break;
c47fa4987358016899f59a10bfba217a1cc8ba47vboxsync case IndicatorType_VideoCapture: strResult = "VideoCapture"; break;
c47fa4987358016899f59a10bfba217a1cc8ba47vboxsync case IndicatorType_Features: strResult = "Features"; break;
c47fa4987358016899f59a10bfba217a1cc8ba47vboxsync case IndicatorType_Mouse: strResult = "Mouse"; break;
c47fa4987358016899f59a10bfba217a1cc8ba47vboxsync case IndicatorType_Keyboard: strResult = "Keyboard"; break;
c47fa4987358016899f59a10bfba217a1cc8ba47vboxsync default:
c47fa4987358016899f59a10bfba217a1cc8ba47vboxsync {
c47fa4987358016899f59a10bfba217a1cc8ba47vboxsync AssertMsgFailed(("No text for indicator type=%d", indicatorType));
c47fa4987358016899f59a10bfba217a1cc8ba47vboxsync break;
c47fa4987358016899f59a10bfba217a1cc8ba47vboxsync }
c47fa4987358016899f59a10bfba217a1cc8ba47vboxsync }
c47fa4987358016899f59a10bfba217a1cc8ba47vboxsync return strResult;
c47fa4987358016899f59a10bfba217a1cc8ba47vboxsync}
c47fa4987358016899f59a10bfba217a1cc8ba47vboxsync
c47fa4987358016899f59a10bfba217a1cc8ba47vboxsync/* IndicatorType <= QString: */
c47fa4987358016899f59a10bfba217a1cc8ba47vboxsynctemplate<> IndicatorType fromInternalString<IndicatorType>(const QString &strIndicatorType)
c47fa4987358016899f59a10bfba217a1cc8ba47vboxsync{
7c43aa13a6461be3454c73b2ba25adfd43f331c7vboxsync /* Here we have some fancy stuff allowing us
7c43aa13a6461be3454c73b2ba25adfd43f331c7vboxsync * to search through the keys using 'case-insensitive' rule: */
7c43aa13a6461be3454c73b2ba25adfd43f331c7vboxsync QStringList keys; QList<IndicatorType> values;
7c43aa13a6461be3454c73b2ba25adfd43f331c7vboxsync keys << "HardDisks"; values << IndicatorType_HardDisks;
7c43aa13a6461be3454c73b2ba25adfd43f331c7vboxsync keys << "OpticalDisks"; values << IndicatorType_OpticalDisks;
7c43aa13a6461be3454c73b2ba25adfd43f331c7vboxsync keys << "FloppyDisks"; values << IndicatorType_FloppyDisks;
7c43aa13a6461be3454c73b2ba25adfd43f331c7vboxsync keys << "Network"; values << IndicatorType_Network;
7c43aa13a6461be3454c73b2ba25adfd43f331c7vboxsync keys << "USB"; values << IndicatorType_USB;
7c43aa13a6461be3454c73b2ba25adfd43f331c7vboxsync keys << "SharedFolders"; values << IndicatorType_SharedFolders;
7c43aa13a6461be3454c73b2ba25adfd43f331c7vboxsync keys << "VideoCapture"; values << IndicatorType_VideoCapture;
7c43aa13a6461be3454c73b2ba25adfd43f331c7vboxsync keys << "Features"; values << IndicatorType_Features;
7c43aa13a6461be3454c73b2ba25adfd43f331c7vboxsync keys << "Mouse"; values << IndicatorType_Mouse;
7c43aa13a6461be3454c73b2ba25adfd43f331c7vboxsync keys << "Keyboard"; values << IndicatorType_Keyboard;
7c43aa13a6461be3454c73b2ba25adfd43f331c7vboxsync /* Invalid type for unknown words: */
7c43aa13a6461be3454c73b2ba25adfd43f331c7vboxsync if (!keys.contains(strIndicatorType, Qt::CaseInsensitive))
7c43aa13a6461be3454c73b2ba25adfd43f331c7vboxsync return IndicatorType_Invalid;
7c43aa13a6461be3454c73b2ba25adfd43f331c7vboxsync /* Corresponding type for known words: */
7c43aa13a6461be3454c73b2ba25adfd43f331c7vboxsync return values.at(keys.indexOf(QRegExp(strIndicatorType, Qt::CaseInsensitive)));
c47fa4987358016899f59a10bfba217a1cc8ba47vboxsync}
c47fa4987358016899f59a10bfba217a1cc8ba47vboxsync
44466decabf6fa586dbe8f1fb56b88386e77f659vboxsync/* QString <= MachineCloseAction: */
44466decabf6fa586dbe8f1fb56b88386e77f659vboxsynctemplate<> QString toInternalString(const MachineCloseAction &machineCloseAction)
44466decabf6fa586dbe8f1fb56b88386e77f659vboxsync{
44466decabf6fa586dbe8f1fb56b88386e77f659vboxsync QString strResult;
44466decabf6fa586dbe8f1fb56b88386e77f659vboxsync switch (machineCloseAction)
44466decabf6fa586dbe8f1fb56b88386e77f659vboxsync {
7c518afb661809cdc80007f311e41b320de11b90vboxsync case MachineCloseAction_SaveState: strResult = "SaveState"; break;
44466decabf6fa586dbe8f1fb56b88386e77f659vboxsync case MachineCloseAction_Shutdown: strResult = "Shutdown"; break;
44466decabf6fa586dbe8f1fb56b88386e77f659vboxsync case MachineCloseAction_PowerOff: strResult = "PowerOff"; break;
44466decabf6fa586dbe8f1fb56b88386e77f659vboxsync case MachineCloseAction_PowerOff_RestoringSnapshot: strResult = "PowerOffRestoringSnapshot"; break;
44466decabf6fa586dbe8f1fb56b88386e77f659vboxsync default:
44466decabf6fa586dbe8f1fb56b88386e77f659vboxsync {
44466decabf6fa586dbe8f1fb56b88386e77f659vboxsync AssertMsgFailed(("No text for indicator type=%d", machineCloseAction));
44466decabf6fa586dbe8f1fb56b88386e77f659vboxsync break;
44466decabf6fa586dbe8f1fb56b88386e77f659vboxsync }
44466decabf6fa586dbe8f1fb56b88386e77f659vboxsync }
44466decabf6fa586dbe8f1fb56b88386e77f659vboxsync return strResult;
44466decabf6fa586dbe8f1fb56b88386e77f659vboxsync}
44466decabf6fa586dbe8f1fb56b88386e77f659vboxsync
44466decabf6fa586dbe8f1fb56b88386e77f659vboxsync/* MachineCloseAction <= QString: */
44466decabf6fa586dbe8f1fb56b88386e77f659vboxsynctemplate<> MachineCloseAction fromInternalString<MachineCloseAction>(const QString &strMachineCloseAction)
44466decabf6fa586dbe8f1fb56b88386e77f659vboxsync{
7c43aa13a6461be3454c73b2ba25adfd43f331c7vboxsync /* Here we have some fancy stuff allowing us
7c43aa13a6461be3454c73b2ba25adfd43f331c7vboxsync * to search through the keys using 'case-insensitive' rule: */
7c43aa13a6461be3454c73b2ba25adfd43f331c7vboxsync QStringList keys; QList<MachineCloseAction> values;
7c518afb661809cdc80007f311e41b320de11b90vboxsync keys << "SaveState"; values << MachineCloseAction_SaveState;
7c43aa13a6461be3454c73b2ba25adfd43f331c7vboxsync keys << "Shutdown"; values << MachineCloseAction_Shutdown;
7c43aa13a6461be3454c73b2ba25adfd43f331c7vboxsync keys << "PowerOff"; values << MachineCloseAction_PowerOff;
7c43aa13a6461be3454c73b2ba25adfd43f331c7vboxsync keys << "PowerOffRestoringSnapshot"; values << MachineCloseAction_PowerOff_RestoringSnapshot;
7c43aa13a6461be3454c73b2ba25adfd43f331c7vboxsync /* Invalid type for unknown words: */
7c43aa13a6461be3454c73b2ba25adfd43f331c7vboxsync if (!keys.contains(strMachineCloseAction, Qt::CaseInsensitive))
44466decabf6fa586dbe8f1fb56b88386e77f659vboxsync return MachineCloseAction_Invalid;
7c43aa13a6461be3454c73b2ba25adfd43f331c7vboxsync /* Corresponding type for known words: */
7c43aa13a6461be3454c73b2ba25adfd43f331c7vboxsync return values.at(keys.indexOf(QRegExp(strMachineCloseAction, Qt::CaseInsensitive)));
44466decabf6fa586dbe8f1fb56b88386e77f659vboxsync}
a2e7eb192429e7fbcc89511fdb4e9faa984c30d6vboxsync