- Timestamp:
- Sep 20, 2019 1:24:33 PM (5 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.cpp
r80894 r80926 2537 2537 } 2538 2538 2539 void UICommon:: startMediumEnumeration(const CMediumVector &comMedia /* = CMediumVector() */)2539 void UICommon::enumerateMedia(const CMediumVector &comMedia /* = CMediumVector() */) 2540 2540 { 2541 2541 /* Make sure UICommon is already valid: */ … … 2551 2551 if (!m_pMediumEnumerator) 2552 2552 return; 2553 /* Make sure enumeration is not already started: */2554 if (m_pMediumEnumerator->isMediumEnumerationInProgress())2555 return;2556 2553 2557 2554 /* Redirect request to medium-enumerator under proper lock: */ … … 2559 2556 { 2560 2557 if (m_pMediumEnumerator) 2561 m_pMediumEnumerator->startMediumEnumeration(comMedia); 2562 m_meCleanupProtectionToken.unlock(); 2563 } 2564 } 2565 2566 void UICommon::enumerateAdditionalMedia(const CMediumVector &comMedia) 2567 { 2568 /* Make sure UICommon is already valid: */ 2569 AssertReturnVoid(m_fValid); 2570 /* Ignore the request during UICommon cleanup: */ 2571 if (s_fCleaningUp) 2572 return; 2573 /* Ignore the request during startup snapshot restoring: */ 2574 if (shouldRestoreCurrentSnapshot()) 2575 return; 2576 2577 /* Make sure medium-enumerator is already created: */ 2578 if (!m_pMediumEnumerator) 2579 return; 2580 2581 /* Redirect request to medium-enumerator under proper lock: */ 2582 if (m_meCleanupProtectionToken.tryLockForRead()) 2583 { 2584 if (m_pMediumEnumerator) 2585 m_pMediumEnumerator->enumerateAdditionalMedia(comMedia); 2558 m_pMediumEnumerator->enumerateMedia(comMedia); 2586 2559 m_meCleanupProtectionToken.unlock(); 2587 2560 } … … 3348 3321 { 3349 3322 /* UI medium may be new and not among our media, request enumeration: */ 3350 enumerate AdditionalMedia(CMediumVector() << comMedium);3323 enumerateMedia(CMediumVector() << comMedium); 3351 3324 3352 3325 /* Search for corresponding UI medium again: */ -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.h
r80894 r80926 482 482 /** @name COM: Virtual Media stuff. 483 483 * @{ */ 484 /** Starts medium-enumeration. */ 485 void startMediumEnumeration(const CMediumVector &comMedia = CMediumVector()); 486 /** Enumerates additional media. */ 487 void enumerateAdditionalMedia(const CMediumVector &comMedia); 484 /** Enumerates passed @a comMedia. */ 485 void enumerateMedia(const CMediumVector &comMedia = CMediumVector()); 488 486 /** Calls refresh for each medium which has been already enumerated. */ 489 487 void refreshMedia(); -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp
r79365 r80926 1272 1272 /* Cache medium data early if necessary: */ 1273 1273 if (uiCommon().agressiveCaching()) 1274 uiCommon(). startMediumEnumeration();1274 uiCommon().enumerateMedia(); 1275 1275 1276 1276 /* Prepare: */ -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumEnumerator.cpp
r80899 r80926 158 158 } 159 159 160 void UIMediumEnumerator::startMediumEnumeration(const CMediumVector &comMedia /* = CMediumVector() */) 161 { 162 /* Make sure we are not already in progress: */ 163 AssertReturnVoid(!m_fMediumEnumerationInProgress); 164 160 void UIMediumEnumerator::enumerateMedia(const CMediumVector &comMedia /* = CMediumVector() */) 161 { 165 162 /* Compose new map of currently cached media & their children. 166 163 * While composing we are using data from already cached media. */ 167 164 UIMediumMap guiMedia; 168 165 addNullMediumToMap(guiMedia); 169 /* If @p comMedia is empty we start the medium-enumeration with all170 * known hard disk media. Otherwise only passed comMedia will be171 * enumerated. But be aware we will enumerate all the optical media172 * in any case to make them listed within the first run wizard for173 * now. But I think later we can add proper enumeration call to the174 * wizard instead and enumerate only comMedia in 'else' case. */175 166 if (comMedia.isEmpty()) 176 167 { 177 m_fFullMediumEnumerationRequested = true;168 /* Compose new map of all known media & their children: */ 178 169 addMediaToMap(uiCommon().virtualBox().GetHardDisks(), guiMedia); 179 170 addMediaToMap(uiCommon().host().GetDVDDrives(), guiMedia); … … 184 175 else 185 176 { 186 m_fFullMediumEnumerationRequested = false;177 /* Compose new map of passed media & their children: */ 187 178 addMediaToMap(comMedia, guiMedia); 188 179 } … … 192 183 return; 193 184 194 /* Replace existing media map: */ 195 m_media = guiMedia; 196 197 /* If enumeration hasn't yet started: */ 198 if (!m_fMediumEnumerationInProgress) 199 { 200 /* Notify listener about enumeration started: */ 201 LogRel(("GUI: UIMediumEnumerator: Medium-enumeration started...\n")); 202 m_fMediumEnumerationInProgress = true; 203 emit sigMediumEnumerationStarted(); 204 205 /* Make sure we really have more than one UIMedium (which is NULL): */ 206 if ( guiMedia.size() == 1 207 && guiMedia.first().id() == UIMedium::nullID()) 208 { 209 /* Notify listener about enumeration finished instantly: */ 210 LogRel(("GUI: UIMediumEnumerator: Medium-enumeration finished!\n")); 211 m_fMediumEnumerationInProgress = false; 212 emit sigMediumEnumerationFinished(); 213 } 214 } 215 216 /* Start enumeration for media with non-NULL ID: */ 217 foreach (const QUuid &uMediumID, guiMedia.keys()) 218 if (!uMediumID.isNull()) 219 createMediumEnumerationTask(guiMedia[uMediumID]); 220 } 221 222 void UIMediumEnumerator::enumerateAdditionalMedia(const CMediumVector &comMedia) 223 { 224 /* Compose new map of passed medium & it's children. 225 * While composing we are using data from already cached media. */ 226 UIMediumMap guiMedia; 227 addMediaToMap(comMedia, guiMedia); 228 229 /* UICommon is cleaning up, abort immediately: */ 230 if (UICommon::isCleaningUp()) 231 return; 232 233 /* Throw the media to existing map: */ 234 foreach (const QUuid &uMediumId, guiMedia.keys()) 235 m_media[uMediumId] = guiMedia.value(uMediumId); 185 if (comMedia.isEmpty()) 186 { 187 /* Replace existing media map since 188 * we have full medium enumeration: */ 189 m_fFullMediumEnumerationRequested = true; 190 m_media = guiMedia; 191 } 192 else 193 { 194 /* Throw the media to existing map: */ 195 foreach (const QUuid &uMediumId, guiMedia.keys()) 196 m_media[uMediumId] = guiMedia.value(uMediumId); 197 } 236 198 237 199 /* If enumeration hasn't yet started: */ -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumEnumerator.h
r80894 r80926 81 81 bool isMediumEnumerationInProgress() const { return m_fMediumEnumerationInProgress; } 82 82 /** Makes a request to enumerate specified @a comMedia. 83 * @note Previous map will be replaced with the new one, values present in both 84 * maps will be merged from the previous to new one, keep that all in mind. 85 * @note Empty passed map means that full/overall medium-enumeration is requested. */ 86 void startMediumEnumeration(const CMediumVector &comMedia = CMediumVector()); 87 /** Makes a request to enumerate additionally specified @a comMedia. 88 * @note Previous map will be extended with the new one, composed of passed 89 * media and their children, values present in both maps will be merged 90 * from the previous to new one, keep that all in mind. */ 91 void enumerateAdditionalMedia(const CMediumVector &comMedia); 83 * @note Empty passed map means that full/overall medium-enumeration is requested. 84 * In that case previous map will be replaced with the new one, values 85 * present in both maps will be merged from the previous to new one. 86 * @note Non-empty passed map means that additional medium-enumeration is requested. 87 * In that case previous map will be extended with the new one, values 88 * present in both maps will be merged from the previous to new one. */ 89 void enumerateMedia(const CMediumVector &comMedia = CMediumVector()); 92 90 /** Refresh all the lightweight UIMedium information for all the cached UIMedium(s). 93 91 * @note Please note that this is a lightweight version, which doesn't perform -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp
r80884 r80926 580 580 { 581 581 /* Start medium-enumeration: */ 582 uiCommon(). startMediumEnumeration();582 uiCommon().enumerateMedia(); 583 583 } 584 584 … … 696 696 /* Start medium-enumeration (if necessary): */ 697 697 if (!uiCommon().isFullMediumEnumerationRequested()) 698 uiCommon(). startMediumEnumeration();698 uiCommon().enumerateMedia(); 699 699 /* Emulate medium-enumeration otherwise: */ 700 700 else -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumSelector.cpp
r80884 r80926 82 82 /* Start medium-enumeration (if necessary): */ 83 83 if (!uiCommon().isFullMediumEnumerationRequested()) 84 uiCommon(). startMediumEnumeration();84 uiCommon().enumerateMedia(); 85 85 configure(); 86 86 finalize(); … … 497 497 { 498 498 /* Initialize media enumation: */ 499 uiCommon(). startMediumEnumeration();499 uiCommon().enumerateMedia(); 500 500 /* Update the search: */ 501 501 m_pSearchWidget->search(m_pTreeWidget); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp
r80890 r80926 210 210 { 211 211 AssertReturn(m_pSession, false); 212 uiCommon(). startMediumEnumeration(m_pSession->machineMedia());212 uiCommon().enumerateMedia(m_pSession->machineMedia()); 213 213 } 214 214 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIVMInformationDialog.cpp
r80884 r80926 170 170 /* This is needed at least for some VM to show correct storage info. */ 171 171 if (!uiCommon().isFullMediumEnumerationRequested()) 172 uiCommon(). startMediumEnumeration();172 uiCommon().enumerateMedia(); 173 173 } 174 174 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp
r80884 r80926 3710 3710 /* Start medium-enumeration (only if necessary): */ 3711 3711 if (!uiCommon().isFullMediumEnumerationRequested()) 3712 uiCommon(). startMediumEnumeration();3712 uiCommon().enumerateMedia(); 3713 3713 3714 3714 /* Layout created in the .ui file. */ -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIMediaComboBox.cpp
r80900 r80926 66 66 comMedia << uiCommon().host().GetDVDDrives(); 67 67 comMedia << uiCommon().virtualBox().GetDVDImages(); 68 uiCommon().enumerate AdditionalMedia(comMedia);68 uiCommon().enumerateMedia(comMedia); 69 69 } 70 70 refresh();
Note:
See TracChangeset
for help on using the changeset viewer.