VirtualBox

Changeset 88000 in vbox


Ignore:
Timestamp:
Mar 8, 2021 8:29:00 AM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
143123
Message:

FE/Qt: bugref:9950. Creating the vm from expert page.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.cpp

    r87932 r88000  
    230230}
    231231
     232void UIWizardNewVM::deleteVirtualDisk()
     233{
     234    CMedium comDisk = virtualDisk();
     235    /* Make sure virtual-disk valid: */
     236    if (comDisk.isNull())
     237        return;
     238
     239    /* Remember virtual-disk attributes: */
     240    QString strLocation = comDisk.GetLocation();
     241    /* Prepare delete storage progress: */
     242    CProgress progress = comDisk.DeleteStorage();
     243    if (comDisk.isOk())
     244    {
     245        /* Show delete storage progress: */
     246        msgCenter().showModalProgressDialog(progress, windowTitle(), ":/progress_media_delete_90px.png", this);
     247        if (!progress.isOk() || progress.GetResultCode() != 0)
     248            msgCenter().cannotDeleteHardDiskStorage(progress, strLocation, this);
     249    }
     250    else
     251        msgCenter().cannotDeleteHardDiskStorage(comDisk, strLocation, this);
     252
     253    /* Detach virtual-disk anyway: */
     254    comDisk.detach();
     255}
     256
    232257void UIWizardNewVM::configureVM(const QString &strGuestTypeId, const CGuestOSType &comGuestType)
    233258{
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.h

    r87916 r88000  
    101101    bool createVM();
    102102    bool createVirtualDisk();
     103    void deleteVirtualDisk();
    103104
    104105    void configureVM(const QString &strGuestTypeId, const CGuestOSType &comGuestType);
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic4.cpp

    r87981 r88000  
    419419            return fResult;
    420420    }
     421
    421422    fResult = qobject_cast<UIWizardNewVM*>(wizard())->createVM();
     423    /* Try to delete the hard disk: */
     424    if (!fResult)
     425        qobject_cast<UIWizardNewVM*>(wizard())->deleteVirtualDisk();
     426
    422427    endProcessing();
    423428
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.cpp

    r87982 r88000  
    3838#include "UIMedium.h"
    3939#include "UIMediumSizeEditor.h"
     40#include "UIMessageCenter.h"
    4041#include "UINameAndSystemEditor.h"
    4142#include "UIToolBox.h"
     
    528529bool UIWizardNewVMPageExpert::validatePage()
    529530{
    530     /* Initial result: */
    531531    bool fResult = true;
    532532
    533     /* Lock finish button: */
     533    if (selectedDiskSource() == SelectedDiskSource_New)
     534    {
     535        /* Check if the path we will be using for hard drive creation exists: */
     536        const QString strMediumPath(fieldImp("mediumPath").toString());
     537        fResult = !QFileInfo(strMediumPath).exists();
     538        if (!fResult)
     539        {
     540            msgCenter().cannotOverwriteHardDiskStorage(strMediumPath, this);
     541            return fResult;
     542        }
     543        /* Check FAT size limitation of the host hard drive: */
     544        fResult = UIWizardNewVDPage3::checkFATSizeLimitation(fieldImp("mediumVariant").toULongLong(),
     545                                                             fieldImp("mediumPath").toString(),
     546                                                             fieldImp("mediumSize").toULongLong());
     547        if (!fResult)
     548        {
     549            msgCenter().cannotCreateHardDiskStorageInFAT(strMediumPath, this);
     550            return fResult;
     551        }
     552    }
     553
    534554    startProcessing();
    535 
    536     /* Try to create machine folder: */
    537     if (fResult)
    538         fResult = createMachineFolder();
    539 
    540     /* Try to assign boot virtual-disk: */
    541     if (fResult)
    542     {
    543         /* Ensure there is no virtual-disk created yet: */
    544         Assert(m_virtualDisk.isNull());
    545         if (fResult)
    546         {
    547             if (m_pDiskNew->isChecked())
    548             {
    549             }
    550         }
    551     }
    552 
    553     /* Try to create VM: */
    554     if (fResult)
    555         fResult = qobject_cast<UIWizardNewVM*>(wizard())->createVM();
    556 
    557     /* Unlock finish button: */
     555    if (selectedDiskSource() == SelectedDiskSource_New)
     556    {
     557        /* Try to create the hard drive:*/
     558        fResult = qobject_cast<UIWizardNewVM*>(wizard())->createVirtualDisk();
     559        /*Don't show any error message here since UIWizardNewVM::createVirtualDisk already does so: */
     560        if (!fResult)
     561            return fResult;
     562    }
     563
     564    fResult = qobject_cast<UIWizardNewVM*>(wizard())->createVM();
     565    /* Try to delete the hard disk: */
     566    if (!fResult)
     567        qobject_cast<UIWizardNewVM*>(wizard())->deleteVirtualDisk();
     568
    558569    endProcessing();
    559570
    560     /* Return result: */
    561571    return fResult;
    562572}
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