VirtualBox

Changeset 103138 in vbox


Ignore:
Timestamp:
Jan 31, 2024 10:36:12 AM (12 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10501. Updating cloud vm state correctly.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/activity/overview
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/activity/overview/UIVMActivityOverviewWidget.cpp

    r103129 r103138  
    247247    virtual bool isCloudVM() const = 0;
    248248    virtual void updateColumnData() = 0;
     249    virtual void setMachineState(int iState) = 0;
    249250
    250251    QString columnData(int iColumnIndex) const;
     
    302303    virtual void updateColumnData() override;
    303304    virtual QString machineStateString() const override;
    304     void setMachineState(KMachineState enmState);
     305    virtual void setMachineState(int iState) override;
    305306
    306307protected:
     
    332333    UIActivityOverviewItemCloud();
    333334    ~UIActivityOverviewItemCloud();
     335    void updateMachineState();
    334336    virtual bool isRunning() const override;
    335337    virtual bool isCloudVM() const override;
    336338    virtual void updateColumnData() override;
    337339    virtual QString machineStateString() const override;
     340    virtual void setMachineState(int iState) override;
    338341
    339342protected:
     
    348351    QTimer *m_pTimer;
    349352    CCloudMachine m_comCloudMachine;
     353    KCloudMachineState m_enmMachineState;
    350354};
    351355
     
    950954    , m_comCloudMachine(comCloudMachine)
    951955{
     956    m_enmMachineState = comCloudMachine.GetState();
    952957    m_pTimer = new QTimer(this);
    953958    if (m_pTimer)
     
    968973}
    969974
     975void UIActivityOverviewItemCloud::updateMachineState()
     976{
     977    if (m_comCloudMachine.isOk())
     978        setMachineState(m_comCloudMachine.GetState());
     979}
     980
    970981bool UIActivityOverviewItemCloud::isRunning() const
    971982{
    972     if (!m_comCloudMachine.isOk())
    973         return false;
    974     return m_comCloudMachine.GetState() == KCloudMachineState_Running;
     983    return m_enmMachineState == KCloudMachineState_Running;
    975984}
    976985
     
    10021011void UIActivityOverviewItemCloud::sltTimeout()
    10031012{
     1013}
     1014
     1015void UIActivityOverviewItemCloud::setMachineState(int iState)
     1016{
     1017    if (iState <= KCloudMachineState_Invalid || iState >= KCloudMachineState_Max)
     1018        return;
     1019    KCloudMachineState enmState = static_cast<KCloudMachineState>(iState);
     1020    if (m_enmMachineState == enmState)
     1021        return;
     1022    m_enmMachineState = enmState;
    10041023}
    10051024
     
    10621081}
    10631082
    1064 void UIActivityOverviewItemLocal::setMachineState(KMachineState enmState)
    1065 {
     1083void UIActivityOverviewItemLocal::setMachineState(int iState)
     1084{
     1085    if (iState <= KMachineState_Null || iState >= KMachineState_Max)
     1086        return;
     1087    KMachineState enmState = static_cast<KMachineState>(iState);
     1088    if (m_enmMachineState == enmState)
     1089        return;
    10661090    m_enmMachineState = enmState;
    10671091    if (m_enmMachineState == KMachineState_Running)
    10681092        resetDebugger();
    10691093}
    1070 
    10711094
    10721095void UIActivityOverviewItemLocal::updateMetricData()
     
    13691392        if (!fFound)
    13701393            m_itemList.append(new UIActivityOverviewItemCloud(this, id, comMachine.GetName(), comMachine));
     1394    }
     1395
     1396    /* Update cloud machine states: */
     1397    for (int i = 0; i < m_itemList.size(); ++i)
     1398    {
     1399        if (!m_itemList[i] || !m_itemList[i]->isCloudVM())
     1400            continue;
     1401        UIActivityOverviewItemCloud *pItem = qobject_cast<UIActivityOverviewItemCloud*>(m_itemList[i]);
     1402        if (!pItem)
     1403            continue;
     1404        pItem->updateMachineState();
    13711405    }
    13721406}
  • trunk/src/VBox/Frontends/VirtualBox/src/activity/overview/UIVMActivityOverviewWidget.h

    r103019 r103138  
    7474    bool isCurrentTool() const;
    7575    void setIsCurrentTool(bool fIsCurrentTool);
    76 
    7776    void setCloudMachineItems(const QList<UIVirtualMachineItemCloud*> &cloudItems);
    7877
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