VirtualBox

Changeset 103021 in vbox for trunk


Ignore:
Timestamp:
Jan 24, 2024 12:54:26 PM (8 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10501: Reworking r161037 a bit the way that cloud machine nodes enumeration being encapsulated in separate reusable method; A bit of cleanup for cloud update related signals as well.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserAbstractModel.cpp

    r102838 r103021  
    616616    m_fKeepCloudNodesUpdated = fUpdate;
    617617
    618     /* Search for a list of provider nodes: */
    619     QList<UIChooserNode*> providerNodes;
    620     invisibleRoot()->searchForNodes(QString(),
    621                                     UIChooserItemSearchFlag_CloudProvider,
    622                                     providerNodes);
    623 
    624     /* Search for a list of profile nodes: */
    625     QList<UIChooserNode*> profileNodes;
    626     foreach (UIChooserNode *pProviderNode, providerNodes)
    627         pProviderNode->searchForNodes(QString(),
    628                                       UIChooserItemSearchFlag_CloudProfile,
    629                                       profileNodes);
    630 
    631     /* Search for a list of machine nodes: */
    632     QList<UIChooserNode*> machineNodes;
    633     foreach (UIChooserNode *pProfileNode, profileNodes)
    634         pProfileNode->searchForNodes(QString(),
    635                                      UIChooserItemSearchFlag_Machine,
    636                                      machineNodes);
    637 
    638     /* Update all the real cloud items: */
    639     foreach (UIChooserNode *pNode, machineNodes)
     618    /* Update all the real cloud machine items: */
     619    foreach (UIChooserNode *pNode, enumerateCloudMachineNodes())
    640620    {
    641621        AssertReturnVoid(pNode && pNode->type() == UIChooserNodeType_Machine);
    642622        UIChooserNodeMachine *pMachineNode = pNode->toMachineNode();
    643         AssertReturnVoid(pMachineNode);
     623        AssertPtrReturnVoid(pMachineNode);
    644624        if (pMachineNode->cacheType() != UIVirtualMachineItemType_CloudReal)
    645625            continue;
    646626        UIVirtualMachineItemCloud *pCloudMachineItem = pMachineNode->cache()->toCloud();
     627        AssertPtrReturnVoid(pCloudMachineItem);
    647628        pCloudMachineItem->setUpdateRequiredByGlobalReason(m_fKeepCloudNodesUpdated);
    648629        if (m_fKeepCloudNodesUpdated)
     
    19441925}
    19451926
     1927QList<UIChooserNode*> UIChooserAbstractModel::enumerateCloudMachineNodes() const
     1928{
     1929    /* Search for a list of provider nodes: */
     1930    QList<UIChooserNode*> providerNodes;
     1931    invisibleRoot()->searchForNodes(QString(),
     1932                                    UIChooserItemSearchFlag_CloudProvider,
     1933                                    providerNodes);
     1934
     1935    /* Search for a list of profile nodes: */
     1936    QList<UIChooserNode*> profileNodes;
     1937    foreach (UIChooserNode *pProviderNode, providerNodes)
     1938        pProviderNode->searchForNodes(QString(),
     1939                                      UIChooserItemSearchFlag_CloudProfile,
     1940                                      profileNodes);
     1941
     1942    /* Search for a list of machine nodes: */
     1943    QList<UIChooserNode*> machineNodes;
     1944    foreach (UIChooserNode *pProfileNode, profileNodes)
     1945        pProfileNode->searchForNodes(QString(),
     1946                                     UIChooserItemSearchFlag_Machine,
     1947                                     machineNodes);
     1948
     1949    return machineNodes;
     1950}
     1951
    19461952void UIChooserAbstractModel::stopCloudUpdates(bool fForced /* = false */)
    19471953{
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserAbstractModel.h

    r102848 r103021  
    5959signals:
    6060
    61     /** @name Cloud machine stuff.
    62       * @{ */
    63         /** Notifies listeners about state change for cloud machine with certain @a uId. */
    64         void sigCloudMachineStateChange(const QUuid &uId);
    65     /** @} */
    66 
    6761    /** @name Group saving stuff.
    6862      * @{ */
     
    7569    /** @name Cloud update stuff.
    7670      * @{ */
     71        /** Notifies listeners about cloud machine state change.
     72          * @param  uId  Brings the cloud machine ID. */
     73        void sigCloudMachineStateChange(const QUuid &uId);
     74
    7775        /** Notifies listeners about cloud update state changed. */
    7876        void sigCloudUpdateStateChanged();
     
    374372    /** @name Cloud update stuff.
    375373      * @{ */
     374        /** Enumerates all cloud machine nodes. */
     375        QList<UIChooserNode*> enumerateCloudMachineNodes() const;
     376
    376377        /** Stops all cloud updates.
    377378          * @param  fForced  Brings whether cloud updates should be killed. */
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