Changeset 83163 in vbox
- Timestamp:
- Feb 26, 2020 2:56:44 PM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 136284
- 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 17 17 18 18 /* GUI includes: */ 19 #include "UICloudNetworkingStuff.h"20 19 #include "UITaskCloudGetInstanceInfo.h" 21 20 22 21 23 UITaskCloudGetInstanceInfo::UITaskCloudGetInstanceInfo(const CCloudClient &comCloudClient, const QString &strId)22 UITaskCloudGetInstanceInfo::UITaskCloudGetInstanceInfo(const UICloudMachine &guiCloudMachine) 24 23 : UITask(Type_CloudGetInstanceState) 25 , m_comCloudClient(comCloudClient) 26 , m_strId(strId) 24 , m_guiCloudMachine(guiCloudMachine) 27 25 { 28 }29 30 QMap<KVirtualSystemDescriptionType, QString> UITaskCloudGetInstanceInfo::result() const31 {32 m_mutex.lock();33 const QMap<KVirtualSystemDescriptionType, QString> resultMap = m_resultMap;34 m_mutex.unlock();35 return resultMap;36 26 } 37 27 … … 47 37 { 48 38 m_mutex.lock(); 49 m_ resultMap = getInstanceInfo(m_comCloudClient, m_strId);39 m_guiCloudMachine.refresh(); 50 40 m_mutex.unlock(); 51 41 } -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UITaskCloudGetInstanceInfo.h
r83129 r83163 27 27 28 28 /* GUI includes: */ 29 #include "UICloudMachine.h" 29 30 #include "UITask.h" 30 31 31 32 /* COM includes: */ 32 #include "COMEnums.h"33 #include "CCloudClient.h"34 33 #include "CVirtualBoxErrorInfo.h" 35 34 … … 42 41 public: 43 42 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); 48 46 49 47 /** Returns error info. */ 50 48 CVirtualBoxErrorInfo errorInfo(); 51 52 /** Returns the task result. */53 QMap<KVirtualSystemDescriptionType, QString> result() const;54 49 55 50 protected: … … 60 55 private: 61 56 62 /** Holds the mutex to access result. */57 /** Holds the mutex to access m_guiCloudMachine member. */ 63 58 mutable QMutex m_mutex; 64 59 65 60 /** Holds the cloud client object. */ 66 CCloudClient m_comCloudClient; 67 /** Holds the cloud VM id. */ 68 QString m_strId; 61 UICloudMachine m_guiCloudMachine; 69 62 70 63 /** Holds the error info object. */ 71 64 CVirtualBoxErrorInfo m_comErrorInfo; 72 73 /** Holds the task result. */74 QMap<KVirtualSystemDescriptionType, QString> m_resultMap;75 65 }; 76 66 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerWidget.cpp
r83129 r83163 286 286 void UIVirtualBoxManagerWidget::sltHandleCloudMachineStateChange(const QString &strId) 287 287 { 288 /* If that is machine or group item selected: */ 289 if (isMachineItemSelected() || isGroupItemSelected()) 290 { 291 /* Recache current item info: */ 292 recacheCurrentItemInformation(); 293 } 294 288 295 /* Acquire current item: */ 289 296 UIVirtualMachineItem *pItem = currentItem(); 290 297 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: */ 292 299 if (pItem && pItem->id() == strId) 293 300 pItem->toCloud()->updateInfoAsync(true /* delayed? */); -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualMachineItemCloud.cpp
r83158 r83163 54 54 } 55 55 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 70 56 void UIVirtualMachineItemCloud::updateInfoAsync(bool fDelayed) 71 57 { … … 116 102 { 117 103 /* Determine attributes which are always available: */ 118 if ( itemType() == ItemType_CloudReal)104 if (!m_guiCloudMachine.isNull()) 119 105 { 120 106 m_strId = m_guiCloudMachine.id(); … … 130 116 131 117 /* Determine own VM attributes: */ 132 if ( itemType() == ItemType_CloudFake133 || m_strOSTypeId.isNull())134 m_strOSTypeId ="Other";118 m_strOSTypeId = !m_guiCloudMachine.isNull() 119 ? m_guiCloudMachine.osType() 120 : "Other"; 135 121 136 122 /* Determine VM states: */ 137 if ( itemType() == ItemType_CloudFake138 || m_enmMachineState == KMachineState_Null)139 m_enmMachineState =KMachineState_PoweredOff;123 m_enmMachineState = !m_guiCloudMachine.isNull() 124 ? m_guiCloudMachine.machineState() 125 : KMachineState_PoweredOff; 140 126 m_strMachineStateName = gpConverter->toString(m_enmMachineState); 141 127 if (itemType() == ItemType_CloudFake) … … 300 286 if (!m_pTask) 301 287 { 302 m_pTask = new UITaskCloudGetInstanceInfo(m_guiCloudMachine .client(), m_strId);288 m_pTask = new UITaskCloudGetInstanceInfo(m_guiCloudMachine); 303 289 connect(m_pTask, &UITask::sigComplete, 304 290 this, &UIVirtualMachineItemCloud::sltHandleGetCloudInstanceInfoDone); … … 316 302 m_pTask = 0; 317 303 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 331 304 /* Recache: */ 332 305 recache(); -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualMachineItemCloud.h
r83158 r83163 69 69 FakeCloudItemState fakeCloudItemState() const { return m_enmFakeCloudItemState; } 70 70 71 /** Updates cloud VM info.72 * @param pWidget Brings parent widget to show messages according to. */73 void updateInfo(QWidget *pParent);74 75 71 /** Updates cloud VM info async way, @a fDelayed if requested or instant otherwise. */ 76 72 void updateInfoAsync(bool fDelayed); … … 133 129 private: 134 130 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 141 131 /** @name Arguments. 142 132 * @{ */
Note:
See TracChangeset
for help on using the changeset viewer.