Changeset 87914 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Mar 2, 2021 2:13:51 PM (4 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic4.cpp
r87913 r87914 77 77 if (returnCode == static_cast<int>(UIMediumSelector::ReturnCode_Accepted) && !uMediumId.isNull()) 78 78 { 79 /* Update medium-combo if necessary: */80 79 m_pDiskSelector->setCurrentItem(uMediumId); 81 /* Focus on hard disk combo: */82 80 m_pDiskSelector->setFocus(); 83 m_virtualDisk = uiCommon().medium(uMediumId).medium(); 84 } 85 } 86 87 bool UIWizardNewVMPage4::getWithNewVirtualDiskWizard() 88 { 89 /* Create New Virtual Hard Drive wizard: */ 90 UISafePointerWizardNewVD pWizard = new UIWizardNewVD(thisImp(), 91 fieldImp("machineBaseName").toString(), 92 fieldImp("machineFolder").toString(), 93 fieldImp("type").value<CGuestOSType>().GetRecommendedHDD(), 94 wizardImp()->mode()); 95 pWizard->prepare(); 96 bool fResult = false; 97 if (pWizard->exec() == QDialog::Accepted) 98 { 99 fResult = true; 100 m_virtualDisk = pWizard->virtualDisk(); 101 m_pDiskSelector->setCurrentItem(m_virtualDisk.GetId()); 102 m_pDiskExisting->click(); 103 } 104 if (pWizard) 105 delete pWizard; 106 return fResult; 107 } 108 109 void UIWizardNewVMPage4::ensureNewVirtualDiskDeleted() 110 { 111 /* Make sure virtual-disk valid: */ 112 if (m_virtualDisk.isNull()) 113 return; 114 115 /* Remember virtual-disk attributes: */ 116 QString strLocation = m_virtualDisk.GetLocation(); 117 /* Prepare delete storage progress: */ 118 CProgress progress = m_virtualDisk.DeleteStorage(); 119 if (m_virtualDisk.isOk()) 120 { 121 /* Show delete storage progress: */ 122 msgCenter().showModalProgressDialog(progress, thisImp()->windowTitle(), ":/progress_media_delete_90px.png", thisImp()); 123 if (!progress.isOk() || progress.GetResultCode() != 0) 124 msgCenter().cannotDeleteHardDiskStorage(progress, strLocation, thisImp()); 125 } 126 else 127 msgCenter().cannotDeleteHardDiskStorage(m_virtualDisk, strLocation, thisImp()); 128 129 /* Detach virtual-disk anyway: */ 130 m_virtualDisk.detach(); 81 } 131 82 } 132 83 … … 154 105 m_pDiskSelector->setEnabled(fEnabled); 155 106 m_pDiskSelectionButton->setEnabled(fEnabled); 107 } 108 109 void UIWizardNewVMPage4::setVirtualDiskFromDiskCombo() 110 { 111 QUuid currentId; 112 if (!m_virtualDisk.isNull()) 113 currentId = m_virtualDisk.GetId(); 114 QUuid id = m_pDiskSelector->id(); 115 /* Do nothing else if m_virtualMedium is already set to what combobox has: */ 116 if (id == currentId) 117 return; 118 if (m_pDiskSelector) 119 { 120 CMedium medium = uiCommon().medium(id).medium(); 121 if (!medium.isNull()) 122 setVirtualDisk(medium); 123 } 156 124 } 157 125 … … 303 271 setSelectedDiskSource(SelectedDiskSource_Empty); 304 272 else if (m_pDiskSourceButtonGroup->checkedButton() == m_pDiskExisting) 273 { 305 274 setSelectedDiskSource(SelectedDiskSource_Existing); 275 setVirtualDiskFromDiskCombo(); 276 } 306 277 else 307 278 setSelectedDiskSource(SelectedDiskSource_New); … … 315 286 void UIWizardNewVMPageBasic4::sltVirtualSelectedDiskSourceChanged() 316 287 { 288 /* Make sure to set m_virtualDisk: */ 289 setVirtualDiskFromDiskCombo(); 317 290 emit completeChanged(); 318 291 } … … 390 363 void UIWizardNewVMPageBasic4::cleanupPage() 391 364 { 392 /* Call to base-class: */393 ensureNewVirtualDiskDeleted();394 365 UIWizardPage::cleanupPage(); 395 366 } … … 399 370 if (selectedDiskSource() == SelectedDiskSource_New) 400 371 return mediumSize() >= m_uMediumSizeMin && mediumSize() <= m_uMediumSizeMax; 372 401 373 if (selectedDiskSource() == SelectedDiskSource_Existing) 402 return m_virtualDisk.isNull(); 374 return !m_virtualDisk.isNull(); 375 403 376 return true; 404 377 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic4.h
r87913 r87914 59 59 SelectedDiskSource selectedDiskSource() const; 60 60 void setSelectedDiskSource(SelectedDiskSource enmSelectedDiskSource); 61 62 void getWithFileOpenDialog();63 61 bool getWithNewVirtualDiskWizard(); 64 65 62 66 63 QWidget *createDiskWidgets(); 67 64 virtual QWidget *createDiskVariantAndSizeWidgets(); 68 69 void ensureNewVirtualDiskDeleted(); 65 void getWithFileOpenDialog(); 70 66 void retranslateWidgets(); 71 67 72 68 void setEnableDiskSelectionWidgets(bool fEnable); 69 void setVirtualDiskFromDiskCombo(); 73 70 bool m_fRecommendedNoDisk; 74 71 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.cpp
r87912 r87914 150 150 void UIWizardNewVMPageExpert::sltGetWithFileOpenDialog() 151 151 { 152 /* Call to base-class: */153 getWithFileOpenDialog();154 152 } 155 153 … … 337 335 void UIWizardNewVMPageExpert::cleanupPage() 338 336 { 339 /* Call to base-class: */340 ensureNewVirtualDiskDeleted();341 337 cleanupMachineFolder(); 342 338 } … … 462 458 if (m_pDiskNew->isChecked()) 463 459 { 464 /* Show the New Virtual Hard Drive wizard if necessary: */465 fResult = getWithNewVirtualDiskWizard();466 460 } 467 461 }
Note:
See TracChangeset
for help on using the changeset viewer.