Changeset 108568 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Mar 17, 2025 11:18:04 AM (5 weeks ago)
- svn:sync-xref-src-repo-rev:
- 167973
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMHardwarePage.cpp
r108567 r108568 27 27 28 28 /* Qt includes: */ 29 #include <QCheckBox> 29 30 #include <QVBoxLayout> 30 31 … … 35 36 #include "UIGlobalSession.h" 36 37 #include "UIGuestOSType.h" 38 #include "UIMediumSizeEditor.h" 39 #include "UITranslationEventListener.h" 37 40 #include "UIVirtualCPUEditor.h" 38 41 #include "UIWizardNewVM.h" 39 #include "UIWizardNewVMEditors.h"40 42 #include "UIWizardNewVMHardwarePage.h" 41 43 … … 46 48 : UINativeWizardPage(strHelpKeyword) 47 49 , m_pLabel(0) 48 , m_pHardwareWidgetContainer(0) 50 , m_pBaseMemoryEditor(0) 51 , m_pVirtualCPUEditor(0) 52 , m_pEFICheckBox(0) 53 , m_pMediumSizeEditor(0) 49 54 , m_fVDIFormatFound(false) 50 55 , m_uMediumSizeMin(_4M) … … 61 66 m_pLabel = new QIRichTextLabel(this); 62 67 pMainLayout->addWidget(m_pLabel); 63 m_pHardwareWidgetContainer = new UINewVMHardwareContainer(this, true /* with medium size editor */); 64 AssertReturnVoid(m_pHardwareWidgetContainer); 65 pMainLayout->addWidget(m_pHardwareWidgetContainer); 68 QWidget *pHardwareWidgetContainer = new QWidget(this); 69 AssertReturnVoid(pHardwareWidgetContainer); 70 71 QGridLayout *pContainerLayout = new QGridLayout(pHardwareWidgetContainer); 72 pContainerLayout->setContentsMargins(0, 0, 0, 0); 73 74 m_pBaseMemoryEditor = new UIBaseMemoryEditor; 75 m_pVirtualCPUEditor = new UIVirtualCPUEditor; 76 m_pMediumSizeEditor = new UIMediumSizeEditor; 77 m_pEFICheckBox = new QCheckBox; 78 pContainerLayout->addWidget(m_pBaseMemoryEditor, 0, 0, 1, 4); 79 pContainerLayout->addWidget(m_pVirtualCPUEditor, 1, 0, 1, 4); 80 pContainerLayout->addWidget(m_pMediumSizeEditor, 2, 0, 1, 4); 81 pContainerLayout->addWidget(m_pEFICheckBox, 3, 0, 1, 1); 82 83 pMainLayout->addWidget(pHardwareWidgetContainer); 66 84 67 85 pMainLayout->addStretch(); … … 71 89 void UIWizardNewVMHardwarePage::createConnections() 72 90 { 73 if (m_pHardwareWidgetContainer) 74 { 75 connect(m_pHardwareWidgetContainer, &UINewVMHardwareContainer::sigMemorySizeChanged, 91 if (m_pBaseMemoryEditor) 92 connect(m_pBaseMemoryEditor, &UIBaseMemoryEditor::sigValueChanged, 76 93 this, &UIWizardNewVMHardwarePage::sltMemorySizeChanged); 77 connect(m_pHardwareWidgetContainer, &UINewVMHardwareContainer::sigCPUCountChanged, 94 if (m_pVirtualCPUEditor) 95 connect(m_pVirtualCPUEditor, &UIVirtualCPUEditor::sigValueChanged, 78 96 this, &UIWizardNewVMHardwarePage::sltCPUCountChanged); 79 connect(m_pHardwareWidgetContainer, &UINewVMHardwareContainer::sigEFIEnabledChanged, 97 if (m_pEFICheckBox) 98 connect(m_pEFICheckBox, &QCheckBox::toggled, 80 99 this, &UIWizardNewVMHardwarePage::sltEFIEnabledChanged); 81 connect(m_pHardwareWidgetContainer, &UINewVMHardwareContainer::sigSizeChanged, 100 if (m_pMediumSizeEditor) 101 connect(m_pMediumSizeEditor, &UIMediumSizeEditor::sigSizeChanged, 82 102 this, &UIWizardNewVMHardwarePage::sltHandleSizeEditorChange); 83 } 103 104 connect(&translationEventListener(), &UITranslationEventListener::sigRetranslateUI, 105 this, &UIWizardNewVMHardwarePage::sltRetranslateUI); 84 106 } 85 107 … … 97 119 98 120 UIWizardNewVM *pWizard = wizardWindow<UIWizardNewVM>(); 99 if (pWizard && m_pHardwareWidgetContainer) 100 { 101 const QString &strTypeId = pWizard->guestOSTypeId(); 102 103 m_pHardwareWidgetContainer->blockSignals(true); 104 if (!m_userModifiedParameters.contains("MemorySize")) 105 { 106 ULONG recommendedRam = gpGlobalSession->guestOSTypeManager().getRecommendedRAM(strTypeId); 107 m_pHardwareWidgetContainer->setMemorySize(recommendedRam); 108 pWizard->setMemorySize(recommendedRam); 109 } 110 if (!m_userModifiedParameters.contains("CPUCount")) 111 { 112 ULONG recommendedCPUs = gpGlobalSession->guestOSTypeManager().getRecommendedCPUCount(strTypeId); 113 m_pHardwareWidgetContainer->setCPUCount(recommendedCPUs); 114 pWizard->setCPUCount(recommendedCPUs); 115 } 116 if (!m_userModifiedParameters.contains("EFIEnabled")) 117 { 118 KFirmwareType fwType = gpGlobalSession->guestOSTypeManager().getRecommendedFirmware(strTypeId); 119 m_pHardwareWidgetContainer->setEFIEnabled(fwType != KFirmwareType_BIOS); 120 pWizard->setEFIEnabled(fwType != KFirmwareType_BIOS); 121 } 122 m_pHardwareWidgetContainer->blockSignals(false); 123 } 121 const QString &strTypeId = pWizard->guestOSTypeId(); 122 123 if (m_pBaseMemoryEditor && !m_userModifiedParameters.contains("MemorySize")) 124 { 125 m_pBaseMemoryEditor->blockSignals(true); 126 ULONG recommendedRam = gpGlobalSession->guestOSTypeManager().getRecommendedRAM(strTypeId); 127 m_pBaseMemoryEditor->setValue(recommendedRam); 128 pWizard->setMemorySize(recommendedRam); 129 m_pBaseMemoryEditor->blockSignals(false); 130 } 131 if (m_pVirtualCPUEditor && !m_userModifiedParameters.contains("CPUCount")) 132 { 133 m_pVirtualCPUEditor->blockSignals(true); 134 ULONG recommendedCPUs = gpGlobalSession->guestOSTypeManager().getRecommendedCPUCount(strTypeId); 135 m_pVirtualCPUEditor->setValue(recommendedCPUs); 136 pWizard->setCPUCount(recommendedCPUs); 137 m_pVirtualCPUEditor->blockSignals(false); 138 } 139 if (m_pEFICheckBox && !m_userModifiedParameters.contains("EFIEnabled")) 140 { 141 m_pEFICheckBox->blockSignals(true); 142 KFirmwareType fwType = gpGlobalSession->guestOSTypeManager().getRecommendedFirmware(strTypeId); 143 m_pEFICheckBox->setChecked(fwType != KFirmwareType_BIOS); 144 pWizard->setEFIEnabled(fwType != KFirmwareType_BIOS); 145 m_pEFICheckBox->blockSignals(false); 146 } 147 124 148 initializeVirtualHardDiskParameters(); 125 149 } … … 174 198 175 199 /* Set the recommended disk size if user has already not done so: */ 176 if (m_p HardwareWidgetContainer && !m_userModifiedParameters.contains("MediumSize"))177 { 178 m_p HardwareWidgetContainer->blockSignals(true);179 m_p HardwareWidgetContainer->setMediumSize(iRecommendedSize);180 m_p HardwareWidgetContainer->blockSignals(false);200 if (m_pMediumSizeEditor && !m_userModifiedParameters.contains("MediumSize")) 201 { 202 m_pMediumSizeEditor->blockSignals(true); 203 m_pMediumSizeEditor->setMediumSize(iRecommendedSize); 204 m_pMediumSizeEditor->blockSignals(false); 181 205 pWizard->setMediumSize(iRecommendedSize); 182 206 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMHardwarePage.h
r108567 r108568 39 39 40 40 /* Forward declarations: */ 41 class QCheckBox; 41 42 class QIRichTextLabel; 42 class UINewVMHardwareContainer; 43 class UIBaseMemoryEditor; 44 class UIVirtualCPUEditor; 45 class UIMediumSizeEditor; 43 46 44 47 class UIWizardNewVMHardwarePage : public UINativeWizardPage … … 69 72 * @{ */ 70 73 QIRichTextLabel *m_pLabel; 71 UINewVMHardwareContainer *m_pHardwareWidgetContainer; 74 UIBaseMemoryEditor *m_pBaseMemoryEditor; 75 UIVirtualCPUEditor *m_pVirtualCPUEditor; 76 QCheckBox *m_pEFICheckBox; 77 UIMediumSizeEditor *m_pMediumSizeEditor; 72 78 /** @} */ 73 79 bool m_fVDIFormatFound;
Note:
See TracChangeset
for help on using the changeset viewer.