VirtualBox

Changeset 102838 in vbox for trunk


Ignore:
Timestamp:
Jan 11, 2024 12:27:44 PM (13 months ago)
Author:
vboxsync
Message:

FE/Qt: VBox Manager: Make sure all cloud VMs are unconditionally updated when Activity Overview Global tool is selected.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/manager
Files:
8 edited

Legend:

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

    r102814 r102838  
    257257    /* Update toolbar: */
    258258    updateToolbar();
     259
     260    /* Handle current tool type change: */
     261    handleCurrentToolTypeChange(enmType);
    259262}
    260263
     
    269272    /* Update toolbar: */
    270273    updateToolbar();
     274
     275    /* Handle current tool type change: */
     276    handleCurrentToolTypeChange(enmType);
    271277}
    272278
     
    488494        case SlidingDirection_Forward:
    489495        {
     496            /* Switch stacked widget to machine tool pane: */
    490497            m_pStackedWidget->setCurrentWidget(m_pPaneToolsMachine);
    491498            m_pPaneToolsGlobal->setActive(false);
    492499            m_pPaneToolsMachine->setActive(true);
     500            /* Handle current tool type change: */
     501            handleCurrentToolTypeChange(m_pMenuToolsMachine->toolsType());
    493502            break;
    494503        }
    495504        case SlidingDirection_Reverse:
    496505        {
     506            /* Switch stacked widget to global tool pane: */
    497507            m_pStackedWidget->setCurrentWidget(m_pPaneToolsGlobal);
    498508            m_pPaneToolsMachine->setActive(false);
    499509            m_pPaneToolsGlobal->setActive(true);
     510            /* Handle current tool type change: */
     511            handleCurrentToolTypeChange(m_pMenuToolsGlobal->toolsType());
    500512            break;
    501513        }
     
    11591171        m_pPaneToolsMachine->closeTool(enmRestrictedType);
    11601172}
     1173
     1174void UIVirtualBoxManagerWidget::handleCurrentToolTypeChange(UIToolType enmType)
     1175{
     1176    /* This method's behavior depends first of all of currently selected tool class.
     1177     * But keep in mind, it is called for both Global and Machine type changes. */
     1178
     1179    /* If Global tools currently chosen: */
     1180    if (m_pStackedWidget->currentWidget() == m_pPaneToolsGlobal)
     1181    {
     1182        /* For the Global tool type changes,
     1183         * start unconditionally updating all cloud VMs,
     1184         * if Activity Overview tool currently chosen (even if VMs are not selected): */
     1185        if (UIToolStuff::isTypeOfClass(enmType, UIToolClass_Global))
     1186            m_pPaneChooser->setKeepCloudNodesUpdated(enmType == UIToolType_VMActivityOverview);
     1187    }
     1188    /* If Machine tools currently chosen: */
     1189    else
     1190    {
     1191        /* Stop unconditionally updating all cloud VMs,
     1192         * (tho they will still be updated if selected): */
     1193        m_pPaneChooser->setKeepCloudNodesUpdated(false);
     1194    }
     1195}
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerWidget.h

    r102814 r102838  
    374374        /** Updates Machine tools menu for @a pItem specified. */
    375375        void updateToolsMenuMachine(UIVirtualMachineItem *pItem);
     376
     377        /** Handles current tool @a enmType change. */
     378        void handleCurrentToolTypeChange(UIToolType enmType);
    376379    /** @} */
    377380
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualMachineItemCloud.cpp

    r102836 r102838  
    114114    , m_enmMachineState(KCloudMachineState_Invalid)
    115115    , m_enmFakeCloudItemState(enmState)
     116    , m_fUpdateRequiredByGlobalReason(false)
    116117    , m_fUpdateRequiredByLocalReason(false)
    117118    , m_pProgressTaskRefresh(0)
     
    125126    , m_enmMachineState(KCloudMachineState_Invalid)
    126127    , m_enmFakeCloudItemState(UIFakeCloudVirtualMachineItemState_NotApplicable)
     128    , m_fUpdateRequiredByGlobalReason(false)
    127129    , m_fUpdateRequiredByLocalReason(false)
    128130    , m_pProgressTaskRefresh(0)
     
    146148    m_strFakeCloudItemErrorMessage = strErrorMessage;
    147149    recache();
     150}
     151
     152void UIVirtualMachineItemCloud::setUpdateRequiredByGlobalReason(bool fRequired)
     153{
     154    m_fUpdateRequiredByGlobalReason = fRequired;
    148155}
    149156
     
    173180
    174181    /* Mark update canceled in any case: */
     182    m_fUpdateRequiredByGlobalReason = false;
    175183    m_fUpdateRequiredByLocalReason = false;
    176184
     
    392400
    393401    /* Refresh again if required: */
    394     if (m_fUpdateRequiredByLocalReason)
     402    if (   m_fUpdateRequiredByGlobalReason
     403        || m_fUpdateRequiredByLocalReason)
    395404        updateInfoAsync(true /* delayed? */);
    396405}
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualMachineItemCloud.h

    r102836 r102838  
    8484        QString fakeCloudItemErrorMessage() const { return m_strFakeCloudItemErrorMessage; }
    8585
     86        /** Defines whether update is @a fRequired by global reason. */
     87        void setUpdateRequiredByGlobalReason(bool fRequired);
    8688        /** Defines whether update is @a fRequired by local reason. */
    8789        void setUpdateRequiredByLocalReason(bool fRequired);
     
    165167        QString                             m_strFakeCloudItemErrorMessage;
    166168
     169        /** Holds whether update is required by global reason. */
     170        bool            m_fUpdateRequiredByGlobalReason;
    167171        /** Holds whether update is required by local reason. */
    168172        bool            m_fUpdateRequiredByLocalReason;
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooser.cpp

    r102111 r102838  
    5555    AssertPtrReturn(model(), false);
    5656    return model()->isGroupSavingInProgress();
     57}
     58
     59void UIChooser::setKeepCloudNodesUpdated(bool fUpdate)
     60{
     61    AssertPtrReturnVoid(model());
     62    return model()->setKeepCloudNodesUpdated(fUpdate);
    5763}
    5864
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooser.h

    r102111 r102838  
    123123    /** @name Cloud update stuff.
    124124      * @{ */
     125        /** Defines whether real cloud nodes should be kept updated. */
     126        void setKeepCloudNodesUpdated(bool fUpdate);
     127
    125128        /** Returns whether at least one cloud profile currently being updated. */
    126129        bool isCloudProfileUpdateInProgress() const;
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserAbstractModel.cpp

    r102836 r102838  
    386386    , m_pParent(pParent)
    387387    , m_pInvisibleRootNode(0)
     388    , m_fKeepCloudNodesUpdated(false)
    388389{
    389390    prepare();
     
    604605    }
    605606    return QString();
     607}
     608
     609void UIChooserAbstractModel::setKeepCloudNodesUpdated(bool fUpdate)
     610{
     611    /* Make sure something changed: */
     612    if (m_fKeepCloudNodesUpdated == fUpdate)
     613        return;
     614
     615    /* Holds the value: */
     616    m_fKeepCloudNodesUpdated = fUpdate;
     617
     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)
     640    {
     641        AssertReturnVoid(pNode && pNode->type() == UIChooserNodeType_Machine);
     642        UIChooserNodeMachine *pMachineNode = pNode->toMachineNode();
     643        AssertReturnVoid(pMachineNode);
     644        if (pMachineNode->cacheType() != UIVirtualMachineItemType_CloudReal)
     645            continue;
     646        UIVirtualMachineItemCloud *pCloudMachineItem = pMachineNode->cache()->toCloud();
     647        pCloudMachineItem->setUpdateRequiredByGlobalReason(m_fKeepCloudNodesUpdated);
     648        if (m_fKeepCloudNodesUpdated)
     649            pCloudMachineItem->updateInfoAsync(false /* delayed? */);
     650    }
    606651}
    607652
     
    16441689                                                           comMachine);
    16451690    /* Request for async node update if necessary: */
    1646     if (!comMachine.GetAccessible())
     1691    if (   m_fKeepCloudNodesUpdated
     1692        || !comMachine.GetAccessible())
    16471693    {
    16481694        AssertReturnVoid(pNode && pNode->cacheType() == UIVirtualMachineItemType_CloudReal);
    16491695        UIVirtualMachineItemCloud *pCloudMachineItem = pNode->cache()->toCloud();
     1696        pCloudMachineItem->setUpdateRequiredByGlobalReason(m_fKeepCloudNodesUpdated);
    16501697        pCloudMachineItem->updateInfoAsync(false /* delayed? */);
    16511698    }
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserAbstractModel.h

    r98103 r102838  
    143143    /** @name Cloud update stuff.
    144144      * @{ */
     145        /** Defines whether real cloud nodes should be kept updated. */
     146        void setKeepCloudNodesUpdated(bool fUpdate);
     147
    145148        /** Inserts cloud entity @a key into a set of keys currently being updated. */
    146149        void insertCloudEntityKey(const UICloudEntityKey &key);
     
    400403    /** @name Cloud update stuff.
    401404      * @{ */
     405        /** Holds whether real cloud nodes should be kept updated. */
     406        bool  m_fKeepCloudNodesUpdated;
     407
    402408        /** Holds the set of cloud entity keys currently being updated. */
    403409        QSet<UICloudEntityKey>  m_cloudEntityKeysBeingUpdated;
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