VirtualBox

Changeset 86630 in vbox for trunk/src


Ignore:
Timestamp:
Oct 19, 2020 6:20:28 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9653: VirtualBox Manager: Chooser pane: Do NOT update cloud accounts if they already being updated.

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  
    601601}
    602602
     603void UIChooserAbstractModel::insertCloudAccountKey(const UICloudAccountKey &key)
     604{
     605    m_cloudAccountKeysBeingUpdated.insert(key);
     606}
     607
     608void UIChooserAbstractModel::removeCloudAccountKey(const UICloudAccountKey &key)
     609{
     610    m_cloudAccountKeysBeingUpdated.remove(key);
     611}
     612
     613bool UIChooserAbstractModel::containsCloudAccountKey(const UICloudAccountKey &key) const
     614{
     615    return m_cloudAccountKeysBeingUpdated.contains(key);
     616}
     617
    603618void UIChooserAbstractModel::sltLocalMachineStateChanged(const QUuid &uMachineId, const KMachineState)
    604619{
     
    833848    if (!registeredMachines.isEmpty())
    834849        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);
    835854}
    836855
     
    10311050                                     0 /* position */,
    10321051                                     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);
    10331056
    10341057            /* Create list cloud machines task: */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserAbstractModel.h

    r86611 r86630  
    2323
    2424/* Qt includes: */
     25#include <QSet>
    2526#include <QUuid>
    2627
     
    3031/* COM includes: */
    3132#include "COMEnums.h"
     33
     34/* Typedefs: */
     35typedef QPair<QString, QString> UICloudAccountKey;
    3236
    3337/* Forward declaration: */
     
    135139        /** Handles group definitions saving complete. */
    136140        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;
    137151    /** @} */
    138152
     
    306320        QMap<QString, QStringList>  m_groups;
    307321    /** @} */
     322
     323    /** @name Cloud update stuff.
     324      * @{ */
     325        /** Holds the set of cloud account keys currently being updated. */
     326        QSet<UICloudAccountKey>  m_cloudAccountKeysBeingUpdated;
     327    /** @} */
    308328};
    309329
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.cpp

    r86629 r86630  
    17761776
    17771777    /* For every selected machine-item: */
    1778     typedef QPair<QString, QString> UICloudAccount;
    1779     QSet<UICloudAccount> changedAccounts;
     1778    QSet<UICloudAccountKey> changedCloudAccountKeys;
    17801779    foreach (UIChooserItemMachine *pMachineItem, machineItems)
    17811780    {
     
    18011800            continue;
    18021801        }
    1803         /* Compose cloud account to update: */
     1802        /* Compose cloud account key to update: */
    18041803        const QString strProviderShortName = pMachineItem->parentItem()->parentItem()->name();
    18051804        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 */,
    18161821                                                                     false /* with refresh? */);
    18171822        AssertPtrReturnVoid(pTask);
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