- Timestamp:
- Mar 2, 2021 8:58:03 AM (4 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/wizards
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic1.cpp
r87859 r87907 147 147 void UIWizardNewVDPage1::retranslateWidgets() 148 148 { 149 QList<QAbstractButton*> buttons = m_pFormatButtonGroup->buttons(); 150 for (int i = 0; i < buttons.size(); ++i) 151 { 152 QAbstractButton *pButton = buttons[i]; 153 UIMediumFormat enmFormat = gpConverter->fromInternalString<UIMediumFormat>(m_formatNames[m_pFormatButtonGroup->id(pButton)]); 154 pButton->setText(gpConverter->toString(enmFormat)); 149 if (m_pFormatButtonGroup) 150 { 151 QList<QAbstractButton*> buttons = m_pFormatButtonGroup->buttons(); 152 for (int i = 0; i < buttons.size(); ++i) 153 { 154 QAbstractButton *pButton = buttons[i]; 155 UIMediumFormat enmFormat = gpConverter->fromInternalString<UIMediumFormat>(m_formatNames[m_pFormatButtonGroup->id(pButton)]); 156 pButton->setText(gpConverter->toString(enmFormat)); 157 } 155 158 } 156 159 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.cpp
r87887 r87907 86 86 setPage(Page2, new UIWizardNewVMPageBasic2); 87 87 setPage(Page4, new UIWizardNewVMPageBasic4); 88 setPage(Page5, new UIWizardNewVMPageBasic5);89 88 setPage(Page8, new UIWizardNewVMPageBasic8); 90 89 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic4.cpp
r87903 r87907 30 30 #include "UIMedium.h" 31 31 #include "UIMediumSelector.h" 32 #include "UIMediumSizeEditor.h" 32 33 #include "UIMessageCenter.h" 33 34 #include "UIWizardNewVD.h" 34 35 #include "UIWizardNewVMPageBasic4.h" 36 37 /* COM includes: */ 38 #include "CGuestOSType.h" 39 #include "CSystemProperties.h" 35 40 36 41 UIWizardNewVMPage4::UIWizardNewVMPage4() … … 179 184 UIWizardNewVMPageBasic4::UIWizardNewVMPageBasic4() 180 185 : m_pLabel(0) 186 , m_fUserSetSize(false) 187 181 188 { 182 189 prepare(); … … 185 192 registerField("virtualDisk", this, "virtualDisk"); 186 193 registerField("selectedDiskSource", this, "selectedDiskSource"); 194 195 registerField("mediumFormat", this, "mediumFormat"); 196 registerField("mediumVariant" /* KMediumVariant */, this, "mediumVariant"); 197 registerField("mediumPath", this, "mediumPath"); 198 registerField("mediumSize", this, "mediumSize"); 199 200 /* We do not have any UI elements for HDD format selection since we default to VDI in case of guided wizard mode: */ 201 bool fFoundVDI = false; 202 CSystemProperties properties = uiCommon().virtualBox().GetSystemProperties(); 203 const QVector<CMediumFormat> &formats = properties.GetMediumFormats(); 204 foreach (const CMediumFormat &format, formats) 205 { 206 if (format.GetName() == "VDI") 207 { 208 m_mediumFormat = format; 209 fFoundVDI = true; 210 } 211 } 212 if (!fFoundVDI) 213 AssertMsgFailed(("No medium format corresponding to VDI could be found!")); 214 215 m_strDefaultExtension = defaultExtension(m_mediumFormat); 216 217 /* Since the medium format is static we can decide widget visibility here: */ 218 setWidgetVisibility(m_mediumFormat); 219 } 220 221 CMediumFormat UIWizardNewVMPageBasic4::mediumFormat() const 222 { 223 return m_mediumFormat; 224 } 225 226 QString UIWizardNewVMPageBasic4::mediumPath() const 227 { 228 return absoluteFilePath(toFileName(m_strDefaultName, m_strDefaultExtension), m_strDefaultPath); 187 229 } 188 230 … … 204 246 pMainLayout->addStretch(); 205 247 setEnableDiskSelectionWidgets(m_enmSelectedDiskSource == SelectedDiskSource_Existing); 248 249 250 pMainLayout->addWidget(createMediumVariantWidgets(true)); 251 252 m_pSizeLabel = new QIRichTextLabel; 253 m_pSizeEditor = new UIMediumSizeEditor; 254 255 pMainLayout->addWidget(m_pSizeLabel); 256 pMainLayout->addWidget(m_pSizeEditor); 257 206 258 createConnections(); 207 259 } … … 215 267 connect(m_pDiskSelectionButton, &QIToolButton::clicked, 216 268 this, &UIWizardNewVMPageBasic4::sltGetWithFileOpenDialog); 269 connect(m_pSizeEditor, &UIMediumSizeEditor::sigSizeChanged, 270 this, &UIWizardNewVMPageBasic4::completeChanged); 271 connect(m_pSizeEditor, &UIMediumSizeEditor::sigSizeChanged, 272 this, &UIWizardNewVMPageBasic4::sltHandleSizeEditorChange); 217 273 } 218 274 … … 259 315 .arg(strRecommendedHDD)); 260 316 261 retranslateWidgets(); 317 UIWizardNewVMPage4::retranslateWidgets(); 318 UIWizardNewVDPage1::retranslateWidgets(); 319 UIWizardNewVDPage2::retranslateWidgets(); 320 UIWizardNewVDPage3::retranslateWidgets(); 262 321 } 263 322 … … 291 350 if (m_pDiskSelector) 292 351 m_pDiskSelector->setCurrentIndex(0); 352 353 /* We set the medium name and path according to machine name/path and do let user change these in the guided mode: */ 354 QString strDefaultName = fieldImp("machineBaseName").toString(); 355 m_strDefaultName = strDefaultName.isEmpty() ? QString("NewVirtualDisk1") : strDefaultName; 356 m_strDefaultPath = fieldImp("machineFolder").toString(); 357 if (m_pSizeEditor && !m_fUserSetSize) 358 { 359 m_pSizeEditor->blockSignals(true); 360 setMediumSize(fieldImp("type").value<CGuestOSType>().GetRecommendedHDD()); 361 m_pSizeEditor->blockSignals(false); 362 } 363 293 364 } 294 365 … … 320 391 return fResult; 321 392 } 393 394 void UIWizardNewVMPageBasic4::sltHandleSizeEditorChange() 395 { 396 m_fUserSetSize = true; 397 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic4.h
r87903 r87907 27 27 /* GUI includes: */ 28 28 #include "UIWizardPage.h" 29 #include "UIWizardNewVDPageBasic1.h" 30 #include "UIWizardNewVDPageBasic2.h" 31 #include "UIWizardNewVDPageBasic3.h" 29 32 #include "UIWizardNewVM.h" 30 33 … … 85 88 }; 86 89 87 class UIWizardNewVMPageBasic4 : public UIWizardPage, public UIWizardNewVMPage4 90 class UIWizardNewVMPageBasic4 : public UIWizardPage, 91 public UIWizardNewVMPage4, 92 public UIWizardNewVDPage1, 93 public UIWizardNewVDPage2, 94 public UIWizardNewVDPage3 88 95 { 89 96 Q_OBJECT; 90 97 Q_PROPERTY(CMedium virtualDisk READ virtualDisk WRITE setVirtualDisk); 91 98 Q_PROPERTY(SelectedDiskSource selectedDiskSource READ selectedDiskSource WRITE setSelectedDiskSource); 99 Q_PROPERTY(CMediumFormat mediumFormat READ mediumFormat); 100 Q_PROPERTY(qulonglong mediumVariant READ mediumVariant WRITE setMediumVariant); 101 Q_PROPERTY(QString mediumPath READ mediumPath); 102 Q_PROPERTY(qulonglong mediumSize READ mediumSize WRITE setMediumSize); 92 103 93 104 public: 94 105 95 /** Constructor. */96 106 UIWizardNewVMPageBasic4(); 107 /** For the guide wizard mode medium path, name and extention is static and we have 108 * no UI element for this. thus override. */ 109 virtual QString mediumPath() const /*override */; 97 110 virtual int nextId() const /* override */; 111 CMediumFormat mediumFormat() const; 98 112 99 113 protected: … … 111 125 void sltVirtualSelectedDiskSourceChanged(); 112 126 void sltGetWithFileOpenDialog(); 127 void sltHandleSizeEditorChange(); 113 128 114 129 private: … … 125 140 126 141 QIRichTextLabel *m_pLabel; 142 143 /** This is set to true when user manually set the size. */ 144 bool m_fUserSetSize; 145 /** For guided new vm wizard VDI is the only format. Thus we have no UI item for it. */ 146 CMediumFormat m_mediumFormat; 127 147 }; 128 148 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic5.h
r87901 r87907 45 45 public UIWizardNewVDPage2, 46 46 public UIWizardNewVDPage3 47 48 47 { 49 48
Note:
See TracChangeset
for help on using the changeset viewer.