- Timestamp:
- Nov 26, 2013 2:33:07 PM (11 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/medium
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumEnumerator.cpp
r49647 r49659 28 28 #include "COMEnums.h" 29 29 #include "CMachine.h" 30 #include "CSnapshot.h" 30 31 #include "CMediumAttachment.h" 31 32 … … 184 185 CMediumMap currentCMediums; 185 186 QStringList currentCMediumIDs; 186 calculateActualUsage(strMachineID, currentCMediums, currentCMediumIDs );187 calculateActualUsage(strMachineID, currentCMediums, currentCMediumIDs, true /* take into account current state only */); 187 188 LogRel(("UIMediumEnumerator: New usage: %s\n", 188 189 currentCMediumIDs.isEmpty() ? "<empty>" : currentCMediumIDs.join(", ").toAscii().constData())); … … 222 223 CMediumMap currentCMediums; 223 224 QStringList currentCMediumIDs; 224 calculateActualUsage(strMachineID, currentCMediums, currentCMediumIDs );225 calculateActualUsage(strMachineID, currentCMediums, currentCMediumIDs, false /* take into account current state only */); 225 226 LogRel(("UIMediumEnumerator: New usage: %s\n", 226 227 currentCMediumIDs.isEmpty() ? "<empty>" : currentCMediumIDs.join(", ").toAscii().constData())); … … 259 260 CMediumMap currentCMediums; 260 261 QStringList currentCMediumIDs; 261 calculateActualUsage(strMachineID, currentCMediums, currentCMediumIDs );262 calculateActualUsage(strMachineID, currentCMediums, currentCMediumIDs, true /* take into account current state only */); 262 263 LogRel(("UIMediumEnumerator: New usage: %s\n", 263 264 currentCMediumIDs.isEmpty() ? "<empty>" : currentCMediumIDs.join(", ").toAscii().constData())); … … 424 425 * @param currentCMediums receives CMedium used in actual data. 425 426 * @param currentCMediumIDs receives CMedium IDs used in actual data. 426 */ 427 void UIMediumEnumerator::calculateActualUsage(const QString &strMachineID, CMediumMap ¤tCMediums, QStringList ¤tCMediumIDs) const 427 * @param fTakeIntoAccountCurrentStateOnly defines whether we should take into accound current VM state only. 428 */ 429 void UIMediumEnumerator::calculateActualUsage(const QString &strMachineID, CMediumMap ¤tCMediums, QStringList ¤tCMediumIDs, bool fTakeIntoAccountCurrentStateOnly) const 428 430 { 429 431 /* Search for corresponding machine: */ 430 432 CMachine machine = vboxGlobal().virtualBox().FindMachine(strMachineID); 433 AssertReturnVoid(!machine.isNull()); 434 435 /* Calculate actual usage starting from root-snapshot if necessary: */ 436 if (!fTakeIntoAccountCurrentStateOnly) 437 calculateActualUsage(machine.FindSnapshot(QString()), currentCMediums, currentCMediumIDs); 438 /* Calculate actual usage for current machine state: */ 439 calculateActualUsage(machine, currentCMediums, currentCMediumIDs); 440 } 441 442 /** 443 * Calculates new CMedium <i>usage</i> based on actual data. 444 * @param snapshot is reference we are calculating <i>usage</i> for. 445 * @param currentCMediums receives CMedium used in actual data. 446 * @param currentCMediumIDs receives CMedium IDs used in actual data. 447 */ 448 void UIMediumEnumerator::calculateActualUsage(const CSnapshot &snapshot, CMediumMap ¤tCMediums, QStringList ¤tCMediumIDs) const 449 { 450 /* Check passed snapshot: */ 451 AssertReturnVoid(!snapshot.isNull()); 452 453 /* Calculate actual usage for passed snapshot machine: */ 454 calculateActualUsage(snapshot.GetMachine(), currentCMediums, currentCMediumIDs); 455 456 /* Iterate through passed snapshot children: */ 457 foreach (const CSnapshot &childSnapshot, snapshot.GetChildren()) 458 calculateActualUsage(childSnapshot, currentCMediums, currentCMediumIDs); 459 } 460 461 /** 462 * Calculates new CMedium <i>usage</i> based on actual data. 463 * @param machine is reference we are calculating <i>usage</i> for. 464 * @param currentCMediums receives CMedium used in actual data. 465 * @param currentCMediumIDs receives CMedium IDs used in actual data. 466 */ 467 void UIMediumEnumerator::calculateActualUsage(const CMachine &machine, CMediumMap ¤tCMediums, QStringList ¤tCMediumIDs) const 468 { 469 /* Check passed machine: */ 431 470 AssertReturnVoid(!machine.isNull()); 432 471 -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumEnumerator.h
r49647 r49659 86 86 /* Helpers: Medium re-caching stuff: */ 87 87 void calculateCachedUsage(const QString &strMachineID, QStringList &previousUIMediumIDs, bool fTakeIntoAccountCurrentStateOnly) const; 88 void calculateActualUsage(const QString &strMachineID, CMediumMap ¤tCMediums, QStringList ¤tCMediumIDs) const; 88 void calculateActualUsage(const QString &strMachineID, CMediumMap ¤tCMediums, QStringList ¤tCMediumIDs, bool fTakeIntoAccountCurrentStateOnly) const; 89 void calculateActualUsage(const CSnapshot &snapshot, CMediumMap ¤tCMediums, QStringList ¤tCMediumIDs) const; 90 void calculateActualUsage(const CMachine &machine, CMediumMap ¤tCMediums, QStringList ¤tCMediumIDs) const; 89 91 void recacheFromCachedUsage(const QStringList &previousUIMediumIDs); 90 92 void recacheFromActualUsage(const CMediumMap ¤tCMediums, const QStringList ¤tCMediumIDs);
Note:
See TracChangeset
for help on using the changeset viewer.