Changeset 90259 in vbox
- Timestamp:
- Jul 20, 2021 12:30:18 PM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 145798
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMDiskPageBasic.cpp
r90252 r90259 36 36 #include "UIMediumSizeEditor.h" 37 37 #include "UIMessageCenter.h" 38 #include "UIWizardNewVD.h"39 38 #include "UIWizardNewVMDiskPageBasic.h" 40 39 … … 42 41 #include "CGuestOSType.h" 43 42 #include "CSystemProperties.h" 43 44 /* Other VBox includes: */ 45 #include <iprt/path.h> 46 44 47 45 48 QString UIWizardNewVMDiskPage::defaultExtension(const CMediumFormat &mediumFormatRef) … … 107 110 return QUuid(); 108 111 return uMediumId; 112 } 113 114 bool UIWizardNewVMDiskPage::checkFATSizeLimitation(const qulonglong uVariant, const QString &strMediumPath, const qulonglong uSize) 115 { 116 /* If the hard disk is split into 2GB parts then no need to make further checks: */ 117 if (uVariant & KMediumVariant_VmdkSplit2G) 118 return true; 119 120 RTFSTYPE enmType; 121 int rc = RTFsQueryType(QFileInfo(strMediumPath).absolutePath().toLatin1().constData(), &enmType); 122 if (RT_SUCCESS(rc)) 123 { 124 if (enmType == RTFSTYPE_FAT) 125 { 126 /* Limit the medium size to 4GB. minus 128 MB for file overhead: */ 127 qulonglong fatLimit = _4G - _128M; 128 if (uSize >= fatLimit) 129 return false; 130 } 131 } 132 133 return true; 109 134 } 110 135 … … 270 295 271 296 if (m_pMediumSizeEditorLabel) 272 m_pMediumSizeEditorLabel->setText(UIWizardNewV D::tr("D&isk Size:"));297 m_pMediumSizeEditorLabel->setText(UIWizardNewVM::tr("D&isk Size:")); 273 298 274 299 if (m_pFixedCheckBox) 275 300 { 276 m_pFixedCheckBox->setText(UIWizardNewV D::tr("Pre-allocate &Full Size"));277 m_pFixedCheckBox->setToolTip(UIWizardNewV D::tr("<p>When checked, the virtual disk image will be fully allocated at "301 m_pFixedCheckBox->setText(UIWizardNewVM::tr("Pre-allocate &Full Size")); 302 m_pFixedCheckBox->setToolTip(UIWizardNewVM::tr("<p>When checked, the virtual disk image will be fully allocated at " 278 303 "VM creation time, rather than being allocated dynamically at VM run-time.</p>")); 279 304 } … … 281 306 /* Translate rich text labels: */ 282 307 if (m_pDescriptionLabel) 283 m_pDescriptionLabel->setText(UIWizardNewV D::tr("Please choose whether the new virtual hard disk file should grow as it is used "308 m_pDescriptionLabel->setText(UIWizardNewVM::tr("Please choose whether the new virtual hard disk file should grow as it is used " 284 309 "(dynamically allocated) or if it should be created at its maximum size (fixed size).")); 285 310 if (m_pDynamicLabel) 286 m_pDynamicLabel->setText(UIWizardNewV D::tr("<p>A <b>dynamically allocated</b> hard disk file will only use space "311 m_pDynamicLabel->setText(UIWizardNewVM::tr("<p>A <b>dynamically allocated</b> hard disk file will only use space " 287 312 "on your physical hard disk as it fills up (up to a maximum <b>fixed size</b>), " 288 313 "although it will not shrink again automatically when space on it is freed.</p>")); 289 314 if (m_pFixedLabel) 290 m_pFixedLabel->setText(UIWizardNewV D::tr("<p>A <b>fixed size</b> hard disk file may take longer to create on some "315 m_pFixedLabel->setText(UIWizardNewVM::tr("<p>A <b>fixed size</b> hard disk file may take longer to create on some " 291 316 "systems but is often faster to use.</p>")); 292 317 } … … 429 454 } 430 455 /* Check FAT size limitation of the host hard drive: */ 431 fResult = UIWizardNewV DPageBaseSizeLocation::checkFATSizeLimitation(pWizard->mediumVariant(),432 pWizard->mediumPath(),433 456 fResult = UIWizardNewVMDiskPage::checkFATSizeLimitation(pWizard->mediumVariant(), 457 strMediumPath, 458 pWizard->mediumSize()); 434 459 if (!fResult) 435 460 { -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMDiskPageBasic.h
r90092 r90259 61 61 QWidget *pCaller); 62 62 QString absoluteFilePath(const QString &strFileName, const QString &strPath); 63 bool checkFATSizeLimitation(const qulonglong uVariant, const QString &strMediumPath, const qulonglong uSize); 63 64 } 64 65 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.cpp
r90252 r90259 47 47 #include "UIWizardNewVMPageExpert.h" 48 48 #include "UIWizardNewVMNameOSTypePageBasic.h" 49 50 49 51 50 /* COM includes: */ … … 596 595 if (m_enmSelectedDiskSource == SelectedDiskSource_New) 597 596 { 598 599 597 qulonglong uSize = pWizard->mediumSize(); 600 598 if( uSize >= m_uMediumSizeMin && uSize <= m_uMediumSizeMax) … … 612 610 bool UIWizardNewVMPageExpert::validatePage() 613 611 { 612 UIWizardNewVM *pWizard = qobject_cast<UIWizardNewVM*>(wizard()); 613 AssertReturn(pWizard, false); 614 614 bool fResult = true; 615 615 616 // if (selectedDiskSource() == SelectedDiskSource_New) 617 // { 618 // /* Check if the path we will be using for hard drive creation exists: */ 619 // const QString strMediumPath(fieldImp("mediumPath").toString()); 620 // fResult = !QFileInfo(strMediumPath).exists(); 621 // if (!fResult) 622 // { 623 // msgCenter().cannotOverwriteHardDiskStorage(strMediumPath, this); 624 // return fResult; 625 // } 626 // /* Check FAT size limitation of the host hard drive: */ 627 // fResult = UIWizardNewVDPageBaseSizeLocation::checkFATSizeLimitation(fieldImp("mediumVariant").toULongLong(), 628 // fieldImp("mediumPath").toString(), 629 // fieldImp("mediumSize").toULongLong()); 630 // if (!fResult) 631 // { 632 // msgCenter().cannotCreateHardDiskStorageInFAT(strMediumPath, this); 633 // return fResult; 634 // } 635 // } 636 637 // startProcessing(); 638 // UIWizardNewVM *pWizard = wizardImp(); 639 // AssertReturn(pWizard, false); 640 // if (selectedDiskSource() == SelectedDiskSource_New) 641 // { 642 // /* Try to create the hard drive:*/ 643 // fResult = pWizard->createVirtualDisk(); 644 // /*Don't show any error message here since UIWizardNewVM::createVirtualDisk already does so: */ 645 // if (!fResult) 646 // return fResult; 647 // } 648 649 // fResult = pWizard->createVM(); 650 // /* Try to delete the hard disk: */ 651 // if (!fResult) 652 // pWizard->deleteVirtualDisk(); 653 654 // endProcessing(); 616 if (m_enmSelectedDiskSource == SelectedDiskSource_New) 617 { 618 /* Check if the path we will be using for hard drive creation exists: */ 619 const QString &strMediumPath = pWizard->mediumPath(); 620 fResult = !QFileInfo(strMediumPath).exists(); 621 if (!fResult) 622 { 623 msgCenter().cannotOverwriteHardDiskStorage(strMediumPath, this); 624 return fResult; 625 } 626 qulonglong uSize = pWizard->mediumSize(); 627 qulonglong uVariant = pWizard->mediumVariant(); 628 /* Check FAT size limitation of the host hard drive: */ 629 fResult = UIWizardNewVMDiskPage::checkFATSizeLimitation(uVariant, strMediumPath, uSize); 630 if (!fResult) 631 { 632 msgCenter().cannotCreateHardDiskStorageInFAT(strMediumPath, this); 633 return fResult; 634 } 635 } 636 637 if (m_enmSelectedDiskSource == SelectedDiskSource_New) 638 { 639 /* Try to create the hard drive:*/ 640 fResult = pWizard->createVirtualDisk(); 641 /*Don't show any error message here since UIWizardNewVM::createVirtualDisk already does so: */ 642 if (!fResult) 643 return fResult; 644 } 645 646 fResult = pWizard->createVM(); 647 /* Try to delete the hard disk: */ 648 if (!fResult) 649 pWizard->deleteVirtualDisk(); 655 650 656 651 return fResult;
Note:
See TracChangeset
for help on using the changeset viewer.