- Timestamp:
- Sep 18, 2019 11:23:57 AM (5 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk
r80413 r80884 85 85 VBOX_WITH_UPDATE_REQUEST := 1 86 86 endif 87 88 89 #90 # Use newly intruduced global media related events for91 # medium enumeration purposes.92 #93 VBOX_GUI_WITH_NEW_MEDIA_EVENTS := 194 87 95 88 … … 118 111 $(if $(VBOX_WITH_ADDITIONS_AUTOUPDATE_UI),VBOX_WITH_ADDITIONS_AUTOUPDATE_UI) \ 119 112 $(if $(VBOX_WITH_UPDATE_REQUEST),VBOX_WITH_UPDATE_REQUEST) \ 120 $(if $(VBOX_GUI_WITH_NEW_MEDIA_EVENTS),VBOX_GUI_WITH_NEW_MEDIA_EVENTS) \121 113 $(if $(VBOX_WITH_AUDIO_OSS),VBOX_WITH_AUDIO_OSS) \ 122 114 $(if $(VBOX_WITH_AUDIO_ALSA),VBOX_WITH_AUDIO_ALSA) \ … … 187 179 $(if $(VBOX_WITH_ADDITIONS_AUTOUPDATE_UI),VBOX_WITH_ADDITIONS_AUTOUPDATE_UI) \ 188 180 $(if $(VBOX_WITH_UPDATE_REQUEST),VBOX_WITH_UPDATE_REQUEST) \ 189 $(if $(VBOX_GUI_WITH_NEW_MEDIA_EVENTS),VBOX_GUI_WITH_NEW_MEDIA_EVENTS) \190 181 $(if $(VBOX_WITH_AUDIO_OSS),VBOX_WITH_AUDIO_OSS) \ 191 182 $(if $(VBOX_WITH_AUDIO_ALSA),VBOX_WITH_AUDIO_ALSA) \ … … 249 240 UICommon_DEFS += \ 250 241 $(if $(VBOX_WITH_UPDATE_REQUEST),VBOX_WITH_UPDATE_REQUEST) \ 251 $(if $(VBOX_GUI_WITH_NEW_MEDIA_EVENTS),VBOX_GUI_WITH_NEW_MEDIA_EVENTS) \252 242 $(if $(VBOX_WITH_AUDIO_OSS),VBOX_WITH_AUDIO_OSS) \ 253 243 $(if $(VBOX_WITH_AUDIO_ALSA),VBOX_WITH_AUDIO_ALSA) \ -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.cpp
r80824 r80884 2618 2618 } 2619 2619 2620 #ifdef VBOX_GUI_WITH_NEW_MEDIA_EVENTS2621 2620 bool UICommon::isFullMediumEnumerationRequested() const 2622 2621 { … … 2625 2624 && m_pMediumEnumerator->isFullMediumEnumerationRequested(); 2626 2625 } 2627 #endif2628 2626 2629 2627 UIMedium UICommon::medium(const QUuid &uMediumID) const … … 2665 2663 } 2666 2664 } 2667 2668 #ifndef VBOX_GUI_WITH_NEW_MEDIA_EVENTS2669 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 #endif2680 2665 2681 2666 QUuid UICommon::openMedium(UIMediumDeviceType enmMediumType, QString strMediumLocation, QWidget *pParent /* = 0 */) -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.h
r80495 r80884 490 490 /** Returns whether medium-enumeration is in progress. */ 491 491 bool isMediumEnumerationInProgress() const; 492 #ifdef VBOX_GUI_WITH_NEW_MEDIA_EVENTS493 492 /** Returns whether full medium-enumeration is requested. */ 494 493 bool isFullMediumEnumerationRequested() const; 495 #endif496 494 /** Returns enumerated medium with certain @a uMediumID. */ 497 495 UIMedium medium(const QUuid &uMediumID) const; … … 500 498 /** Creates medium on the basis of passed @a guiMedium description. */ 501 499 void createMedium(const UIMedium &guiMedium); 502 #ifndef VBOX_GUI_WITH_NEW_MEDIA_EVENTS503 /** Deletes medium with certain @a uMediumID. */504 void deleteMedium(const QUuid &uMediumID);505 #endif506 500 507 501 /** Opens external medium by passed @a strMediumLocation. -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumEnumerator.cpp
r79425 r80884 98 98 UIMediumEnumerator::UIMediumEnumerator() 99 99 : m_fMediumEnumerationInProgress(false) 100 #ifdef VBOX_GUI_WITH_NEW_MEDIA_EVENTS101 100 , m_fMediumEnumerationRequested(false) 102 #endif103 101 { 104 102 /* Allow UIMedium to be used in inter-thread signals: */ … … 106 104 107 105 /* Prepare Main event handlers: */ 108 #ifndef VBOX_GUI_WITH_NEW_MEDIA_EVENTS109 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 */122 106 /* Machine related events: */ 123 107 connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigMachineDataChange, … … 134 118 connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigMediumRegistered, 135 119 this, &UIMediumEnumerator::sltHandleMediumRegistered); 136 #endif /* VBOX_GUI_WITH_NEW_MEDIA_EVENTS */137 120 138 121 /* Prepare global thread-pool listener: */ … … 174 157 emit sigMediumCreated(uMediumID); 175 158 } 176 177 #ifndef VBOX_GUI_WITH_NEW_MEDIA_EVENTS178 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 #endif193 159 194 160 void UIMediumEnumerator::startMediumEnumeration(const CMediumVector &comMedia /* = CMediumVector() */) … … 209 175 if (comMedia.isEmpty()) 210 176 { 211 #ifdef VBOX_GUI_WITH_NEW_MEDIA_EVENTS212 177 m_fMediumEnumerationRequested = true; 213 #endif214 178 addMediaToMap(uiCommon().virtualBox().GetHardDisks(), media); 215 179 addMediaToMap(uiCommon().host().GetDVDDrives(), media); … … 220 184 else 221 185 { 222 #ifdef VBOX_GUI_WITH_NEW_MEDIA_EVENTS223 186 m_fMediumEnumerationRequested = false; 224 #endif225 187 addMediaToMap(uiCommon().host().GetDVDDrives(), media); 226 188 addMediaToMap(uiCommon().virtualBox().GetDVDImages(), media); … … 296 258 m_media[UIMedium::nullID()] = UIMedium(); 297 259 } 298 299 #ifndef VBOX_GUI_WITH_NEW_MEDIA_EVENTS300 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 else359 {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 */401 260 402 261 void UIMediumEnumerator::sltHandleMachineDataChange(const QUuid &uMachineId) … … 535 394 } 536 395 537 #endif /* VBOX_GUI_WITH_NEW_MEDIA_EVENTS */538 539 396 void UIMediumEnumerator::sltHandleMediumEnumerationTaskComplete(UITask *pTask) 540 397 { … … 653 510 } 654 511 } 655 656 #ifndef VBOX_GUI_WITH_NEW_MEDIA_EVENTS657 658 void UIMediumEnumerator::calculateCachedUsage(const QUuid &uMachineID,659 QList<QUuid> &previousUIMediumIDs,660 const bool fTakeIntoAccountCurrentStateOnly) const661 {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 = fTakeIntoAccountCurrentStateOnly670 ? 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 ¤tCMediums,680 QList<QUuid> ¤tCMediumIDs,681 const bool fTakeIntoAccountCurrentStateOnly) const682 {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 ¤tCMediums,701 QList<QUuid> ¤tCMediumIDs) const702 {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 ¤tCMediums,717 QList<QUuid> ¤tCMediumIDs) const718 {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 else763 {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 ¤tCMediums,777 const QList<QUuid> ¤tCMediumIDs)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 */805 512 806 513 void UIMediumEnumerator::parseAttachment(CMediumAttachment comAttachment, QList<QUuid> &result) … … 948 655 } 949 656 950 #endif /* VBOX_GUI_WITH_NEW_MEDIA_EVENTS */951 952 657 953 658 #include "UIMediumEnumerator.moc" -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumEnumerator.h
r79337 r80884 32 32 33 33 /* COM includes: */ 34 #ifdef VBOX_GUI_WITH_NEW_MEDIA_EVENTS35 34 # include "CMedium.h" 36 35 # include "CMediumAttachment.h" 37 #endif38 36 39 37 /* Forward declarations: */ … … 77 75 /** Creates UIMedium thus caching it internally on the basis of passed @a guiMedium information. */ 78 76 void createMedium(const UIMedium &guiMedium); 79 #ifndef VBOX_GUI_WITH_NEW_MEDIA_EVENTS80 /** Deletes UIMedium with specified @a uMediumID thus removing it from internal cache. */81 void deleteMedium(const QUuid &uMediumID);82 #endif83 77 84 78 /** Returns whether consolidated medium-enumeration process is in progress. */ 85 79 bool isMediumEnumerationInProgress() const { return m_fMediumEnumerationInProgress; } 86 #ifdef VBOX_GUI_WITH_NEW_MEDIA_EVENTS87 80 /** Returns whether full consolidated medium-enumeration process is requested. */ 88 81 bool isFullMediumEnumerationRequested() const { return m_fMediumEnumerationRequested; } 89 #endif90 82 /** Makes a request to enumerate specified @a comMedia. 91 83 * @note Previous map will be replaced with the new one, values present in both … … 111 103 private slots: 112 104 113 #ifndef VBOX_GUI_WITH_NEW_MEDIA_EVENTS114 /** 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 */122 105 /** Handles machine-data-change event for a machine with specified @a uMachineId. */ 123 106 void sltHandleMachineDataChange(const QUuid &uMachineId); … … 141 124 * @param fRegistered Brings whether medium is registered or unregistered. */ 142 125 void sltHandleMediumRegistered(const QUuid &uMediumId, KDeviceType enmMediumType, bool fRegistered); 143 #endif /* VBOX_GUI_WITH_NEW_MEDIA_EVENTS */144 126 145 127 /** Handles medium-enumeration @a pTask complete signal. */ … … 155 137 void addMediaToMap(const CMediumVector &inputMedia, UIMediumMap &outputMedia); 156 138 157 #ifndef VBOX_GUI_WITH_NEW_MEDIA_EVENTS158 /** 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 ¤tCMediums,170 QList<QUuid> ¤tCMediumIDs,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 ¤tCMediums,177 QList<QUuid> ¤tCMediumIDs) 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 ¤tCMediums,183 QList<QUuid> ¤tCMediumIDs) 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 ¤tCMediums,192 const QList<QUuid> ¤tCMediumIDs);193 #else /* VBOX_GUI_WITH_NEW_MEDIA_EVENTS */194 139 /** Parses incoming @a comAttachment, enumerating the media it has attached. 195 140 * @param result Brings the list of previously enumerated media … … 209 154 * IDs to be appended with newly enumerated. */ 210 155 void enumerateAllMediaOfMediumWithId(const QUuid &uMediumId, QList<QUuid> &result); 211 #endif /* VBOX_GUI_WITH_NEW_MEDIA_EVENTS */212 156 213 157 /** Holds whether consolidated medium-enumeration process is in progress. */ 214 158 bool m_fMediumEnumerationInProgress; 215 #ifdef VBOX_GUI_WITH_NEW_MEDIA_EVENTS216 159 /** Holds whether full consolidated medium-enumeration process is requested. */ 217 160 bool m_fMediumEnumerationRequested; 218 #endif219 161 220 162 /** Holds a set of current medium-enumeration tasks. */ -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumItem.cpp
r79365 r80884 423 423 /* Remember some of hard-disk attributes: */ 424 424 CMedium hardDisk = medium().medium(); 425 #ifndef VBOX_GUI_WITH_NEW_MEDIA_EVENTS426 QUuid uMediumID = id();427 #endif428 425 429 426 /* Propose to remove medium storage: */ … … 438 435 return false; 439 436 } 440 441 #ifndef VBOX_GUI_WITH_NEW_MEDIA_EVENTS442 /* Remove UIMedium finally: */443 uiCommon().deleteMedium(uMediumID);444 #endif445 437 446 438 /* True by default: */ … … 554 546 /* Remember some of optical-disk attributes: */ 555 547 CMedium image = medium().medium(); 556 #ifndef VBOX_GUI_WITH_NEW_MEDIA_EVENTS557 QUuid uMediumID = id();558 #endif559 548 560 549 /* Close optical-disk: */ … … 566 555 } 567 556 568 #ifndef VBOX_GUI_WITH_NEW_MEDIA_EVENTS569 /* Remove UIMedium finally: */570 uiCommon().deleteMedium(uMediumID);571 #endif572 573 557 /* True by default: */ 574 558 return true; … … 629 613 /* Remember some of floppy-disk attributes: */ 630 614 CMedium image = medium().medium(); 631 #ifndef VBOX_GUI_WITH_NEW_MEDIA_EVENTS632 QUuid uMediumID = id();633 #endif634 615 635 616 /* Close floppy-disk: */ … … 641 622 } 642 623 643 #ifndef VBOX_GUI_WITH_NEW_MEDIA_EVENTS644 /* Remove UIMedium finally: */645 uiCommon().deleteMedium(uMediumID);646 #endif647 648 624 /* True by default: */ 649 625 return true; -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp
r79365 r80884 695 695 696 696 /* Start medium-enumeration (if necessary): */ 697 #ifndef VBOX_GUI_WITH_NEW_MEDIA_EVENTS698 if (!uiCommon().isMediumEnumerationInProgress())699 #else700 697 if (!uiCommon().isFullMediumEnumerationRequested()) 701 #endif702 698 uiCommon().startMediumEnumeration(); 703 699 /* Emulate medium-enumeration otherwise: */ … … 1357 1353 refetchCurrentMediumItem(type); 1358 1354 1359 #ifdef VBOX_GUI_WITH_NEW_MEDIA_EVENTS1360 1355 /* Update all the children recursively as well: */ 1361 1356 foreach(const QUuid &uMediumId, uiCommon().mediumIDs()) … … 1366 1361 updateMediumItem(guiMedium); 1367 1362 } 1368 #endif1369 1363 } 1370 1364 -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumSelector.cpp
r79365 r80884 81 81 { 82 82 /* Start medium-enumeration (if necessary): */ 83 #ifndef VBOX_GUI_WITH_NEW_MEDIA_EVENTS84 if (uiCommon().uiType() == UICommon::UIType_RuntimeUI)85 #else86 83 if (!uiCommon().isFullMediumEnumerationRequested()) 87 #endif88 84 uiCommon().startMediumEnumeration(); 89 85 configure(); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIVMInformationDialog.cpp
r80773 r80884 169 169 170 170 /* This is needed at least for some VM to show correct storage info. */ 171 #ifndef VBOX_GUI_WITH_NEW_MEDIA_EVENTS172 if (uiCommon().uiType() == UICommon::UIType_RuntimeUI)173 #else174 171 if (!uiCommon().isFullMediumEnumerationRequested()) 175 #endif176 172 uiCommon().startMediumEnumeration(); 177 173 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp
r80736 r80884 3708 3708 UIIconPoolStorageSettings::create(); 3709 3709 3710 #ifdef VBOX_GUI_WITH_NEW_MEDIA_EVENTS3711 3710 /* Start medium-enumeration (only if necessary): */ 3712 3711 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(); 3718 3713 3719 3714 /* Layout created in the .ui file. */ -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIMediaComboBox.cpp
r80445 r80884 59 59 { 60 60 /* Start medium-enumeration (if necessary): */ 61 #ifndef VBOX_GUI_WITH_NEW_MEDIA_EVENTS62 if (!uiCommon().isMediumEnumerationInProgress())63 #else64 61 if (!uiCommon().isFullMediumEnumerationRequested()) 65 #endif66 62 uiCommon().startMediumEnumeration(); 67 63 else -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic3.cpp
r79365 r80884 112 112 113 113 /* Remember virtual-disk attributes: */ 114 #ifndef VBOX_GUI_WITH_NEW_MEDIA_EVENTS115 QUuid uMediumID = m_virtualDisk.GetId();116 #endif117 114 QString strLocation = m_virtualDisk.GetLocation(); 118 115 /* Prepare delete storage progress: */ … … 127 124 else 128 125 msgCenter().cannotDeleteHardDiskStorage(m_virtualDisk, strLocation, thisImp()); 129 130 #ifndef VBOX_GUI_WITH_NEW_MEDIA_EVENTS131 /* Inform UICommon about it: */132 uiCommon().deleteMedium(uMediumID);133 #endif134 126 135 127 /* Detach virtual-disk anyway: */
Note:
See TracChangeset
for help on using the changeset viewer.