Changeset 90077 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Jul 7, 2021 3:40:54 PM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 145574
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMDiskPageBasic.cpp
r90076 r90077 115 115 // } 116 116 117 118 119 120 117 // registerField("mediumFormat", this, "mediumFormat"); 118 // registerField("mediumVariant" /* KMediumVariant */, this, "mediumVariant"); 119 // registerField("mediumPath", this, "mediumPath"); 120 // registerField("mediumSize", this, "mediumSize"); 121 121 122 122 UIWizardNewVMDiskPageBasic::UIWizardNewVMDiskPageBasic() … … 133 133 , m_pDynamicLabel(0) 134 134 , m_pFixedLabel(0) 135 , m_pSplitLabel(0)136 135 , m_pFixedCheckBox(0) 137 , m_pSplitBox(0)138 136 , m_enmSelectedDiskSource(SelectedDiskSource_New) 139 137 , m_fRecommendedNoDisk(false) 138 , m_fVDIFormatFound(false) 140 139 { 141 140 prepare(); … … 143 142 // qRegisterMetaType<SelectedDiskSource>(); 144 143 145 /* We do not have any UI elements for HDD format selection since we default to VDI in case of guided wizard mode: */ 146 bool fFoundVDI = false; 147 CSystemProperties properties = uiCommon().virtualBox().GetSystemProperties(); 148 const QVector<CMediumFormat> &formats = properties.GetMediumFormats(); 149 foreach (const CMediumFormat &format, formats) 150 { 151 if (format.GetName() == "VDI") 152 { 153 m_mediumFormat = format; 154 fFoundVDI = true; 155 } 156 } 157 if (!fFoundVDI) 158 AssertMsgFailed(("No medium format corresponding to VDI could be found!")); 159 160 m_strDefaultExtension = UIWizardNewVMDiskPage::defaultExtension(m_mediumFormat); 161 162 /* Since the medium format is static we can decide widget visibility here: */ 163 setWidgetVisibility(m_mediumFormat); 164 } 165 166 CMediumFormat UIWizardNewVMDiskPageBasic::mediumFormat() const 167 { 168 return m_mediumFormat; 169 } 144 } 145 170 146 171 147 void UIWizardNewVMDiskPageBasic::prepare() … … 320 296 } 321 297 322 if (m_pSplitBox)323 m_pSplitBox->setText(UIWizardNewVD::tr("&Split Into Files of Less Than 2GB"));324 325 326 298 /* Translate rich text labels: */ 327 299 if (m_pDescriptionLabel) … … 335 307 m_pFixedLabel->setText(UIWizardNewVD::tr("<p>A <b>fixed size</b> hard disk file may take longer to create on some " 336 308 "systems but is often faster to use.</p>")); 337 if (m_pSplitLabel)338 m_pSplitLabel->setText(UIWizardNewVD::tr("<p>You can also choose to <b>split</b> the hard disk file into several files "339 "of up to two gigabytes each. This is mainly useful if you wish to store the "340 "virtual machine on removable USB devices or old systems, some of which cannot "341 "handle very large files."));342 343 309 } 344 310 345 311 void UIWizardNewVMDiskPageBasic::initializePage() 346 312 { 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 313 retranslateUi(); 314 315 UIWizardNewVM *pWizard = qobject_cast<UIWizardNewVM*>(wizard()); 316 AssertReturnVoid(pWizard); 317 318 LONG64 iRecommendedSize = 0; 319 CGuestOSType type = pWizard->guestOSType(); 320 if (!type.isNull()) 321 { 322 iRecommendedSize = type.GetRecommendedHDD(); 323 if (iRecommendedSize != 0) 324 { 325 if (m_pDiskNew) 326 { 327 m_pDiskNew->setFocus(); 328 m_pDiskNew->setChecked(true); 329 } 330 m_enmSelectedDiskSource = SelectedDiskSource_New; 331 m_fRecommendedNoDisk = false; 332 } 333 else 334 { 335 if (m_pDiskEmpty) 336 { 337 m_pDiskEmpty->setFocus(); 338 m_pDiskEmpty->setChecked(true); 339 } 340 m_enmSelectedDiskSource = SelectedDiskSource_Empty; 341 m_fRecommendedNoDisk = true; 342 } 343 } 378 344 379 345 if (m_pDiskSelector) … … 382 348 setEnableNewDiskWidgets(m_enmSelectedDiskSource == SelectedDiskSource_New); 383 349 350 if (!m_fVDIFormatFound) 351 { 352 /* We do not have any UI elements for HDD format selection since we default to VDI in case of guided wizard mode: */ 353 CSystemProperties properties = uiCommon().virtualBox().GetSystemProperties(); 354 const QVector<CMediumFormat> &formats = properties.GetMediumFormats(); 355 foreach (const CMediumFormat &format, formats) 356 { 357 if (format.GetName() == "VDI") 358 { 359 newVMWizardPropertySet(MediumFormat, format); 360 m_fVDIFormatFound = true; 361 } 362 } 363 if (!m_fVDIFormatFound) 364 AssertMsgFailed(("No medium format corresponding to VDI could be found!")); 365 setWidgetVisibility(pWizard->mediumFormat()); 366 } 367 QString strDefaultExtension = UIWizardNewVMDiskPage::defaultExtension(pWizard->mediumFormat()); 368 384 369 /* We set the medium name and path according to machine name/path and do not allow user change these in the guided mode: */ 385 370 QString strDefaultName = pWizard->machineBaseName().isEmpty() ? QString("NewVirtualDisk1") : pWizard->machineBaseName(); 386 371 const QString &strMachineFolder = pWizard->machineFolder(); 387 QString strMediumPath = UIWizardNewVMDiskPage::absoluteFilePath(UIWizardNewVMDiskPage::toFileName(strDefaultName,388 m_strDefaultExtension),389 strMachineFolder);372 QString strMediumPath = 373 UIWizardNewVMDiskPage::absoluteFilePath(UIWizardNewVMDiskPage::toFileName(strDefaultName, 374 strDefaultExtension), strMachineFolder); 390 375 newVMWizardPropertySet(MediumPath, strMediumPath); 391 376 … … 464 449 if (pWizard) 465 450 { 466 // if (selectedDiskSource() == SelectedDiskSource_New)467 // {468 // /* Try to create the hard drive:*/469 // fResult = pWizard->createVirtualDisk();470 // /*Don't show any error message here since UIWizardNewVM::createVirtualDisk already does so: */471 // if (!fResult)472 // return fResult;473 // }474 475 // fResult = pWizard->createVM();476 // /* Try to delete the hard disk: */477 // if (!fResult)478 // pWizard->deleteVirtualDisk();451 // if (selectedDiskSource() == SelectedDiskSource_New) 452 // { 453 // /* Try to create the hard drive:*/ 454 // fResult = pWizard->createVirtualDisk(); 455 // /*Don't show any error message here since UIWizardNewVM::createVirtualDisk already does so: */ 456 // if (!fResult) 457 // return fResult; 458 // } 459 460 // fResult = pWizard->createVM(); 461 // /* Try to delete the hard disk: */ 462 // if (!fResult) 463 // pWizard->deleteVirtualDisk(); 479 464 } 480 465 // endProcessing(); … … 552 537 m_pDynamicLabel = new QIRichTextLabel; 553 538 m_pFixedLabel = new QIRichTextLabel; 554 m_pSplitLabel = new QIRichTextLabel;555 539 } 556 540 QVBoxLayout *pVariantLayout = new QVBoxLayout; … … 558 542 { 559 543 m_pFixedCheckBox = new QCheckBox; 560 m_pSplitBox = new QCheckBox;561 544 pVariantLayout->addWidget(m_pFixedCheckBox); 562 pVariantLayout->addWidget(m_pSplitBox);563 545 } 564 546 if (fWithLabels) … … 567 549 pMainLayout->addWidget(m_pDynamicLabel); 568 550 pMainLayout->addWidget(m_pFixedLabel); 569 pMainLayout->addWidget(m_pSplitLabel);570 551 } 571 552 pMainLayout->addLayout(pVariantLayout); … … 585 566 } 586 567 587 void UIWizardNewVMDiskPageBasic::setWidgetVisibility( CMediumFormat &mediumFormat)568 void UIWizardNewVMDiskPageBasic::setWidgetVisibility(const CMediumFormat &mediumFormat) 588 569 { 589 570 ULONG uCapabilities = 0; … … 595 576 bool fIsCreateDynamicPossible = uCapabilities & KMediumFormatCapabilities_CreateDynamic; 596 577 bool fIsCreateFixedPossible = uCapabilities & KMediumFormatCapabilities_CreateFixed; 597 bool fIsCreateSplitPossible = uCapabilities & KMediumFormatCapabilities_CreateSplit2G;598 578 if (m_pFixedCheckBox) 599 579 { … … 615 595 if (m_pFixedCheckBox) 616 596 m_pFixedCheckBox->setHidden(!fIsCreateFixedPossible); 617 if (m_pSplitLabel) 618 m_pSplitLabel->setHidden(!fIsCreateSplitPossible); 619 if (m_pSplitBox) 620 m_pSplitBox->setHidden(!fIsCreateSplitPossible); 621 } 597 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMDiskPageBasic.h
r90076 r90077 79 79 80 80 UIWizardNewVMDiskPageBasic(); 81 CMediumFormat mediumFormat() const;82 81 83 82 protected: … … 108 107 109 108 void setEnableDiskSelectionWidgets(bool fEnabled); 110 void setWidgetVisibility( CMediumFormat &mediumFormat);109 void setWidgetVisibility(const CMediumFormat &mediumFormat); 111 110 112 111 /** @name Widgets … … 124 123 QIRichTextLabel *m_pDynamicLabel; 125 124 QIRichTextLabel *m_pFixedLabel; 126 QIRichTextLabel *m_pSplitLabel;127 125 QCheckBox *m_pFixedCheckBox; 128 QCheckBox *m_pSplitBox;129 126 /** @} */ 130 127 131 /** For guided new vm wizard VDI is the only format. Thus we have no UI item for it. */132 CMediumFormat m_mediumFormat;133 128 SelectedDiskSource m_enmSelectedDiskSource; 134 129 bool m_fRecommendedNoDisk; … … 136 131 QString m_strDefaultExtension; 137 132 QSet<QString> m_userModifiedParameters; 133 bool m_fVDIFormatFound; 138 134 }; 139 135
Note:
See TracChangeset
for help on using the changeset viewer.