VirtualBox

Changeset 87878 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Feb 25, 2021 5:17:43 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
142951
Message:

FE/Qt: bugref:9950. Breaking the wizard even more

Location:
trunk/src/VBox/Frontends/VirtualBox/src/wizards
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic2.cpp

    r87871 r87878  
    3131
    3232UIWizardNewVDPage2::UIWizardNewVDPage2()
     33    : m_pVariantButtonGroup(0)
     34    , m_pDynamicalButton(0)
     35    , m_pFixedButton(0)
     36    , m_pSplitBox(0)
    3337{
    3438}
     
    4044
    4145    /* Exclusive options: */
    42     if (m_pDynamicalButton->isChecked())
     46    if (m_pDynamicalButton && m_pDynamicalButton->isChecked())
    4347        uMediumVariant = (qulonglong)KMediumVariant_Standard;
    44     else if (m_pFixedButton->isChecked())
     48    else if (m_pFixedButton && m_pFixedButton->isChecked())
    4549        uMediumVariant = (qulonglong)KMediumVariant_Fixed;
    4650
    4751    /* Additional options: */
    48     if (m_pSplitBox->isChecked())
     52    if (m_pSplitBox && m_pSplitBox->isChecked())
    4953        uMediumVariant |= (qulonglong)KMediumVariant_VmdkSplit2G;
    5054
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic3.cpp

    r87874 r87878  
    184184}
    185185
    186 bool UIWizardNewVDPage3::checkFATSizeLimitation() const
    187 {
    188     /* Acquire medium variant: */
    189     const qulonglong uVariant = fieldImp("mediumVariant").toULongLong();
    190 
     186/* static */
     187bool UIWizardNewVDPage3::checkFATSizeLimitation(const qulonglong uVariant, const QString &strMediumPath, const qulonglong uSize)
     188{
    191189    /* If the hard disk is split into 2GB parts then no need to make further checks: */
    192190    if (uVariant & KMediumVariant_VmdkSplit2G)
    193191        return true;
    194 
    195     /* Acquire medium path and size: */
    196     const QString strMediumPath = fieldImp("mediumPath").toString();
    197     const qulonglong uSize = fieldImp("mediumSize").toULongLong();
    198192
    199193    RTFSTYPE enmType;
     
    332326
    333327    /* Make sure we are passing FAT size limitation: */
    334     fResult = checkFATSizeLimitation();
     328    fResult = checkFATSizeLimitation(fieldImp("mediumVariant").toULongLong(),
     329                                     fieldImp("mediumPath").toString(),
     330                                     fieldImp("mediumSize").toULongLong());
    335331    if (!fResult)
    336332    {
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic3.h

    r87874 r87878  
    4040
    4141    static QString defaultExtension(const CMediumFormat &mediumFormatRef);
     42    /* Checks if the medium file is bigger than what is allowed in FAT file systems. */
     43    static bool checkFATSizeLimitation(const qulonglong uVariant, const QString &strMediumPath, const qulonglong uSize);
    4244
    4345protected:
     
    5658    /* Returns the full image file path including the extension. */
    5759    static QString absoluteFilePath(const QString &strFileName, const QString &strPath, const QString &strExtension);
    58 
    59     /* Checks if the medium file is bigger than what is allowed in FAT file systems. */
    60     bool checkFATSizeLimitation() const;
    6160
    6261    /* Stuff for 'mediumPath' field: */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageExpert.cpp

    r87859 r87878  
    258258
    259259    /* Make sure we are passing FAT size limitation: */
    260     fResult = checkFATSizeLimitation();
     260    fResult = UIWizardNewVDPage3::checkFATSizeLimitation(fieldImp("mediumVariant").toULongLong(),
     261                                                         fieldImp("mediumPath").toString(),
     262                                                         fieldImp("mediumSize").toULongLong());
    261263    if (!fResult)
    262264    {
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic5.cpp

    r87874 r87878  
    2525#include "QIRichTextLabel.h"
    2626#include "UIBaseMemoryEditor.h"
     27#include "UICommon.h"
    2728#include "UIVirtualCPUEditor.h"
    2829#include "UIWizardNewVM.h"
     
    3132/* COM includes: */
    3233#include "CGuestOSType.h"
     34#include "CSystemProperties.h"
    3335
    3436UIWizardNewVMPageBasic5::UIWizardNewVMPageBasic5()
     
    4244    registerField("mediumSize", this, "mediumSize");
    4345
    44     // fieldImp("machineBaseName").toString(),
    45     //     fieldImp("machineFolder").toString(),
    46     //     fieldImp("type").value<CGuestOSType>().GetRecommendedHDD(),
    47     QString strDefaultName = fieldImp("machineBaseName").toString();
    48     m_strDefaultName = strDefaultName.isEmpty() ? QString("NewVirtualDisk1") : strDefaultName;
    49     m_strDefaultPath = fieldImp("machineFolder").toString();
     46    /* We do not have any UI elements for HDD format selection since we default to VDI in case of guided wizard mode: */
     47    bool fFoundVDI = false;
     48    CSystemProperties properties = uiCommon().virtualBox().GetSystemProperties();
     49    const QVector<CMediumFormat> &formats = properties.GetMediumFormats();
     50    foreach (const CMediumFormat &format, formats)
     51    {
     52        if (format.GetName() == "VDI")
     53        {
     54            m_mediumFormat = format;
     55            fFoundVDI = true;
     56        }
     57    }
     58    Assert(fFoundVDI);
     59    m_strDefaultExtension =  defaultExtension(m_mediumFormat);
     60}
    5061
     62CMediumFormat UIWizardNewVMPageBasic5::mediumFormat() const
     63{
     64    return m_mediumFormat;
    5165}
    5266
     
    5771    m_pLabel = new QIRichTextLabel(this);
    5872    pMainLayout->addWidget(m_pLabel);
    59     //pMainLayout->addWidget(createHardwareWidgets());
    6073
    6174    pMainLayout->addStretch();
     
    8093void UIWizardNewVMPageBasic5::initializePage()
    8194{
     95    /* We set the medium name and path according to machine name/path and do let user change these in the guided mode: */
     96    QString strDefaultName = fieldImp("machineBaseName").toString();
     97    m_strDefaultName = strDefaultName.isEmpty() ? QString("NewVirtualDisk1") : strDefaultName;
     98    m_strDefaultPath = fieldImp("machineFolder").toString();
     99    // fieldImp("type").value<CGuestOSType>().GetRecommendedHDD()
    82100    retranslateUi();
    83 
    84     // if (!field("type").canConvert<CGuestOSType>())
    85     //     return;
    86 
    87     // CGuestOSType type = field("type").value<CGuestOSType>();
    88     // ULONG recommendedRam = type.GetRecommendedRAM();
    89     // if (m_pBaseMemoryEditor)
    90     //     m_pBaseMemoryEditor->setValue(recommendedRam);
    91 
    92     // KFirmwareType fwType = type.GetRecommendedFirmware();
    93     // if (m_pEFICheckBox)
    94     //     m_pEFICheckBox->setChecked(fwType != KFirmwareType_BIOS);
    95101}
    96102
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic5.h

    r87874 r87878  
    4848{
    4949    Q_OBJECT;
    50     Q_PROPERTY(CMediumFormat mediumFormat READ mediumFormat WRITE setMediumFormat);
     50    Q_PROPERTY(CMediumFormat mediumFormat READ mediumFormat);
    5151    Q_PROPERTY(qulonglong mediumVariant READ mediumVariant WRITE setMediumVariant);
    5252    Q_PROPERTY(QString mediumPath READ mediumPath);
     
    5757    /** Constructor. */
    5858    UIWizardNewVMPageBasic5();
     59    CMediumFormat mediumFormat() const;
    5960
    6061protected:
     
    8586    /** Widgets. */
    8687    QIRichTextLabel *m_pLabel;
     88    /** For guided new vm wizard VDI is the only format. Thus we have no UI item for it. */
     89    CMediumFormat m_mediumFormat;
    8790};
    8891
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic8.cpp

    r87864 r87878  
    1818/* Qt includes: */
    1919#include <QCheckBox>
     20#include <QFileInfo>
    2021#include <QGridLayout>
    2122#include <QMetaType>
     
    2526#include "QIRichTextLabel.h"
    2627#include "UIBaseMemoryEditor.h"
     28#include "UIMessageCenter.h"
    2729#include "UIVirtualCPUEditor.h"
    2830#include "UIWizardNewVM.h"
    2931#include "UIWizardNewVMPageBasic8.h"
     32#include "UIWizardNewVDPageBasic3.h"
    3033
    3134/* COM includes: */
     
    152155bool UIWizardNewVMPageBasic8::validatePage()
    153156{
    154     /* Lock finish button: */
     157    bool fResult = true;
     158
     159    const QString strMediumPath(fieldImp("mediumPath").toString());
     160    fResult = !QFileInfo(strMediumPath).exists();
     161    if (!fResult)
     162    {
     163        msgCenter().cannotOverwriteHardDiskStorage(strMediumPath, this);
     164        return fResult;
     165    }
     166
     167    fResult = UIWizardNewVDPage3::checkFATSizeLimitation(fieldImp("mediumVariant").toULongLong(),
     168                                                         fieldImp("mediumPath").toString(),
     169                                                         fieldImp("mediumSize").toULongLong());
     170    if (!fResult)
     171    {
     172        msgCenter().cannotCreateHardDiskStorageInFAT(strMediumPath, this);
     173        return fResult;
     174    }
     175
     176
    155177    startProcessing();
    156178
    157     /* Try to create VM: */
    158     bool fResult = qobject_cast<UIWizardNewVM*>(wizard())->createVM();
     179    fResult = qobject_cast<UIWizardNewVM*>(wizard())->createVirtualDisk();
     180    fResult = qobject_cast<UIWizardNewVM*>(wizard())->createVM();
    159181
    160     /* Unlock finish button: */
    161182    endProcessing();
     183
    162184
    163185    return fResult;
Note: See TracChangeset for help on using the changeset viewer.

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