- Timestamp:
- Oct 19, 2020 6:20:28 PM (4 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserAbstractModel.cpp
r86611 r86630 601 601 } 602 602 603 void UIChooserAbstractModel::insertCloudAccountKey(const UICloudAccountKey &key) 604 { 605 m_cloudAccountKeysBeingUpdated.insert(key); 606 } 607 608 void UIChooserAbstractModel::removeCloudAccountKey(const UICloudAccountKey &key) 609 { 610 m_cloudAccountKeysBeingUpdated.remove(key); 611 } 612 613 bool UIChooserAbstractModel::containsCloudAccountKey(const UICloudAccountKey &key) const 614 { 615 return m_cloudAccountKeysBeingUpdated.contains(key); 616 } 617 603 618 void UIChooserAbstractModel::sltLocalMachineStateChanged(const QUuid &uMachineId, const KMachineState) 604 619 { … … 833 848 if (!registeredMachines.isEmpty()) 834 849 sltCloudMachinesRegistered(pAcquiringTask->providerShortName(), pAcquiringTask->profileName(), registeredMachines); 850 851 /* Remove cloud account key from the list of keys currently being updated: */ 852 const UICloudAccountKey accountKey = qMakePair(pAcquiringTask->providerShortName(), pAcquiringTask->profileName()); 853 removeCloudAccountKey(accountKey); 835 854 } 836 855 … … 1031 1050 0 /* position */, 1032 1051 UIFakeCloudVirtualMachineItemState_Loading); 1052 1053 /* Insert cloud account key into a list of keys currently being updated: */ 1054 const UICloudAccountKey cloudAccountKey = qMakePair(strProviderShortName, strProfileName); 1055 insertCloudAccountKey(cloudAccountKey); 1033 1056 1034 1057 /* Create list cloud machines task: */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserAbstractModel.h
r86611 r86630 23 23 24 24 /* Qt includes: */ 25 #include <QSet> 25 26 #include <QUuid> 26 27 … … 30 31 /* COM includes: */ 31 32 #include "COMEnums.h" 33 34 /* Typedefs: */ 35 typedef QPair<QString, QString> UICloudAccountKey; 32 36 33 37 /* Forward declaration: */ … … 135 139 /** Handles group definitions saving complete. */ 136 140 void sltGroupDefinitionsSaveComplete(); 141 /** @} */ 142 143 /** @name Cloud update stuff. 144 * @{ */ 145 /** Inserts cloud account @a key into a set of keys currently being updated. */ 146 void insertCloudAccountKey(const UICloudAccountKey &key); 147 /** Removes cloud account @a key from a set of keys currently being updated. */ 148 void removeCloudAccountKey(const UICloudAccountKey &key); 149 /** Returns whether cloud account @a key is a part of key set currently being updated. */ 150 bool containsCloudAccountKey(const UICloudAccountKey &key) const; 137 151 /** @} */ 138 152 … … 306 320 QMap<QString, QStringList> m_groups; 307 321 /** @} */ 322 323 /** @name Cloud update stuff. 324 * @{ */ 325 /** Holds the set of cloud account keys currently being updated. */ 326 QSet<UICloudAccountKey> m_cloudAccountKeysBeingUpdated; 327 /** @} */ 308 328 }; 309 329 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.cpp
r86629 r86630 1776 1776 1777 1777 /* For every selected machine-item: */ 1778 typedef QPair<QString, QString> UICloudAccount; 1779 QSet<UICloudAccount> changedAccounts; 1778 QSet<UICloudAccountKey> changedCloudAccountKeys; 1780 1779 foreach (UIChooserItemMachine *pMachineItem, machineItems) 1781 1780 { … … 1801 1800 continue; 1802 1801 } 1803 /* Compose cloud account to update: */1802 /* Compose cloud account key to update: */ 1804 1803 const QString strProviderShortName = pMachineItem->parentItem()->parentItem()->name(); 1805 1804 const QString strProfileName = pMachineItem->parentItem()->name(); 1806 const UICloudAccount account = qMakePair(strProviderShortName, strProfileName); 1807 if (!changedAccounts.contains(account)) 1808 changedAccounts.insert(account); 1809 } 1810 1811 /* Restart list cloud machines task for required accounts: */ 1812 foreach (const UICloudAccount &account, changedAccounts) 1813 { 1814 UITaskCloudListMachines *pTask = new UITaskCloudListMachines(account.first /* short provider name */, 1815 account.second /* profile name */, 1805 const UICloudAccountKey accountKey = qMakePair(strProviderShortName, strProfileName); 1806 if (!changedCloudAccountKeys.contains(accountKey)) 1807 changedCloudAccountKeys.insert(accountKey); 1808 } 1809 1810 /* Restart List Cloud Machines task for required account keys: */ 1811 foreach (const UICloudAccountKey &accountKey, changedCloudAccountKeys) 1812 { 1813 /* Skip cloud account keys already being updated: */ 1814 if (containsCloudAccountKey(accountKey)) 1815 continue; 1816 insertCloudAccountKey(accountKey); 1817 1818 /* Create a task for particular cloud account key: */ 1819 UITaskCloudListMachines *pTask = new UITaskCloudListMachines(accountKey.first /* short provider name */, 1820 accountKey.second /* profile name */, 1816 1821 false /* with refresh? */); 1817 1822 AssertPtrReturnVoid(pTask);
Note:
See TracChangeset
for help on using the changeset viewer.