- Timestamp:
- Jul 23, 2021 1:08:11 PM (4 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.cpp
r90301 r90302 4155 4155 } 4156 4156 4157 void UICommon::sltHandleCloudMachineAdded(const QString &strShortProviderName, 4158 const QString &strProfileName, 4159 const CCloudMachine &comMachine) 4160 { 4161 /* Make sure we cached added cloud VM in GUI: */ 4162 notifyCloudMachineRegistered(strShortProviderName, 4163 strProfileName, 4164 comMachine); 4165 } 4166 4157 4167 bool UICommon::eventFilter(QObject *pObject, QEvent *pEvent) 4158 4168 { -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.h
r90301 r90302 735 735 /** @} */ 736 736 737 /** @name Cloud Machine related stuff. 738 * @{ */ 739 /** Handles signal about cloud machine was added. */ 740 void sltHandleCloudMachineAdded(const QString &strShortProviderName, 741 const QString &strProfileName, 742 const CCloudMachine &comMachine); 743 /** @} */ 744 737 745 protected: 738 746 -
trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.cpp
r90301 r90302 40 40 QString UINotificationProgressMediumMove::details() const 41 41 { 42 return UINotificationProgress::tr("<b>From </b>: %1<br><b>To</b>:%2").arg(m_strFrom, m_strTo);42 return UINotificationProgress::tr("<b>From:</b> %1<br><b>To:</b> %2").arg(m_strFrom, m_strTo); 43 43 } 44 44 … … 76 76 QString UINotificationProgressMediumCopy::details() const 77 77 { 78 return UINotificationProgress::tr("<b>From </b>: %1<br><b>To</b>:%2")78 return UINotificationProgress::tr("<b>From:</b> %1<br><b>To:</b> %2") 79 79 .arg(m_comSource.GetLocation(), m_comTarget.GetLocation()); 80 80 } … … 95 95 emit sigMediumCopied(m_comTarget); 96 96 } 97 98 99 /********************************************************************************************************************************* 100 * Class UINotificationProgressCloudMachineAdd implementation. * 101 *********************************************************************************************************************************/ 102 103 UINotificationProgressCloudMachineAdd::UINotificationProgressCloudMachineAdd(const CCloudClient &comClient, 104 const CCloudMachine &comMachine, 105 const QString &strInstanceName, 106 const QString &strShortProviderName, 107 const QString &strProfileName) 108 : m_comClient(comClient) 109 , m_comMachine(comMachine) 110 , m_strInstanceName(strInstanceName) 111 , m_strShortProviderName(strShortProviderName) 112 , m_strProfileName(strProfileName) 113 { 114 connect(this, &UINotificationProgress::sigProgressFinished, 115 this, &UINotificationProgressCloudMachineAdd::sltHandleProgressFinished); 116 } 117 118 QString UINotificationProgressCloudMachineAdd::name() const 119 { 120 return UINotificationProgress::tr("Adding cloud VM ..."); 121 } 122 123 QString UINotificationProgressCloudMachineAdd::details() const 124 { 125 return UINotificationProgress::tr("<b>Provider:</b> %1<br><b>Profile:</b> %2<br><b>Instance Name:</b> %3") 126 .arg(m_strShortProviderName, m_strProfileName, m_strInstanceName); 127 } 128 129 CProgress UINotificationProgressCloudMachineAdd::createProgress(COMResult &comResult) 130 { 131 /* Initialize progress-wrapper: */ 132 CProgress comProgress = m_comClient.AddCloudMachine(m_strInstanceName, m_comMachine); 133 /* Store COM result: */ 134 comResult = m_comClient; 135 /* Return progress-wrapper: */ 136 return comProgress; 137 } 138 139 void UINotificationProgressCloudMachineAdd::sltHandleProgressFinished() 140 { 141 if (m_comMachine.isNotNull() && !m_comMachine.GetId().isNull()) 142 emit sigCloudMachineAdded(m_strShortProviderName, m_strProfileName, m_comMachine); 143 } -
trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.h
r90301 r90302 27 27 /* COM includes: */ 28 28 #include "COMEnums.h" 29 #include "CCloudClient.h" 30 #include "CCloudMachine.h" 29 31 #include "CMedium.h" 30 32 … … 107 109 }; 108 110 111 /** UINotificationProgress extension for cloud machine add functionality. */ 112 class SHARED_LIBRARY_STUFF UINotificationProgressCloudMachineAdd : public UINotificationProgress 113 { 114 Q_OBJECT; 115 116 signals: 117 118 /** Notifies listeners about cloud @a comMachine was added. 119 * @param strShortProviderName Brigns the short provider name. 120 * @param strProfileName Brings the profile name. */ 121 void sigCloudMachineAdded(const QString &strShortProviderName, 122 const QString &strProfileName, 123 const CCloudMachine &comMachine); 124 125 public: 126 127 /** Constructs cloud machine add notification-progress. 128 * @param comClient Brings the cloud client being adding machine. 129 * @param comMachine Brings the cloud machine being added. 130 * @param strInstanceName Brings the instance name. 131 * @param strShortProviderName Brings the short provider name. 132 * @param strProfileName Brings the profile name. */ 133 UINotificationProgressCloudMachineAdd(const CCloudClient &comClient, 134 const CCloudMachine &comMachine, 135 const QString &strInstanceName, 136 const QString &strShortProviderName, 137 const QString &strProfileName); 138 139 protected: 140 141 /** Returns object name. */ 142 virtual QString name() const /* override final */; 143 /** Returns object details. */ 144 virtual QString details() const /* override final */; 145 /** Creates and returns started progress-wrapper. */ 146 virtual CProgress createProgress(COMResult &comResult) /* override final */; 147 148 private slots: 149 150 /** Handles signal about progress being finished. */ 151 void sltHandleProgressFinished(); 152 153 private: 154 155 /** Holds the cloud client being adding machine. */ 156 CCloudClient m_comClient; 157 /** Holds the cloud machine being added. */ 158 CCloudMachine m_comMachine; 159 /** Holds the instance name. */ 160 QString m_strInstanceName; 161 /** Holds the short provider name. */ 162 QString m_strShortProviderName; 163 /** Holds the profile name. */ 164 QString m_strProfileName; 165 }; 166 109 167 #endif /* !FEQT_INCLUDED_SRC_notificationcenter_UINotificationObjects_h */ -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/addcloudvm/UIWizardAddCloudVM.cpp
r89999 r90302 19 19 #include "UICommon.h" 20 20 #include "UIMessageCenter.h" 21 #include "UINotificationCenter.h" 21 22 #include "UIWizardAddCloudVM.h" 22 23 #include "UIWizardAddCloudVMPageBasic1.h" … … 57 58 /* Initiate cloud VM add procedure: */ 58 59 CCloudMachine comMachine; 59 CProgress comProgress = comClient.AddCloudMachine(strInstanceName, comMachine);60 /* Check for immediate errors: */61 if (!comClient.isOk())62 {63 msgCenter().cannotCreateCloudMachine(comClient, this);64 break;65 }66 else67 {68 /* Show "Add cloud machine" progress: */69 msgCenter().showModalProgressDialog(comProgress, QString(),70 ":/progress_new_cloud_vm_90px.png", this, 0);71 /* Check for canceled progress: */72 if (comProgress.GetCanceled())73 break;74 else75 {76 /* Check for progress errors: */77 if (!comProgress.isOk() || comProgress.GetResultCode() != 0)78 {79 msgCenter().cannotCreateCloudMachine(comProgress, this);80 break;81 }82 else83 {84 /* Check whether VM really added: */85 if (comMachine.isNotNull())86 {87 /* Notify GUI about VM was added: */88 uiCommon().notifyCloudMachineRegistered(shortProviderName(),89 profileName(),90 comMachine);91 60 92 /* Finally, success: */ 93 fResult = true; 94 } 95 } 96 } 97 } 61 /* Add cloud VM: */ 62 UINotificationProgressCloudMachineAdd *pNotification = new UINotificationProgressCloudMachineAdd(comClient, 63 comMachine, 64 strInstanceName, 65 shortProviderName(), 66 profileName()); 67 connect(pNotification, &UINotificationProgressCloudMachineAdd::sigCloudMachineAdded, 68 &uiCommon(), &UICommon::sltHandleCloudMachineAdded); 69 notificationCenter().append(pNotification); 70 71 /* Positive: */ 72 fResult = true; 98 73 } 99 74
Note:
See TracChangeset
for help on using the changeset viewer.