VirtualBox

Changeset 83163 in vbox


Ignore:
Timestamp:
Feb 26, 2020 2:56:44 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
136284
Message:

FE/Qt: bugref:9653: VirtualBox Manager: Update UIVirtualMachineItemCloud on the basis on internal UICloudMachine wrapper, not ourselves as before; Besides that, update selected tool contents on state-change signals received after that.

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

Legend:

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

    r83129 r83163  
    1717
    1818/* GUI includes: */
    19 #include "UICloudNetworkingStuff.h"
    2019#include "UITaskCloudGetInstanceInfo.h"
    2120
    2221
    23 UITaskCloudGetInstanceInfo::UITaskCloudGetInstanceInfo(const CCloudClient &comCloudClient, const QString &strId)
     22UITaskCloudGetInstanceInfo::UITaskCloudGetInstanceInfo(const UICloudMachine &guiCloudMachine)
    2423    : UITask(Type_CloudGetInstanceState)
    25     , m_comCloudClient(comCloudClient)
    26     , m_strId(strId)
     24    , m_guiCloudMachine(guiCloudMachine)
    2725{
    28 }
    29 
    30 QMap<KVirtualSystemDescriptionType, QString> UITaskCloudGetInstanceInfo::result() const
    31 {
    32     m_mutex.lock();
    33     const QMap<KVirtualSystemDescriptionType, QString> resultMap = m_resultMap;
    34     m_mutex.unlock();
    35     return resultMap;
    3626}
    3727
     
    4737{
    4838    m_mutex.lock();
    49     m_resultMap = getInstanceInfo(m_comCloudClient, m_strId);
     39    m_guiCloudMachine.refresh();
    5040    m_mutex.unlock();
    5141}
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UITaskCloudGetInstanceInfo.h

    r83129 r83163  
    2727
    2828/* GUI includes: */
     29#include "UICloudMachine.h"
    2930#include "UITask.h"
    3031
    3132/* COM includes: */
    32 #include "COMEnums.h"
    33 #include "CCloudClient.h"
    3433#include "CVirtualBoxErrorInfo.h"
    3534
     
    4241public:
    4342
    44     /** Constructs task taking @a comCloudClient and @a strId as data.
    45       * @param  comCloudClient  Brings the cloud client object.
    46       * @param  strId           Brings the cloud VM id. */
    47     UITaskCloudGetInstanceInfo(const CCloudClient &comCloudClient, const QString &strId);
     43    /** Constructs task taking @a guiCloudMachine as data.
     44      * @param  guiCloudMachine  Brings the cloud VM wrapper. */
     45    UITaskCloudGetInstanceInfo(const UICloudMachine &guiCloudMachine);
    4846
    4947    /** Returns error info. */
    5048    CVirtualBoxErrorInfo errorInfo();
    51 
    52     /** Returns the task result. */
    53     QMap<KVirtualSystemDescriptionType, QString> result() const;
    5449
    5550protected:
     
    6055private:
    6156
    62     /** Holds the mutex to access result. */
     57    /** Holds the mutex to access m_guiCloudMachine member. */
    6358    mutable QMutex  m_mutex;
    6459
    6560    /** Holds the cloud client object. */
    66     CCloudClient  m_comCloudClient;
    67     /** Holds the cloud VM id. */
    68     QString       m_strId;
     61    UICloudMachine  m_guiCloudMachine;
    6962
    7063    /** Holds the error info object. */
    7164    CVirtualBoxErrorInfo  m_comErrorInfo;
    72 
    73     /** Holds the task result. */
    74     QMap<KVirtualSystemDescriptionType, QString>  m_resultMap;
    7565};
    7666
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerWidget.cpp

    r83129 r83163  
    286286void UIVirtualBoxManagerWidget::sltHandleCloudMachineStateChange(const QString &strId)
    287287{
     288    /* If that is machine or group item selected: */
     289    if (isMachineItemSelected() || isGroupItemSelected())
     290    {
     291        /* Recache current item info: */
     292        recacheCurrentItemInformation();
     293    }
     294
    288295    /* Acquire current item: */
    289296    UIVirtualMachineItem *pItem = currentItem();
    290297
    291     /* repeat the task only if we are still on the same item: */
     298    /* Repeat the task only if we are still on the same item: */
    292299    if (pItem && pItem->id() == strId)
    293300        pItem->toCloud()->updateInfoAsync(true /* delayed? */);
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualMachineItemCloud.cpp

    r83158 r83163  
    5454}
    5555
    56 void UIVirtualMachineItemCloud::updateInfo(QWidget *pParent)
    57 {
    58     /* Make sure item is of real cloud type and is initialized: */
    59     AssertReturnVoid(itemType() == ItemType_CloudReal);
    60 
    61     /* Acquire info: */
    62     const QMap<KVirtualSystemDescriptionType, QString> infoMap = getInstanceInfo(m_guiCloudMachine.client(),
    63                                                                                  m_strId,
    64                                                                                  pParent);
    65 
    66     /* Update info: */
    67     updateInfo(infoMap);
    68 }
    69 
    7056void UIVirtualMachineItemCloud::updateInfoAsync(bool fDelayed)
    7157{
     
    116102{
    117103    /* Determine attributes which are always available: */
    118     if (itemType() == ItemType_CloudReal)
     104    if (!m_guiCloudMachine.isNull())
    119105    {
    120106        m_strId = m_guiCloudMachine.id();
     
    130116
    131117        /* Determine own VM attributes: */
    132         if (   itemType() == ItemType_CloudFake
    133             || m_strOSTypeId.isNull())
    134             m_strOSTypeId = "Other";
     118        m_strOSTypeId = !m_guiCloudMachine.isNull()
     119                      ? m_guiCloudMachine.osType()
     120                      : "Other";
    135121
    136122        /* Determine VM states: */
    137         if (   itemType() == ItemType_CloudFake
    138             || m_enmMachineState == KMachineState_Null)
    139             m_enmMachineState = KMachineState_PoweredOff;
     123        m_enmMachineState = !m_guiCloudMachine.isNull()
     124                          ? m_guiCloudMachine.machineState()
     125                          : KMachineState_PoweredOff;
    140126        m_strMachineStateName = gpConverter->toString(m_enmMachineState);
    141127        if (itemType() == ItemType_CloudFake)
     
    300286    if (!m_pTask)
    301287    {
    302         m_pTask = new UITaskCloudGetInstanceInfo(m_guiCloudMachine.client(), m_strId);
     288        m_pTask = new UITaskCloudGetInstanceInfo(m_guiCloudMachine);
    303289        connect(m_pTask, &UITask::sigComplete,
    304290                this, &UIVirtualMachineItemCloud::sltHandleGetCloudInstanceInfoDone);
     
    316302    m_pTask = 0;
    317303
    318     /* Cast task to corresponding sub-class: */
    319     UITaskCloudGetInstanceInfo *pInfoTask = static_cast<UITaskCloudGetInstanceInfo*>(pTask);
    320 
    321     /* Update info: */
    322     updateInfo(pInfoTask->result());
    323 }
    324 
    325 void UIVirtualMachineItemCloud::updateInfo(const QMap<KVirtualSystemDescriptionType, QString> &infoMap)
    326 {
    327     /* Update info: */
    328     m_strOSTypeId = fetchOsType(infoMap);
    329     m_enmMachineState = fetchMachineState(infoMap);
    330 
    331304    /* Recache: */
    332305    recache();
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualMachineItemCloud.h

    r83158 r83163  
    6969        FakeCloudItemState fakeCloudItemState() const { return m_enmFakeCloudItemState; }
    7070
    71         /** Updates cloud VM info.
    72           * @param  pWidget  Brings parent widget to show messages according to. */
    73         void updateInfo(QWidget *pParent);
    74 
    7571        /** Updates cloud VM info async way, @a fDelayed if requested or instant otherwise. */
    7672        void updateInfoAsync(bool fDelayed);
     
    133129private:
    134130
    135     /** @name Data attributes.
    136       * @{ */
    137         /** Updates cloud VM info on the basis of @a infoMap value. */
    138         void updateInfo(const QMap<KVirtualSystemDescriptionType, QString> &infoMap);
    139     /** @} */
    140 
    141131    /** @name Arguments.
    142132      * @{ */
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