Changeset 38241 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Jul 29, 2011 1:12:04 PM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 73224
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxProblemReporter.cpp
r38222 r38241 1091 1091 } 1092 1092 1093 void VBoxProblemReporter::cannotFindSnapshotByName(QWidget *pParent, 1094 const CMachine &machine, 1095 const QString &strName) const 1096 { 1097 message (pParent ? pParent : mainWindowShown(), Error, 1098 tr ("Can't find snapshot named <b>%1</b>.") 1099 .arg(strName), 1100 formatErrorInfo(machine) 1101 ); 1102 } 1103 1093 1104 void VBoxProblemReporter::cannotFindMachineByName (const CVirtualBox &vbox, 1094 1105 const QString &name) -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxProblemReporter.h
r38222 r38241 237 237 void cannotDeleteSnapshot (const CConsole &aConsole, const QString &aSnapshotName); 238 238 void cannotDeleteSnapshot (const CProgress &aProgress, const QString &aSnapshotName); 239 void cannotFindSnapshotByName(QWidget *pParent, const CMachine &machine, const QString &strMachine) const; 239 240 240 241 void cannotFindMachineByName (const CVirtualBox &vbox, const QString &name); -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UICloneVMWizard.cpp
r38102 r38241 34 34 : QIWizard(pParent) 35 35 , m_machine(machine) 36 , m_snapshot(snapshot) 36 37 { 37 38 /* Create & add pages: */ 38 39 setPage(PageIntro, new UICloneVMWizardPage1(machine.GetName())); 39 40 /* If we are having a snapshot we can show the "Linked" option. */ 40 if (!snapshot.isNull()) 41 setPage(PageType, new UICloneVMWizardPage2()); 41 setPage(PageType, new UICloneVMWizardPage2(snapshot.isNull())); 42 42 /* If the machine has no snapshots, we don't bother the user about options 43 43 * for it. */ … … 77 77 const QString &strSettingsFile = vbox.ComposeMachineFilename(strName, QString::null); 78 78 79 CMachine srcMachine = m_machine; 80 /* If the user like to create a linked clone from the current machine, we 81 * have to take a little bit more action. First we create an snapshot, so 82 * that new differencing images on the source VM are created. Based on that 83 * we could use the new snapshot machine for cloning. */ 84 if ( fLinked 85 && m_snapshot.isNull()) 86 { 87 const QString &strId = m_machine.GetId(); 88 CSession session = vboxGlobal().openSession(strId); 89 if (session.isNull()) 90 return false; 91 CConsole console = session.GetConsole(); 92 93 /* Take the snapshot */ 94 QString strSnapshotName = tr("Linked Base for %1 and %2").arg(m_machine.GetName()).arg(strName); 95 CProgress progress = console.TakeSnapshot(strSnapshotName, ""); 96 97 if (console.isOk()) 98 { 99 /* Show the "Taking Snapshot" progress dialog */ 100 vboxProblem().showModalProgressDialog(progress, m_machine.GetName(), ":/progress_snapshot_create_90px.png", this, true); 101 102 if (!progress.isOk() || progress.GetResultCode() != 0) 103 { 104 vboxProblem().cannotTakeSnapshot(progress); 105 return false; 106 } 107 } 108 else 109 { 110 vboxProblem().cannotTakeSnapshot(console); 111 return false; 112 } 113 114 /* Unlock machine finally: */ 115 session.UnlockMachine(); 116 117 /* Get the new snapshot and the snapshot machine. */ 118 const CSnapshot &newSnapshot = m_machine.FindSnapshot(strSnapshotName); 119 if (newSnapshot.isNull()) 120 { 121 vboxProblem().cannotFindSnapshotByName(this, m_machine, strSnapshotName); 122 return false; 123 } 124 srcMachine = newSnapshot.GetMachine(); 125 } 126 79 127 /* Create a new machine object. */ 80 128 CMachine cloneMachine = vbox.CreateMachine(strSettingsFile, strName, QString::null, QString::null, false); … … 94 142 95 143 /* Start cloning. */ 96 CProgress progress = m_machine.CloneTo(cloneMachine, mode, options);97 if (! m_machine.isOk())98 { 99 vboxProblem().cannotCreateClone( m_machine, this);144 CProgress progress = srcMachine.CloneTo(cloneMachine, mode, options); 145 if (!srcMachine.isOk()) 146 { 147 vboxProblem().cannotCreateClone(srcMachine, this); 100 148 return false; 101 149 } … … 107 155 if (!progress.isOk() || progress.GetResultCode() != 0) 108 156 { 109 vboxProblem().cannotCreateClone( m_machine, progress, this);157 vboxProblem().cannotCreateClone(srcMachine, progress, this); 110 158 return false; 111 159 } … … 115 163 if (!vbox.isOk()) 116 164 { 117 vboxProblem().cannotRegisterMachine(vbox, m_machine, this);165 vboxProblem().cannotRegisterMachine(vbox, cloneMachine, this); 118 166 return false; 119 167 } … … 198 246 } 199 247 200 UICloneVMWizardPage2::UICloneVMWizardPage2() 248 UICloneVMWizardPage2::UICloneVMWizardPage2(bool fAdditionalInfo) 249 : m_fAdditionalInfo(fAdditionalInfo) 201 250 { 202 251 /* Decorate page: */ … … 223 272 /* Set 'Page2' page title: */ 224 273 setTitle(tr("Cloning Configuration")); 274 275 276 QString strLabel = tr("<p>Please select the type of the clone.</p><p>If you choose <b>Full Clone</b> an exact copy (including all virtual disk images) of the original VM will be created. If you select <b>Linked Clone</b>, a new VM will be created, but the virtual disk images will point to the virtual disk images of original VM.</p>"); 277 if (m_fAdditionalInfo) 278 strLabel += tr("<p>Note that a new snapshot within the source VM is created in case you select <b>Linked Clone</b>.</p>"); 279 m_pLabel->setText(strLabel); 225 280 } 226 281 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UICloneVMWizard.h
r38102 r38241 55 55 /* Private member vars */ 56 56 CMachine m_machine; 57 CSnapshot m_snapshot; 57 58 }; 58 59 … … 120 121 121 122 /* Constructor: */ 122 UICloneVMWizardPage2( );123 UICloneVMWizardPage2(bool fAdditionalInfo); 123 124 int nextId() const; 124 125 … … 136 137 137 138 void buttonClicked(QAbstractButton *pButton); 139 140 private: 141 142 bool m_fAdditionalInfo; 138 143 }; 139 144 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UICloneVMWizardPage2.ui
r38102 r38241 34 34 <widget class="QILabel" name="m_pLabel"> 35 35 <property name="text"> 36 <string> <p>Please select the type of the clone.</p><p>If you choose <b>Full Clone</b> an exact copy (including all virtual disk images) of the original VM will be created. If you select <b>Linked Clone</b>, a new VM will be created, but the virtual disk images will point to the virtual disk images of original VM.</p></string>36 <string></string> 37 37 </property> 38 38 <property name="wordWrap">
Note:
See TracChangeset
for help on using the changeset viewer.