Changeset 90321 in vbox
- Timestamp:
- Jul 23, 2021 6:03:23 PM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 145882
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.cpp
r90302 r90321 142 142 emit sigCloudMachineAdded(m_strShortProviderName, m_strProfileName, m_comMachine); 143 143 } 144 145 146 /********************************************************************************************************************************* 147 * Class UINotificationProgressCloudMachineCreate implementation. * 148 *********************************************************************************************************************************/ 149 150 UINotificationProgressCloudMachineCreate::UINotificationProgressCloudMachineCreate(const CCloudClient &comClient, 151 const CCloudMachine &comMachine, 152 const CVirtualSystemDescription &comVSD, 153 const QString &strShortProviderName, 154 const QString &strProfileName) 155 : m_comClient(comClient) 156 , m_comMachine(comMachine) 157 , m_comVSD(comVSD) 158 , m_strShortProviderName(strShortProviderName) 159 , m_strProfileName(strProfileName) 160 { 161 /* Parse cloud VM name: */ 162 QVector<KVirtualSystemDescriptionType> types; 163 QVector<QString> refs, origValues, configValues, extraConfigValues; 164 m_comVSD.GetDescriptionByType(KVirtualSystemDescriptionType_Name, types, 165 refs, origValues, configValues, extraConfigValues); 166 if (!origValues.isEmpty()) 167 m_strName = origValues.first(); 168 169 /* Listen for last progress signal: */ 170 connect(this, &UINotificationProgress::sigProgressFinished, 171 this, &UINotificationProgressCloudMachineCreate::sltHandleProgressFinished); 172 } 173 174 QString UINotificationProgressCloudMachineCreate::name() const 175 { 176 return UINotificationProgress::tr("Creating cloud VM ..."); 177 } 178 179 QString UINotificationProgressCloudMachineCreate::details() const 180 { 181 return UINotificationProgress::tr("<b>Provider:</b> %1<br><b>Profile:</b> %2<br><b>Name:</b> %3") 182 .arg(m_strShortProviderName, m_strProfileName, m_strName); 183 } 184 185 CProgress UINotificationProgressCloudMachineCreate::createProgress(COMResult &comResult) 186 { 187 /* Initialize progress-wrapper: */ 188 CProgress comProgress = m_comClient.CreateCloudMachine(m_comVSD, m_comMachine); 189 /* Store COM result: */ 190 comResult = m_comClient; 191 /* Return progress-wrapper: */ 192 return comProgress; 193 } 194 195 void UINotificationProgressCloudMachineCreate::sltHandleProgressFinished() 196 { 197 if (m_comMachine.isNotNull() && !m_comMachine.GetId().isNull()) 198 emit sigCloudMachineCreated(m_strShortProviderName, m_strProfileName, m_comMachine); 199 } -
trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.h
r90302 r90321 30 30 #include "CCloudMachine.h" 31 31 #include "CMedium.h" 32 #include "CVirtualSystemDescription.h" 32 33 33 34 /** UINotificationProgress extension for medium move functionality. */ … … 165 166 }; 166 167 168 /** UINotificationProgress extension for cloud machine create functionality. */ 169 class SHARED_LIBRARY_STUFF UINotificationProgressCloudMachineCreate : public UINotificationProgress 170 { 171 Q_OBJECT; 172 173 signals: 174 175 /** Notifies listeners about cloud @a comMachine was created. 176 * @param strShortProviderName Brigns the short provider name. 177 * @param strProfileName Brings the profile name. */ 178 void sigCloudMachineCreated(const QString &strShortProviderName, 179 const QString &strProfileName, 180 const CCloudMachine &comMachine); 181 182 public: 183 184 /** Constructs cloud machine create notification-progress. 185 * @param comClient Brings the cloud client being adding machine. 186 * @param comMachine Brings the cloud machine being added. 187 * @param comVSD Brings the virtual system description. 188 * @param strShortProviderName Brings the short provider name. 189 * @param strProfileName Brings the profile name. */ 190 UINotificationProgressCloudMachineCreate(const CCloudClient &comClient, 191 const CCloudMachine &comMachine, 192 const CVirtualSystemDescription &comVSD, 193 const QString &strShortProviderName, 194 const QString &strProfileName); 195 196 protected: 197 198 /** Returns object name. */ 199 virtual QString name() const /* override final */; 200 /** Returns object details. */ 201 virtual QString details() const /* override final */; 202 /** Creates and returns started progress-wrapper. */ 203 virtual CProgress createProgress(COMResult &comResult) /* override final */; 204 205 private slots: 206 207 /** Handles signal about progress being finished. */ 208 void sltHandleProgressFinished(); 209 210 private: 211 212 /** Holds the cloud client being adding machine. */ 213 CCloudClient m_comClient; 214 /** Holds the cloud machine being added. */ 215 CCloudMachine m_comMachine; 216 /** Holds the the virtual system description. */ 217 CVirtualSystemDescription m_comVSD; 218 /** Holds the name acquired from VSD. */ 219 QString m_strName; 220 /** Holds the short provider name. */ 221 QString m_strShortProviderName; 222 /** Holds the profile name. */ 223 QString m_strProfileName; 224 }; 225 167 226 #endif /* !FEQT_INCLUDED_SRC_notificationcenter_UINotificationObjects_h */ -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newcloudvm/UIWizardNewCloudVM.cpp
r89996 r90321 22 22 #include "UICommon.h" 23 23 #include "UIMessageCenter.h" 24 #include "UINotificationCenter.h" 24 25 #include "UIWizardNewCloudVM.h" 25 26 #include "UIWizardNewCloudVMPageBasic1.h" … … 118 119 /* Initiate cloud VM creation procedure: */ 119 120 CCloudMachine comMachine; 120 CProgress comProgress = comClient.CreateCloudMachine(comVSD, comMachine);121 /* Check for immediate errors: */122 if (!comClient.isOk())123 msgCenter().cannotCreateCloudMachine(comClient, this);124 else125 {126 /* Show "Create Cloud Machine" progress: */127 msgCenter().showModalProgressDialog(comProgress, QString(),128 ":/progress_new_cloud_vm_90px.png", this, 0);129 /* Check for canceled progress: */130 if (!comProgress.GetCanceled())131 {132 /* Check for progress errors: */133 if (!comProgress.isOk() || comProgress.GetResultCode() != 0)134 msgCenter().cannotCreateCloudMachine(comProgress, this);135 else136 {137 /* Check whether VM really added: */138 if (comMachine.isNotNull())139 {140 /* Notify GUI about VM was added: */141 uiCommon().notifyCloudMachineRegistered(shortProviderName(),142 profileName(),143 comMachine);144 121 145 /* Finally, success: */ 146 fResult = true; 147 } 148 } 149 } 150 } 122 /* Create cloud VM: */ 123 UINotificationProgressCloudMachineCreate *pNotification = new UINotificationProgressCloudMachineCreate(comClient, 124 comMachine, 125 comVSD, 126 shortProviderName(), 127 profileName()); 128 connect(pNotification, &UINotificationProgressCloudMachineCreate::sigCloudMachineCreated, 129 &uiCommon(), &UICommon::sltHandleCloudMachineAdded); 130 notificationCenter().append(pNotification); 131 132 /* Positive: */ 133 fResult = true; 151 134 152 135 /* Return result: */
Note:
See TracChangeset
for help on using the changeset viewer.