Changeset 90225 in vbox
- Timestamp:
- Jul 16, 2021 10:56:46 AM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 145762
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/wizards
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/wizards/editors/UIWizardDiskEditors.cpp
r90223 r90225 37 37 #include "UIWizardDiskEditors.h" 38 38 #include "UIWizardNewVM.h" 39 #include "UIWizardNewVMDiskPageBasic.h" 39 40 40 41 /* Other VBox includes: */ … … 168 169 m_formatNames << medFormat.GetName(); 169 170 m_pFormatButtonGroup->addButton(pFormatButton, m_formatNames.size() - 1); 170 m_formatExtensions << defaultExtension(medFormat); 171 } 172 } 173 174 /* static */ 175 QString UIDiskFormatsGroupBox::defaultExtension(const CMediumFormat &mediumFormatRef) 176 { 177 if (!mediumFormatRef.isNull()) 178 { 179 /* Load extension / device list: */ 180 QVector<QString> fileExtensions; 181 QVector<KDeviceType> deviceTypes; 182 CMediumFormat mediumFormat(mediumFormatRef); 183 mediumFormat.DescribeFileExtensions(fileExtensions, deviceTypes); 184 for (int i = 0; i < fileExtensions.size(); ++i) 185 if (deviceTypes[i] == KDeviceType_HardDisk) 186 return fileExtensions[i].toLower(); 187 } 188 AssertMsgFailed(("Extension can't be NULL!\n")); 189 return QString(); 171 m_formatExtensions << UIWizardNewVMDiskPage::defaultExtension(medFormat); 172 } 190 173 } 191 174 … … 327 310 328 311 /********************************************************************************************************************************* 329 * UI DiskSizeAndLocationGroupBox implementation.*312 * UIMediumSizeAndPathGroupBox implementation. * 330 313 *********************************************************************************************************************************/ 331 314 332 UI DiskSizeAndLocationGroupBox::UIDiskSizeAndLocationGroupBox(QWidget *pParent /* = 0 */)315 UIMediumSizeAndPathGroupBox::UIMediumSizeAndPathGroupBox(QWidget *pParent /* = 0 */) 333 316 : QIWithRetranslateUI<QGroupBox>(pParent) 334 317 , m_pLocationLabel(0) … … 341 324 } 342 325 343 void UI DiskSizeAndLocationGroupBox::prepare()326 void UIMediumSizeAndPathGroupBox::prepare() 344 327 { 345 328 QGridLayout *pDiskContainerLayout = new QGridLayout(this); … … 374 357 retranslateUi(); 375 358 } 376 void UI DiskSizeAndLocationGroupBox::retranslateUi()359 void UIMediumSizeAndPathGroupBox::retranslateUi() 377 360 { 378 361 setTitle(tr("Hard Disk File Location and Size")); 379 362 } 380 363 381 QString UI DiskSizeAndLocationGroupBox::location() const364 QString UIMediumSizeAndPathGroupBox::mediumPath() const 382 365 { 383 366 if (m_pLocationEditor) … … 386 369 } 387 370 388 void UI DiskSizeAndLocationGroupBox::setLocation(const QString &strLocation)371 void UIMediumSizeAndPathGroupBox::setMediumPath(const QString &strMediumPath) 389 372 { 390 373 if (m_pLocationEditor) 391 m_pLocationEditor->setText(str Location);392 } 393 394 void UI DiskSizeAndLocationGroupBox::updateLocationEditorAfterFormatChange(const CMediumFormat &mediumFormat, const QStringList &formatExtensions)374 m_pLocationEditor->setText(strMediumPath); 375 } 376 377 void UIMediumSizeAndPathGroupBox::updateMediumPath(const CMediumFormat &mediumFormat, const QStringList &formatExtensions) 395 378 { 396 379 /* Compose virtual-disk extension: */ 397 QString strDefaultExtension = UI DiskFormatsGroupBox::defaultExtension(mediumFormat);380 QString strDefaultExtension = UIWizardNewVMDiskPage::defaultExtension(mediumFormat); 398 381 /* Update m_pLocationEditor's text if necessary: */ 399 382 if (!m_pLocationEditor->text().isEmpty() && !strDefaultExtension.isEmpty()) … … 412 395 413 396 /* static */ 414 QString UI DiskSizeAndLocationGroupBox::stripFormatExtension(const QString &strFileName, const QStringList &formatExtensions)397 QString UIMediumSizeAndPathGroupBox::stripFormatExtension(const QString &strFileName, const QStringList &formatExtensions) 415 398 { 416 399 QString result(strFileName); -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/editors/UIWizardDiskEditors.h
r90223 r90225 62 62 void setMediumFormat(const CMediumFormat &mediumFormat); 63 63 const CMediumFormat &VDIMeiumFormat() const; 64 static QString defaultExtension(const CMediumFormat &mediumFormatRef);65 64 const QStringList formatExtensions() const; 66 65 … … 106 105 107 106 108 class UI DiskSizeAndLocationGroupBox : public QIWithRetranslateUI<QGroupBox>107 class UIMediumSizeAndPathGroupBox : public QIWithRetranslateUI<QGroupBox> 109 108 { 110 109 Q_OBJECT; … … 115 114 public: 116 115 117 UI DiskSizeAndLocationGroupBox(QWidget *pParent = 0);116 UIMediumSizeAndPathGroupBox(QWidget *pParent = 0); 118 117 119 QString location() const;120 void set Location(const QString &strLocation);121 void update LocationEditorAfterFormatChange(const CMediumFormat &mediumFormat, const QStringList &formatExtensions);118 QString mediumPath() const; 119 void setMediumPath(const QString &strMediumPath); 120 void updateMediumPath(const CMediumFormat &mediumFormat, const QStringList &formatExtensions); 122 121 123 122 private: -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMNameOSTypePageBasic.cpp
r90223 r90225 447 447 { 448 448 UIWizardNewVM *pWizard = qobject_cast<UIWizardNewVM*>(this->wizard()); 449 AssertReturnVoid(pWizard); 449 450 UIWizardNewVMNameOSTypePage::determineOSType(strPath, pWizard); 450 if (pWizard) 451 { 452 if (!pWizard->detectedOSTypeId().isEmpty() && !m_userModifiedParameters.contains("GuestOSType")) 451 452 if (!pWizard->detectedOSTypeId().isEmpty() && !m_userModifiedParameters.contains("GuestOSType")) 453 453 UIWizardNewVMNameOSTypePage::guessOSTypeFromName(m_pNameAndSystemEditor, pWizard->detectedOSTypeId()); 454 455 } 454 pWizard->setISOFilePath(strPath); 455 456 456 /* Update the global recent ISO path: */ 457 457 QFileInfo fileInfo(strPath); -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.cpp
r90223 r90225 123 123 UIWizardNewVMNameOSTypePage::guessOSTypeFromName(m_pNameAndSystemEditor, strNewName); 124 124 UIWizardNewVMNameOSTypePage::composeMachineFilePath(m_pNameAndSystemEditor, qobject_cast<UIWizardNewVM*>(wizard())); 125 updateVirtual DiskPathFromMachinePathName();125 updateVirtualMediumPathFromMachinePathName(); 126 126 emit completeChanged(); 127 127 } … … 131 131 Q_UNUSED(strNewPath); 132 132 UIWizardNewVMNameOSTypePage::composeMachineFilePath(m_pNameAndSystemEditor, qobject_cast<UIWizardNewVM*>(wizard())); 133 updateVirtual DiskPathFromMachinePathName();133 updateVirtualMediumPathFromMachinePathName(); 134 134 } 135 135 … … 147 147 } 148 148 149 void UIWizardNewVMPageExpert::sltISOPathChanged(const QString &strPath) 150 { 151 Q_UNUSED(strPath); 152 // determineOSType(strPath); 153 // setTypeByISODetectedOSType(m_strDetectedOSTypeId); 154 // disableEnableUnattendedRelatedWidgets(isUnattendedEnabled()); 155 156 // /* Update the global recent ISO path: */ 157 // QFileInfo fileInfo(strPath); 158 // if (fileInfo.exists() && fileInfo.isReadable()) 159 // uiCommon().updateRecentlyUsedMediumListAndFolder(UIMediumDeviceType_DVD, strPath); 160 // setSkipCheckBoxEnable(); 161 // emit completeChanged(); 149 void UIWizardNewVMPageExpert::sltISOPathChanged(const QString &strISOPath) 150 { 151 UIWizardNewVM *pWizard = qobject_cast<UIWizardNewVM*>(wizard()); 152 AssertReturnVoid(pWizard); 153 154 UIWizardNewVMNameOSTypePage::determineOSType(strISOPath, pWizard); 155 156 if (!pWizard->detectedOSTypeId().isEmpty() && !m_userModifiedParameters.contains("GuestOSType")) 157 UIWizardNewVMNameOSTypePage::guessOSTypeFromName(m_pNameAndSystemEditor, pWizard->detectedOSTypeId()); 158 newVMWizardPropertySet(ISOFilePath, strISOPath); 159 160 /* Update the global recent ISO path: */ 161 QFileInfo fileInfo(strISOPath); 162 if (fileInfo.exists() && fileInfo.isReadable()) 163 uiCommon().updateRecentlyUsedMediumListAndFolder(UIMediumDeviceType_DVD, strISOPath); 164 setSkipCheckBoxEnable(); 165 disableEnableUnattendedRelatedWidgets(pWizard->isUnattendedEnabled()); 166 emit completeChanged(); 162 167 } 163 168 … … 168 173 } 169 174 170 void UIWizardNewVMPageExpert::sltOSFamilyTypeChanged() 171 { 172 //disableEnableProductKeyWidgets(isProductKeyWidgetEnabled()); 175 void UIWizardNewVMPageExpert::sltOSFamilyTypeChanged(const QString &strGuestOSFamilyType) 176 { 177 if (m_pAdditionalOptionsContainer) 178 m_pAdditionalOptionsContainer->disableEnableProductKeyWidgets(isProductKeyWidgetEnabled()); 179 m_userModifiedParameters << "GuestOSFamilyId"; 180 newVMWizardPropertySet(GuestOSFamilyId, strGuestOSFamilyType); 173 181 } 174 182 … … 222 230 connect(m_pNameAndSystemEditor, &UINameAndSystemEditor::sigOsTypeChanged, 223 231 this, &UIWizardNewVMPageExpert::sltOsTypeChanged); 224 // connect(m_pNameAndSystemEditor, &UINameAndSystemEditor::sigOSFamilyChanged, 225 // this, &UIWizardNewVMPageExpert::sltOSFamilyTypeChanged); 226 // connect(m_pNameAndSystemEditor, &UINameAndSystemEditor::sigImageChanged, 227 // this, &UIWizardNewVMPageExpert::sltISOPathChanged); 228 } 229 232 connect(m_pNameAndSystemEditor, &UINameAndSystemEditor::sigOSFamilyChanged, 233 this, &UIWizardNewVMPageExpert::sltOSFamilyTypeChanged); 234 connect(m_pNameAndSystemEditor, &UINameAndSystemEditor::sigImageChanged, 235 this, &UIWizardNewVMPageExpert::sltISOPathChanged); 236 } 237 238 if (m_pHardwareWidgetContainer) 239 { 240 connect(m_pHardwareWidgetContainer, &UINewVMHardwareContainer::sigMemorySizeChanged, 241 this, &UIWizardNewVMPageExpert::sltMemorySizeChanged); 242 connect(m_pHardwareWidgetContainer, &UINewVMHardwareContainer::sigCPUCountChanged, 243 this, &UIWizardNewVMPageExpert::sltCPUCountChanged); 244 connect(m_pHardwareWidgetContainer, &UINewVMHardwareContainer::sigEFIEnabledChanged, 245 this, &UIWizardNewVMPageExpert::sltEFIEnabledChanged); 246 } 230 247 // /* Connections for username, password, and hostname: */ 231 248 // if (m_pUserNamePasswordGroupBox) … … 240 257 // this, &UIWizardNewVMPageExpert::sltInstallGACheckBoxToggle); 241 258 242 // if (m_pBaseMemoryEditor)243 // connect(m_pBaseMemoryEditor, &UIBaseMemoryEditor::sigValueChanged,244 // this, &UIWizardNewVMPageExpert::sltValueModified);245 // if (m_pEFICheckBox)246 // connect(m_pEFICheckBox, &QCheckBox::toggled,247 // this, &UIWizardNewVMPageExpert::sltValueModified);248 249 259 // if (m_pFormatButtonGroup) 250 260 // connect(m_pFormatButtonGroup, static_cast<void(QButtonGroup::*)(QAbstractButton*)>(&QButtonGroup::buttonClicked), … … 291 301 292 302 293 //KFirmwareType fwType = type.GetRecommendedFirmware();294 // if (m_pEFICheckBox && !m_userSetWidgets.contains(m_pEFICheckBox))295 //{296 // m_pEFICheckBox->blockSignals(true);297 // m_pEFICheckBox->setChecked(fwType != KFirmwareType_BIOS);298 // m_pEFICheckBox->blockSignals(false);299 //}303 KFirmwareType fwType = type.GetRecommendedFirmware(); 304 if (m_pHardwareWidgetContainer && !m_userModifiedParameters.contains("EFIEnabled")) 305 { 306 m_pHardwareWidgetContainer->blockSignals(true); 307 m_pHardwareWidgetContainer->setEFIEnabled(fwType != KFirmwareType_BIOS); 308 m_pHardwareWidgetContainer->blockSignals(false); 309 } 300 310 // LONG64 recommendedDiskSize = type.GetRecommendedHDD(); 301 311 // /* Prepare initial disk choice: */ … … 350 360 } 351 361 352 362 /* Medium related properties: */ 353 363 if (m_pFormatButtonGroup) 354 364 newVMWizardPropertySet(MediumFormat, m_pFormatButtonGroup->mediumFormat()); 355 365 updateVirtualMediumPathFromMachinePathName(); 356 366 357 367 // disableEnableUnattendedRelatedWidgets(isUnattendedEnabled()); 358 368 setOSTypeDependedValues(); 359 369 // disableEnableUnattendedRelatedWidgets(isUnattendedEnabled()); 360 updateVirtualDiskPathFromMachinePathName(); 370 361 371 362 372 // updateWidgetAterMediumFormatChange(); … … 405 415 QGridLayout *pDiskContainerLayout = new QGridLayout(pNewDiskContainerWidget); 406 416 407 m_pSizeAndLocationGroup = new UI DiskSizeAndLocationGroupBox;417 m_pSizeAndLocationGroup = new UIMediumSizeAndPathGroupBox; 408 418 pDiskContainerLayout->addWidget(m_pSizeAndLocationGroup, 0, 0, 2, 2); 409 419 m_pFormatButtonGroup = new UIDiskFormatsGroupBox; … … 574 584 bool UIWizardNewVMPageExpert::isProductKeyWidgetEnabled() const 575 585 { 576 // UIWizardNewVM *pWizard = wizardImp(); 577 // AssertReturn(pWizard, false); 578 // if (!pWizard->isUnattendedEnabled() || !pWizard->isGuestOSTypeWindows()) 579 // return false; 586 UIWizardNewVM *pWizard = qobject_cast<UIWizardNewVM*>(wizard()); 587 if (!pWizard || !pWizard->isUnattendedEnabled() || !pWizard->isGuestOSTypeWindows()) 588 return false; 580 589 return true; 581 590 } … … 595 604 } 596 605 597 void UIWizardNewVMPageExpert::sltValueModified()598 {599 QWidget *pSenderWidget = qobject_cast<QWidget*>(sender());600 if (!pSenderWidget)601 return;602 603 }604 605 606 void UIWizardNewVMPageExpert::sltSkipUnattendedCheckBoxChecked() 606 607 { … … 652 653 } 653 654 654 void UIWizardNewVMPageExpert::updateVirtualDiskPathFromMachinePathName() 655 void UIWizardNewVMPageExpert::sltMemorySizeChanged(int iValue) 656 { 657 newVMWizardPropertySet(MemorySize, iValue); 658 m_userModifiedParameters << "MemorySize"; 659 } 660 661 void UIWizardNewVMPageExpert::sltCPUCountChanged(int iCount) 662 { 663 newVMWizardPropertySet(CPUCount, iCount); 664 } 665 666 void UIWizardNewVMPageExpert::sltEFIEnabledChanged(bool fEnabled) 667 { 668 newVMWizardPropertySet(EFIEnabled, fEnabled); 669 m_userModifiedParameters << "EFIEnabled"; 670 } 671 672 void UIWizardNewVMPageExpert::updateVirtualMediumPathFromMachinePathName() 655 673 { 656 674 UIWizardNewVM *pWizard = qobject_cast<UIWizardNewVM*>(wizard()); 657 675 AssertReturnVoid(pWizard); 658 676 QString strDiskFileName = pWizard->machineBaseName().isEmpty() ? QString("NewVirtualDisk1") : pWizard->machineBaseName(); 659 QString str DiskPath = pWizard->machineFolder();660 if (str DiskPath.isEmpty())677 QString strMediumPath = pWizard->machineFolder(); 678 if (strMediumPath.isEmpty()) 661 679 { 662 680 if (m_pNameAndSystemEditor) 663 str DiskPath = m_pNameAndSystemEditor->path();681 strMediumPath = m_pNameAndSystemEditor->path(); 664 682 else 665 str DiskPath = uiCommon().virtualBox().GetSystemProperties().GetDefaultMachineFolder();683 strMediumPath = uiCommon().virtualBox().GetSystemProperties().GetDefaultMachineFolder(); 666 684 } 667 685 QString strExtension = UIWizardNewVMDiskPage::defaultExtension(pWizard->mediumFormat()); … … 672 690 QString strMediumPath = 673 691 UIWizardNewVMDiskPage::absoluteFilePath(UIWizardNewVMDiskPage::toFileName(strDiskFileName, 674 strExtension), str DiskPath);675 m_pSizeAndLocationGroup->set Location(strMediumPath);692 strExtension), strMediumPath); 693 m_pSizeAndLocationGroup->setMediumPath(strMediumPath); 676 694 } 677 695 } … … 684 702 AssertReturnVoid(!comMediumFormat.isNull()); 685 703 m_pDiskVariantGroupBox->updateMediumVariantWidgetsAfterFormatChange(comMediumFormat); 686 m_pSizeAndLocationGroup->update LocationEditorAfterFormatChange(comMediumFormat, m_pFormatButtonGroup->formatExtensions());704 m_pSizeAndLocationGroup->updateMediumPath(comMediumFormat, m_pFormatButtonGroup->formatExtensions()); 687 705 } 688 706 … … 725 743 return pContainerWidget; 726 744 } 745 746 void UIWizardNewVMPageExpert::setSkipCheckBoxEnable() 747 { 748 if (!m_pSkipUnattendedCheckBox) 749 return; 750 if (m_pNameAndSystemEditor) 751 { 752 const QString &strPath = m_pNameAndSystemEditor->image(); 753 m_pSkipUnattendedCheckBox->setEnabled(!strPath.isNull() && !strPath.isEmpty()); 754 } 755 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.h
r90217 r90225 42 42 class UIAdditionalUnattendedOptions; 43 43 class UIDiskFormatsGroupBox; 44 class UI DiskSizeAndLocationGroupBox;44 class UIMediumSizeAndPathGroupBox; 45 45 class UIDiskVariantGroupBox; 46 46 class UIFilePathSelector; … … 77 77 void sltISOPathChanged(const QString &strPath); 78 78 void sltGAISOPathChanged(const QString &strPath); 79 void sltOSFamilyTypeChanged( );79 void sltOSFamilyTypeChanged(const QString &strGuestOSFamilyType); 80 80 void sltInstallGACheckBoxToggle(bool fEnabled); 81 void sltValueModified();82 81 void sltSkipUnattendedCheckBoxChecked(); 83 82 void sltMediumFormatChanged(); … … 85 84 void sltSelectedDiskSourceChanged(); 86 85 void sltSelectLocationButtonClicked(); 86 87 void sltMemorySizeChanged(int iValue); 88 void sltCPUCountChanged(int iCount); 89 void sltEFIEnabledChanged(bool fEnabled); 90 87 91 88 92 private: … … 122 126 QWidget *createNameOSTypeWidgets(); 123 127 124 void updateVirtual DiskPathFromMachinePathName();128 void updateVirtualMediumPathFromMachinePathName(); 125 129 void updateWidgetAterMediumFormatChange(); 126 130 void setEnableNewDiskWidgets(bool fEnable); 127 131 void setVirtualDiskFromDiskCombo(); 132 void setSkipCheckBoxEnable(); 128 133 129 134 /** @name Variables … … 132 137 UIDiskVariantGroupBox *m_pDiskVariantGroupBox; 133 138 UIDiskFormatsGroupBox *m_pFormatButtonGroup; 134 UI DiskSizeAndLocationGroupBox *m_pSizeAndLocationGroup;139 UIMediumSizeAndPathGroupBox *m_pSizeAndLocationGroup; 135 140 UINameAndSystemEditor *m_pNameAndSystemEditor; 136 141 QCheckBox *m_pSkipUnattendedCheckBox;
Note:
See TracChangeset
for help on using the changeset viewer.