VirtualBox

Changeset 73931 in vbox


Ignore:
Timestamp:
Aug 28, 2018 6:59:00 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:8472. Some refactoring in UIMediumEnumerator

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumEnumerator.cpp

    r73926 r73931  
    145145    UIMediumMap media;
    146146    addNullMediumToMap(media);
    147     addHardDisksToMap(vboxGlobal().virtualBox().GetHardDisks(), media);
    148     addMediaToMap(vboxGlobal().host().GetDVDDrives(), media, UIMediumType_DVD);
    149     addMediaToMap(vboxGlobal().virtualBox().GetDVDImages(), media, UIMediumType_DVD);
    150     addMediaToMap(vboxGlobal().host().GetFloppyDrives(), media, UIMediumType_Floppy);
    151     addMediaToMap(vboxGlobal().virtualBox().GetFloppyImages(), media, UIMediumType_Floppy);
     147    addMediaToMap(vboxGlobal().virtualBox().GetHardDisks(), media);
     148    addMediaToMap(vboxGlobal().host().GetDVDDrives(), media);
     149    addMediaToMap(vboxGlobal().virtualBox().GetDVDImages(), media);
     150    addMediaToMap(vboxGlobal().host().GetFloppyDrives(), media);
     151    addMediaToMap(vboxGlobal().virtualBox().GetFloppyImages(), media);
    152152    if (VBoxGlobal::isCleaningUp())
    153153        return; /* VBoxGlobal is cleaning up, abort immediately. */
     
    378378}
    379379
    380 void UIMediumEnumerator::addMediaToMap(const CMediumVector &inputMedia, UIMediumMap &outputMedia, UIMediumType mediumType)
     380void UIMediumEnumerator::addMediaToMap(const CMediumVector &inputMedia, UIMediumMap &outputMedia)
    381381{
    382382    /* Insert hard-disks to the passed uimedium map.
     
    391391        QString strMediumID = medium.GetId();
    392392        UIMedium uimedium = m_media.contains(strMediumID) ? m_media[strMediumID] :
    393                                                               UIMedium(medium, mediumType);
     393            UIMedium(medium, UIMediumDefs::mediumTypeToLocal(medium.GetDeviceType()));
    394394
    395395        /* Insert uimedium into map: */
    396396        outputMedia.insert(uimedium.id(), uimedium);
    397     }
    398 }
    399 
    400 void UIMediumEnumerator::addHardDisksToMap(const CMediumVector &inputMedia, UIMediumMap &outputMedia)
    401 {
    402     /* Insert hard-disks to the passed uimedium map.
    403      * Get existing one from the previous map if any. */
    404     foreach (CMedium medium, inputMedia)
    405     {
    406         /* If VBoxGlobal is cleaning up, abort immediately: */
    407         if (VBoxGlobal::isCleaningUp())
    408             break;
    409 
    410         /* Prepare uimedium on the basis of current medium: */
    411         QString strMediumID = medium.GetId();
    412         UIMedium uimedium = m_media.contains(strMediumID) ? m_media[strMediumID] :
    413                                                               UIMedium(medium, UIMediumType_HardDisk);
    414 
    415         /* Insert uimedium into map: */
    416         outputMedia.insert(uimedium.id(), uimedium);
    417397
    418398        /* Insert medium children into map too: */
    419         addHardDisksToMap(medium.GetChildren(), outputMedia);
     399        addMediaToMap(medium.GetChildren(), outputMedia);
    420400    }
    421401}
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumEnumerator.h

    r73926 r73931  
    8888    void createMediumEnumerationTask(const UIMedium &medium);
    8989    void addNullMediumToMap(UIMediumMap &media);
    90     void addMediaToMap(const CMediumVector &inputMedia, UIMediumMap &outputMedia, UIMediumType mediumType);
    91     void addHardDisksToMap(const CMediumVector &inputMedia, UIMediumMap &outputMedia);
     90    void addMediaToMap(const CMediumVector &inputMedia, UIMediumMap &outputMedia);
    9291
    9392    /* Helpers: Medium re-caching stuff: */
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