VirtualBox

Changeset 34947 in vbox


Ignore:
Timestamp:
Dec 10, 2010 1:14:00 PM (14 years ago)
Author:
vboxsync
Message:

FE/Qt: VBoxGlobal extended with few medium-type conversion methods commonly used.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp

    r34822 r34947  
    23922392
    23932393    mMediaEnumThread->start();
     2394}
     2395
     2396VBoxDefs::MediumType VBoxGlobal::mediumTypeToLocal(KDeviceType globalType)
     2397{
     2398    switch (globalType)
     2399    {
     2400        case KDeviceType_HardDisk:
     2401            return VBoxDefs::MediumType_HardDisk;
     2402        case KDeviceType_DVD:
     2403            return VBoxDefs::MediumType_DVD;
     2404        case KDeviceType_Floppy:
     2405            return VBoxDefs::MediumType_Floppy;
     2406        default:
     2407            break;
     2408    }
     2409    return VBoxDefs::MediumType_Invalid;
     2410}
     2411
     2412KDeviceType VBoxGlobal::mediumTypeToGlobal(VBoxDefs::MediumType localType)
     2413{
     2414    switch (localType)
     2415    {
     2416        case VBoxDefs::MediumType_HardDisk:
     2417            return KDeviceType_HardDisk;
     2418        case VBoxDefs::MediumType_DVD:
     2419            return KDeviceType_DVD;
     2420        case VBoxDefs::MediumType_Floppy:
     2421            return KDeviceType_Floppy;
     2422        default:
     2423            break;
     2424    }
     2425    return KDeviceType_Null;
    23942426}
    23952427
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h

    r34822 r34947  
    574574    bool isMediaEnumerationStarted() const { return mMediaEnumThread != NULL; }
    575575
     576    VBoxDefs::MediumType mediumTypeToLocal(KDeviceType globalType);
     577    KDeviceType mediumTypeToGlobal(VBoxDefs::MediumType localType);
     578
    576579    void addMedium (const VBoxMedium &);
    577580    void updateMedium (const VBoxMedium &);
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r34936 r34947  
    10881088    QMenu *pFloppyDevicesMenu = actionsPool()->action(UIActionIndex_Menu_FloppyDevices)->menu();
    10891089
    1090     /* Determine device type: */
    1091     KDeviceType deviceType = pMenu == pOpticalDevicesMenu ? KDeviceType_DVD :
    1092                              pMenu == pFloppyDevicesMenu  ? KDeviceType_Floppy :
    1093                                                             KDeviceType_Null;
    1094     AssertMsg(deviceType != KDeviceType_Null, ("Incorrect storage device type!\n"));
    1095 
    1096     /* Determine medium type: */
     1090    /* Determine medium & device types: */
    10971091    VBoxDefs::MediumType mediumType = pMenu == pOpticalDevicesMenu ? VBoxDefs::MediumType_DVD :
    10981092                                      pMenu == pFloppyDevicesMenu  ? VBoxDefs::MediumType_Floppy :
    10991093                                                                     VBoxDefs::MediumType_Invalid;
     1094    KDeviceType deviceType = vboxGlobal().mediumTypeToGlobal(mediumType);
    11001095    AssertMsg(mediumType != VBoxDefs::MediumType_Invalid, ("Incorrect storage medium type!\n"));
     1096    AssertMsg(deviceType != KDeviceType_Null, ("Incorrect storage device type!\n"));
    11011097
    11021098    /* Fill attachments menu: */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp

    r34946 r34947  
    3636#include <QTimer>
    3737#include <QCommonStyle>
    38 
    39 /* Type converters */
    40 VBoxDefs::MediumType typeToLocal (KDeviceType aType)
    41 {
    42     VBoxDefs::MediumType result = VBoxDefs::MediumType_Invalid;
    43     switch (aType)
    44     {
    45         case KDeviceType_HardDisk:
    46             result = VBoxDefs::MediumType_HardDisk;
    47             break;
    48         case KDeviceType_DVD:
    49             result = VBoxDefs::MediumType_DVD;
    50             break;
    51         case KDeviceType_Floppy:
    52             result = VBoxDefs::MediumType_Floppy;
    53             break;
    54         default:
    55             AssertMsgFailed (("Incorrect medium type!\n"));
    56             break;
    57     }
    58     return result;
    59 }
    60 
    6138
    6239QString compressText (const QString &aText)
     
    23212298                        break;
    23222299                }
    2323                 m_pMediumIdHolder->setType(typeToLocal(device));
     2300                m_pMediumIdHolder->setType(vboxGlobal().mediumTypeToLocal(device));
    23242301                m_pMediumIdHolder->setId(mStorageModel->data(index, StorageModel::R_AttMediumId).toString());
    23252302
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