Changeset 90208 in vbox for trunk/src/VBox
- Timestamp:
- Jul 15, 2021 9:51:10 AM (4 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/wizards
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/wizards/editors/UIWizardNewVMEditors.cpp
r90174 r90208 23 23 /* GUI includes: */ 24 24 #include "QILineEdit.h" 25 #include "UIBaseMemoryEditor.h" 25 26 #include "UICommon.h" 26 27 #include "UIHostnameDomainNameEditor.h" … … 29 30 #include "UIWizardNewVM.h" 30 31 #include "UIWizardNewVMEditors.h" 32 #include "UIVirtualCPUEditor.h" 31 33 32 34 /* Other VBox includes: */ … … 313 315 m_pProductKeyLineEdit->setEnabled(fEnabled); 314 316 } 317 318 /********************************************************************************************************************************* 319 * UINewVMHardwareContainer implementation. * 320 *********************************************************************************************************************************/ 321 322 UINewVMHardwareContainer::UINewVMHardwareContainer(QWidget *pParent /* = 0 */) 323 : QIWithRetranslateUI<QWidget>(pParent) 324 , m_pBaseMemoryEditor(0) 325 , m_pVirtualCPUEditor(0) 326 , m_pEFICheckBox(0) 327 { 328 prepare(); 329 } 330 331 void UINewVMHardwareContainer::setMemorySize(int iSize) 332 { 333 if (m_pBaseMemoryEditor) 334 m_pBaseMemoryEditor->setValue(iSize); 335 } 336 337 void UINewVMHardwareContainer::setEFIEnabled(bool fEnabled) 338 { 339 if (m_pEFICheckBox) 340 m_pEFICheckBox->setChecked(fEnabled); 341 } 342 343 void UINewVMHardwareContainer::prepare() 344 { 345 QGridLayout *pHardwareLayout = new QGridLayout(this); 346 pHardwareLayout->setContentsMargins(0, 0, 0, 0); 347 348 m_pBaseMemoryEditor = new UIBaseMemoryEditor(0, true); 349 m_pVirtualCPUEditor = new UIVirtualCPUEditor(0, true); 350 m_pEFICheckBox = new QCheckBox; 351 pHardwareLayout->addWidget(m_pBaseMemoryEditor, 0, 0, 1, 4); 352 pHardwareLayout->addWidget(m_pVirtualCPUEditor, 1, 0, 1, 4); 353 pHardwareLayout->addWidget(m_pEFICheckBox, 2, 0, 1, 1); 354 355 356 if (m_pBaseMemoryEditor) 357 connect(m_pBaseMemoryEditor, &UIBaseMemoryEditor::sigValueChanged, 358 this, &UINewVMHardwareContainer::sigMemorySizeChanged); 359 if (m_pVirtualCPUEditor) 360 connect(m_pVirtualCPUEditor, &UIVirtualCPUEditor::sigValueChanged, 361 this, &UINewVMHardwareContainer::sigCPUCountChanged); 362 if (m_pEFICheckBox) 363 connect(m_pEFICheckBox, &QCheckBox::toggled, 364 this, &UINewVMHardwareContainer::sigEFIEnabledChanged); 365 366 367 retranslateUi(); 368 } 369 370 void UINewVMHardwareContainer::retranslateUi() 371 { 372 if (m_pEFICheckBox) 373 { 374 m_pEFICheckBox->setText(UIWizardNewVM::tr("&Enable EFI (special OSes only)")); 375 m_pEFICheckBox->setToolTip(UIWizardNewVM::tr("<p>When checked, the guest will support the " 376 "Extended Firmware Interface (EFI), which is required to boot certain " 377 "guest OSes. Non-EFI aware OSes will not be able to boot if this option is activated.</p>")); 378 } 379 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/editors/UIWizardNewVMEditors.h
r90174 r90208 34 34 class QLabel; 35 35 class QILineEdit; 36 class UIBaseMemoryEditor; 36 37 class UIFilePathSelector; 37 38 class UIHostnameDomainNameEditor; 38 39 class UIPasswordLineEdit; 39 40 class UIUserNamePasswordEditor; 41 class UIVirtualCPUEditor; 40 42 41 43 class UIUserNamePasswordGroupBox : public QIWithRetranslateUI<QGroupBox> … … 141 143 }; 142 144 145 146 class UINewVMHardwareContainer : public QIWithRetranslateUI<QWidget> 147 { 148 Q_OBJECT; 149 150 signals: 151 152 void sigMemorySizeChanged(int iSize); 153 void sigCPUCountChanged(int iCount); 154 void sigEFIEnabledChanged(bool fEnabled); 155 156 public: 157 158 UINewVMHardwareContainer(QWidget *pParent = 0); 159 160 /** @name Wrappers for UIFilePathSelector 161 * @{ */ 162 void setMemorySize(int size); 163 void setEFIEnabled(bool fEnabled); 164 /** @} */ 165 166 private: 167 168 void prepare(); 169 virtual void retranslateUi() /* override final */; 170 171 UIBaseMemoryEditor *m_pBaseMemoryEditor; 172 UIVirtualCPUEditor *m_pVirtualCPUEditor; 173 QCheckBox *m_pEFICheckBox; 174 }; 175 143 176 #endif /* !FEQT_INCLUDED_SRC_wizards_editors_UIWizardNewVMEditors_h */ -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMHardwarePageBasic.cpp
r90073 r90208 28 28 #include "UIVirtualCPUEditor.h" 29 29 #include "UIWizardNewVM.h" 30 #include "UIWizardNewVMEditors.h" 30 31 #include "UIWizardNewVMHardwarePageBasic.h" 31 32 #include "UIWizardNewVDPageSizeLocation.h" … … 35 36 36 37 UIWizardNewVMHardwarePageBasic::UIWizardNewVMHardwarePageBasic() 37 : m_pBaseMemoryEditor(0) 38 , m_pVirtualCPUEditor(0) 39 , m_pEFICheckBox(0) 40 , m_pLabel(0) 38 : m_pLabel(0) 39 , m_pHardwareWidgetContainer(0) 41 40 { 42 41 prepare(); … … 50 49 m_pLabel = new QIRichTextLabel(this); 51 50 pMainLayout->addWidget(m_pLabel); 52 pMainLayout->addWidget(createHardwareWidgets()); 51 m_pHardwareWidgetContainer = new UINewVMHardwareContainer; 52 AssertReturnVoid(m_pHardwareWidgetContainer); 53 pMainLayout->addWidget(m_pHardwareWidgetContainer); 53 54 54 55 pMainLayout->addStretch(); … … 58 59 void UIWizardNewVMHardwarePageBasic::createConnections() 59 60 { 60 if (m_pBaseMemoryEditor) 61 connect(m_pBaseMemoryEditor, &UIBaseMemoryEditor::sigValueChanged, 61 if (m_pHardwareWidgetContainer) 62 { 63 connect(m_pHardwareWidgetContainer, &UINewVMHardwareContainer::sigMemorySizeChanged, 62 64 this, &UIWizardNewVMHardwarePageBasic::sltMemorySizeChanged); 63 if (m_pVirtualCPUEditor) 64 connect(m_pVirtualCPUEditor, &UIVirtualCPUEditor::sigValueChanged, 65 this, &UIWizardNewVMHardwarePageBasic::sltCPUCountChanged); 66 if (m_pEFICheckBox) 67 connect(m_pEFICheckBox, &QCheckBox::toggled, 65 connect(m_pHardwareWidgetContainer, &UINewVMHardwareContainer::sigCPUCountChanged, 66 this, &UIWizardNewVMHardwarePageBasic::sltCPUCountChanged); 67 connect(m_pHardwareWidgetContainer, &UINewVMHardwareContainer::sigEFIEnabledChanged, 68 68 this, &UIWizardNewVMHardwarePageBasic::sltEFIEnabledChanged); 69 69 } 70 70 } 71 71 … … 77 77 m_pLabel->setText(UIWizardNewVM::tr("<p>You can modify virtual machine's hardware by changing amount of RAM and " 78 78 "virtual CPU count. Enabling EFI is also possible.</p>")); 79 80 if (m_pEFICheckBox)81 {82 m_pEFICheckBox->setText(UIWizardNewVM::tr("&Enable EFI (special OSes only)"));83 m_pEFICheckBox->setToolTip(UIWizardNewVM::tr("<p>When checked, the guest will support the "84 "Extended Firmware Interface (EFI), which is required to boot certain "85 "guest OSes. Non-EFI aware OSes will not be able to boot if this option is activated.</p>"));86 }87 79 } 88 80 … … 92 84 93 85 UIWizardNewVM *pWizard = qobject_cast<UIWizardNewVM*>(wizard()); 94 if (pWizard )86 if (pWizard && m_pHardwareWidgetContainer) 95 87 { 96 88 CGuestOSType type = pWizard->guestOSType(); … … 100 92 { 101 93 ULONG recommendedRam = type.GetRecommendedRAM(); 102 if (m_pBaseMemoryEditor) 103 m_pBaseMemoryEditor->setValue(recommendedRam); 94 m_pHardwareWidgetContainer->setMemorySize(recommendedRam); 104 95 } 105 96 if (!m_userModifiedParameters.contains("EFIEnabled")) 106 97 { 107 98 KFirmwareType fwType = type.GetRecommendedFirmware(); 108 if (m_pEFICheckBox) 109 m_pEFICheckBox->setChecked(fwType != KFirmwareType_BIOS); 99 m_pHardwareWidgetContainer->setEFIEnabled(fwType != KFirmwareType_BIOS); 110 100 } 111 101 } … … 121 111 { 122 112 return true; 123 }124 125 QWidget *UIWizardNewVMHardwarePageBasic::createHardwareWidgets()126 {127 QWidget *pHardwareContainer = new QWidget;128 QGridLayout *pHardwareLayout = new QGridLayout(pHardwareContainer);129 pHardwareLayout->setContentsMargins(0, 0, 0, 0);130 131 m_pBaseMemoryEditor = new UIBaseMemoryEditor(0, true);132 m_pVirtualCPUEditor = new UIVirtualCPUEditor(0, true);133 m_pEFICheckBox = new QCheckBox;134 pHardwareLayout->addWidget(m_pBaseMemoryEditor, 0, 0, 1, 4);135 pHardwareLayout->addWidget(m_pVirtualCPUEditor, 1, 0, 1, 4);136 pHardwareLayout->addWidget(m_pEFICheckBox, 2, 0, 1, 1);137 138 return pHardwareContainer;139 113 } 140 114 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMHardwarePageBasic.h
r90073 r90208 38 38 class QIRichTextLabel; 39 39 class UIBaseMemoryEditor; 40 class UINewVMHardwareContainer; 40 41 class UIVirtualCPUEditor; 41 42 class UIWizardNewVM; … … 74 75 void initializePage(); 75 76 void cleanupPage(); 76 QWidget *createHardwareWidgets();77 77 bool isComplete() const; 78 78 79 79 /** @name Widgets 80 80 * @{ */ 81 UIBaseMemoryEditor *m_pBaseMemoryEditor;82 UIVirtualCPUEditor *m_pVirtualCPUEditor;83 QCheckBox *m_pEFICheckBox;84 81 QIRichTextLabel *m_pLabel; 82 UINewVMHardwareContainer *m_pHardwareWidgetContainer; 85 83 /** @} */ 86 84 /** This set is used to decide if we have to set wizard's parameters -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.cpp
r90206 r90208 58 58 , m_pSkipUnattendedCheckBox(0) 59 59 , m_pNameAndSystemLayout(0) 60 , m_pHardwareWidgetContainer(0) 60 61 , m_pAdditionalOptionsContainer(0) 61 62 , m_pGAInstallationISOContainer(0) … … 67 68 m_pToolBox->insertPage(ExpertToolboxItems_NameAndOSType, createNameOSTypeWidgets(), ""); 68 69 m_pToolBox->insertPage(ExpertToolboxItems_Unattended, createUnattendedWidgets(), ""); 69 //m_pToolBox->insertPage(ExpertToolboxItems_Hardware, createHardwareWidgets(), ""); 70 m_pHardwareWidgetContainer = new UINewVMHardwareContainer; 71 m_pToolBox->insertPage(ExpertToolboxItems_Hardware, m_pHardwareWidgetContainer, ""); 70 72 m_pToolBox->insertPage(ExpertToolboxItems_Disk, createNewDiskWidgets(), ""); 71 73 m_pToolBox->setCurrentPage(ExpertToolboxItems_NameAndOSType); -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.h
r90206 r90208 47 47 class UIMediumSizeEditor; 48 48 class UINameAndSystemEditor; 49 class UINewVMHardwareContainer; 49 50 class UIToolBox; 50 51 class UIUserNamePasswordGroupBox; … … 135 136 QCheckBox *m_pSkipUnattendedCheckBox; 136 137 QGridLayout *m_pNameAndSystemLayout; 138 UINewVMHardwareContainer *m_pHardwareWidgetContainer; 137 139 UIAdditionalUnattendedOptions *m_pAdditionalOptionsContainer; 138 140 UIGAInstallationGroupBox *m_pGAInstallationISOContainer;
Note:
See TracChangeset
for help on using the changeset viewer.