Changeset 108567 in vbox
- Timestamp:
- Mar 17, 2025 10:48:45 AM (8 weeks ago)
- svn:sync-xref-src-repo-rev:
- 167972
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/wizards
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/wizards/editors/UIWizardNewVMEditors.cpp
r108376 r108567 36 36 #include "UIFilePathSelector.h" 37 37 #include "UIHostnameDomainNameEditor.h" 38 #include "UIMediumSizeEditor.h" 38 39 #include "UIMediumTools.h" 39 40 #include "UITranslationEventListener.h" … … 323 324 *********************************************************************************************************************************/ 324 325 325 UINewVMHardwareContainer::UINewVMHardwareContainer(QWidget *pParent /* = 0 */)326 UINewVMHardwareContainer::UINewVMHardwareContainer(QWidget *pParent, bool fWithMediumSizeEditor) 326 327 : QWidget(pParent) 327 328 , m_pBaseMemoryEditor(0) 328 329 , m_pVirtualCPUEditor(0) 329 330 , m_pEFICheckBox(0) 331 , m_pMediumSizeEditor(0) 332 , m_fWithMediumSizeEditor(fWithMediumSizeEditor) 330 333 { 331 334 prepare(); … … 350 353 } 351 354 355 void UINewVMHardwareContainer::setMediumSize(qulonglong uSize) 356 { 357 if (m_pMediumSizeEditor) 358 m_pMediumSizeEditor->setMediumSize(uSize); 359 } 360 352 361 void UINewVMHardwareContainer::prepare() 353 362 { … … 357 366 m_pBaseMemoryEditor = new UIBaseMemoryEditor; 358 367 m_pVirtualCPUEditor = new UIVirtualCPUEditor; 368 if (m_fWithMediumSizeEditor) 369 m_pMediumSizeEditor = new UIMediumSizeEditor; 359 370 m_pEFICheckBox = new QCheckBox; 360 371 pHardwareLayout->addWidget(m_pBaseMemoryEditor, 0, 0, 1, 4); 361 372 pHardwareLayout->addWidget(m_pVirtualCPUEditor, 1, 0, 1, 4); 362 pHardwareLayout->addWidget(m_pEFICheckBox, 2, 0, 1, 1); 373 if (m_pMediumSizeEditor) 374 { 375 pHardwareLayout->addWidget(m_pMediumSizeEditor, 2, 0, 1, 4); 376 pHardwareLayout->addWidget(m_pEFICheckBox, 3, 0, 1, 1); 377 } 378 else 379 pHardwareLayout->addWidget(m_pEFICheckBox, 2, 0, 1, 1); 363 380 364 381 … … 372 389 connect(m_pEFICheckBox, &QCheckBox::toggled, 373 390 this, &UINewVMHardwareContainer::sigEFIEnabledChanged); 391 if (m_pMediumSizeEditor) 392 connect(m_pMediumSizeEditor, &UIMediumSizeEditor::sigSizeChanged, 393 this, &UINewVMHardwareContainer::sigSizeChanged); 374 394 375 395 sltRetranslateUI(); -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/editors/UIWizardNewVMEditors.h
r108376 r108567 45 45 class UIHostnameDomainNameEditor; 46 46 class UIPasswordLineEdit; 47 class UIMediumSizeEditor; 47 48 class UIUserNamePasswordEditor; 48 49 class UIVirtualCPUEditor; … … 166 167 void sigCPUCountChanged(int iCount); 167 168 void sigEFIEnabledChanged(bool fEnabled); 168 169 public: 170 171 UINewVMHardwareContainer(QWidget *pParent = 0); 172 173 /** @name Wrappers for UIFilePathSelector 169 void sigSizeChanged(qulonglong uSize); 170 171 public: 172 173 UINewVMHardwareContainer(QWidget *pParent, bool fWithMediumSizeEditor); 174 175 /** @name Wrappers for members 174 176 * @{ */ 175 177 void setMemorySize(int iSize); 176 178 void setCPUCount(int iCount); 177 179 void setEFIEnabled(bool fEnabled); 180 void setMediumSize(qulonglong uSize); 178 181 /** @} */ 179 182 … … 192 195 UIVirtualCPUEditor *m_pVirtualCPUEditor; 193 196 QCheckBox *m_pEFICheckBox; 197 UIMediumSizeEditor *m_pMediumSizeEditor; 198 bool m_fWithMediumSizeEditor; 194 199 }; 195 200 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.cpp
r108376 r108567 114 114 setUnattendedPageVisible(false); 115 115 addPage(new UIWizardNewVMHardwarePage("create-vm-wizard-hardware" /* help keyword*/)); 116 addPage(new UIWizardNewVMDiskPage(m_pActionPool, "create-vm-wizard-virtual-hard-disk" /* help keyword*/));117 116 addPage(new UIWizardNewVMSummaryPage); 118 117 break; -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMDiskPage.cpp
r108548 r108567 201 201 } 202 202 203 /* Initialize medium variant parameter of the wizard (only if user has not touched the checkbox yet): */ 204 if (!m_userModifiedParameters.contains("MediumVariant")) 205 { 206 pWizard->setMediumVariant((qulonglong)KMediumVariant_Standard); 207 } 203 pWizard->setMediumVariant((qulonglong)KMediumVariant_Standard); 208 204 } 209 205 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMExpertPage.cpp
r108389 r108567 81 81 m_pToolBox->insertPage(ExpertToolboxItems_NameAndOSType, createNameOSTypeWidgets(), ""); 82 82 m_pToolBox->insertPage(ExpertToolboxItems_Unattended, createUnattendedWidgets(), ""); 83 m_pHardwareWidgetContainer = new UINewVMHardwareContainer ;83 m_pHardwareWidgetContainer = new UINewVMHardwareContainer(this, false /* without medium size editor */); 84 84 m_pToolBox->insertPage(ExpertToolboxItems_Hardware, m_pHardwareWidgetContainer, ""); 85 85 m_pToolBox->insertPage(ExpertToolboxItems_Disk, createDiskWidgets(), ""); -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMHardwarePage.cpp
r108162 r108567 32 32 #include "QIRichTextLabel.h" 33 33 #include "UIBaseMemoryEditor.h" 34 #include "UIWizardDiskEditors.h" 34 35 #include "UIGlobalSession.h" 35 36 #include "UIGuestOSType.h" … … 39 40 #include "UIWizardNewVMHardwarePage.h" 40 41 42 /* COM includes: */ 43 #include "CSystemProperties.h" 41 44 42 45 UIWizardNewVMHardwarePage::UIWizardNewVMHardwarePage(const QString strHelpKeyword /* = QString() */) … … 44 47 , m_pLabel(0) 45 48 , m_pHardwareWidgetContainer(0) 49 , m_fVDIFormatFound(false) 50 , m_uMediumSizeMin(_4M) 51 , m_uMediumSizeMax(gpGlobalSession->virtualBox().GetSystemProperties().GetInfoVDSize()) 46 52 { 47 53 prepare(); … … 55 61 m_pLabel = new QIRichTextLabel(this); 56 62 pMainLayout->addWidget(m_pLabel); 57 m_pHardwareWidgetContainer = new UINewVMHardwareContainer ;63 m_pHardwareWidgetContainer = new UINewVMHardwareContainer(this, true /* with medium size editor */); 58 64 AssertReturnVoid(m_pHardwareWidgetContainer); 59 65 pMainLayout->addWidget(m_pHardwareWidgetContainer); … … 73 79 connect(m_pHardwareWidgetContainer, &UINewVMHardwareContainer::sigEFIEnabledChanged, 74 80 this, &UIWizardNewVMHardwarePage::sltEFIEnabledChanged); 81 connect(m_pHardwareWidgetContainer, &UINewVMHardwareContainer::sigSizeChanged, 82 this, &UIWizardNewVMHardwarePage::sltHandleSizeEditorChange); 75 83 } 76 84 } … … 114 122 m_pHardwareWidgetContainer->blockSignals(false); 115 123 } 124 initializeVirtualHardDiskParameters(); 125 } 126 127 void UIWizardNewVMHardwarePage::initializeVirtualHardDiskParameters() 128 { 129 UIWizardNewVM *pWizard = wizardWindow<UIWizardNewVM>(); 130 AssertReturnVoid(pWizard); 131 132 LONG64 iRecommendedSize = 0; 133 134 if (!m_userModifiedParameters.contains("SelectedDiskSource")) 135 { 136 iRecommendedSize = gpGlobalSession->guestOSTypeManager().getRecommendedHDD(pWizard->guestOSTypeId()); 137 if (iRecommendedSize != 0) 138 { 139 pWizard->setDiskSource(SelectedDiskSource_New); 140 pWizard->setEmptyDiskRecommended(false); 141 } 142 else 143 { 144 pWizard->setDiskSource(SelectedDiskSource_Empty); 145 pWizard->setEmptyDiskRecommended(true); 146 } 147 } 148 149 if (!m_fVDIFormatFound) 150 { 151 /* We do not have any UI elements for HDD format selection since we default to VDI in case of guided wizard mode: */ 152 CSystemProperties properties = gpGlobalSession->virtualBox().GetSystemProperties(); 153 const QVector<CMediumFormat> &formats = properties.GetMediumFormats(); 154 foreach (const CMediumFormat &format, formats) 155 { 156 if (format.GetName() == "VDI") 157 { 158 pWizard->setMediumFormat(format); 159 m_fVDIFormatFound = true; 160 } 161 } 162 if (!m_fVDIFormatFound) 163 AssertMsgFailed(("No medium format corresponding to VDI could be found!")); 164 } 165 QString strDefaultExtension = UIWizardDiskEditors::defaultExtension(pWizard->mediumFormat(), KDeviceType_HardDisk); 166 167 /* We set the medium name and path according to machine name/path and do not allow user change these in the guided mode: */ 168 QString strDefaultName = pWizard->machineFileName().isEmpty() ? QString("NewVirtualDisk1") : pWizard->machineFileName(); 169 const QString &strMachineFolder = pWizard->machineFolder(); 170 QString strMediumPath = 171 UIWizardDiskEditors::constructMediumFilePath(UIWizardDiskEditors::appendExtension(strDefaultName, 172 strDefaultExtension), strMachineFolder); 173 pWizard->setMediumPath(strMediumPath); 174 175 /* Set the recommended disk size if user has already not done so: */ 176 if (m_pHardwareWidgetContainer && !m_userModifiedParameters.contains("MediumSize")) 177 { 178 m_pHardwareWidgetContainer->blockSignals(true); 179 m_pHardwareWidgetContainer->setMediumSize(iRecommendedSize); 180 m_pHardwareWidgetContainer->blockSignals(false); 181 pWizard->setMediumSize(iRecommendedSize); 182 } 183 184 pWizard->setMediumVariant((qulonglong)KMediumVariant_Standard); 116 185 } 117 186 118 187 bool UIWizardNewVMHardwarePage::isComplete() const 119 188 { 120 return true; 189 UIWizardNewVM *pWizard = wizardWindow<UIWizardNewVM>(); 190 AssertReturn(pWizard, false); 191 192 const qulonglong uSize = pWizard->mediumSize(); 193 if (pWizard->diskSource() == SelectedDiskSource_New) 194 return uSize >= m_uMediumSizeMin && uSize <= m_uMediumSizeMax; 195 return true; 121 196 } 122 197 … … 141 216 m_userModifiedParameters << "EFIEnabled"; 142 217 } 218 219 void UIWizardNewVMHardwarePage::sltHandleSizeEditorChange(qulonglong uSize) 220 { 221 AssertReturnVoid(wizardWindow<UIWizardNewVM>()); 222 wizardWindow<UIWizardNewVM>()->setMediumSize(uSize); 223 m_userModifiedParameters << "MediumSize"; 224 emit completeChanged(); 225 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMHardwarePage.h
r107002 r108567 55 55 void sltCPUCountChanged(int iCount); 56 56 void sltEFIEnabledChanged(bool fEnabled); 57 void sltHandleSizeEditorChange(qulonglong uSize); 57 58 virtual void sltRetranslateUI() RT_OVERRIDE RT_FINAL; 58 59 … … 64 65 virtual void initializePage() RT_OVERRIDE RT_FINAL; 65 66 virtual bool isComplete() const RT_OVERRIDE RT_FINAL; 66 67 void initializeVirtualHardDiskParameters(); 67 68 /** @name Widgets 68 69 * @{ */ … … 70 71 UINewVMHardwareContainer *m_pHardwareWidgetContainer; 71 72 /** @} */ 73 bool m_fVDIFormatFound; 74 qulonglong m_uMediumSizeMin; 75 qulonglong m_uMediumSizeMax; 72 76 /** This set is used to decide if we have to set wizard's parameters 73 77 * some default values or not. When user modifies a value through a widget we
Note:
See TracChangeset
for help on using the changeset viewer.