VirtualBox

Changeset 46684 in vbox


Ignore:
Timestamp:
Jun 19, 2013 5:38:27 PM (11 years ago)
Author:
vboxsync
Message:

FE/Qt: UI converter: Support string conversions for the indicator-type enum.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/converter
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackend.h

    r42526 r46684  
    5757template<> bool canConvert<StorageSlot>();
    5858template<> bool canConvert<DetailsElementType>();
     59template<> bool canConvert<IndicatorType>();
    5960
    6061/* Declare COM canConvert specializations: */
     
    8788template<> QString toInternalString(const DetailsElementType &detailsElementType);
    8889template<> DetailsElementType fromInternalString<DetailsElementType>(const QString &strDetailsElementType);
     90template<> QString toInternalString(const IndicatorType &indicatorType);
     91template<> IndicatorType fromInternalString<IndicatorType>(const QString &strIndicatorType);
    8992
    9093/* Declare COM conversion specializations: */
  • trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendGlobal.cpp

    r42526 r46684  
    3333template<> bool canConvert<StorageSlot>() { return true; }
    3434template<> bool canConvert<DetailsElementType>() { return true; }
     35template<> bool canConvert<IndicatorType>() { return true; }
    3536
    3637/* QString <= StorageSlot: */
     
    370371}
    371372
     373/* QString <= IndicatorType: */
     374template<> QString toInternalString(const IndicatorType &indicatorType)
     375{
     376    QString strResult;
     377    switch (indicatorType)
     378    {
     379        case IndicatorType_HardDisks:     strResult = "HardDisks"; break;
     380        case IndicatorType_OpticalDisks:  strResult = "OpticalDisks"; break;
     381        case IndicatorType_FloppyDisks:   strResult = "FloppyDisks"; break;
     382        case IndicatorType_Network:       strResult = "Network"; break;
     383        case IndicatorType_USB:           strResult = "USB"; break;
     384        case IndicatorType_SharedFolders: strResult = "SharedFolders"; break;
     385        case IndicatorType_VideoCapture:  strResult = "VideoCapture"; break;
     386        case IndicatorType_Features:      strResult = "Features"; break;
     387        case IndicatorType_Mouse:         strResult = "Mouse"; break;
     388        case IndicatorType_Keyboard:      strResult = "Keyboard"; break;
     389        default:
     390        {
     391            AssertMsgFailed(("No text for indicator type=%d", indicatorType));
     392            break;
     393        }
     394    }
     395    return strResult;
     396}
     397
     398/* IndicatorType <= QString: */
     399template<> IndicatorType fromInternalString<IndicatorType>(const QString &strIndicatorType)
     400{
     401    QHash<QString, IndicatorType> list;
     402    list.insert("HardDisks",     IndicatorType_HardDisks);
     403    list.insert("OpticalDisks",  IndicatorType_OpticalDisks);
     404    list.insert("FloppyDisks",   IndicatorType_FloppyDisks);
     405    list.insert("Network",       IndicatorType_Network);
     406    list.insert("USB",           IndicatorType_USB);
     407    list.insert("SharedFolders", IndicatorType_SharedFolders);
     408    list.insert("VideoCapture",  IndicatorType_VideoCapture);
     409    list.insert("Features",      IndicatorType_Features);
     410    list.insert("Mouse",         IndicatorType_Mouse);
     411    list.insert("Keyboard",      IndicatorType_Keyboard);
     412    if (!list.contains(strIndicatorType))
     413    {
     414        AssertMsgFailed(("No value for '%s'", strIndicatorType.toAscii().constData()));
     415    }
     416    return list.value(strIndicatorType);
     417}
     418
Note: See TracChangeset for help on using the changeset viewer.

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