Changeset 83676 in vbox
- Timestamp:
- Apr 10, 2020 5:50:30 PM (5 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.cpp
r83674 r83676 938 938 /* Execute wizard: */ 939 939 pWizard->exec(); 940 941 // WORKAROUND: 942 // Hehey! Now we have to inject created VM nodes and then rebuild tree for the main root node ourselves 943 // cause there is no corresponding event yet. Later this to be done in corresponding event handler instead. 944 foreach (const CCloudMachine &comMachine, pWizard->machines()) 945 { 946 // Create new node: 947 UIChooserNodeMachine *pNode = new UIChooserNodeMachine(pGroup->node(), 948 false /* favorite */, 949 pGroup->node()->nodes().size() /* position */, 950 comMachine); 951 // Request async node update: 952 pNode->cache()->toCloud()->updateInfoAsync(false /* delayed? */); 953 } 954 // Remember first selected item definition: 955 const QString strDefinition = firstSelectedItem()->definition(); 956 // Rebuild tree for main root: 957 buildTreeForMainRoot(); 958 updateNavigationItemList(); 959 updateLayout(); 960 // Restore selection: 961 setSelectedItem(strDefinition); 962 940 963 delete pWizard; 941 964 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/addcloudvm/UIWizardAddCloudVM.cpp
r83670 r83676 23 23 24 24 /* COM includes: */ 25 #include "CCloudMachine.h"26 25 #include "CProgress.h" 27 26 … … 69 68 bool UIWizardAddCloudVM::addCloudVMs() 70 69 { 71 /* Acquire prepared client and description: */ 70 /* Prepare result: */ 71 bool fResult = false; 72 73 /* Acquire prepared client: */ 72 74 CCloudClient comClient = client(); 73 AssertReturn(comClient.isNotNull(), f alse);75 AssertReturn(comClient.isNotNull(), fResult); 74 76 75 77 /* For each cloud instance name we have: */ 76 78 foreach (const QString &strInstanceName, field("instanceIds").toStringList()) 77 79 { 80 /* Initiate cloud VM add procedure: */ 78 81 CCloudMachine comMachine; 79 80 /* Initiate cloud VM add procedure: */81 82 CProgress comProgress = comClient.AddCloudMachine(strInstanceName, comMachine); 82 RT_NOREF(comMachine);83 /* Check for immediate errors: */ 83 84 if (!comClient.isOk()) 84 85 { 85 86 msgCenter().cannotCreateCloudMachine(comClient, this); 86 return false;87 break; 87 88 } 88 89 /* Show "Add cloud machine" progress: */ 90 msgCenter().showModalProgressDialog(comProgress, tr("Add cloud machine ..."), 91 ":/progress_new_cloud_vm_90px.png", this, 0); 92 if (comProgress.GetCanceled()) 93 return false; 94 if (!comProgress.isOk() || comProgress.GetResultCode() != 0) 89 else 95 90 { 96 msgCenter().cannotCreateCloudMachine(comProgress, this); 97 return false; 91 /* Show "Add cloud machine" progress: */ 92 msgCenter().showModalProgressDialog(comProgress, tr("Add cloud machine ..."), 93 ":/progress_new_cloud_vm_90px.png", this, 0); 94 /* Check for canceled progress: */ 95 if (comProgress.GetCanceled()) 96 break; 97 else 98 { 99 /* Check for progress errors: */ 100 if (!comProgress.isOk() || comProgress.GetResultCode() != 0) 101 { 102 msgCenter().cannotCreateCloudMachine(comProgress, this); 103 break; 104 } 105 else 106 { 107 /* Check whether VM really added: */ 108 if (comMachine.isNotNull()) 109 { 110 m_machines << comMachine; 111 fResult = true; 112 } 113 } 114 } 98 115 } 99 116 } 100 117 101 /* Success by default: */102 return true;118 /* Return result: */ 119 return fResult; 103 120 } 104 121 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/addcloudvm/UIWizardAddCloudVM.h
r83653 r83676 28 28 #include "COMEnums.h" 29 29 #include "CCloudClient.h" 30 #include "CCloudMachine.h" 30 31 31 32 /** Add Cloud VM wizard. */ … … 57 58 virtual void prepare() /* override */; 58 59 59 /** Defines Cloud @a comClient object . */60 /** Defines Cloud @a comClient object wrapper. */ 60 61 void setClient(const CCloudClient &comClient) { m_comClient = comClient; } 61 /** Returns Cloud Client object . */62 /** Returns Cloud Client object wrapper. */ 62 63 CCloudClient client() const { return m_comClient; } 64 65 /** Returns Cloud Machine object wrapper list. */ 66 QList<CCloudMachine> machines() const { return m_machines; } 63 67 64 68 /** Adds cloud VMs. */ … … 74 78 /** Holds the Cloud Client object wrapper. */ 75 79 CCloudClient m_comClient; 80 81 /** Holds the Cloud Machine object wrapper list. */ 82 QList<CCloudMachine> m_machines; 76 83 }; 77 84
Note:
See TracChangeset
for help on using the changeset viewer.