VirtualBox

Ignore:
Timestamp:
Sep 18, 2019 11:23:57 AM (5 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:7127: Cleanup old enumeration code across the project.

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

Legend:

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

    r80413 r80884  
    8585VBOX_WITH_UPDATE_REQUEST := 1
    8686endif
    87 
    88 
    89 #
    90 # Use newly intruduced global media related events for
    91 # medium enumeration purposes.
    92 #
    93 VBOX_GUI_WITH_NEW_MEDIA_EVENTS := 1
    9487
    9588
     
    118111        $(if $(VBOX_WITH_ADDITIONS_AUTOUPDATE_UI),VBOX_WITH_ADDITIONS_AUTOUPDATE_UI) \
    119112        $(if $(VBOX_WITH_UPDATE_REQUEST),VBOX_WITH_UPDATE_REQUEST) \
    120         $(if $(VBOX_GUI_WITH_NEW_MEDIA_EVENTS),VBOX_GUI_WITH_NEW_MEDIA_EVENTS) \
    121113        $(if $(VBOX_WITH_AUDIO_OSS),VBOX_WITH_AUDIO_OSS) \
    122114        $(if $(VBOX_WITH_AUDIO_ALSA),VBOX_WITH_AUDIO_ALSA) \
     
    187179        $(if $(VBOX_WITH_ADDITIONS_AUTOUPDATE_UI),VBOX_WITH_ADDITIONS_AUTOUPDATE_UI) \
    188180        $(if $(VBOX_WITH_UPDATE_REQUEST),VBOX_WITH_UPDATE_REQUEST) \
    189         $(if $(VBOX_GUI_WITH_NEW_MEDIA_EVENTS),VBOX_GUI_WITH_NEW_MEDIA_EVENTS) \
    190181        $(if $(VBOX_WITH_AUDIO_OSS),VBOX_WITH_AUDIO_OSS) \
    191182        $(if $(VBOX_WITH_AUDIO_ALSA),VBOX_WITH_AUDIO_ALSA) \
     
    249240UICommon_DEFS         += \
    250241        $(if $(VBOX_WITH_UPDATE_REQUEST),VBOX_WITH_UPDATE_REQUEST) \
    251         $(if $(VBOX_GUI_WITH_NEW_MEDIA_EVENTS),VBOX_GUI_WITH_NEW_MEDIA_EVENTS) \
    252242        $(if $(VBOX_WITH_AUDIO_OSS),VBOX_WITH_AUDIO_OSS) \
    253243        $(if $(VBOX_WITH_AUDIO_ALSA),VBOX_WITH_AUDIO_ALSA) \
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.cpp

    r80824 r80884  
    26182618}
    26192619
    2620 #ifdef VBOX_GUI_WITH_NEW_MEDIA_EVENTS
    26212620bool UICommon::isFullMediumEnumerationRequested() const
    26222621{
     
    26252624           && m_pMediumEnumerator->isFullMediumEnumerationRequested();
    26262625}
    2627 #endif
    26282626
    26292627UIMedium UICommon::medium(const QUuid &uMediumID) const
     
    26652663    }
    26662664}
    2667 
    2668 #ifndef VBOX_GUI_WITH_NEW_MEDIA_EVENTS
    2669 void UICommon::deleteMedium(const QUuid &uMediumID)
    2670 {
    2671     if (m_meCleanupProtectionToken.tryLockForRead())
    2672     {
    2673         /* Delete medium from medium-enumerator: */
    2674         if (m_pMediumEnumerator)
    2675             m_pMediumEnumerator->deleteMedium(uMediumID);
    2676         m_meCleanupProtectionToken.unlock();
    2677     }
    2678 }
    2679 #endif
    26802665
    26812666QUuid UICommon::openMedium(UIMediumDeviceType enmMediumType, QString strMediumLocation, QWidget *pParent /* = 0 */)
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.h

    r80495 r80884  
    490490        /** Returns whether medium-enumeration is in progress. */
    491491        bool isMediumEnumerationInProgress() const;
    492 #ifdef VBOX_GUI_WITH_NEW_MEDIA_EVENTS
    493492        /** Returns whether full medium-enumeration is requested. */
    494493        bool isFullMediumEnumerationRequested() const;
    495 #endif
    496494        /** Returns enumerated medium with certain @a uMediumID. */
    497495        UIMedium medium(const QUuid &uMediumID) const;
     
    500498        /** Creates medium on the basis of passed @a guiMedium description. */
    501499        void createMedium(const UIMedium &guiMedium);
    502 #ifndef VBOX_GUI_WITH_NEW_MEDIA_EVENTS
    503         /** Deletes medium with certain @a uMediumID. */
    504         void deleteMedium(const QUuid &uMediumID);
    505 #endif
    506500
    507501        /** Opens external medium by passed @a strMediumLocation.
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumEnumerator.cpp

    r79425 r80884  
    9898UIMediumEnumerator::UIMediumEnumerator()
    9999    : m_fMediumEnumerationInProgress(false)
    100 #ifdef VBOX_GUI_WITH_NEW_MEDIA_EVENTS
    101100    , m_fMediumEnumerationRequested(false)
    102 #endif
    103101{
    104102    /* Allow UIMedium to be used in inter-thread signals: */
     
    106104
    107105    /* Prepare Main event handlers: */
    108 #ifndef VBOX_GUI_WITH_NEW_MEDIA_EVENTS
    109     connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigMachineDataChange,
    110             this, &UIMediumEnumerator::sltHandleMachineUpdate);
    111     connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigSnapshotTake,
    112             this, &UIMediumEnumerator::sltHandleMachineUpdate);
    113     connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigSnapshotDelete,
    114             this, &UIMediumEnumerator::sltHandleSnapshotDeleted);
    115     connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigSnapshotChange,
    116             this, &UIMediumEnumerator::sltHandleMachineUpdate);
    117     connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigSnapshotRestore,
    118             this, &UIMediumEnumerator::sltHandleSnapshotDeleted);
    119     connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigMachineRegistered,
    120             this, &UIMediumEnumerator::sltHandleMachineRegistration);
    121 #else /* VBOX_GUI_WITH_NEW_MEDIA_EVENTS */
    122106    /* Machine related events: */
    123107    connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigMachineDataChange,
     
    134118    connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigMediumRegistered,
    135119            this, &UIMediumEnumerator::sltHandleMediumRegistered);
    136 #endif /* VBOX_GUI_WITH_NEW_MEDIA_EVENTS */
    137120
    138121    /* Prepare global thread-pool listener: */
     
    174157    emit sigMediumCreated(uMediumID);
    175158}
    176 
    177 #ifndef VBOX_GUI_WITH_NEW_MEDIA_EVENTS
    178 void UIMediumEnumerator::deleteMedium(const QUuid &uMediumID)
    179 {
    180     /* Do not delete UIMedium(s) with incorrect ID: */
    181     AssertReturnVoid(!uMediumID.isNull());
    182     /* Make sure UIMedium still exists: */
    183     AssertReturnVoid(m_media.contains(uMediumID));
    184 
    185     /* Remove UIMedium: */
    186     m_media.remove(uMediumID);
    187     LogRel(("GUI: UIMediumEnumerator: Medium with key={%s} deleted\n", uMediumID.toString().toUtf8().constData()));
    188 
    189     /* Notify listener: */
    190     emit sigMediumDeleted(uMediumID);
    191 }
    192 #endif
    193159
    194160void UIMediumEnumerator::startMediumEnumeration(const CMediumVector &comMedia /* = CMediumVector() */)
     
    209175    if (comMedia.isEmpty())
    210176    {
    211 #ifdef VBOX_GUI_WITH_NEW_MEDIA_EVENTS
    212177        m_fMediumEnumerationRequested = true;
    213 #endif
    214178        addMediaToMap(uiCommon().virtualBox().GetHardDisks(), media);
    215179        addMediaToMap(uiCommon().host().GetDVDDrives(), media);
     
    220184    else
    221185    {
    222 #ifdef VBOX_GUI_WITH_NEW_MEDIA_EVENTS
    223186        m_fMediumEnumerationRequested = false;
    224 #endif
    225187        addMediaToMap(uiCommon().host().GetDVDDrives(), media);
    226188        addMediaToMap(uiCommon().virtualBox().GetDVDImages(), media);
     
    296258        m_media[UIMedium::nullID()] = UIMedium();
    297259}
    298 
    299 #ifndef VBOX_GUI_WITH_NEW_MEDIA_EVENTS
    300 
    301 void UIMediumEnumerator::sltHandleMachineUpdate(const QUuid &uMachineID)
    302 {
    303     LogRel2(("GUI: UIMediumEnumerator: Machine (or snapshot) event received, ID = %s\n",
    304              uMachineID.toString().toUtf8().constData()));
    305 
    306     /* Gather previously used UIMedium IDs: */
    307     QList<QUuid> previousUIMediumIDs;
    308     calculateCachedUsage(uMachineID, previousUIMediumIDs, true /* take into account current state only */);
    309     LogRel2(("GUI: UIMediumEnumerator:  Old usage: %s\n",
    310              previousUIMediumIDs.isEmpty() ? "<empty>" : toStringList(previousUIMediumIDs).join(", ").toUtf8().constData()));
    311 
    312     /* Gather currently used CMediums and their IDs: */
    313     CMediumMap currentCMediums;
    314     QList<QUuid> currentCMediumIDs;
    315     calculateActualUsage(uMachineID, currentCMediums, currentCMediumIDs, true /* take into account current state only */);
    316     LogRel2(("GUI: UIMediumEnumerator:  New usage: %s\n",
    317              currentCMediumIDs.isEmpty() ? "<empty>" : toStringList(currentCMediumIDs).join(", ").toUtf8().constData()));
    318 
    319     /* Determine excluded media: */
    320     const QSet<QUuid> previousSet = previousUIMediumIDs.toSet();
    321     const QSet<QUuid> currentSet = currentCMediumIDs.toSet();
    322     const QSet<QUuid> excludedSet = previousSet - currentSet;
    323     const QList<QUuid> excludedUIMediumIDs = excludedSet.toList();
    324     if (!excludedUIMediumIDs.isEmpty())
    325         LogRel2(("GUI: UIMediumEnumerator:  Items excluded from usage: %s\n", toStringList(excludedUIMediumIDs).join(", ").toUtf8().constData()));
    326     if (!currentCMediumIDs.isEmpty())
    327         LogRel2(("GUI: UIMediumEnumerator:  Items currently in usage: %s\n", toStringList(currentCMediumIDs).join(", ").toUtf8().constData()));
    328 
    329     /* Update cache for excluded UIMediums: */
    330     recacheFromCachedUsage(excludedUIMediumIDs);
    331 
    332     /* Update cache for current CMediums: */
    333     recacheFromActualUsage(currentCMediums, currentCMediumIDs);
    334 
    335     LogRel2(("GUI: UIMediumEnumerator: Machine (or snapshot) event processed, ID = %s\n",
    336              uMachineID.toString().toUtf8().constData()));
    337 }
    338 
    339 void UIMediumEnumerator::sltHandleMachineRegistration(const QUuid &uMachineID, const bool fRegistered)
    340 {
    341     LogRel2(("GUI: UIMediumEnumerator: Machine %s event received, ID = %s\n",
    342              fRegistered ? "registration" : "unregistration",
    343              uMachineID.toString().toUtf8().constData()));
    344 
    345     /* Machine was registered: */
    346     if (fRegistered)
    347     {
    348         /* Gather currently used CMediums and their IDs: */
    349         CMediumMap currentCMediums;
    350         QList<QUuid> currentCMediumIDs;
    351         calculateActualUsage(uMachineID, currentCMediums, currentCMediumIDs, false /* take into account current state only */);
    352         LogRel2(("GUI: UIMediumEnumerator:  New usage: %s\n",
    353                  currentCMediumIDs.isEmpty() ? "<empty>" : toStringList(currentCMediumIDs).join(", ").toUtf8().constData()));
    354         /* Update cache with currently used CMediums: */
    355         recacheFromActualUsage(currentCMediums, currentCMediumIDs);
    356     }
    357     /* Machine was unregistered: */
    358     else
    359     {
    360         /* Gather previously used UIMedium IDs: */
    361         QList<QUuid> previousUIMediumIDs;
    362         calculateCachedUsage(uMachineID, previousUIMediumIDs, false /* take into account current state only */);
    363         LogRel2(("GUI: UIMediumEnumerator:  Old usage: %s\n",
    364                  previousUIMediumIDs.isEmpty() ? "<empty>" : toStringList(previousUIMediumIDs).join(", ").toUtf8().constData()));
    365         /* Update cache for previously used UIMediums: */
    366         recacheFromCachedUsage(previousUIMediumIDs);
    367     }
    368 
    369     LogRel2(("GUI: UIMediumEnumerator: Machine %s event processed, ID = %s\n",
    370              fRegistered ? "registration" : "unregistration",
    371              uMachineID.toString().toUtf8().constData()));
    372 }
    373 
    374 void UIMediumEnumerator::sltHandleSnapshotDeleted(const QUuid &uMachineID, const QUuid &uSnapshotID)
    375 {
    376     LogRel2(("GUI: UIMediumEnumerator: Snapshot-deleted event received, Machine ID = {%s}, Snapshot ID = {%s}\n",
    377              uMachineID.toString().toUtf8().constData(), uSnapshotID.toString().toUtf8().constData()));
    378 
    379     /* Gather previously used UIMedium IDs: */
    380     QList<QUuid> previousUIMediumIDs;
    381     calculateCachedUsage(uMachineID, previousUIMediumIDs, false /* take into account current state only */);
    382     LogRel2(("GUI: UIMediumEnumerator:  Old usage: %s\n",
    383              previousUIMediumIDs.isEmpty() ? "<empty>" : toStringList(previousUIMediumIDs).join(", ").toUtf8().constData()));
    384 
    385     /* Gather currently used CMediums and their IDs: */
    386     CMediumMap currentCMediums;
    387     QList<QUuid> currentCMediumIDs;
    388     calculateActualUsage(uMachineID, currentCMediums, currentCMediumIDs, true /* take into account current state only */);
    389     LogRel2(("GUI: UIMediumEnumerator:  New usage: %s\n",
    390              currentCMediumIDs.isEmpty() ? "<empty>" : toStringList(currentCMediumIDs).join(", ").toUtf8().constData()));
    391 
    392     /* Update everything: */
    393     recacheFromCachedUsage(previousUIMediumIDs);
    394     recacheFromActualUsage(currentCMediums, currentCMediumIDs);
    395 
    396     LogRel2(("GUI: UIMediumEnumerator: Snapshot-deleted event processed, Machine ID = {%s}, Snapshot ID = {%s}\n",
    397              uMachineID.toString().toUtf8().constData(), uSnapshotID.toString().toUtf8().constData()));
    398 }
    399 
    400 #else /* VBOX_GUI_WITH_NEW_MEDIA_EVENTS */
    401260
    402261void UIMediumEnumerator::sltHandleMachineDataChange(const QUuid &uMachineId)
     
    535394}
    536395
    537 #endif /* VBOX_GUI_WITH_NEW_MEDIA_EVENTS */
    538 
    539396void UIMediumEnumerator::sltHandleMediumEnumerationTaskComplete(UITask *pTask)
    540397{
     
    653510    }
    654511}
    655 
    656 #ifndef VBOX_GUI_WITH_NEW_MEDIA_EVENTS
    657 
    658 void UIMediumEnumerator::calculateCachedUsage(const QUuid &uMachineID,
    659                                               QList<QUuid> &previousUIMediumIDs,
    660                                               const bool fTakeIntoAccountCurrentStateOnly) const
    661 {
    662     /* For each the cached UIMedium we have: */
    663     foreach (const QUuid &uUIMediumID, mediumIDs())
    664     {
    665         /* Get corresponding UIMedium: */
    666         const UIMedium &guiMedium = m_media[uUIMediumID];
    667         /* Get the list of the machines this UIMedium attached to.
    668          * Take into account current-state only if necessary. */
    669         const QList<QUuid> &machineIDs = fTakeIntoAccountCurrentStateOnly
    670                                        ? guiMedium.curStateMachineIds()
    671                                        : guiMedium.machineIds();
    672         /* Add this UIMedium ID to previous usage if necessary: */
    673         if (machineIDs.contains(uMachineID))
    674             previousUIMediumIDs.append(uUIMediumID);
    675     }
    676 }
    677 
    678 void UIMediumEnumerator::calculateActualUsage(const QUuid &uMachineID,
    679                                               CMediumMap &currentCMediums,
    680                                               QList<QUuid> &currentCMediumIDs,
    681                                               const bool fTakeIntoAccountCurrentStateOnly) const
    682 {
    683     /* Search for corresponding machine: */
    684     CMachine comMachine = uiCommon().virtualBox().FindMachine(uMachineID.toString());
    685     if (comMachine.isNull())
    686     {
    687         /* Usually means the machine is already gone, not harmful. */
    688         return;
    689     }
    690 
    691     /* Calculate actual usage starting from root-snapshot if necessary: */
    692     if (!fTakeIntoAccountCurrentStateOnly)
    693         calculateActualUsage(comMachine.FindSnapshot(QString()), currentCMediums, currentCMediumIDs);
    694 
    695     /* Calculate actual usage for current machine state: */
    696     calculateActualUsage(comMachine, currentCMediums, currentCMediumIDs);
    697 }
    698 
    699 void UIMediumEnumerator::calculateActualUsage(const CSnapshot &comSnapshot,
    700                                               CMediumMap &currentCMediums,
    701                                               QList<QUuid> &currentCMediumIDs) const
    702 {
    703     /* Check passed snapshot: */
    704     if (comSnapshot.isNull())
    705         return;
    706 
    707     /* Calculate actual usage for passed snapshot machine: */
    708     calculateActualUsage(comSnapshot.GetMachine(), currentCMediums, currentCMediumIDs);
    709 
    710     /* Iterate through passed snapshot children: */
    711     foreach (const CSnapshot &comChildSnapshot, comSnapshot.GetChildren())
    712         calculateActualUsage(comChildSnapshot, currentCMediums, currentCMediumIDs);
    713 }
    714 
    715 void UIMediumEnumerator::calculateActualUsage(const CMachine &comMachine,
    716                                               CMediumMap &currentCMediums,
    717                                               QList<QUuid> &currentCMediumIDs) const
    718 {
    719     /* Check passed machine: */
    720     AssertReturnVoid(!comMachine.isNull());
    721 
    722     /* For each the attachment machine have: */
    723     foreach (const CMediumAttachment &comAttachment, comMachine.GetMediumAttachments())
    724     {
    725         /* Get corresponding CMedium: */
    726         CMedium comMedium = comAttachment.GetMedium();
    727         if (!comMedium.isNull())
    728         {
    729             /* Make sure that CMedium was not yet closed: */
    730             const QUuid &uCMediumID = comMedium.GetId();
    731             if (comMedium.isOk() && !uCMediumID.isNull())
    732             {
    733                 /* Add this CMedium to current usage: */
    734                 currentCMediums.insert(uCMediumID, comMedium);
    735                 currentCMediumIDs.append(uCMediumID);
    736             }
    737         }
    738     }
    739 }
    740 
    741 void UIMediumEnumerator::recacheFromCachedUsage(const QList<QUuid> &previousUIMediumIDs)
    742 {
    743     /* For each of previously used UIMedium ID: */
    744     foreach (const QUuid &uUIMediumID, previousUIMediumIDs)
    745     {
    746         /* Make sure this ID still in our map: */
    747         if (m_media.contains(uUIMediumID))
    748         {
    749             /* Get corresponding UIMedium: */
    750             UIMedium &guiMedium = m_media[uUIMediumID];
    751 
    752             /* If corresponding CMedium still exists: */
    753             CMedium comMedium = guiMedium.medium();
    754             if (!comMedium.GetId().isNull() && comMedium.isOk())
    755             {
    756                 /* Refresh UIMedium parent first of all: */
    757                 guiMedium.updateParentID();
    758                 /* Enumerate corresponding UIMedium: */
    759                 createMediumEnumerationTask(guiMedium);
    760             }
    761             /* If corresponding CMedium was closed already: */
    762             else
    763             {
    764                 /* Uncache corresponding UIMedium: */
    765                 m_media.remove(uUIMediumID);
    766                 LogRel2(("GUI: UIMediumEnumerator:  Medium with key={%s} uncached\n",
    767                          uUIMediumID.toString().toUtf8().constData()));
    768 
    769                 /* And notify listeners: */
    770                 emit sigMediumDeleted(uUIMediumID);
    771             }
    772         }
    773     }
    774 }
    775 
    776 void UIMediumEnumerator::recacheFromActualUsage(const CMediumMap &currentCMediums,
    777                                                 const QList<QUuid> &currentCMediumIDs)
    778 {
    779     /* For each of currently used CMedium ID: */
    780     foreach (const QUuid &uCMediumID, currentCMediumIDs)
    781     {
    782         /* If that ID is not in our map: */
    783         if (!m_media.contains(uCMediumID))
    784         {
    785             /* Create new UIMedium: */
    786             const CMedium &comMedium = currentCMediums[uCMediumID];
    787             const UIMedium guiMedium(comMedium, UIMediumDefs::mediumTypeToLocal(comMedium.GetDeviceType()));
    788             const QUuid &uUIMediumKey = guiMedium.key();
    789 
    790             /* Cache created UIMedium: */
    791             m_media.insert(uUIMediumKey, guiMedium);
    792             LogRel2(("GUI: UIMediumEnumerator:  Medium with key={%s} cached\n",
    793                      uUIMediumKey.toString().toUtf8().constData()));
    794 
    795             /* And notify listeners: */
    796             emit sigMediumCreated(uUIMediumKey);
    797         }
    798 
    799         /* Enumerate corresponding UIMedium: */
    800         createMediumEnumerationTask(m_media[uCMediumID]);
    801     }
    802 }
    803 
    804 #else /* VBOX_GUI_WITH_NEW_MEDIA_EVENTS */
    805512
    806513void UIMediumEnumerator::parseAttachment(CMediumAttachment comAttachment, QList<QUuid> &result)
     
    948655}
    949656
    950 #endif /* VBOX_GUI_WITH_NEW_MEDIA_EVENTS */
    951 
    952657
    953658#include "UIMediumEnumerator.moc"
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumEnumerator.h

    r79337 r80884  
    3232
    3333/* COM includes: */
    34 #ifdef VBOX_GUI_WITH_NEW_MEDIA_EVENTS
    3534# include "CMedium.h"
    3635# include "CMediumAttachment.h"
    37 #endif
    3836
    3937/* Forward declarations: */
     
    7775    /** Creates UIMedium thus caching it internally on the basis of passed @a guiMedium information. */
    7876    void createMedium(const UIMedium &guiMedium);
    79 #ifndef VBOX_GUI_WITH_NEW_MEDIA_EVENTS
    80     /** Deletes UIMedium with specified @a uMediumID thus removing it from internal cache. */
    81     void deleteMedium(const QUuid &uMediumID);
    82 #endif
    8377
    8478    /** Returns whether consolidated medium-enumeration process is in progress. */
    8579    bool isMediumEnumerationInProgress() const { return m_fMediumEnumerationInProgress; }
    86 #ifdef VBOX_GUI_WITH_NEW_MEDIA_EVENTS
    8780    /** Returns whether full consolidated medium-enumeration process is requested. */
    8881    bool isFullMediumEnumerationRequested() const { return m_fMediumEnumerationRequested; }
    89 #endif
    9082    /** Makes a request to enumerate specified @a comMedia.
    9183      * @note  Previous map will be replaced with the new one, values present in both
     
    111103private slots:
    112104
    113 #ifndef VBOX_GUI_WITH_NEW_MEDIA_EVENTS
    114     /** Handles machine-data-change and snapshot-change events for a machine with specified @a uMachineID. */
    115     void sltHandleMachineUpdate(const QUuid &uMachineID);
    116     /** Handles machine-[un]registration events for a machine with specified @a uMachineID.
    117       * @param  fRegistered  Specifies whether the machine was registered or unregistered otherwise. */
    118     void sltHandleMachineRegistration(const QUuid &uMachineID, const bool fRegistered);
    119     /** Handles snapshot-deleted events for a machine with specified @a uMachineID and a snapshot with specified @a uSnapshotID. */
    120     void sltHandleSnapshotDeleted(const QUuid &uMachineID, const QUuid &uSnapshotID);
    121 #else /* VBOX_GUI_WITH_NEW_MEDIA_EVENTS */
    122105    /** Handles machine-data-change event for a machine with specified @a uMachineId. */
    123106    void sltHandleMachineDataChange(const QUuid &uMachineId);
     
    141124      * @param  fRegistered    Brings whether medium is registered or unregistered. */
    142125    void sltHandleMediumRegistered(const QUuid &uMediumId, KDeviceType enmMediumType, bool fRegistered);
    143 #endif /* VBOX_GUI_WITH_NEW_MEDIA_EVENTS */
    144126
    145127    /** Handles medium-enumeration @a pTask complete signal. */
     
    155137    void addMediaToMap(const CMediumVector &inputMedia, UIMediumMap &outputMedia);
    156138
    157 #ifndef VBOX_GUI_WITH_NEW_MEDIA_EVENTS
    158     /** Updates usage for machine with specified @a uMachineID on the basis of cached data.
    159       * @param  previousUIMediumIDs               Brings UIMedium IDs used in cached data.
    160       * @param  fTakeIntoAccountCurrentStateOnly  Brings whether we should take into accound current VM state only. */
    161     void calculateCachedUsage(const QUuid &uMachineID,
    162                               QList<QUuid> &previousUIMediumIDs,
    163                               const bool fTakeIntoAccountCurrentStateOnly) const;
    164     /** Updates usage for machine with specified @a uMachineID on the basis of actual data.
    165       * @param  currentCMediums                   Brings CMedium used in actual data.
    166       * @param  currentCMediumIDs                 Brings CMedium IDs used in actual data.
    167       * @param  fTakeIntoAccountCurrentStateOnly  Brings whether we should take into accound current VM state only. */
    168     void calculateActualUsage(const QUuid &uMachineID,
    169                               CMediumMap &currentCMediums,
    170                               QList<QUuid> &currentCMediumIDs,
    171                               const bool fTakeIntoAccountCurrentStateOnly) const;
    172     /** Updates usage for machine specified by its @a comSnapshot reference on the basis of actual data.
    173       * @param  currentCMediums                   Brings CMedium used in actual data.
    174       * @param  currentCMediumIDs                 Brings CMedium IDs used in actual data. */
    175     void calculateActualUsage(const CSnapshot &comSnapshot,
    176                               CMediumMap &currentCMediums,
    177                               QList<QUuid> &currentCMediumIDs) const;
    178     /** Updates usage for machine specified by own @a comMachine reference on the basis of actual data.
    179       * @param  currentCMediums                   Brings CMedium used in actual data.
    180       * @param  currentCMediumIDs                 Brings CMedium IDs used in actual data. */
    181     void calculateActualUsage(const CMachine &comMachine,
    182                               CMediumMap &currentCMediums,
    183                               QList<QUuid> &currentCMediumIDs) const;
    184 
    185     /** Updates cache using known changes in cached data.
    186       * @param  previousUIMediumIDs               Brings UIMedium IDs used in cached data. */
    187     void recacheFromCachedUsage(const QList<QUuid> &previousUIMediumIDs);
    188     /** Updates cache using known changes in actual data.
    189       * @param  currentCMediums                   Brings CMedium used in actual data.
    190       * @param  currentCMediumIDs                 Brings CMedium IDs used in actual data. */
    191     void recacheFromActualUsage(const CMediumMap &currentCMediums,
    192                                 const QList<QUuid> &currentCMediumIDs);
    193 #else /* VBOX_GUI_WITH_NEW_MEDIA_EVENTS */
    194139    /** Parses incoming @a comAttachment, enumerating the media it has attached.
    195140      * @param  result  Brings the list of previously enumerated media
     
    209154      *                 IDs to be appended with newly enumerated. */
    210155    void enumerateAllMediaOfMediumWithId(const QUuid &uMediumId, QList<QUuid> &result);
    211 #endif /* VBOX_GUI_WITH_NEW_MEDIA_EVENTS */
    212156
    213157    /** Holds whether consolidated medium-enumeration process is in progress. */
    214158    bool  m_fMediumEnumerationInProgress;
    215 #ifdef VBOX_GUI_WITH_NEW_MEDIA_EVENTS
    216159    /** Holds whether full consolidated medium-enumeration process is requested. */
    217160    bool  m_fMediumEnumerationRequested;
    218 #endif
    219161
    220162    /** Holds a set of current medium-enumeration tasks. */
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumItem.cpp

    r79365 r80884  
    423423    /* Remember some of hard-disk attributes: */
    424424    CMedium hardDisk = medium().medium();
    425 #ifndef VBOX_GUI_WITH_NEW_MEDIA_EVENTS
    426     QUuid uMediumID = id();
    427 #endif
    428425
    429426    /* Propose to remove medium storage: */
     
    438435        return false;
    439436    }
    440 
    441 #ifndef VBOX_GUI_WITH_NEW_MEDIA_EVENTS
    442     /* Remove UIMedium finally: */
    443     uiCommon().deleteMedium(uMediumID);
    444 #endif
    445437
    446438    /* True by default: */
     
    554546    /* Remember some of optical-disk attributes: */
    555547    CMedium image = medium().medium();
    556 #ifndef VBOX_GUI_WITH_NEW_MEDIA_EVENTS
    557     QUuid uMediumID = id();
    558 #endif
    559548
    560549    /* Close optical-disk: */
     
    566555    }
    567556
    568 #ifndef VBOX_GUI_WITH_NEW_MEDIA_EVENTS
    569     /* Remove UIMedium finally: */
    570     uiCommon().deleteMedium(uMediumID);
    571 #endif
    572 
    573557    /* True by default: */
    574558    return true;
     
    629613    /* Remember some of floppy-disk attributes: */
    630614    CMedium image = medium().medium();
    631 #ifndef VBOX_GUI_WITH_NEW_MEDIA_EVENTS
    632     QUuid uMediumID = id();
    633 #endif
    634615
    635616    /* Close floppy-disk: */
     
    641622    }
    642623
    643 #ifndef VBOX_GUI_WITH_NEW_MEDIA_EVENTS
    644     /* Remove UIMedium finally: */
    645     uiCommon().deleteMedium(uMediumID);
    646 #endif
    647 
    648624    /* True by default: */
    649625    return true;
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp

    r79365 r80884  
    695695
    696696    /* Start medium-enumeration (if necessary): */
    697 #ifndef VBOX_GUI_WITH_NEW_MEDIA_EVENTS
    698     if (!uiCommon().isMediumEnumerationInProgress())
    699 #else
    700697    if (!uiCommon().isFullMediumEnumerationRequested())
    701 #endif
    702698        uiCommon().startMediumEnumeration();
    703699    /* Emulate medium-enumeration otherwise: */
     
    13571353        refetchCurrentMediumItem(type);
    13581354
    1359 #ifdef VBOX_GUI_WITH_NEW_MEDIA_EVENTS
    13601355    /* Update all the children recursively as well: */
    13611356    foreach(const QUuid &uMediumId, uiCommon().mediumIDs())
     
    13661361            updateMediumItem(guiMedium);
    13671362    }
    1368 #endif
    13691363}
    13701364
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumSelector.cpp

    r79365 r80884  
    8181{
    8282    /* Start medium-enumeration (if necessary): */
    83 #ifndef VBOX_GUI_WITH_NEW_MEDIA_EVENTS
    84     if (uiCommon().uiType() == UICommon::UIType_RuntimeUI)
    85 #else
    8683    if (!uiCommon().isFullMediumEnumerationRequested())
    87 #endif
    8884        uiCommon().startMediumEnumeration();
    8985    configure();
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIVMInformationDialog.cpp

    r80773 r80884  
    169169
    170170    /* This is needed at least for some VM to show correct storage info. */
    171 #ifndef VBOX_GUI_WITH_NEW_MEDIA_EVENTS
    172     if (uiCommon().uiType() == UICommon::UIType_RuntimeUI)
    173 #else
    174171    if (!uiCommon().isFullMediumEnumerationRequested())
    175 #endif
    176172        uiCommon().startMediumEnumeration();
    177173}
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp

    r80736 r80884  
    37083708    UIIconPoolStorageSettings::create();
    37093709
    3710 #ifdef VBOX_GUI_WITH_NEW_MEDIA_EVENTS
    37113710    /* Start medium-enumeration (only if necessary): */
    37123711    if (!uiCommon().isFullMediumEnumerationRequested())
    3713 #endif
    3714     /* Enumerate Media. We need at least the MediaList filled, so this is the
    3715      * lasted point, where we can start. The rest of the media checking is done
    3716      * in a background thread. */
    3717     uiCommon().startMediumEnumeration();
     3712        uiCommon().startMediumEnumeration();
    37183713
    37193714    /* Layout created in the .ui file. */
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIMediaComboBox.cpp

    r80445 r80884  
    5959{
    6060    /* Start medium-enumeration (if necessary): */
    61 #ifndef VBOX_GUI_WITH_NEW_MEDIA_EVENTS
    62     if (!uiCommon().isMediumEnumerationInProgress())
    63 #else
    6461    if (!uiCommon().isFullMediumEnumerationRequested())
    65 #endif
    6662        uiCommon().startMediumEnumeration();
    6763    else
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic3.cpp

    r79365 r80884  
    112112
    113113    /* Remember virtual-disk attributes: */
    114 #ifndef VBOX_GUI_WITH_NEW_MEDIA_EVENTS
    115     QUuid uMediumID = m_virtualDisk.GetId();
    116 #endif
    117114    QString strLocation = m_virtualDisk.GetLocation();
    118115    /* Prepare delete storage progress: */
     
    127124    else
    128125        msgCenter().cannotDeleteHardDiskStorage(m_virtualDisk, strLocation, thisImp());
    129 
    130 #ifndef VBOX_GUI_WITH_NEW_MEDIA_EVENTS
    131     /* Inform UICommon about it: */
    132     uiCommon().deleteMedium(uMediumID);
    133 #endif
    134126
    135127    /* Detach virtual-disk anyway: */
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