VirtualBox

Changeset 73597 in vbox


Ignore:
Timestamp:
Aug 9, 2018 5:32:32 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:6596: Few fixes for r124233.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp

    r73595 r73597  
    16911691{
    16921692    alert(pParent, MessageType_Info,
    1693           tr("Failed to create the hard disk storage <nobr><b>%1</b>.</nobr> FAT file systems have 4GB file size limit")
     1693          tr("Failed to create the hard disk storage <nobr><b>%1</b>.</nobr> FAT file systems have 4GB file size limit.")
    16941694          .arg(strLocation));
    16951695}
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVD.cpp

    r73592 r73597  
    3838#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
    3939
    40 /* Other VBox includes: */
    41 #include <iprt/cdefs.h>
    42 #include <iprt/path.h>
    4340
    4441UIWizardNewVD::UIWizardNewVD(QWidget *pParent,
     
    118115}
    119116
    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 
    145117void UIWizardNewVD::retranslateUi()
    146118{
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVD.h

    r73592 r73597  
    6464    bool createVirtualDisk();
    6565
    66     /* Checks if the medium file is bigger than what is allowed in FAT file systems. */
    67     bool checkFATSizeLimitation();
    68 
    6966    /* Who will be able to create virtual-disk: */
    7067    friend class UIWizardNewVDPageBasic3;
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic3.cpp

    r73592 r73597  
    4848#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
    4949
     50/* Other VBox includes: */
     51#include <iprt/cdefs.h>
     52#include <iprt/path.h>
     53
     54
    5055UIWizardNewVDPage3::UIWizardNewVDPage3(const QString &strDefaultName, const QString &strDefaultPath)
    5156    : m_strDefaultName(strDefaultName.isEmpty() ? QString("NewVirtualDisk1") : strDefaultName)
     
    156161    AssertMsgFailed(("Extension can't be NULL!\n"));
    157162    return QString();
     163}
     164
     165bool UIWizardNewVDPage3::checkFATSizeLimitation()
     166{
     167    /* Acquire medium variant: */
     168    const qulonglong uVariant = fieldImp("mediumVariant").toULongLong();
     169
     170    /* If the hard disk is split into 2GB parts then no need to make further checks: */
     171    if (uVariant & KMediumVariant_VmdkSplit2G)
     172        return true;
     173
     174    /* Acquire medium path and size: */
     175    const QString strMediumPath = fieldImp("mediumPath").toString();
     176    const qulonglong uSize = fieldImp("mediumSize").toULongLong();
     177
     178    RTFSTYPE enmType;
     179    int rc = RTFsQueryType(QFileInfo(strMediumPath).absolutePath().toLatin1().constData(), &enmType);
     180    if (RT_SUCCESS(rc))
     181    {
     182        if (enmType == RTFSTYPE_FAT)
     183        {
     184            /* Limit the medium size to 4GB. minus 128 MB for file overhead: */
     185            qulonglong fatLimit = _4G - _128M;
     186            if (uSize >= fatLimit)
     187                return false;
     188        }
     189    }
     190
     191    return true;
    158192}
    159193
     
    254288    bool fResult = true;
    255289
    256     /* Make sure such file doesn't exists already: */
    257     QString strMediumPath(mediumPath());
     290    /* Make sure such file doesn't exist already: */
     291    const QString strMediumPath(mediumPath());
    258292    fResult = !QFileInfo(strMediumPath).exists();
    259293    if (!fResult)
     
    263297    }
    264298
    265     fResult = qobject_cast<UIWizardNewVD*>(wizard())->checkFATSizeLimitation();
     299    /* Make sure we are passing FAT size limitation: */
     300    fResult = checkFATSizeLimitation();
    266301    if (!fResult)
    267302    {
     
    272307    /* Lock finish button: */
    273308    startProcessing();
    274 
    275     /* Try to create virtual hard drive file: */
     309    /* Try to create virtual-disk: */
    276310    fResult = qobject_cast<UIWizardNewVD*>(wizard())->createVirtualDisk();
    277311    /* Unlock finish button: */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic3.h

    r73592 r73597  
    4545    static QString absoluteFilePath(const QString &strFileName, const QString &strDefaultPath);
    4646    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();
    4750
    4851    /* Stuff for 'mediumPath' field: */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageExpert.cpp

    r73592 r73597  
    260260    bool fResult = true;
    261261
    262     /* Make sure such virtual-disk doesn't exists: */
    263     QString strMediumPath(mediumPath());
     262    /* Make sure such file doesn't exist already: */
     263    const QString strMediumPath(mediumPath());
    264264    fResult = !QFileInfo(strMediumPath).exists();
    265265    if (!fResult)
     
    269269    }
    270270
    271     fResult = qobject_cast<UIWizardNewVD*>(wizard())->checkFATSizeLimitation();
     271    /* Make sure we are passing FAT size limitation: */
     272    fResult = checkFATSizeLimitation();
    272273    if (!fResult)
    273274    {
     
    278279    /* Lock finish button: */
    279280    startProcessing();
    280 
    281281    /* Try to create virtual-disk: */
    282282    fResult = qobject_cast<UIWizardNewVD*>(wizard())->createVirtualDisk();
    283 
    284283    /* Unlock finish button: */
    285284    endProcessing();
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette