- Timestamp:
- Feb 26, 2021 4:54:52 PM (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/newvd/UIWizardNewVDPageBasic2.h
r87890 r87891 64 64 }; 65 65 66 67 66 /* 2nd page of the New Virtual Hard Drive wizard (basic extension): */ 68 67 class SHARED_LIBRARY_STUFF UIWizardNewVDPageBasic2 : public UIWizardPage, public UIWizardNewVDPage2 … … 73 72 public: 74 73 75 /* Constructor: */76 74 UIWizardNewVDPageBasic2(); 77 75 78 76 private: 79 77 80 /* Translation stuff: */81 78 void retranslateUi(); 82 83 /* Prepare stuff: */84 79 void initializePage(); 85 86 /* Validation stuff: */87 80 bool isComplete() const; 88 81 }; -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic3.cpp
r87878 r87891 54 54 , m_pLocationEditor(0) 55 55 , m_pLocationOpenButton(0) 56 , m_pEditorSize(0) 56 , m_pSizeEditor(0) 57 , m_pLocationLabel(0) 58 , m_pSizeLabel(0) 57 59 { 58 60 } … … 63 65 , m_pLocationEditor(0) 64 66 , m_pLocationOpenButton(0) 65 , m_p EditorSize(0)67 , m_pSizeEditor(0) 66 68 { 67 69 } … … 216 218 qulonglong UIWizardNewVDPage3::mediumSize() const 217 219 { 218 return m_p EditorSize ? m_pEditorSize->mediumSize() : 0;220 return m_pSizeEditor ? m_pSizeEditor->mediumSize() : 0; 219 221 } 220 222 221 223 void UIWizardNewVDPage3::setMediumSize(qulonglong uMediumSize) 222 224 { 223 if (m_p EditorSize)224 m_p EditorSize->setMediumSize(uMediumSize);225 if (m_pSizeEditor) 226 m_pSizeEditor->setMediumSize(uMediumSize); 225 227 } 226 228 … … 250 252 } 251 253 m_pSizeLabel = new QIRichTextLabel(this); 252 m_p EditorSize= new UIMediumSizeEditor;254 m_pSizeEditor = new UIMediumSizeEditor; 253 255 setMediumSize(uDefaultSize); 254 256 pMainLayout->addWidget(m_pLocationLabel); 255 257 pMainLayout->addLayout(pLocationLayout); 256 258 pMainLayout->addWidget(m_pSizeLabel); 257 pMainLayout->addWidget(m_p EditorSize);259 pMainLayout->addWidget(m_pSizeEditor); 258 260 pMainLayout->addStretch(); 259 261 } … … 262 264 connect(m_pLocationEditor, &QLineEdit::textChanged, this, &UIWizardNewVDPageBasic3::completeChanged); 263 265 connect(m_pLocationOpenButton, &QIToolButton::clicked, this, &UIWizardNewVDPageBasic3::sltSelectLocationButtonClicked); 264 connect(m_p EditorSize, &UIMediumSizeEditor::sigSizeChanged, this, &UIWizardNewVDPageBasic3::completeChanged);266 connect(m_pSizeEditor, &UIMediumSizeEditor::sigSizeChanged, this, &UIWizardNewVDPageBasic3::completeChanged); 265 267 266 268 /* Register fields: */ … … 306 308 if (!m_pLocationEditor) 307 309 return false; 308 /* Make sure current name is not empty and current size f eats the bounds: */310 /* Make sure current name is not empty and current size fits the bounds: */ 309 311 return !m_pLocationEditor->text().trimmed().isEmpty() && 310 312 mediumSize() >= m_uMediumSizeMin && mediumSize() <= m_uMediumSizeMax; -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic3.h
r87878 r87891 45 45 protected: 46 46 47 /* Constructor: */48 47 UIWizardNewVDPage3(const QString &strDefaultName, const QString &strDefaultPath); 49 48 UIWizardNewVDPage3(); 50 49 51 /* Handlers: */52 50 void onSelectLocationButtonClicked(); 53 51 54 /* Location-editors stuff: */55 52 static QString toFileName(const QString &strName, const QString &strExtension); 56 /* Returns the full image file path except the extension. */53 /** Returns the full image file path except the extension. */ 57 54 static QString absoluteFilePath(const QString &strFileName, const QString &strPath); 58 /* Returns the full image file path including the extension. */55 /** Returns the full image file path including the extension. */ 59 56 static QString absoluteFilePath(const QString &strFileName, const QString &strPath, const QString &strExtension); 60 57 61 /* Stuff for 'mediumPath' field: */62 58 QString mediumPath() const; 63 59 64 /* Stuff for 'mediumSize' field: */65 60 qulonglong mediumSize() const; 66 61 void setMediumSize(qulonglong uMediumSize); 67 62 void retranslateWidgets(); 68 63 69 /* Variables: */ 70 QString m_strDefaultName; 71 QString m_strDefaultPath; 72 QString m_strDefaultExtension; 73 qulonglong m_uMediumSizeMin; 74 qulonglong m_uMediumSizeMax; 64 /** @name Widgets 65 * @{ */ 66 QString m_strDefaultName; 67 QString m_strDefaultPath; 68 QString m_strDefaultExtension; 69 qulonglong m_uMediumSizeMin; 70 qulonglong m_uMediumSizeMax; 71 /** @} */ 75 72 76 /* Widgets: */ 77 QLineEdit *m_pLocationEditor; 78 QIToolButton *m_pLocationOpenButton; 79 UIMediumSizeEditor *m_pEditorSize; 73 /** @name Widgets 74 * @{ */ 75 QLineEdit *m_pLocationEditor; 76 QIToolButton *m_pLocationOpenButton; 77 UIMediumSizeEditor *m_pSizeEditor; 78 QIRichTextLabel *m_pLocationLabel; 79 QIRichTextLabel *m_pSizeLabel; 80 /** @} */ 80 81 }; 81 82 … … 90 91 public: 91 92 92 /* Constructor: */93 93 UIWizardNewVDPageBasic3(const QString &strDefaultName, const QString &strDefaultPath, qulonglong uDefaultSize); 94 94 95 95 protected: 96 96 97 /* Wrapper to access 'this' from base part: */97 /** Wrapper to access 'this' from base part: */ 98 98 UIWizardPage* thisImp() { return this; } 99 /* Wrapper to access 'wizard-field' from base part: */99 /** Wrapper to access 'wizard-field' from base part: */ 100 100 QVariant fieldImp(const QString &strFieldName) const { return UIWizardPage::field(strFieldName); } 101 101 102 102 private slots: 103 103 104 /* Location editors stuff: */104 /** Location editors stuff: */ 105 105 void sltSelectLocationButtonClicked(); 106 106 107 107 private: 108 108 109 /* Translation stuff: */110 109 void retranslateUi(); 111 112 /* Prepare stuff: */113 110 void initializePage(); 114 115 /* Validation stuff: */116 111 bool isComplete() const; 117 112 bool validatePage(); 118 119 /* Widgets: */120 QIRichTextLabel *m_pLocationLabel;121 QIRichTextLabel *m_pSizeLabel;122 113 }; 123 114 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageExpert.cpp
r87878 r87891 76 76 QVBoxLayout *pSizeGroupBoxLayout = new QVBoxLayout(m_pSizeGroupBox); 77 77 { 78 m_p EditorSize= new UIMediumSizeEditor;78 m_pSizeEditor = new UIMediumSizeEditor; 79 79 { 80 pSizeGroupBoxLayout->addWidget(m_p EditorSize);80 pSizeGroupBoxLayout->addWidget(m_pSizeEditor); 81 81 } 82 82 } … … 129 129 connect(m_pLocationOpenButton, &QIToolButton::clicked, 130 130 this, &UIWizardNewVDPageExpert::sltSelectLocationButtonClicked); 131 connect(m_p EditorSize, &UIMediumSizeEditor::sigSizeChanged,131 connect(m_pSizeEditor, &UIMediumSizeEditor::sigSizeChanged, 132 132 this, &UIWizardNewVDPageExpert::completeChanged); 133 133 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic5.cpp
r87890 r87891 26 26 #include "UIBaseMemoryEditor.h" 27 27 #include "UICommon.h" 28 #include "UIMediumSizeEditor.h" 28 29 #include "UIVirtualCPUEditor.h" 29 30 #include "UIWizardNewVM.h" … … 35 36 36 37 UIWizardNewVMPageBasic5::UIWizardNewVMPageBasic5() 38 : m_fUserSetSize(false) 37 39 { 38 40 prepare(); … … 62 64 /* Since the medium format is static we can decide widget visibility here: */ 63 65 setWidgetVisibility(m_mediumFormat); 66 67 retranslateUi(); 64 68 } 65 69 … … 75 79 QVBoxLayout *pMainLayout = new QVBoxLayout(this); 76 80 pMainLayout->addWidget(createMediumVariantWidgets(true)); 81 82 m_pSizeLabel = new QIRichTextLabel; 83 m_pSizeEditor = new UIMediumSizeEditor; 84 85 pMainLayout->addWidget(m_pSizeLabel); 86 87 pMainLayout->addWidget(m_pSizeEditor); 88 77 89 pMainLayout->addStretch(); 78 90 79 // connect(m_pVariantButtonGroup,static_cast<void(QButtonGroup::*)(QAbstractButton*)>(&QButtonGroup::buttonClicked), 80 // this, &UIWizardNewVDPageBasic2::completeChanged); 81 // connect(m_pSplitBox, &QCheckBox::stateChanged, 82 // this, &UIWizardNewVDPageBasic2::completeChanged); 83 84 // QVBoxLayout *pMainLayout = new QVBoxLayout(this); 85 86 87 // m_pLabel = new QIRichTextLabel(this); 88 // pMainLayout->addWidget(m_pLabel); 89 90 // pMainLayout->addStretch(); 91 // createConnections(); 91 createConnections(); 92 92 } 93 93 94 94 void UIWizardNewVMPageBasic5::createConnections() 95 95 { 96 connect(m_pSizeEditor, &UIMediumSizeEditor::sigSizeChanged, this, &UIWizardNewVDPageBasic3::completeChanged); 97 connect(m_pSizeEditor, &UIMediumSizeEditor::sigSizeChanged, this, &UIWizardNewVMPageBasic5::sltHandleSizeEditorChange); 96 98 } 97 99 … … 101 103 UIWizardNewVDPage2::retranslateWidgets(); 102 104 103 104 //retranslateWidgets(); 105 if (m_pSizeLabel) 106 m_pSizeLabel->setText(UIWizardNewVM::tr("Select the size of the virtual hard disk in megabytes. " 107 "This size is the limit on the amount of file data " 108 "that a virtual machine will be able to store on the hard disk.")); 105 109 } 106 110 … … 111 115 m_strDefaultName = strDefaultName.isEmpty() ? QString("NewVirtualDisk1") : strDefaultName; 112 116 m_strDefaultPath = fieldImp("machineFolder").toString(); 113 // fieldImp("type").value<CGuestOSType>().GetRecommendedHDD() 114 115 retranslateUi(); 117 if (m_pSizeEditor && !m_fUserSetSize) 118 { 119 m_pSizeEditor->blockSignals(true); 120 setMediumSize(fieldImp("type").value<CGuestOSType>().GetRecommendedHDD()); 121 m_pSizeEditor->blockSignals(false); 122 } 116 123 } 117 124 118 125 void UIWizardNewVMPageBasic5::cleanupPage() 119 126 { 120 UIWizardPage::cleanupPage();127 /* do not reset fields: */ 121 128 } 122 129 123 130 bool UIWizardNewVMPageBasic5::isComplete() const 124 131 { 125 return true;132 return mediumSize() >= m_uMediumSizeMin && mediumSize() <= m_uMediumSizeMax; 126 133 } 134 135 136 void UIWizardNewVMPageBasic5::sltHandleSizeEditorChange() 137 { 138 m_fUserSetSize = true; 139 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic5.h
r87890 r87891 71 71 private slots: 72 72 73 void sltHandleSizeEditorChange(); 73 74 74 75 private: … … 83 84 84 85 bool isComplete() const; 85 86 /** this is set to true when user manually set the size. */ 87 bool m_fUserSetSize; 86 88 87 89 /** For guided new vm wizard VDI is the only format. Thus we have no UI item for it. */
Note:
See TracChangeset
for help on using the changeset viewer.