- Timestamp:
- Jul 24, 2021 1:21:36 PM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 145888
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.cpp
r90302 r90325 4155 4155 } 4156 4156 4157 void UICommon::sltHandleMachineCreated(const CMachine &comMachine) 4158 { 4159 /* Register created machine. */ 4160 CVirtualBox comVBox = virtualBox(); 4161 comVBox.RegisterMachine(comMachine); 4162 if (!comVBox.isOk()) 4163 msgCenter().cannotRegisterMachine(comVBox, comMachine.GetName()); 4164 } 4165 4157 4166 void UICommon::sltHandleCloudMachineAdded(const QString &strShortProviderName, 4158 4167 const QString &strProfileName, -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.h
r90302 r90325 735 735 /** @} */ 736 736 737 /** @name Machine related stuff. 738 * @{ */ 739 /** Handles signal about machine was created. */ 740 void sltHandleMachineCreated(const CMachine &comMachine); 741 /** @} */ 742 737 743 /** @name Cloud Machine related stuff. 738 744 * @{ */ -
trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.cpp
r90321 r90325 98 98 99 99 /********************************************************************************************************************************* 100 * Class UINotificationProgressMachineCopy implementation. * 101 *********************************************************************************************************************************/ 102 103 UINotificationProgressMachineCopy::UINotificationProgressMachineCopy(const CMachine &comSource, 104 const CMachine &comTarget, 105 const KCloneMode &enmCloneMode, 106 const QVector<KCloneOptions> &options) 107 : m_comSource(comSource) 108 , m_comTarget(comTarget) 109 , m_enmCloneMode(enmCloneMode) 110 , m_options(options) 111 { 112 connect(this, &UINotificationProgress::sigProgressFinished, 113 this, &UINotificationProgressMachineCopy::sltHandleProgressFinished); 114 } 115 116 QString UINotificationProgressMachineCopy::name() const 117 { 118 return UINotificationProgress::tr("Copying machine ..."); 119 } 120 121 QString UINotificationProgressMachineCopy::details() const 122 { 123 return UINotificationProgress::tr("<b>From:</b> %1<br><b>To:</b> %2") 124 .arg(m_comSource.GetName(), m_comTarget.GetName()); 125 } 126 127 CProgress UINotificationProgressMachineCopy::createProgress(COMResult &comResult) 128 { 129 /* Initialize progress-wrapper: */ 130 CProgress comProgress = m_comSource.CloneTo(m_comTarget, m_enmCloneMode, m_options); 131 /* Store COM result: */ 132 comResult = m_comSource; 133 /* Return progress-wrapper: */ 134 return comProgress; 135 } 136 137 void UINotificationProgressMachineCopy::sltHandleProgressFinished() 138 { 139 if (m_comTarget.isNotNull() && !m_comTarget.GetId().isNull()) 140 emit sigMachineCopied(m_comTarget); 141 } 142 143 144 /********************************************************************************************************************************* 100 145 * Class UINotificationProgressCloudMachineAdd implementation. * 101 146 *********************************************************************************************************************************/ -
trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.h
r90321 r90325 29 29 #include "CCloudClient.h" 30 30 #include "CCloudMachine.h" 31 #include "CMachine.h" 31 32 #include "CMedium.h" 32 33 #include "CVirtualSystemDescription.h" … … 108 109 /** Holds the target medium options. */ 109 110 QVector<KMediumVariant> m_variants; 111 }; 112 113 /** UINotificationProgress extension for machine copy functionality. */ 114 class SHARED_LIBRARY_STUFF UINotificationProgressMachineCopy : public UINotificationProgress 115 { 116 Q_OBJECT; 117 118 signals: 119 120 /** Notifies listeners about @a comMachine was copied. */ 121 void sigMachineCopied(const CMachine &comMachine); 122 123 public: 124 125 /** Constructs medium move notification-progress. 126 * @param comSource Brings the machine being copied. 127 * @param comTarget Brings the machine being the target. 128 * @param enmCloneMode Brings the cloning mode. 129 * @param options Brings the cloning options. */ 130 UINotificationProgressMachineCopy(const CMachine &comSource, 131 const CMachine &comTarget, 132 const KCloneMode &enmCloneMode, 133 const QVector<KCloneOptions> &options); 134 135 protected: 136 137 /** Returns object name. */ 138 virtual QString name() const /* override final */; 139 /** Returns object details. */ 140 virtual QString details() const /* override final */; 141 /** Creates and returns started progress-wrapper. */ 142 virtual CProgress createProgress(COMResult &comResult) /* override final */; 143 144 private slots: 145 146 /** Handles signal about progress being finished. */ 147 void sltHandleProgressFinished(); 148 149 private: 150 151 /** Holds the machine being copied. */ 152 CMachine m_comSource; 153 /** Holds the machine being the target. */ 154 CMachine m_comTarget; 155 /** Holds the machine cloning mode. */ 156 KCloneMode m_enmCloneMode; 157 /** Holds the target machine options. */ 158 QVector<KCloneOptions> m_options; 110 159 }; 111 160 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVM.cpp
r88446 r90325 17 17 18 18 /* GUI includes: */ 19 #include "UICommon.h" 20 #include "UIMessageCenter.h" 21 #include "UINotificationCenter.h" 19 22 #include "UIWizardCloneVM.h" 20 23 #include "UIWizardCloneVMPageBasic1.h" … … 22 25 #include "UIWizardCloneVMPageBasic3.h" 23 26 #include "UIWizardCloneVMPageExpert.h" 24 #include "UICommon.h"25 #include "UIMessageCenter.h"26 27 27 28 /* COM includes: */ … … 147 148 options.append(KCloneOptions_Link); 148 149 149 /* Start cloning. */ 150 CProgress progress = srcMachine.CloneTo(cloneMachine, cloneMode, options); 151 if (!srcMachine.isOk()) 152 { 153 msgCenter().cannotCreateClone(srcMachine, this); 154 return false; 155 } 156 157 /* Wait until done. */ 158 msgCenter().showModalProgressDialog(progress, windowTitle(), ":/progress_clone_90px.png", this); 159 if (progress.GetCanceled()) 160 return false; 161 if (!progress.isOk() || progress.GetResultCode() != 0) 162 { 163 msgCenter().cannotCreateClone(progress, srcMachine.GetName(), this); 164 return false; 165 } 166 167 /* Finally register the clone machine. */ 168 vbox.RegisterMachine(cloneMachine); 169 if (!vbox.isOk()) 170 { 171 msgCenter().cannotRegisterMachine(vbox, cloneMachine.GetName(), this); 172 return false; 173 } 150 /* Clone VM: */ 151 UINotificationProgressMachineCopy *pNotification = new UINotificationProgressMachineCopy(srcMachine, 152 cloneMachine, 153 cloneMode, 154 options); 155 connect(pNotification, &UINotificationProgressMachineCopy::sigMachineCopied, 156 &uiCommon(), &UICommon::sltHandleMachineCreated); 157 notificationCenter().append(pNotification); 174 158 175 159 return true;
Note:
See TracChangeset
for help on using the changeset viewer.