VirtualBox

Changeset 41819 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Jun 18, 2012 5:59:30 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
78640
Message:

FE/Qt: UIConverter template interface supporting various required conversions between different GUI and COM types.

Location:
trunk/src/VBox/Frontends/VirtualBox
Files:
2 deleted
26 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk

    r41689 r41819  
    145145VBOX_GUI_INC_DIRS = \
    146146        ./src \
     147        ./src/converter \
    147148        ./src/extensions \
    148149        ./src/globals \
     
    275276        src/globals/VBoxGlobal.h \
    276277        src/globals/VBoxUtils.h \
    277         src/globals/COMEnumsWrapper.h \
    278278        src/net/UINetworkManager.h \
    279279        src/net/UINetworkManagerDialog.h \
     
    446446        src/VBoxVMInformationDlg.cpp \
    447447        src/UIVMLogViewer.cpp \
     448        src/converter/UIConverter.cpp \
     449        src/converter/UIConverterBackendCOM.cpp \
     450        src/converter/UIConverterBackendGlobal.cpp \
    448451        src/extensions/QIAdvancedSlider.cpp \
    449452        src/extensions/QIArrowButtonPress.cpp \
     
    479482        src/globals/UIMessageCenter.cpp \
    480483        src/globals/VBoxGlobal.cpp \
    481         src/globals/COMEnumsWrapper.cpp \
    482484        src/medium/UIMediumDefs.cpp \
    483485        src/medium/UIMedium.cpp \
  • trunk/src/VBox/Frontends/VirtualBox/src/UIMediumTypeChangeDialog.cpp

    r41608 r41819  
    3030#include "QILabel.h"
    3131#include "QIDialogButtonBox.h"
    32 #include "COMEnumsWrapper.h"
     32#include "UIConverter.h"
    3333
    3434/* Constructor: */
     
    126126    QList<QRadioButton*> buttons = findChildren<QRadioButton*>();
    127127    for (int i = 0; i < buttons.size(); ++i)
    128         buttons[i]->setText(gCOMenum->toString(buttons[i]->property("mediumType").value<KMediumType>()));
     128        buttons[i]->setText(gpConverter->toString(buttons[i]->property("mediumType").value<KMediumType>()));
    129129}
    130130
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMInformationDlg.cpp

    r41689 r41819  
    3434#include "VBoxGlobal.h"
    3535#include "VBoxVMInformationDlg.h"
     36#include "UIConverter.h"
    3637
    3738/* COM includes: */
     
    664665    QString header = "<tr><td></td><td colspan=2><nobr>&nbsp;&nbsp;%1:</nobr></td></tr>";
    665666    CStorageController ctr = mSession.GetMachine().GetStorageControllerByName (aCtrName);
    666     QString name = vboxGlobal().toString (StorageSlot (ctr.GetBus(), aPort, aDevice));
     667    QString name = gpConverter->toString (StorageSlot (ctr.GetBus(), aPort, aDevice));
    667668    return header.arg (name) + composeArticle (aBelongsTo, 2);
    668669}
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDefs.h

    r41695 r41819  
    2323#include <QEvent>
    2424#include <QStringList>
     25
     26/* COM includes: */
     27#include "COMEnums.h"
    2528
    2629/* Other VBox defines: */
     
    207210using namespace UIDefs /* globally */;
    208211
     212struct StorageSlot
     213{
     214    StorageSlot() : bus(KStorageBus_Null), port(0), device(0) {}
     215    StorageSlot(const StorageSlot &other) : bus(other.bus), port(other.port), device(other.device) {}
     216    StorageSlot(KStorageBus otherBus, LONG iPort, LONG iDevice) : bus(otherBus), port(iPort), device(iDevice) {}
     217    StorageSlot& operator=(const StorageSlot &other) { bus = other.bus; port = other.port; device = other.device; return *this; }
     218    bool operator==(const StorageSlot &other) const { return bus == other.bus && port == other.port && device == other.device; }
     219    bool operator!=(const StorageSlot &other) const { return bus != other.bus || port != other.port || device != other.device; }
     220    bool operator<(const StorageSlot &other) const { return (bus <  other.bus) ||
     221                                                            (bus == other.bus && port <  other.port) ||
     222                                                            (bus == other.bus && port == other.port && device < other.device); }
     223    bool operator>(const StorageSlot &other) const { return (bus >  other.bus) ||
     224                                                            (bus == other.bus && port >  other.port) ||
     225                                                            (bus == other.bus && port == other.port && device > other.device); }
     226    bool isNull() const { return bus == KStorageBus_Null; }
     227    KStorageBus bus; LONG port; LONG device;
     228};
     229Q_DECLARE_METATYPE(StorageSlot);
     230
    209231#endif // __UIDefs_h__
    210232
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp

    r41689 r41819  
    3636#include "UINetworkManager.h"
    3737#include "UINetworkManagerDialog.h"
    38 #include "COMEnumsWrapper.h"
     38#include "UIConverter.h"
    3939#ifdef VBOX_OSE
    4040# include "UIDownloaderUserManual.h"
     
    13531353    message(pParent ? pParent : mainWindowShown(), Error,
    13541354            tr("<p>Error changing medium type from <b>%1</b> to <b>%2</b>.</p>")
    1355                 .arg(gCOMenum->toString(oldMediumType)).arg(gCOMenum->toString(newMediumType)),
     1355                .arg(gpConverter->toString(oldMediumType)).arg(gpConverter->toString(newMediumType)),
    13561356            formatErrorInfo(medium));
    13571357}
     
    15411541        {
    15421542            strMessage = tr("Failed to detach the hard disk (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.")
    1543                            .arg(strLocation).arg(vboxGlobal().toString(storageSlot)).arg(CMachine(machine).GetName());
     1543                           .arg(strLocation).arg(gpConverter->toString(storageSlot)).arg(CMachine(machine).GetName());
    15441544            break;
    15451545        }
     
    15471547        {
    15481548            strMessage = tr("Failed to detach the CD/DVD device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.")
    1549                            .arg(strLocation).arg(vboxGlobal().toString(storageSlot)).arg(CMachine(machine).GetName());
     1549                           .arg(strLocation).arg(gpConverter->toString(storageSlot)).arg(CMachine(machine).GetName());
    15501550            break;
    15511551        }
     
    15531553        {
    15541554            strMessage = tr("Failed to detach the floppy device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.")
    1555                            .arg(strLocation).arg(vboxGlobal().toString(storageSlot)).arg(CMachine(machine).GetName());
     1555                           .arg(strLocation).arg(gpConverter->toString(storageSlot)).arg(CMachine(machine).GetName());
    15561556            break;
    15571557        }
     
    30823082        {
    30833083            strMessage = tr("Failed to attach the hard disk (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.")
    3084                            .arg(strLocation).arg(vboxGlobal().toString(storageSlot)).arg(CMachine(machine).GetName());
     3084                           .arg(strLocation).arg(gpConverter->toString(storageSlot)).arg(CMachine(machine).GetName());
    30853085            break;
    30863086        }
     
    30883088        {
    30893089            strMessage = tr("Failed to attach the CD/DVD device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.")
    3090                            .arg(strLocation).arg(vboxGlobal().toString(storageSlot)).arg(CMachine(machine).GetName());
     3090                           .arg(strLocation).arg(gpConverter->toString(storageSlot)).arg(CMachine(machine).GetName());
    30913091            break;
    30923092        }
     
    30943094        {
    30953095            strMessage = tr("Failed to attach the floppy device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.")
    3096                            .arg(strLocation).arg(vboxGlobal().toString(storageSlot)).arg(CMachine(machine).GetName());
     3096                           .arg(strLocation).arg(gpConverter->toString(storageSlot)).arg(CMachine(machine).GetName());
    30973097            break;
    30983098        }
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp

    r41691 r41819  
    6565#include "UIMachine.h"
    6666#include "UISession.h"
    67 #include "COMEnumsWrapper.h"
     67#include "UIConverter.h"
    6868
    6969#ifdef Q_WS_X11
     
    959959}
    960960
    961 /**
    962  * Returns a full string representation of the given device of the given channel on the given storage bus.
    963  * This method does not uses any separate string tags related to bus, channel, device, it has own
    964  * separately translated string tags allowing to translate a full slot name into human readable format
    965  * to be consistent with i18n.
    966  * Complementary to #toStorageSlot (const QString &) const.
    967  */
    968 QString VBoxGlobal::toString (StorageSlot aSlot) const
    969 {
    970     switch (aSlot.bus)
    971     {
    972         case KStorageBus_IDE:
    973         case KStorageBus_SATA:
    974         case KStorageBus_SCSI:
    975         case KStorageBus_SAS:
    976         case KStorageBus_Floppy:
    977             break;
    978 
    979         default:
    980         {
    981             AssertMsgFailed (("Invalid bus type %d\n", aSlot.bus));
    982             break;
    983         }
    984     }
    985 
    986     int maxPort = virtualBox().GetSystemProperties().GetMaxPortCountForStorageBus (aSlot.bus);
    987     int maxDevice = virtualBox().GetSystemProperties().GetMaxDevicesPerPortForStorageBus (aSlot.bus);
    988     if (aSlot.port < 0 || aSlot.port > maxPort)
    989         AssertMsgFailed (("Invalid port %d\n", aSlot.port));
    990     if (aSlot.device < 0 || aSlot.device > maxDevice)
    991         AssertMsgFailed (("Invalid device %d\n", aSlot.device));
    992 
    993     QString result;
    994     switch (aSlot.bus)
    995     {
    996         case KStorageBus_IDE:
    997         {
    998             result = mSlotTemplates [aSlot.port * maxDevice + aSlot.device];
    999             break;
    1000         }
    1001         case KStorageBus_SATA:
    1002         {
    1003             result = mSlotTemplates [4].arg (aSlot.port);
    1004             break;
    1005         }
    1006         case KStorageBus_SCSI:
    1007         {
    1008             result = mSlotTemplates [5].arg (aSlot.port);
    1009             break;
    1010         }
    1011         case KStorageBus_SAS:
    1012         {
    1013             result = mSlotTemplates [6].arg (aSlot.port);
    1014             break;
    1015         }
    1016         case KStorageBus_Floppy:
    1017         {
    1018             result = mSlotTemplates [7].arg (aSlot.device);
    1019             break;
    1020         }
    1021         default:
    1022         {
    1023             AssertMsgFailed (("Invalid bus type %d\n", aSlot.bus));
    1024             break;
    1025         }
    1026     }
    1027     return result;
    1028 }
    1029 
    1030 /**
    1031  * Returns a StorageSlot based on the given device of the given channel on the given storage bus.
    1032  * Complementary to #toFullString (StorageSlot) const.
    1033  */
    1034 StorageSlot VBoxGlobal::toStorageSlot (const QString &aSlot) const
    1035 {
    1036     int index = -1;
    1037     QRegExp regExp;
    1038     for (int i = 0; i < mSlotTemplates.size(); ++ i)
    1039     {
    1040         regExp = QRegExp (i >= 0 && i <= 3 ? mSlotTemplates [i] : mSlotTemplates [i].arg ("(\\d+)"));
    1041         if (regExp.indexIn (aSlot) != -1)
    1042         {
    1043             index = i;
    1044             break;
    1045         }
    1046     }
    1047 
    1048     StorageSlot result;
    1049     switch (index)
    1050     {
    1051         case 0:
    1052         case 1:
    1053         case 2:
    1054         case 3:
    1055         {
    1056             result.bus = KStorageBus_IDE;
    1057             int maxPort = virtualBox().GetSystemProperties().GetMaxPortCountForStorageBus (result.bus);
    1058             result.port = index / maxPort;
    1059             result.device = index % maxPort;
    1060             break;
    1061         }
    1062         case 4:
    1063         {
    1064             result.bus = KStorageBus_SATA;
    1065             int maxPort = virtualBox().GetSystemProperties().GetMaxPortCountForStorageBus (result.bus);
    1066             result.port = regExp.cap (1).toInt();
    1067             if (result.port < 0 || result.port > maxPort)
    1068                 AssertMsgFailed (("Invalid port %d\n", result.port));
    1069             break;
    1070         }
    1071         case 5:
    1072         {
    1073             result.bus = KStorageBus_SCSI;
    1074             int maxPort = virtualBox().GetSystemProperties().GetMaxPortCountForStorageBus (result.bus);
    1075             result.port = regExp.cap (1).toInt();
    1076             if (result.port < 0 || result.port > maxPort)
    1077                 AssertMsgFailed (("Invalid port %d\n", result.port));
    1078             break;
    1079         }
    1080         case 6:
    1081         {
    1082             result.bus = KStorageBus_SAS;
    1083             int maxPort = virtualBox().GetSystemProperties().GetMaxPortCountForStorageBus (result.bus);
    1084             result.port = regExp.cap (1).toInt();
    1085             if (result.port < 0 || result.port > maxPort)
    1086                 AssertMsgFailed (("Invalid port %d\n", result.port));
    1087             break;
    1088         }
    1089         case 7:
    1090         {
    1091             result.bus = KStorageBus_Floppy;
    1092             int maxDevice = virtualBox().GetSystemProperties().GetMaxDevicesPerPortForStorageBus (result.bus);
    1093             result.device = regExp.cap (1).toInt();
    1094             if (result.device < 0 || result.device > maxDevice)
    1095                 AssertMsgFailed (("Invalid device %d\n", result.device));
    1096             break;
    1097         }
    1098         default:
    1099             break;
    1100     }
    1101     return result;
    1102 }
    1103 
    1104961struct PortConfig
    1105962{
     
    1139996        return mDiskTypes_Differencing;
    1140997    }
    1141     return gCOMenum->toString(medium.GetType());
     998    return gpConverter->toString(medium.GetType());
    1142999}
    11431000
     
    13241181    {
    13251182        tip += QString (tr ("<br><nobr>State: %1</nobr>", "USB device tooltip"))
    1326                         .arg (gCOMenum->toString (hostDev.GetState()));
     1183                        .arg (gpConverter->toString (hostDev.GetState()));
    13271184    }
    13281185
     
    13771234    {
    13781235        tip += tip.isEmpty() ? "":"<br/>" + tr ("<nobr>State: %1</nobr>", "USB filter tooltip")
    1379                                                 .arg (gCOMenum->toString (hostDev.GetState()));
     1236                                                .arg (gpConverter->toString (hostDev.GetState()));
    13801237    }
    13811238
     
    14481305            if (!bootOrder.isEmpty())
    14491306                bootOrder += ", ";
    1450             bootOrder += gCOMenum->toString (device);
     1307            bootOrder += gpConverter->toString (device);
    14511308        }
    14521309        if (bootOrder.isEmpty())
    1453             bootOrder = gCOMenum->toString (KDeviceType_Null);
     1310            bootOrder = gpConverter->toString (KDeviceType_Null);
    14541311
    14551312        iRowCount += 1; /* Boot-order row. */
     
    16171474                                            QString(sSectionItemTpl2)
    16181475                                            .arg(QString("&nbsp;&nbsp;") +
    1619                                                  toString(StorageSlot(controller.GetBus(),
    1620                                                                       attachment.GetPort(),
    1621                                                                       attachment.GetDevice())) + strDeviceType)
     1476                                                 gpConverter->toString(StorageSlot(controller.GetBus(),
     1477                                                                                   attachment.GetPort(),
     1478                                                                                   attachment.GetDevice())) + strDeviceType)
    16221479                                            .arg(details(medium, false));
    16231480                /* Insert that attachment into map: */
     
    16611518            item = QString (sSectionItemTpl2)
    16621519                   .arg (tr ("Host Driver", "details report (audio)"),
    1663                          gCOMenum->toString (audio.GetAudioDriver())) +
     1520                         gpConverter->toString (audio.GetAudioDriver())) +
    16641521                   QString (sSectionItemTpl2)
    16651522                   .arg (tr ("Controller", "details report (audio)"),
    1666                          gCOMenum->toString (audio.GetAudioController()));
     1523                         gpConverter->toString (audio.GetAudioController()));
    16671524        else
    16681525            item = QString (sSectionItemTpl1)
     
    16891546            {
    16901547                KNetworkAttachmentType type = adapter.GetAttachmentType();
    1691                 QString attType = gCOMenum->toString (adapter.GetAdapterType())
     1548                QString attType = gpConverter->toString (adapter.GetAdapterType())
    16921549                                  .replace (QRegExp ("\\s\\(.+\\)"), " (%1)");
    16931550                /* don't use the adapter type string for types that have
     
    17071564                        "details report (network)").arg (adapter.GetGenericDriver()));
    17081565                else
    1709                     attType = attType.arg (gCOMenum->toString (type));
     1566                    attType = attType.arg (gpConverter->toString (type));
    17101567
    17111568                item += QString (sSectionItemTpl2)
     
    17491606                    mode == KPortMode_RawFile)
    17501607                    data += QString ("%1 (<nobr>%2</nobr>)")
    1751                             .arg (gCOMenum->toString (mode))
     1608                            .arg (gpConverter->toString (mode))
    17521609                            .arg (QDir::toNativeSeparators (port.GetPath()));
    17531610                else
    1754                     data += gCOMenum->toString (mode);
     1611                    data += gpConverter->toString (mode);
    17551612
    17561613                item += QString (sSectionItemTpl2)
     
    25772434void VBoxGlobal::retranslateUi()
    25782435{
    2579     mSlotTemplates [0] = tr ("IDE Primary Master", "New Storage UI : Slot Name");
    2580     mSlotTemplates [1] = tr ("IDE Primary Slave", "New Storage UI : Slot Name");
    2581     mSlotTemplates [2] = tr ("IDE Secondary Master", "New Storage UI : Slot Name");
    2582     mSlotTemplates [3] = tr ("IDE Secondary Slave", "New Storage UI : Slot Name");
    2583     mSlotTemplates [4] = tr ("SATA Port %1", "New Storage UI : Slot Name");
    2584     mSlotTemplates [5] = tr ("SCSI Port %1", "New Storage UI : Slot Name");
    2585     mSlotTemplates [6] = tr ("SAS Port %1", "New Storage UI : Slot Name");
    2586     mSlotTemplates [7] = tr ("Floppy Device %1", "New Storage UI : Slot Name");
    2587 
    2588     mDiskTypes_Differencing =                   tr ("Differencing", "DiskType");
     2436    mDiskTypes_Differencing = tr ("Differencing", "DiskType");
    25892437
    25902438    mUserDefinedPortName = tr ("User-defined", "serial port");
     
    46614509    mValid = true;
    46624510
    4663     /* Prepare COM enum extensions: */
    4664     COMEnumsWrapper::prepare();
     4511    UIConverter::prepare();
    46654512
    46664513    /* Cache IMedium data.
     
    47624609        delete m_pVirtualMachine;
    47634610
    4764     /* Cleanup COM enum extensions: */
    4765     COMEnumsWrapper::cleanup();
     4611    UIConverter::cleanup();
    47664612
    47674613    /* ensure CGuestOSType objects are no longer used */
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h

    r41689 r41819  
    3535/* COM includes: */
    3636#include "VBox/com/Guid.h"
    37 #include "COMEnums.h"
    3837#include "CHost.h"
    3938#include "CVirtualBox.h"
     
    5049class CUSBDevice;
    5150
    52 struct StorageSlot
    53 {
    54     StorageSlot() : bus (KStorageBus_Null), port (0), device (0) {}
    55     StorageSlot (const StorageSlot &aOther) : bus (aOther.bus), port (aOther.port), device (aOther.device) {}
    56     StorageSlot (KStorageBus aBus, LONG aPort, LONG aDevice) : bus (aBus), port (aPort), device (aDevice) {}
    57     StorageSlot& operator= (const StorageSlot &aOther) { bus = aOther.bus; port = aOther.port; device = aOther.device; return *this; }
    58     bool operator== (const StorageSlot &aOther) const { return bus == aOther.bus && port == aOther.port && device == aOther.device; }
    59     bool operator!= (const StorageSlot &aOther) const { return bus != aOther.bus || port != aOther.port || device != aOther.device; }
    60     bool operator< (const StorageSlot &aOther) const { return (bus < aOther.bus) ||
    61                                                               (bus == aOther.bus && port < aOther.port) ||
    62                                                               (bus == aOther.bus && port == aOther.port && device < aOther.device); }
    63     bool operator> (const StorageSlot &aOther) const { return (bus > aOther.bus) ||
    64                                                               (bus == aOther.bus && port > aOther.port) ||
    65                                                               (bus == aOther.bus && port == aOther.port && device > aOther.device); }
    66     bool isNull() { return bus == KStorageBus_Null; }
    67     KStorageBus bus; LONG port; LONG device;
    68 };
    69 Q_DECLARE_METATYPE (StorageSlot);
    70 
    7151// VBoxGlobal class
    7252////////////////////////////////////////////////////////////////////////////////
     
    8161
    8262public:
    83 
    84     typedef QHash <ulong, QString> QULongStringHash;
    8563
    8664    static VBoxGlobal &instance();
     
    208186        return tr("%n second(s)", "", cVal);
    209187    }
    210 
    211     QString toString (StorageSlot aSlot) const;
    212     StorageSlot toStorageSlot (const QString &aSlot) const;
    213188
    214189    QString differencingMediumTypeName() const { return mDiskTypes_Differencing; }
     
    548523    QPixmap mOfflineSnapshotIcon, mOnlineSnapshotIcon;
    549524
    550     QULongStringHash mSlotTemplates;
    551 
    552525    QString mDiskTypes_Differencing;
    553526
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMedium.cpp

    r41774 r41819  
    2929#include "VBoxGlobal.h"
    3030#include "UIMessageCenter.h"
    31 #include "COMEnumsWrapper.h"
     31#include "UIConverter.h"
    3232
    3333/* COM includes: */
     
    142142        mHardDiskFormat = mMedium.GetFormat();
    143143        mHardDiskType = vboxGlobal().mediumTypeString (mMedium);
    144         mStorageDetails = gCOMenum->toString((KMediumVariant)mMedium.GetVariant());
     144        mStorageDetails = gpConverter->toString((KMediumVariant)mMedium.GetVariant());
    145145        mIsReadOnly = mMedium.GetReadOnly();
    146146
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIIndicatorsPool.cpp

    r41615 r41819  
    2626#include "UIMachineDefs.h"
    2727#include "QIWithRetranslateUI.h"
    28 #include "COMEnumsWrapper.h"
     28#include "UIConverter.h"
    2929
    3030/* COM includes: */
     
    8888                    continue;
    8989                strAttData += QString("<br>&nbsp;<nobr>%1:&nbsp;%2</nobr>")
    90                     .arg(vboxGlobal().toString(StorageSlot(controller.GetBus(), attachment.GetPort(), attachment.GetDevice())))
     90                    .arg(gpConverter->toString(StorageSlot(controller.GetBus(), attachment.GetPort(), attachment.GetDevice())))
    9191                    .arg(UIMedium(attachment.GetMedium(), UIMediumType_HardDisk).location());
    9292                fAttachmentsPresent = true;
     
    157157                UIMedium vboxMedium(attachment.GetMedium(), UIMediumType_DVD);
    158158                strAttData += QString("<br>&nbsp;<nobr>%1:&nbsp;%2</nobr>")
    159                     .arg(vboxGlobal().toString(StorageSlot(controller.GetBus(), attachment.GetPort(), attachment.GetDevice())))
     159                    .arg(gpConverter->toString(StorageSlot(controller.GetBus(), attachment.GetPort(), attachment.GetDevice())))
    160160                    .arg(vboxMedium.isNull() || vboxMedium.isHostDrive() ? vboxMedium.name() : vboxMedium.location());
    161161                fAttachmentsPresent = true;
     
    228228                UIMedium vboxMedium(attachment.GetMedium(), UIMediumType_Floppy);
    229229                strAttData += QString("<br>&nbsp;<nobr>%1:&nbsp;%2</nobr>")
    230                     .arg(vboxGlobal().toString(StorageSlot(controller.GetBus(), attachment.GetPort(), attachment.GetDevice())))
     230                    .arg(gpConverter->toString(StorageSlot(controller.GetBus(), attachment.GetPort(), attachment.GetDevice())))
    231231                    .arg(vboxMedium.isNull() || vboxMedium.isHostDrive() ? vboxMedium.name() : vboxMedium.location());
    232232                fAttachmentsPresent = true;
     
    328328                               "<br><nobr><b>Adapter %1 (%2)</b>: %3 cable %4</nobr>", "Network adapters tooltip")
    329329                    .arg(uSlot + 1)
    330                     .arg(gCOMenum->toString(adapter.GetAttachmentType()))
     330                    .arg(gpConverter->toString(adapter.GetAttachmentType()))
    331331                    .arg(strGuestIp.isEmpty() ? "" : "IP " + strGuestIp + ", ")
    332332                    .arg(adapter.GetCableConnected() ?
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r41689 r41819  
    4848#include "UISettingsDialogSpecific.h"
    4949#include "UIVMLogViewer.h"
     50#include "UIConverter.h"
    5051#ifdef Q_WS_MAC
    5152# include "DockIconPreview.h"
     
    11531154                pAttachmentMenu = new QMenu(pMenu);
    11541155                pAttachmentMenu->setTitle(QString("%1 (%2)").arg(controller.GetName())
    1155                                           .arg(vboxGlobal().toString(StorageSlot(controller.GetBus(),
     1156                                          .arg(gpConverter->toString(StorageSlot(controller.GetBus(),
    11561157                                                                                 attachment.GetPort(),
    11571158                                                                                 attachment.GetDevice()))));
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp

    r41689 r41819  
    3737#include "UISession.h"
    3838#include "UIVMCloseDialog.h"
    39 #include "COMEnumsWrapper.h"
     39#include "UIConverter.h"
    4040
    4141/* COM includes: */
     
    609609        QString strMachineName = m.GetName() + strSnapshotName;
    610610        if (state != KMachineState_Null)
    611             strMachineName += " [" + gCOMenum->toString(state) + "]";
     611            strMachineName += " [" + gpConverter->toString(state) + "]";
    612612        /* Unusual on the Mac. */
    613613#ifndef Q_WS_MAC
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UIVMDesktop.cpp

    r41689 r41819  
    4242#include "UIToolBar.h"
    4343#include "VBoxUtils.h"
    44 #include "COMEnumsWrapper.h"
     44#include "UIConverter.h"
    4545
    4646/* COM includes: */
     
    755755                    if (device == KDeviceType_Null)
    756756                        continue;
    757                     bootOrder << gCOMenum->toString(device);
     757                    bootOrder << gpConverter->toString(device);
    758758                }
    759759                if (bootOrder.isEmpty())
    760                     bootOrder << gCOMenum->toString(KDeviceType_Null);
     760                    bootOrder << gpConverter->toString(KDeviceType_Null);
    761761
    762762                item += sSectionItemTpl2.arg(tr("Boot Order", "details report"), bootOrder.join(", "));
     
    929929                                                QString(sSectionItemTpl2)
    930930                                                .arg(QString("&nbsp;&nbsp;") +
    931                                                      vboxGlobal().toString(StorageSlot(controller.GetBus(),
     931                                                     gpConverter->toString(StorageSlot(controller.GetBus(),
    932932                                                                                       attachment.GetPort(),
    933933                                                                                       attachment.GetDevice())) +
     
    981981            if (audio.GetEnabled())
    982982                item = QString(sSectionItemTpl2).arg(tr("Host Driver", "details report (audio)"),
    983                                                      gCOMenum->toString(audio.GetAudioDriver())) +
     983                                                     gpConverter->toString(audio.GetAudioDriver())) +
    984984                       QString(sSectionItemTpl2).arg(tr("Controller", "details report (audio)"),
    985                                                      gCOMenum->toString(audio.GetAudioController()));
     985                                                     gpConverter->toString(audio.GetAudioController()));
    986986            else
    987987                item = QString(sSectionItemTpl1).arg(tr("Disabled", "details report (audio)"));
     
    10201020                {
    10211021                    KNetworkAttachmentType type = adapter.GetAttachmentType();
    1022                     QString attType = gCOMenum->toString(adapter.GetAdapterType())
     1022                    QString attType = gpConverter->toString(adapter.GetAdapterType())
    10231023                                      .replace(QRegExp("\\s\\(.+\\)"), " (%1)");
    10241024                    /* Don't use the adapter type string for types that have
     
    10401040                    }
    10411041                    else
    1042                         attType = attType.arg(gCOMenum->toString(type));
     1042                        attType = attType.arg(gpConverter->toString(type));
    10431043
    10441044                    item += QString(sSectionItemTpl2).arg(tr("Adapter %1", "details report (network)").arg(adapter.GetSlot() + 1))
     
    10841084                    QString data = vboxGlobal().toCOMPortName(port.GetIRQ(), port.GetIOBase()) + ", ";
    10851085                    if (mode == KPortMode_HostPipe || mode == KPortMode_HostDevice || mode == KPortMode_RawFile)
    1086                         data += QString("%1 (<nobr>%2</nobr>)").arg(gCOMenum->toString(mode)).arg(QDir::toNativeSeparators(port.GetPath()));
     1086                        data += QString("%1 (<nobr>%2</nobr>)").arg(gpConverter->toString(mode)).arg(QDir::toNativeSeparators(port.GetPath()));
    10871087                    else
    1088                         data += gCOMenum->toString(mode);
     1088                        data += gpConverter->toString(mode);
    10891089
    10901090                    item += QString(sSectionItemTpl2).arg(tr("Port %1", "details report (serial ports)").arg(port.GetSlot() + 1))
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UIVMItem.cpp

    r41689 r41819  
    2929#include "UIVMItem.h"
    3030#include "VBoxGlobal.h"
    31 #include "COMEnumsWrapper.h"
     31#include "UIConverter.h"
    3232#ifdef Q_WS_MAC
    3333# include <ApplicationServices/ApplicationServices.h>
     
    161161QString UIVMItem::machineStateName() const
    162162{
    163     return m_fAccessible ? gCOMenum->toString(m_machineState) :
     163    return m_fAccessible ? gpConverter->toString(m_machineState) :
    164164           QApplication::translate("UIVMListView", "Inaccessible");
    165165}
     
    167167QIcon UIVMItem::machineStateIcon() const
    168168{
    169     return m_fAccessible ? gCOMenum->toIcon(m_machineState) :
     169    return m_fAccessible ? gpConverter->toPixmap(m_machineState) :
    170170                           QPixmap(":/state_aborted_16px.png");
    171171}
     
    173173QString UIVMItem::sessionStateName() const
    174174{
    175     return m_fAccessible ? gCOMenum->toString(m_sessionState) :
     175    return m_fAccessible ? gpConverter->toString(m_sessionState) :
    176176           QApplication::translate("UIVMListView", "Inaccessible");
    177177}
     
    196196            "VM tooltip (name, last state change, session state)")
    197197            .arg(toolTip)
    198             .arg(gCOMenum->toString(m_machineState))
     198            .arg(gpConverter->toString(m_machineState))
    199199            .arg(dateTime)
    200             .arg(gCOMenum->toString(m_sessionState));
     200            .arg(gpConverter->toString(m_sessionState));
    201201    }
    202202    else
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/VBoxSnapshotsWgt.cpp

    r41608 r41819  
    3939#include "UIVirtualBoxEventHandler.h"
    4040#include "UISelectorShortcuts.h"
    41 #include "COMEnumsWrapper.h"
     41#include "UIConverter.h"
    4242
    4343/* COM includes: */
     
    190190            return;
    191191
    192         setIcon (0, gCOMenum->toIcon (aState));
     192        setIcon (0, gpConverter->toPixmap (aState));
    193193        mMachineState = aState;
    194194        mTimestamp.setTime_t (mMachine.GetLastStateChange() / 1000);
     
    277277        {
    278278            dateTime = VBoxSnapshotsWgt::tr ("%1 since %2", "Current State (time or date + time)")
    279                 .arg (gCOMenum->toString (mMachineState)).arg (dateTime);
     279                .arg (gpConverter->toString (mMachineState)).arg (dateTime);
    280280        }
    281281
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsAudio.cpp

    r41608 r41819  
    2020/* GUI includes: */
    2121#include "UIMachineSettingsAudio.h"
    22 #include "COMEnumsWrapper.h"
     22#include "UIConverter.h"
    2323
    2424/* COM includes: */
     
    7272    /* Load audio data to page: */
    7373    mGbAudio->setChecked(audioData.m_fAudioEnabled);
    74     mCbAudioDriver->setCurrentIndex(mCbAudioDriver->findText(gCOMenum->toString(audioData.m_audioDriverType)));
    75     mCbAudioController->setCurrentIndex(mCbAudioController->findText(gCOMenum->toString(audioData.m_audioControllerType)));
     74    mCbAudioDriver->setCurrentIndex(mCbAudioDriver->findText(gpConverter->toString(audioData.m_audioDriverType)));
     75    mCbAudioController->setCurrentIndex(mCbAudioController->findText(gpConverter->toString(audioData.m_audioControllerType)));
    7676
    7777    /* Polish page finally: */
     
    8888    /* Gather audio data: */
    8989    audioData.m_fAudioEnabled = mGbAudio->isChecked();
    90     audioData.m_audioDriverType = gCOMenum->toAudioDriverType(mCbAudioDriver->currentText());
    91     audioData.m_audioControllerType = gCOMenum->toAudioControllerType(mCbAudioController->currentText());
     90    audioData.m_audioDriverType = gpConverter->fromString<KAudioDriverType>(mCbAudioDriver->currentText());
     91    audioData.m_audioControllerType = gpConverter->fromString<KAudioControllerType>(mCbAudioController->currentText());
    9292
    9393    /* Cache audio data: */
     
    148148    mCbAudioDriver->clear();
    149149    /* Refill them */
    150     mCbAudioDriver->addItem (gCOMenum->toString (KAudioDriverType_Null));
     150    mCbAudioDriver->addItem (gpConverter->toString (KAudioDriverType_Null));
    151151#if defined Q_WS_WIN32
    152     mCbAudioDriver->addItem (gCOMenum->toString (KAudioDriverType_DirectSound));
     152    mCbAudioDriver->addItem (gpConverter->toString (KAudioDriverType_DirectSound));
    153153# ifdef VBOX_WITH_WINMM
    154     mCbAudioDriver->addItem (gCOMenum->toString (KAudioDriverType_WinMM));
     154    mCbAudioDriver->addItem (gpConverter->toString (KAudioDriverType_WinMM));
    155155# endif
    156156#endif
    157157#if defined Q_OS_SOLARIS
    158     mCbAudioDriver->addItem (gCOMenum->toString (KAudioDriverType_SolAudio));
     158    mCbAudioDriver->addItem (gpConverter->toString (KAudioDriverType_SolAudio));
    159159# if defined VBOX_WITH_SOLARIS_OSS
    160     mCbAudioDriver->addItem (gCOMenum->toString (KAudioDriverType_OSS));
     160    mCbAudioDriver->addItem (gpConverter->toString (KAudioDriverType_OSS));
    161161#endif
    162162#endif
    163163#if defined Q_OS_LINUX || defined Q_OS_FREEBSD
    164     mCbAudioDriver->addItem (gCOMenum->toString (KAudioDriverType_OSS));
     164    mCbAudioDriver->addItem (gpConverter->toString (KAudioDriverType_OSS));
    165165# ifdef VBOX_WITH_PULSE
    166     mCbAudioDriver->addItem (gCOMenum->toString (KAudioDriverType_Pulse));
     166    mCbAudioDriver->addItem (gpConverter->toString (KAudioDriverType_Pulse));
    167167# endif
    168168#endif
    169169#if defined Q_OS_LINUX
    170170# ifdef VBOX_WITH_ALSA
    171     mCbAudioDriver->addItem (gCOMenum->toString (KAudioDriverType_ALSA));
     171    mCbAudioDriver->addItem (gpConverter->toString (KAudioDriverType_ALSA));
    172172# endif
    173173#endif
    174174#if defined Q_OS_MACX
    175     mCbAudioDriver->addItem (gCOMenum->toString (KAudioDriverType_CoreAudio));
     175    mCbAudioDriver->addItem (gpConverter->toString (KAudioDriverType_CoreAudio));
    176176#endif
    177177    /* Set the old value */
     
    184184    /* Refill them */
    185185    mCbAudioController->insertItem (mCbAudioController->count(),
    186         gCOMenum->toString (KAudioControllerType_HDA));
     186        gpConverter->toString (KAudioControllerType_HDA));
    187187    mCbAudioController->insertItem (mCbAudioController->count(),
    188         gCOMenum->toString (KAudioControllerType_AC97));
     188        gpConverter->toString (KAudioControllerType_AC97));
    189189    mCbAudioController->insertItem (mCbAudioController->count(),
    190         gCOMenum->toString (KAudioControllerType_SB16));
     190        gpConverter->toString (KAudioControllerType_SB16));
    191191    /* Set the old value */
    192192    mCbAudioController->setCurrentIndex (currentController);
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.cpp

    r41689 r41819  
    2626#include "VBoxGlobal.h"
    2727#include "UIMessageCenter.h"
    28 #include "COMEnumsWrapper.h"
     28#include "UIConverter.h"
    2929
    3030/* COM includes: */
     
    222222        mCbVRDE->setChecked(displayData.m_fVRDEServerEnabled);
    223223        mLeVRDEPort->setText(displayData.m_strVRDEPort);
    224         mCbVRDEMethod->setCurrentIndex(mCbVRDEMethod->findText(gCOMenum->toString(displayData.m_VRDEAuthType)));
     224        mCbVRDEMethod->setCurrentIndex(mCbVRDEMethod->findText(gpConverter->toString(displayData.m_VRDEAuthType)));
    225225        mLeVRDETimeout->setText(QString::number(displayData.m_uVRDETimeout));
    226226        mCbMultipleConn->setChecked(displayData.m_fMultipleConnectionsAllowed);
     
    253253        displayData.m_fVRDEServerEnabled = mCbVRDE->isChecked();
    254254        displayData.m_strVRDEPort = mLeVRDEPort->text();
    255         displayData.m_VRDEAuthType = gCOMenum->toAuthType(mCbVRDEMethod->currentText());
     255        displayData.m_VRDEAuthType = gpConverter->fromString<KAuthType>(mCbVRDEMethod->currentText());
    256256        displayData.m_uVRDETimeout = mLeVRDETimeout->text().toULong();
    257257        displayData.m_fMultipleConnectionsAllowed = mCbMultipleConn->isChecked();
     
    436436
    437437    mCbVRDEMethod->setItemText (0,
    438         gCOMenum->toString (KAuthType_Null));
     438        gpConverter->toString (KAuthType_Null));
    439439    mCbVRDEMethod->setItemText (1,
    440         gCOMenum->toString (KAuthType_External));
     440        gpConverter->toString (KAuthType_External));
    441441    mCbVRDEMethod->setItemText (2,
    442         gCOMenum->toString (KAuthType_Guest));
     442        gpConverter->toString (KAuthType_Guest));
    443443}
    444444
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.cpp

    r41689 r41819  
    2626#include "UIMessageCenter.h"
    2727#include "QIWidgetValidator.h"
    28 #include "COMEnumsWrapper.h"
     28#include "UIConverter.h"
    2929
    3030UIMachineSettingsGeneral::UIMachineSettingsGeneral()
     
    241241
    242242    /* Shared Clipboard mode */
    243     mCbClipboard->setItemText (0, gCOMenum->toString (KClipboardMode_Disabled));
    244     mCbClipboard->setItemText (1, gCOMenum->toString (KClipboardMode_HostToGuest));
    245     mCbClipboard->setItemText (2, gCOMenum->toString (KClipboardMode_GuestToHost));
    246     mCbClipboard->setItemText (3, gCOMenum->toString (KClipboardMode_Bidirectional));
     243    mCbClipboard->setItemText (0, gpConverter->toString (KClipboardMode_Disabled));
     244    mCbClipboard->setItemText (1, gpConverter->toString (KClipboardMode_HostToGuest));
     245    mCbClipboard->setItemText (2, gpConverter->toString (KClipboardMode_GuestToHost));
     246    mCbClipboard->setItemText (3, gpConverter->toString (KClipboardMode_Bidirectional));
    247247}
    248248
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.cpp

    r41608 r41819  
    2424#include "QITabWidget.h"
    2525#include "VBoxGlobal.h"
    26 #include "COMEnumsWrapper.h"
     26#include "UIConverter.h"
    2727
    2828/* COM includes: */
     
    509509        /* Populate attachments: */
    510510        int iAttachmentTypeIndex = 0;
    511         m_pAttachmentTypeComboBox->insertItem(iAttachmentTypeIndex, gCOMenum->toString(KNetworkAttachmentType_Null));
     511        m_pAttachmentTypeComboBox->insertItem(iAttachmentTypeIndex, gpConverter->toString(KNetworkAttachmentType_Null));
    512512        m_pAttachmentTypeComboBox->setItemData(iAttachmentTypeIndex, KNetworkAttachmentType_Null);
    513513        m_pAttachmentTypeComboBox->setItemData(iAttachmentTypeIndex, m_pAttachmentTypeComboBox->itemText(iAttachmentTypeIndex), Qt::ToolTipRole);
    514514        ++iAttachmentTypeIndex;
    515         m_pAttachmentTypeComboBox->insertItem(iAttachmentTypeIndex, gCOMenum->toString(KNetworkAttachmentType_NAT));
     515        m_pAttachmentTypeComboBox->insertItem(iAttachmentTypeIndex, gpConverter->toString(KNetworkAttachmentType_NAT));
    516516        m_pAttachmentTypeComboBox->setItemData(iAttachmentTypeIndex, KNetworkAttachmentType_NAT);
    517517        m_pAttachmentTypeComboBox->setItemData(iAttachmentTypeIndex, m_pAttachmentTypeComboBox->itemText(iAttachmentTypeIndex), Qt::ToolTipRole);
    518518        ++iAttachmentTypeIndex;
    519         m_pAttachmentTypeComboBox->insertItem(iAttachmentTypeIndex, gCOMenum->toString(KNetworkAttachmentType_Bridged));
     519        m_pAttachmentTypeComboBox->insertItem(iAttachmentTypeIndex, gpConverter->toString(KNetworkAttachmentType_Bridged));
    520520        m_pAttachmentTypeComboBox->setItemData(iAttachmentTypeIndex, KNetworkAttachmentType_Bridged);
    521521        m_pAttachmentTypeComboBox->setItemData(iAttachmentTypeIndex, m_pAttachmentTypeComboBox->itemText(iAttachmentTypeIndex), Qt::ToolTipRole);
    522522        ++iAttachmentTypeIndex;
    523         m_pAttachmentTypeComboBox->insertItem(iAttachmentTypeIndex, gCOMenum->toString(KNetworkAttachmentType_Internal));
     523        m_pAttachmentTypeComboBox->insertItem(iAttachmentTypeIndex, gpConverter->toString(KNetworkAttachmentType_Internal));
    524524        m_pAttachmentTypeComboBox->setItemData(iAttachmentTypeIndex, KNetworkAttachmentType_Internal);
    525525        m_pAttachmentTypeComboBox->setItemData(iAttachmentTypeIndex, m_pAttachmentTypeComboBox->itemText(iAttachmentTypeIndex), Qt::ToolTipRole);
    526526        ++iAttachmentTypeIndex;
    527         m_pAttachmentTypeComboBox->insertItem(iAttachmentTypeIndex, gCOMenum->toString(KNetworkAttachmentType_HostOnly));
     527        m_pAttachmentTypeComboBox->insertItem(iAttachmentTypeIndex, gpConverter->toString(KNetworkAttachmentType_HostOnly));
    528528        m_pAttachmentTypeComboBox->setItemData(iAttachmentTypeIndex, KNetworkAttachmentType_HostOnly);
    529529        m_pAttachmentTypeComboBox->setItemData(iAttachmentTypeIndex, m_pAttachmentTypeComboBox->itemText(iAttachmentTypeIndex), Qt::ToolTipRole);
    530530        ++iAttachmentTypeIndex;
    531         m_pAttachmentTypeComboBox->insertItem(iAttachmentTypeIndex, gCOMenum->toString(KNetworkAttachmentType_Generic));
     531        m_pAttachmentTypeComboBox->insertItem(iAttachmentTypeIndex, gpConverter->toString(KNetworkAttachmentType_Generic));
    532532        m_pAttachmentTypeComboBox->setItemData(iAttachmentTypeIndex, KNetworkAttachmentType_Generic);
    533533        m_pAttachmentTypeComboBox->setItemData(iAttachmentTypeIndex, m_pAttachmentTypeComboBox->itemText(iAttachmentTypeIndex), Qt::ToolTipRole);
     
    548548        /* Populate adapter types: */
    549549        int iAdapterTypeIndex = 0;
    550         m_pAdapterTypeCombo->insertItem(iAdapterTypeIndex, gCOMenum->toString(KNetworkAdapterType_Am79C970A));
     550        m_pAdapterTypeCombo->insertItem(iAdapterTypeIndex, gpConverter->toString(KNetworkAdapterType_Am79C970A));
    551551        m_pAdapterTypeCombo->setItemData(iAdapterTypeIndex, KNetworkAdapterType_Am79C970A);
    552552        m_pAdapterTypeCombo->setItemData(iAdapterTypeIndex, m_pAdapterTypeCombo->itemText(iAdapterTypeIndex), Qt::ToolTipRole);
    553553        ++iAdapterTypeIndex;
    554         m_pAdapterTypeCombo->insertItem(iAdapterTypeIndex, gCOMenum->toString(KNetworkAdapterType_Am79C973));
     554        m_pAdapterTypeCombo->insertItem(iAdapterTypeIndex, gpConverter->toString(KNetworkAdapterType_Am79C973));
    555555        m_pAdapterTypeCombo->setItemData(iAdapterTypeIndex, KNetworkAdapterType_Am79C973);
    556556        m_pAdapterTypeCombo->setItemData(iAdapterTypeIndex, m_pAdapterTypeCombo->itemText(iAdapterTypeIndex), Qt::ToolTipRole);
    557557        ++iAdapterTypeIndex;
    558558#ifdef VBOX_WITH_E1000
    559         m_pAdapterTypeCombo->insertItem(iAdapterTypeIndex, gCOMenum->toString(KNetworkAdapterType_I82540EM));
     559        m_pAdapterTypeCombo->insertItem(iAdapterTypeIndex, gpConverter->toString(KNetworkAdapterType_I82540EM));
    560560        m_pAdapterTypeCombo->setItemData(iAdapterTypeIndex, KNetworkAdapterType_I82540EM);
    561561        m_pAdapterTypeCombo->setItemData(iAdapterTypeIndex, m_pAdapterTypeCombo->itemText(iAdapterTypeIndex), Qt::ToolTipRole);
    562562        ++iAdapterTypeIndex;
    563         m_pAdapterTypeCombo->insertItem(iAdapterTypeIndex, gCOMenum->toString(KNetworkAdapterType_I82543GC));
     563        m_pAdapterTypeCombo->insertItem(iAdapterTypeIndex, gpConverter->toString(KNetworkAdapterType_I82543GC));
    564564        m_pAdapterTypeCombo->setItemData(iAdapterTypeIndex, KNetworkAdapterType_I82543GC);
    565565        m_pAdapterTypeCombo->setItemData(iAdapterTypeIndex, m_pAdapterTypeCombo->itemText(iAdapterTypeIndex), Qt::ToolTipRole);
    566566        ++iAdapterTypeIndex;
    567         m_pAdapterTypeCombo->insertItem(iAdapterTypeIndex, gCOMenum->toString(KNetworkAdapterType_I82545EM));
     567        m_pAdapterTypeCombo->insertItem(iAdapterTypeIndex, gpConverter->toString(KNetworkAdapterType_I82545EM));
    568568        m_pAdapterTypeCombo->setItemData(iAdapterTypeIndex, KNetworkAdapterType_I82545EM);
    569569        m_pAdapterTypeCombo->setItemData(iAdapterTypeIndex, m_pAdapterTypeCombo->itemText(iAdapterTypeIndex), Qt::ToolTipRole);
     
    571571#endif /* VBOX_WITH_E1000 */
    572572#ifdef VBOX_WITH_VIRTIO
    573         m_pAdapterTypeCombo->insertItem(iAdapterTypeIndex, gCOMenum->toString(KNetworkAdapterType_Virtio));
     573        m_pAdapterTypeCombo->insertItem(iAdapterTypeIndex, gpConverter->toString(KNetworkAdapterType_Virtio));
    574574        m_pAdapterTypeCombo->setItemData(iAdapterTypeIndex, KNetworkAdapterType_Virtio);
    575575        m_pAdapterTypeCombo->setItemData(iAdapterTypeIndex, m_pAdapterTypeCombo->itemText(iAdapterTypeIndex), Qt::ToolTipRole);
     
    591591        /* Populate promiscuous modes: */
    592592        int iPromiscuousModeIndex = 0;
    593         m_pPromiscuousModeCombo->insertItem(iPromiscuousModeIndex, gCOMenum->toString(KNetworkAdapterPromiscModePolicy_Deny));
     593        m_pPromiscuousModeCombo->insertItem(iPromiscuousModeIndex, gpConverter->toString(KNetworkAdapterPromiscModePolicy_Deny));
    594594        m_pPromiscuousModeCombo->setItemData(iPromiscuousModeIndex, KNetworkAdapterPromiscModePolicy_Deny);
    595595        m_pPromiscuousModeCombo->setItemData(iPromiscuousModeIndex, m_pPromiscuousModeCombo->itemText(iPromiscuousModeIndex), Qt::ToolTipRole);
    596596        ++iPromiscuousModeIndex;
    597         m_pPromiscuousModeCombo->insertItem(iPromiscuousModeIndex, gCOMenum->toString(KNetworkAdapterPromiscModePolicy_AllowNetwork));
     597        m_pPromiscuousModeCombo->insertItem(iPromiscuousModeIndex, gpConverter->toString(KNetworkAdapterPromiscModePolicy_AllowNetwork));
    598598        m_pPromiscuousModeCombo->setItemData(iPromiscuousModeIndex, KNetworkAdapterPromiscModePolicy_AllowNetwork);
    599599        m_pPromiscuousModeCombo->setItemData(iPromiscuousModeIndex, m_pPromiscuousModeCombo->itemText(iPromiscuousModeIndex), Qt::ToolTipRole);
    600600        ++iPromiscuousModeIndex;
    601         m_pPromiscuousModeCombo->insertItem(iPromiscuousModeIndex, gCOMenum->toString(KNetworkAdapterPromiscModePolicy_AllowAll));
     601        m_pPromiscuousModeCombo->insertItem(iPromiscuousModeIndex, gpConverter->toString(KNetworkAdapterPromiscModePolicy_AllowAll));
    602602        m_pPromiscuousModeCombo->setItemData(iPromiscuousModeIndex, KNetworkAdapterPromiscModePolicy_AllowAll);
    603603        m_pPromiscuousModeCombo->setItemData(iPromiscuousModeIndex, m_pPromiscuousModeCombo->itemText(iPromiscuousModeIndex), Qt::ToolTipRole);
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsPortForwardingDlg.cpp

    r41608 r41819  
    3838#include "QIDialogButtonBox.h"
    3939#include "UIIconPool.h"
    40 #include "COMEnumsWrapper.h"
     40#include "UIConverter.h"
    4141
    4242/* Other VBox includes: */
     
    111111    ProtocolEditor(QWidget *pParent = 0) : QComboBox(pParent)
    112112    {
    113         addItem(gCOMenum->toString(KNATProtocol_UDP), QVariant::fromValue(KNATProtocol_UDP));
    114         addItem(gCOMenum->toString(KNATProtocol_TCP), QVariant::fromValue(KNATProtocol_TCP));
     113        addItem(gpConverter->toString(KNATProtocol_UDP), QVariant::fromValue(KNATProtocol_UDP));
     114        addItem(gpConverter->toString(KNATProtocol_TCP), QVariant::fromValue(KNATProtocol_TCP));
    115115    }
    116116
     
    284284                {
    285285                    case UIPortForwardingDataType_Name: return m_dataList[index.row()].name;
    286                     case UIPortForwardingDataType_Protocol: return gCOMenum->toString(m_dataList[index.row()].protocol);
     286                    case UIPortForwardingDataType_Protocol: return gpConverter->toString(m_dataList[index.row()].protocol);
    287287                    case UIPortForwardingDataType_HostIp: return m_dataList[index.row()].hostIp;
    288288                    case UIPortForwardingDataType_HostPort: return m_dataList[index.row()].hostPort.value();
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSerial.cpp

    r41608 r41819  
    2626#include "VBoxGlobal.h"
    2727#include "QITabWidget.h"
    28 #include "COMEnumsWrapper.h"
     28#include "UIConverter.h"
    2929
    3030/* COM includes: */
     
    7676    ulong uIRQ, uIOBase;
    7777    bool fStd = vboxGlobal().toCOMPortNumbers(mCbNumber->currentText(), uIRQ, uIOBase);
    78     KPortMode mode = gCOMenum->toPortMode(mCbMode->currentText());
     78    KPortMode mode = gpConverter->fromString<KPortMode>(mCbMode->currentText());
    7979
    8080    mGbSerial->setEnabled(m_pParent->isMachineOffline());
     
    105105    mLeIRQ->setText(QString::number(portData.m_uIRQ));
    106106    mLeIOPort->setText("0x" + QString::number(portData.m_uIOBase, 16).toUpper());
    107     mCbMode->setCurrentIndex(mCbMode->findText(gCOMenum->toString(portData.m_hostMode)));
     107    mCbMode->setCurrentIndex(mCbMode->findText(gpConverter->toString(portData.m_hostMode)));
    108108    mCbPipe->setChecked(portData.m_fServer);
    109109    mLePath->setText(portData.m_strPath);
     
    123123    portData.m_uIOBase = mLeIOPort->text().toULong (NULL, 0);
    124124    portData.m_fServer = mCbPipe->isChecked();
    125     portData.m_hostMode = gCOMenum->toPortMode(mCbMode->currentText());
     125    portData.m_hostMode = gpConverter->fromString<KPortMode>(mCbMode->currentText());
    126126    portData.m_strPath = QDir::toNativeSeparators(mLePath->text());
    127127
     
    173173    mCbNumber->setItemText (mCbNumber->count() - 1, vboxGlobal().toCOMPortName (0, 0));
    174174
    175     mCbMode->setItemText (3, gCOMenum->toString (KPortMode_RawFile));
    176     mCbMode->setItemText (2, gCOMenum->toString (KPortMode_HostDevice));
    177     mCbMode->setItemText (1, gCOMenum->toString (KPortMode_HostPipe));
    178     mCbMode->setItemText (0, gCOMenum->toString (KPortMode_Disconnected));
     175    mCbMode->setItemText (3, gpConverter->toString (KPortMode_RawFile));
     176    mCbMode->setItemText (2, gpConverter->toString (KPortMode_HostDevice));
     177    mCbMode->setItemText (1, gpConverter->toString (KPortMode_HostPipe));
     178    mCbMode->setItemText (0, gpConverter->toString (KPortMode_Disconnected));
    179179}
    180180
     
    206206void UIMachineSettingsSerial::mCbModeActivated (const QString &aText)
    207207{
    208     KPortMode mode = gCOMenum->toPortMode (aText);
     208    KPortMode mode = gpConverter->fromString<KPortMode> (aText);
    209209    mCbPipe->setEnabled (mode == KPortMode_HostPipe);
    210210    mLePath->setEnabled (mode != KPortMode_Disconnected);
     
    409409        /* Check the port path emptiness & unicity */
    410410        KPortMode mode =
    411             gCOMenum->toPortMode (page->mCbMode->currentText());
     411            gpConverter->fromString<KPortMode> (page->mCbMode->currentText());
    412412        if (mode != KPortMode_Disconnected)
    413413        {
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp

    r41689 r41819  
    3636#include "UIMessageCenter.h"
    3737#include "UIMachineSettingsStorage.h"
    38 #include "COMEnumsWrapper.h"
     38#include "UIConverter.h"
    3939
    4040/* COM includes: */
     
    550550                                 "<nobr>Type:&nbsp;&nbsp;%3</nobr>")
    551551                                 .arg (mCtrName)
    552                                  .arg (gCOMenum->toString (mCtrType->busType()))
    553                                  .arg (gCOMenum->toString (mCtrType->ctrType()));
     552                                 .arg (gpConverter->toString (mCtrType->busType()))
     553                                 .arg (gpConverter->toString (mCtrType->ctrType()));
    554554}
    555555
     
    21262126            KDeviceType attDevice = mStorageModel->data (attIndex, StorageModel::R_AttDevice).value <KDeviceType>();
    21272127            QString key (mStorageModel->data (attIndex, StorageModel::R_AttMediumId).toString());
    2128             QString value (QString ("%1 (%2)").arg (ctrName, vboxGlobal().toString (attSlot)));
     2128            QString value (QString ("%1 (%2)").arg (ctrName, gpConverter->toString (attSlot)));
    21292129            /* Check for emptiness */
    21302130            if (vboxGlobal().findMedium (key).isNull() && attDevice == KDeviceType_HardDisk)
     
    21532153        {
    21542154            QString strExcessiveRecord = QString("%1 (%2)");
    2155             strExcessiveRecord = strExcessiveRecord.arg(QString("<b>%1</b>").arg(gCOMenum->toString((KStorageBus)iStorageBusType)));
     2155            strExcessiveRecord = strExcessiveRecord.arg(QString("<b>%1</b>").arg(gpConverter->toString((KStorageBus)iStorageBusType)));
    21562156            strExcessiveRecord = strExcessiveRecord.arg(maximumType[(KStorageBus)iStorageBusType] == 1 ?
    21572157                                                        tr("at most one supported", "controller") :
     
    21652165                        "Please change the chipset type on the System settings page or reduce the number "
    21662166                        "of the following storage controllers on the Storage settings page: %2.")
    2167                         .arg(gCOMenum->toString(mStorageModel->chipsetType()))
     2167                        .arg(gpConverter->toString(mStorageModel->chipsetType()))
    21682168                        .arg(excessiveList.join(", "));
    21692169        return false;
     
    24312431                ControllerTypeList controllerTypeList (mStorageModel->data (index, StorageModel::R_CtrTypes).value <ControllerTypeList>());
    24322432                for (int i = 0; i < controllerTypeList.size(); ++ i)
    2433                     mCbType->insertItem (mCbType->count(), gCOMenum->toString (controllerTypeList [i]));
     2433                    mCbType->insertItem (mCbType->count(), gpConverter->toString (controllerTypeList [i]));
    24342434                KStorageControllerType type = mStorageModel->data (index, StorageModel::R_CtrType).value <KStorageControllerType>();
    2435                 int ctrPos = mCbType->findText (gCOMenum->toString (type));
     2435                int ctrPos = mCbType->findText (gpConverter->toString (type));
    24362436                mCbType->setCurrentIndex (ctrPos == -1 ? 0 : ctrPos);
    24372437
     
    24552455                SlotsList slotsList (mStorageModel->data (index, StorageModel::R_AttSlots).value <SlotsList>());
    24562456                for (int i = 0; i < slotsList.size(); ++ i)
    2457                     mCbSlot->insertItem (mCbSlot->count(), vboxGlobal().toString (slotsList [i]));
     2457                    mCbSlot->insertItem (mCbSlot->count(), gpConverter->toString (slotsList [i]));
    24582458                StorageSlot slt = mStorageModel->data (index, StorageModel::R_AttSlot).value <StorageSlot>();
    2459                 int attSlotPos = mCbSlot->findText (vboxGlobal().toString (slt));
     2459                int attSlotPos = mCbSlot->findText (gpConverter->toString (slt));
    24602460                mCbSlot->setCurrentIndex (attSlotPos == -1 ? 0 : attSlotPos);
    24612461                mCbSlot->setToolTip (mCbSlot->itemText (mCbSlot->currentIndex()));
     
    25512551            /* Setting Controller Sub-Type */
    25522552            else if (sdr == mCbType)
    2553                 mStorageModel->setData (index, QVariant::fromValue (gCOMenum->toControllerType (mCbType->currentText())),
     2553                mStorageModel->setData (index, QVariant::fromValue (gpConverter->fromString<KStorageControllerType> (mCbType->currentText())),
    25542554                                        StorageModel::R_CtrType);
    25552555            else if (sdr == mSbPortCount)
     
    25652565            {
    25662566                QModelIndex controllerIndex = mStorageModel->parent(index);
    2567                 StorageSlot attachmentStorageSlot = vboxGlobal().toStorageSlot(mCbSlot->currentText());
     2567                StorageSlot attachmentStorageSlot = gpConverter->fromString<StorageSlot>(mCbSlot->currentText());
    25682568                mStorageModel->setData(index, QVariant::fromValue(attachmentStorageSlot), StorageModel::R_AttSlot);
    25692569                QModelIndex theSameIndexAtNewPosition = mStorageModel->attachmentBySlot(controllerIndex, attachmentStorageSlot);
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.cpp

    r41608 r41819  
    2626#include "VBoxGlobal.h"
    2727#include "UIMachineSettingsSystem.h"
    28 #include "COMEnumsWrapper.h"
     28#include "UIConverter.h"
    2929
    3030/* COM includes: */
     
    163163
    164164    /* Populate chipset combo: */
    165     mCbChipset->insertItem(0, gCOMenum->toString(KChipsetType_PIIX3), QVariant(KChipsetType_PIIX3));
    166     mCbChipset->insertItem(1, gCOMenum->toString(KChipsetType_ICH9), QVariant(KChipsetType_ICH9));
     165    mCbChipset->insertItem(0, gpConverter->toString(KChipsetType_PIIX3), QVariant(KChipsetType_PIIX3));
     166    mCbChipset->insertItem(1, gpConverter->toString(KChipsetType_ICH9), QVariant(KChipsetType_ICH9));
    167167
    168168    /* Install global event filter */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.cpp

    r41689 r41819  
    3131#include "UIMachineSettingsUSB.h"
    3232#include "UIMachineSettingsUSBFilterDetails.h"
    33 #include "COMEnumsWrapper.h"
     33#include "UIConverter.h"
    3434
    3535/* COM includes: */
     
    821821            case UISettingsPageType_Global:
    822822            {
    823                 usbFilterData.m_action = gCOMenum->toUSBDevFilterAction(dlgFilterDetails.mCbAction->currentText());
     823                usbFilterData.m_action = gpConverter->fromString<KUSBDeviceFilterAction>(dlgFilterDetails.mCbAction->currentText());
    824824                break;
    825825            }
     
    10201020    {
    10211021        strToolTip += strToolTip.isEmpty() ? "":"<br/>" + tr("<nobr>State: %1</nobr>", "USB filter tooltip")
    1022                                                           .arg(gCOMenum->toString(usbFilterData.m_hostUSBDeviceState));
     1022                                                          .arg(gpConverter->toString(usbFilterData.m_hostUSBDeviceState));
    10231023    }
    10241024
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSBFilterDetails.cpp

    r41608 r41819  
    2020/* GUI includes: */
    2121#include "UIMachineSettingsUSBFilterDetails.h"
    22 #include "COMEnumsWrapper.h"
     22#include "UIConverter.h"
    2323
    2424UIMachineSettingsUSBFilterDetails::UIMachineSettingsUSBFilterDetails(UISettingsPageType type, QWidget *pParent /* = 0 */)
     
    6363
    6464    mCbAction->setItemText (0,
    65         gCOMenum->toString (KUSBDeviceFilterAction_Ignore));
     65        gpConverter->toString (KUSBDeviceFilterAction_Ignore));
    6666    mCbAction->setItemText (1,
    67         gCOMenum->toString (KUSBDeviceFilterAction_Hold));
     67        gpConverter->toString (KUSBDeviceFilterAction_Hold));
    6868}
    6969
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceEditorWidget.cpp

    r41608 r41819  
    3333#include "VBoxOSTypeSelectorButton.h"
    3434#include "UILineTextEdit.h"
    35 #include "COMEnumsWrapper.h"
     35#include "UIConverter.h"
    3636
    3737/* COM includes: */
     
    239239                    case KVirtualSystemDescriptionType_OS:             v = vboxGlobal().vmGuestOSTypeDescription(m_strConfigValue); break;
    240240                    case KVirtualSystemDescriptionType_Memory:         v = m_strConfigValue + " " + VBoxGlobal::tr("MB", "size suffix MBytes=1024 KBytes"); break;
    241                     case KVirtualSystemDescriptionType_SoundCard:      v = gCOMenum->toString(static_cast<KAudioControllerType>(m_strConfigValue.toInt())); break;
    242                     case KVirtualSystemDescriptionType_NetworkAdapter: v = gCOMenum->toString(static_cast<KNetworkAdapterType>(m_strConfigValue.toInt())); break;
     241                    case KVirtualSystemDescriptionType_SoundCard:      v = gpConverter->toString(static_cast<KAudioControllerType>(m_strConfigValue.toInt())); break;
     242                    case KVirtualSystemDescriptionType_NetworkAdapter: v = gpConverter->toString(static_cast<KNetworkAdapterType>(m_strConfigValue.toInt())); break;
    243243                    default:                                           v = m_strConfigValue; break;
    244244                }
     
    436436            {
    437437                QComboBox *e = new QComboBox(pParent);
    438                 e->addItem(gCOMenum->toString(KAudioControllerType_AC97), KAudioControllerType_AC97);
    439                 e->addItem(gCOMenum->toString(KAudioControllerType_SB16), KAudioControllerType_SB16);
    440                 e->addItem(gCOMenum->toString(KAudioControllerType_HDA),  KAudioControllerType_HDA);
     438                e->addItem(gpConverter->toString(KAudioControllerType_AC97), KAudioControllerType_AC97);
     439                e->addItem(gpConverter->toString(KAudioControllerType_SB16), KAudioControllerType_SB16);
     440                e->addItem(gpConverter->toString(KAudioControllerType_HDA),  KAudioControllerType_HDA);
    441441                editor = e;
    442442                break;
     
    445445            {
    446446                QComboBox *e = new QComboBox(pParent);
    447                 e->addItem(gCOMenum->toString(KNetworkAdapterType_Am79C970A), KNetworkAdapterType_Am79C970A);
    448                 e->addItem(gCOMenum->toString(KNetworkAdapterType_Am79C973), KNetworkAdapterType_Am79C973);
     447                e->addItem(gpConverter->toString(KNetworkAdapterType_Am79C970A), KNetworkAdapterType_Am79C970A);
     448                e->addItem(gpConverter->toString(KNetworkAdapterType_Am79C973), KNetworkAdapterType_Am79C973);
    449449#ifdef VBOX_WITH_E1000
    450                 e->addItem(gCOMenum->toString(KNetworkAdapterType_I82540EM), KNetworkAdapterType_I82540EM);
    451                 e->addItem(gCOMenum->toString(KNetworkAdapterType_I82543GC), KNetworkAdapterType_I82543GC);
    452                 e->addItem(gCOMenum->toString(KNetworkAdapterType_I82545EM), KNetworkAdapterType_I82545EM);
     450                e->addItem(gpConverter->toString(KNetworkAdapterType_I82540EM), KNetworkAdapterType_I82540EM);
     451                e->addItem(gpConverter->toString(KNetworkAdapterType_I82543GC), KNetworkAdapterType_I82543GC);
     452                e->addItem(gpConverter->toString(KNetworkAdapterType_I82545EM), KNetworkAdapterType_I82545EM);
    453453#endif /* VBOX_WITH_E1000 */
    454454#ifdef VBOX_WITH_VIRTIO
    455                 e->addItem(gCOMenum->toString(KNetworkAdapterType_Virtio), KNetworkAdapterType_Virtio);
     455                e->addItem(gpConverter->toString(KNetworkAdapterType_Virtio), KNetworkAdapterType_Virtio);
    456456#endif /* VBOX_WITH_VIRTIO */
    457457                editor = e;
     
    461461            {
    462462                QComboBox *e = new QComboBox(pParent);
    463                 e->addItem(gCOMenum->toString(KStorageControllerType_PIIX3), "PIIX3");
    464                 e->addItem(gCOMenum->toString(KStorageControllerType_PIIX4), "PIIX4");
    465                 e->addItem(gCOMenum->toString(KStorageControllerType_ICH6),  "ICH6");
     463                e->addItem(gpConverter->toString(KStorageControllerType_PIIX3), "PIIX3");
     464                e->addItem(gpConverter->toString(KStorageControllerType_PIIX4), "PIIX4");
     465                e->addItem(gpConverter->toString(KStorageControllerType_ICH6),  "ICH6");
    466466                editor = e;
    467467                break;
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIBootTable.cpp

    r41608 r41819  
    2323/* Local includes */
    2424#include "UIBootTable.h"
    25 #include "COMEnumsWrapper.h"
     25#include "UIConverter.h"
    2626
    2727UIBootTableItem::UIBootTableItem(KDeviceType type)
     
    6262void UIBootTableItem::retranslateUi()
    6363{
    64     setText(gCOMenum->toString(m_type));
     64    setText(gpConverter->toString(m_type));
    6565}
    6666
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette