Changeset 73592 in vbox for trunk/src/VBox
- Timestamp:
- Aug 9, 2018 4:05:17 PM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 124233
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
r73586 r73592 1690 1690 void UIMessageCenter::cannotCreateHardDiskStorageInFAT(const QString &strLocation, QWidget *pParent /* = 0 */) const 1691 1691 { 1692 error(pParent, MessageType_Error,1692 alert(pParent, MessageType_Info, 1693 1693 tr("Failed to create the hard disk storage <nobr><b>%1</b>.</nobr> FAT file systems has 4GB (minus some overhead) size limit") 1694 .arg(strLocation) , QString());1694 .arg(strLocation)); 1695 1695 } 1696 1696 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVD.cpp
r73586 r73592 38 38 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ 39 39 40 /* Other VBox includes: */ 41 #include <iprt/cdefs.h> 42 #include <iprt/path.h> 40 43 41 44 UIWizardNewVD::UIWizardNewVD(QWidget *pParent, … … 115 118 } 116 119 120 bool UIWizardNewVD::checkFATSizeLimitation() 121 { 122 qulonglong uVariant = field("mediumVariant").toULongLong(); 123 /* If the hard disk is split into 2GB parts then no need to make further checks: */ 124 if (uVariant & KMediumVariant_VmdkSplit2G) 125 return true; 126 127 QString strMediumPath = field("mediumPath").toString(); 128 qulonglong uSize = field("mediumSize").toULongLong(); 129 130 RTFSTYPE enmType; 131 int rc = RTFsQueryType(QFileInfo(strMediumPath).absolutePath().toLatin1().constData(), &enmType); 132 if (RT_SUCCESS(rc)) 133 { 134 if (enmType == RTFSTYPE_FAT) 135 { 136 /* Limit the medium size to 4GB. minus 128 MB for file overhead: */ 137 qulonglong fatLimit = _4G - _128M; 138 if (uSize >= fatLimit) 139 return false; 140 } 141 } 142 return true; 143 } 144 117 145 void UIWizardNewVD::retranslateUi() 118 146 { -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVD.h
r72021 r73592 64 64 bool createVirtualDisk(); 65 65 66 /* Checks if the medium file is bigger than what is allowed in FAT file systems. */ 67 bool checkFATSizeLimitation(); 68 66 69 /* Who will be able to create virtual-disk: */ 67 70 friend class UIWizardNewVDPageBasic3; -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic3.cpp
r73591 r73592 47 47 48 48 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ 49 50 /* Other VBox includes: */51 #include <iprt/cdefs.h>52 #include <iprt/path.h>53 49 54 50 UIWizardNewVDPage3::UIWizardNewVDPage3(const QString &strDefaultName, const QString &strDefaultPath) … … 262 258 fResult = !QFileInfo(strMediumPath).exists(); 263 259 if (!fResult) 260 { 264 261 msgCenter().cannotOverwriteHardDiskStorage(strMediumPath, this); 265 266 if (fResult)267 fResult = checkFATSizeLimitation(); 268 262 return fResult; 263 } 264 265 fResult = qobject_cast<UIWizardNewVD*>(wizard())->checkFATSizeLimitation(); 269 266 if (!fResult) 267 { 270 268 msgCenter().cannotCreateHardDiskStorageInFAT(strMediumPath, this); 271 else272 {273 /* Lock finish button: */ 274 startProcessing();275 276 /* Try to create virtual hard drive file: */ 277 fResult = qobject_cast<UIWizardNewVD*>(wizard())->createVirtualDisk();278 /* Unlock finish button: */279 endProcessing();280 }269 return fResult; 270 } 271 272 /* Lock finish button: */ 273 startProcessing(); 274 275 /* Try to create virtual hard drive file: */ 276 fResult = qobject_cast<UIWizardNewVD*>(wizard())->createVirtualDisk(); 277 /* Unlock finish button: */ 278 endProcessing(); 281 279 282 280 /* Return result: */ 283 281 return fResult; 284 282 } 285 286 bool UIWizardNewVDPage3::checkFATSizeLimitation()287 {288 QString strMediumPath(mediumPath());289 RTFSTYPE enmType;290 int rc = RTFsQueryType(QFileInfo(strMediumPath).absolutePath().toLatin1().constData(), &enmType);291 if (RT_SUCCESS(rc))292 {293 if (enmType == RTFSTYPE_FAT)294 {295 /* Limit the medium size to 4GB. minus 128 MB for file overhead: */296 qulonglong fatLimit = _4G - _128M;297 if (mediumSize() >= fatLimit)298 return false;299 }300 }301 return true;302 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic3.h
r73586 r73592 45 45 static QString absoluteFilePath(const QString &strFileName, const QString &strDefaultPath); 46 46 static QString defaultExtension(const CMediumFormat &mediumFormatRef); 47 48 /* Checks if the medium file is bigger than what is allowed in FAT file systems. */49 bool checkFATSizeLimitation();50 47 51 48 /* Stuff for 'mediumPath' field: */ -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageExpert.cpp
r73586 r73592 260 260 bool fResult = true; 261 261 262 /* Lock finish button: */263 startProcessing();264 265 262 /* Make sure such virtual-disk doesn't exists: */ 266 263 QString strMediumPath(mediumPath()); 267 264 fResult = !QFileInfo(strMediumPath).exists(); 268 265 if (!fResult) 266 { 269 267 msgCenter().cannotOverwriteHardDiskStorage(strMediumPath, this); 270 271 if (fResult)272 fResult = checkFATSizeLimitation(); 273 268 return fResult; 269 } 270 271 fResult = qobject_cast<UIWizardNewVD*>(wizard())->checkFATSizeLimitation(); 274 272 if (!fResult) 273 { 275 274 msgCenter().cannotCreateHardDiskStorageInFAT(strMediumPath, this); 275 return fResult; 276 } 277 278 /* Lock finish button: */ 279 startProcessing(); 276 280 277 281 /* Try to create virtual-disk: */ 278 if (fResult) 279 fResult = qobject_cast<UIWizardNewVD*>(wizard())->createVirtualDisk(); 282 fResult = qobject_cast<UIWizardNewVD*>(wizard())->createVirtualDisk(); 280 283 281 284 /* Unlock finish button: */
Note:
See TracChangeset
for help on using the changeset viewer.