- Timestamp:
- Jul 30, 2021 2:23:10 PM (4 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVD.cpp
r90413 r90430 94 94 { 95 95 case WizardMode_Basic: 96 case WizardMode_Expert:97 96 { 98 97 addPage(new UIWizardNewVDPageFileType); … … 101 100 break; 102 101 } 103 104 //{105 // //addPage(new UIWizardNewVDPageExpert);106 //break;107 //}102 case WizardMode_Expert: 103 { 104 addPage(new UIWizardNewVDPageExpert(m_strDefaultName, m_strDefaultPath, m_uDefaultSize)); 105 break; 106 } 108 107 default: 109 108 { -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageExpert.cpp
r90427 r90430 74 74 connect(m_pFormatGroup, &UIDiskFormatsGroupBox::sigMediumFormatChanged, 75 75 this, &UIWizardNewVDPageExpert::sltMediumFormatChanged); 76 connect(m_pVariantGroup, &UIDiskVariantGroupBox::sigMediumVariantChanged, 77 this, &UIWizardNewVDPageExpert::sltMediumVariantChanged); 78 76 79 // connect(m_pFixedCheckBox, &QAbstractButton::toggled, 77 80 // this, &UIWizardNewVDPageExpert::completeChanged); … … 85 88 // this, &UIWizardNewVDPageExpert::completeChanged); 86 89 90 connect(m_pSizeAndPathGroup, &UIMediumSizeAndPathGroupBox::sigMediumSizeChanged, 91 this, &UIWizardNewVDPageExpert::sltMediumSizeChanged); 92 93 connect(m_pSizeAndPathGroup, &UIMediumSizeAndPathGroupBox::sigMediumPathChanged, 94 this, &UIWizardNewVDPageExpert::sltMediumPathChanged); 87 95 88 96 retranslateUi(); 89 97 98 } 99 100 void UIWizardNewVDPageExpert::sltMediumSizeChanged(qulonglong uSize) 101 { 102 newVDWizardPropertySet(MediumSize, uSize); 103 emit completeChanged(); 104 } 105 106 void UIWizardNewVDPageExpert::sltMediumPathChanged(const QString &strPath) 107 { 108 newVDWizardPropertySet(MediumPath, strPath); 109 emit completeChanged(); 110 } 111 112 void UIWizardNewVDPageExpert::sltMediumVariantChanged(qulonglong uVariant) 113 { 114 newVDWizardPropertySet(MediumVariant, uVariant); 115 emit completeChanged(); 90 116 } 91 117 … … 110 136 QFileInfo mediumPath(strMediumPath); 111 137 m_pSizeAndPathGroup->setMediumPath(QDir::toNativeSeparators(mediumPath.absoluteFilePath())); 138 emit completeChanged(); 112 139 } 113 140 … … 173 200 bool UIWizardNewVDPageExpert::isComplete() const 174 201 { 175 /* Make sure medium format/variant is correct, 176 * current name is not empty and current size feats the bounds: */ 177 // return !mediumFormat().isNull() && 178 // mediumVariant() != (qulonglong)KMediumVariant_Max && 179 // !m_pLocationEditor->text().trimmed().isEmpty() && 180 // mediumSize() >= m_uMediumSizeMin && mediumSize() <= m_uMediumSizeMax; 181 return false; 202 UIWizardNewVD *pWizard = qobject_cast<UIWizardNewVD*>(wizard()); 203 AssertReturn(pWizard, false); 204 if (pWizard->mediumFormat().isNull()) 205 return false; 206 if (pWizard->mediumVariant() == (qulonglong)KMediumVariant_Max) 207 return false; 208 if (pWizard->mediumPath().isEmpty()) 209 return false; 210 if (pWizard->mediumSize() > m_uMediumSizeMax || pWizard->mediumSize() < m_uMediumSizeMin) 211 return false; 212 return true; 182 213 } 183 214 184 215 bool UIWizardNewVDPageExpert::validatePage() 185 216 { 186 /* Initial result: */187 217 bool fResult = true; 188 189 // /* Make sure such file doesn't exist already: */ 190 // const QString strMediumPath(mediumPath()); 191 // fResult = !QFileInfo(strMediumPath).exists(); 192 // if (!fResult) 193 // { 194 // msgCenter().cannotOverwriteHardDiskStorage(strMediumPath, this); 195 // return fResult; 196 // } 197 198 // /* Make sure we are passing FAT size limitation: */ 199 // fResult = UIWizardNewVDPageBaseSizeLocation::checkFATSizeLimitation(fieldImp("mediumVariant").toULongLong(), 200 // fieldImp("mediumPath").toString(), 201 // fieldImp("mediumSize").toULongLong()); 202 // if (!fResult) 203 // { 204 // msgCenter().cannotCreateHardDiskStorageInFAT(strMediumPath, this); 205 // return fResult; 206 // } 207 208 // /* Lock finish button: */ 209 // startProcessing(); 210 // /* Try to create virtual-disk: */ 211 // fResult = qobject_cast<UIWizardNewVD*>(wizard())->createVirtualDisk(); 212 // /* Unlock finish button: */ 213 // endProcessing(); 214 215 /* Return result: */ 218 UIWizardNewVD *pWizard = qobject_cast<UIWizardNewVD*>(wizard()); 219 AssertReturn(pWizard, false); 220 /* Make sure such file doesn't exist already: */ 221 const QString strMediumPath(pWizard->mediumPath()); 222 fResult = !QFileInfo(strMediumPath).exists(); 223 if (!fResult) 224 { 225 msgCenter().cannotOverwriteHardDiskStorage(strMediumPath, this); 226 return fResult; 227 } 228 229 /* Make sure we are passing FAT size limitation: */ 230 fResult = UIDiskEditorGroupBox::checkFATSizeLimitation(pWizard->mediumVariant(), 231 pWizard->mediumPath(), 232 pWizard->mediumSize()); 233 if (!fResult) 234 { 235 msgCenter().cannotCreateHardDiskStorageInFAT(strMediumPath, this); 236 return fResult; 237 } 238 239 fResult = pWizard->createVirtualDisk(); 216 240 return fResult; 217 241 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageExpert.h
r90427 r90430 47 47 void sltMediumFormatChanged(); 48 48 void sltSelectLocationButtonClicked(); 49 void sltMediumVariantChanged(qulonglong uVariant); 50 void sltMediumPathChanged(const QString &strPath); 51 void sltMediumSizeChanged(qulonglong uSize); 49 52 50 53 private: -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageFileType.cpp
r90413 r90430 52 52 AssertReturnVoid(m_pFormatButtonGroup); 53 53 newVDWizardPropertySet(MediumFormat, m_pFormatButtonGroup->mediumFormat()); 54 emit completeChanged(); 54 55 } 55 56 … … 72 73 bool UIWizardNewVDPageFileType::isComplete() const 73 74 { 74 /* Make sure medium format is correct: */ 75 //return !mediumFormat().isNull(); 76 return true; 75 UIWizardNewVD *pWizard = qobject_cast<UIWizardNewVD*>(wizard()); 76 if (pWizard && !pWizard->mediumFormat().isNull()) 77 return true; 78 return false; 77 79 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageSizeLocation.cpp
r90427 r90430 100 100 void UIWizardNewVDPageSizeLocation::sltSelectLocationButtonClicked() 101 101 { 102 102 UIWizardNewVD *pWizard = qobject_cast<UIWizardNewVD*>(wizard()); 103 AssertReturnVoid(pWizard); 104 QString strSelectedPath = UIWizardNewVDSizeLocation::selectNewMediumLocation(pWizard); 105 if (strSelectedPath.isEmpty()) 106 return; 107 QString strMediumPath = 108 UIDiskEditorGroupBox::appendExtension(strSelectedPath, 109 UIDiskEditorGroupBox::defaultExtensionForMediumFormat(pWizard->mediumFormat())); 110 QFileInfo mediumPath(strMediumPath); 111 m_pMediumSizePathGroup->setMediumPath(QDir::toNativeSeparators(mediumPath.absoluteFilePath())); 103 112 } 104 113 105 void UIWizardNewVDPageSizeLocation::sltMediumSizeChanged(qulonglong /*uSize*/)114 void UIWizardNewVDPageSizeLocation::sltMediumSizeChanged(qulonglong uSize) 106 115 { 107 AssertReturnVoid(m_pMediumSizePathGroup);108 116 m_userModifiedParameters << "MediumSize"; 109 newVDWizardPropertySet(MediumSize, m_pMediumSizePathGroup->mediumSize()); 117 newVDWizardPropertySet(MediumSize, uSize); 118 emit completeChanged(); 110 119 } 111 120 112 void UIWizardNewVDPageSizeLocation::sltMediumPathChanged(const QString & /*strPath*/)121 void UIWizardNewVDPageSizeLocation::sltMediumPathChanged(const QString &strPath) 113 122 { 114 AssertReturnVoid(m_pMediumSizePathGroup);115 123 m_userModifiedParameters << "MediumPath"; 116 newVDWizardPropertySet(MediumPath, m_pMediumSizePathGroup->mediumPath()); 124 newVDWizardPropertySet(MediumPath, strPath); 125 emit completeChanged(); 117 126 } 118 127
Note:
See TracChangeset
for help on using the changeset viewer.