- Timestamp:
- Feb 18, 2020 4:09:49 PM (5 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/manager
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/UICloudNetworkingStuff.cpp
r83107 r83111 23 23 /* COM includes: */ 24 24 #include "CAppliance.h" 25 #include "CProgress.h" 26 #include "CStringArray.h" 25 27 #include "CVirtualBox.h" 26 28 #include "CVirtualSystemDescription.h" 27 29 30 31 QList<UICloudMachine> UICloudNetworkingStuff::listInstances(const CCloudClient &comCloudClient, 32 QWidget *pParent /* = 0 */) 33 { 34 /* Prepare VM names, ids and states. 35 * Currently we are interested in Running and Stopped VMs only. */ 36 CStringArray comNames; 37 CStringArray comIDs; 38 const QVector<KCloudMachineState> cloudMachineStates = QVector<KCloudMachineState>() 39 << KCloudMachineState_Running 40 << KCloudMachineState_Stopped; 41 42 /* Now execute ListInstances async method: */ 43 CProgress comProgress = comCloudClient.ListInstances(cloudMachineStates, comNames, comIDs); 44 if (!comCloudClient.isOk()) 45 { 46 if (pParent) 47 msgCenter().cannotAcquireCloudClientParameter(comCloudClient, pParent); 48 else 49 { 50 /// @todo fetch error info 51 } 52 } 53 else 54 { 55 /* Show "Acquire cloud instances" progress: */ 56 if (pParent) 57 msgCenter().showModalProgressDialog(comProgress, 58 UICommon::tr("Acquire cloud instances ..."), 59 ":/progress_reading_appliance_90px.png", pParent, 0); 60 else 61 comProgress.WaitForCompletion(-1); 62 if (!comProgress.isOk() || comProgress.GetResultCode() != 0) 63 { 64 if (pParent) 65 msgCenter().cannotAcquireCloudClientParameter(comProgress, pParent); 66 else 67 { 68 /// @todo fetch error info 69 } 70 } 71 else 72 { 73 /* Fetch acquired objects to lists: */ 74 const QVector<QString> instanceIds = comIDs.GetValues(); 75 const QVector<QString> instanceNames = comNames.GetValues(); 76 QList<UICloudMachine> resultList; 77 for (int i = 0; i < instanceIds.size(); ++i) 78 resultList << UICloudMachine(comCloudClient, instanceIds.at(i), instanceNames.at(i)); 79 return resultList; 80 } 81 } 82 83 /* Return empty list by default: */ 84 return QList<UICloudMachine>(); 85 } 28 86 29 87 QString UICloudNetworkingStuff::getInstanceInfo(KVirtualSystemDescriptionType enmType, … … 81 139 /* Show "Acquire instance info" progress: */ 82 140 if (pParent) 83 msgCenter().showModalProgressDialog(comProgress, UICommon::tr("Acquire instance info ..."), 141 msgCenter().showModalProgressDialog(comProgress, 142 UICommon::tr("Acquire cloud instance info ..."), 84 143 ":/progress_reading_appliance_90px.png", pParent, 0); 85 144 else -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UICloudNetworkingStuff.h
r83107 r83111 22 22 #endif 23 23 24 /* GUI includes: */ 25 #include "UICloudMachine.h" 26 24 27 /* COM includes: */ 25 28 #include "COMEnums.h" 26 29 #include "CCloudClient.h" 27 30 28 /* Forward declarations: */29 class QString;30 class QWidget;31 32 31 /** Cloud networking stuff namespace. */ 33 32 namespace UICloudNetworkingStuff 34 33 { 34 /** Acquires instance list. 35 * @param comCloudClient Brings cloud client object. 36 * @param pWidget Brings parent widget to show messages according to, 37 * if no parent set, progress will be executed in blocking way. */ 38 QList<UICloudMachine> listInstances(const CCloudClient &comCloudClient, 39 QWidget *pParent = 0); 40 35 41 /** Acquires instance info of certain @a enmType. 36 42 * @param comCloudClient Brings cloud client object. 37 43 * @param strId Brings cloud VM id. 38 * @param pWidget Brings parent widget to show messages according to. */ 44 * @param pWidget Brings parent widget to show messages according to, 45 * if no parent set, progress will be executed in blocking way. */ 39 46 QString getInstanceInfo(KVirtualSystemDescriptionType enmType, 40 47 const CCloudClient &comCloudClient, -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UITaskCloudAcquireInstances.cpp
r83099 r83111 17 17 18 18 /* GUI includes: */ 19 #include "UICloudNetworkingStuff.h" 19 20 #include "UITaskCloudAcquireInstances.h" 20 21 /* COM includes: */22 #include "CProgress.h"23 #include "CStringArray.h"24 21 25 22 … … 50 47 { 51 48 m_mutex.lock(); 52 53 /* Gather VM names, ids and states. 54 * Currently we are interested in Running and Stopped VMs only. */ 55 CStringArray comNames; 56 CStringArray comIDs; 57 const QVector<KCloudMachineState> cloudMachineStates = QVector<KCloudMachineState>() 58 << KCloudMachineState_Running 59 << KCloudMachineState_Stopped; 60 61 /* Ask for cloud instance list: */ 62 CProgress comProgress = m_comCloudClient.ListInstances(cloudMachineStates, comNames, comIDs); 63 if (!m_comCloudClient.isOk()) 64 { 65 /// @todo pack error info to m_comErrorInfo 66 } 67 else 68 { 69 /* Wait for "Acquire cloud instances" progress: */ 70 comProgress.WaitForCompletion(-1); 71 if (!comProgress.isOk() || comProgress.GetResultCode() != 0) 72 { 73 /// @todo pack error info to m_comErrorInfo 74 } 75 else 76 { 77 /* Fetch acquired objects to lists: */ 78 const QVector<QString> instanceIds = comIDs.GetValues(); 79 const QVector<QString> instanceNames = comNames.GetValues(); 80 for (int i = 0; i < instanceIds.size(); ++i) 81 m_result << UICloudMachine(m_comCloudClient, instanceIds.at(i), instanceNames.at(i)); 82 } 83 } 84 49 m_result = listInstances(m_comCloudClient); 85 50 m_mutex.unlock(); 86 51 } -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UITaskCloudAcquireInstances.h
r83099 r83111 44 44 public: 45 45 46 /** Constructs update task taking @a comCloudClient and @a pParentNode as data. */ 46 /** Constructs update task taking @a comCloudClient and @a pParentNode as data. 47 * @param comCloudClient Brings the cloud client object. 48 * @param m_pParentNode Brings the parent node reference. */ 47 49 UITaskCloudAcquireInstances(const CCloudClient &comCloudClient, UIChooserNode *pParentNode); 48 50
Note:
See TracChangeset
for help on using the changeset viewer.