VirtualBox

Changeset 99207 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Mar 29, 2023 12:07:11 PM (22 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:6669: VirtualBox Manager: Move New VM wizard onto non-modal rails.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp

    r99202 r99207  
    987987        switch (enmType)
    988988        {
     989            case WizardType_NewVM:
     990                m_wizards[enmType] = new UIWizardNewVM(this, actionPool(), m_pWidget->fullGroupName(), m_strISOFilePath);
     991                break;
    989992            case WizardType_ExportAppliance:
    990993                m_wizards[enmType] = new UIWizardExportApp(this, m_names, m_fExportToOCI);
     
    10161019void UIVirtualBoxManager::sltCloseWizard(WizardType enmType)
    10171020{
     1021    /* Postprocess wizard if still exists: */
     1022    if (m_wizards.contains(enmType))
     1023    {
     1024        switch (enmType)
     1025        {
     1026            case WizardType_NewVM:
     1027            {
     1028                UIWizardNewVM *pWizard = qobject_cast<UIWizardNewVM*>(m_wizards.value(enmType));
     1029                if (pWizard->isUnattendedEnabled())
     1030                    startUnattendedInstall(pWizard->installer(),
     1031                                           pWizard->startHeadless(),
     1032                                           pWizard->createdMachineId().toString());
     1033                break;
     1034            }
     1035            default:
     1036                break;
     1037        }
     1038    }
     1039
     1040    /* Cleanup instance: */
    10181041    delete m_wizards.take(enmType);
    10191042}
     
    25862609void UIVirtualBoxManager::openNewMachineWizard(const QString &strISOFilePath /* = QString() */)
    25872610{
    2588     /* Lock the actions preventing cascade calls: */
    2589     UIQObjectPropertySetter guardBlock(QList<QObject*>() << actionPool()->action(UIActionIndexMN_M_Welcome_S_New)
    2590                                                          << actionPool()->action(UIActionIndexMN_M_Machine_S_New)
    2591                                                          << actionPool()->action(UIActionIndexMN_M_Group_S_New),
    2592                                        "opened", true);
    2593     connect(&guardBlock, &UIQObjectPropertySetter::sigAboutToBeDestroyed,
    2594             this, &UIVirtualBoxManager::sltHandleUpdateActionAppearanceRequest);
    2595     updateActionsAppearance();
    2596 
    2597     CUnattended comUnattendedInstaller = uiCommon().virtualBox().CreateUnattendedInstaller();
    2598     AssertMsg(!comUnattendedInstaller.isNull(), ("Could not create unattended installer!\n"));
    2599 
    2600     /* Use the "safe way" to open stack of Mac OS X Sheets: */
    2601     QWidget *pWizardParent = windowManager().realParentWindow(this);
    2602     UISafePointerWizardNewVM pWizard = new UIWizardNewVM(pWizardParent, actionPool(),
    2603                                                          m_pWidget->fullGroupName(),
    2604                                                          comUnattendedInstaller, strISOFilePath);
    2605     windowManager().registerNewParent(pWizard, pWizardParent);
    2606 
    2607     /* Execute wizard: */
    2608     pWizard->exec();
    2609 
    2610     bool fStartHeadless = pWizard->startHeadless();
    2611     bool fUnattendedEnabled = pWizard->isUnattendedEnabled();
    2612     QString strMachineId = pWizard->createdMachineId().toString();
    2613     delete pWizard;
    2614     /* Handle unattended install stuff: */
    2615     if (fUnattendedEnabled)
    2616         startUnattendedInstall(comUnattendedInstaller, fStartHeadless, strMachineId);
     2611    /* Configure wizard variables: */
     2612    m_strISOFilePath = strISOFilePath;
     2613
     2614    /* Open New VM Wizard: */
     2615    sltOpenWizard(WizardType_NewVM);
    26172616}
    26182617
     
    26832682}
    26842683
    2685 void UIVirtualBoxManager::startUnattendedInstall(CUnattended &comUnattendedInstaller,
     2684void UIVirtualBoxManager::startUnattendedInstall(const CUnattended &comUnattendedRef,
    26862685                                                 bool fStartHeadless, const QString &strMachineId)
    26872686{
     
    26912690        return;
    26922691
    2693     comUnattendedInstaller.Prepare();
    2694     AssertReturnVoid(checkUnattendedInstallError(comUnattendedInstaller));
    2695     comUnattendedInstaller.ConstructMedia();
    2696     AssertReturnVoid(checkUnattendedInstallError(comUnattendedInstaller));
    2697     comUnattendedInstaller.ReconfigureVM();
    2698     AssertReturnVoid(checkUnattendedInstallError(comUnattendedInstaller));
     2692    CUnattended comUnattended = comUnattendedRef;
     2693    comUnattended.Prepare();
     2694    AssertReturnVoid(checkUnattendedInstallError(comUnattended));
     2695    comUnattended.ConstructMedia();
     2696    AssertReturnVoid(checkUnattendedInstallError(comUnattended));
     2697    comUnattended.ReconfigureVM();
     2698    AssertReturnVoid(checkUnattendedInstallError(comUnattended));
    26992699
    27002700    launchMachine(comMachine, fStartHeadless ? UILaunchMode_Headless : UILaunchMode_Default);
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.h

    r99202 r99207  
    411411
    412412        /** Creates an unattended installer and uses it to install guest os to newly created vm. */
    413         void startUnattendedInstall(CUnattended &comUnattendedInstaller, bool fStartHeadless, const QString &strMachineId);
     413        void startUnattendedInstall(const CUnattended &comUnattended, bool fStartHeadless, const QString &strMachineId);
    414414
    415415        /** Launches or shows virtual machines represented by passed @a items in corresponding @a enmLaunchMode (for launch). */
     
    522522    int  m_iGeometrySaveTimerId;
    523523
     524    /** Holds the ISO file path used by new VM wizard. */
     525    QString  m_strISOFilePath;
     526
    524527    /** Holds whether OCI importing should be started by default. */
    525528    bool     m_fImportFromOCI;
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UIToolsModel.cpp

    r98103 r99207  
    5050#include "UIVirtualBoxManagerWidget.h"
    5151#include "UIVirtualBoxEventHandler.h"
    52 #include "UIWizardNewVM.h"
    5352
    5453/* COM includes: */
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIToolBox.cpp

    r98103 r99207  
    3939#include "UIIconPool.h"
    4040#include "UIToolBox.h"
    41 #include "UIWizardNewVM.h"
    4241
    4342
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/editors/UIHostnameDomainNameEditor.cpp

    r98103 r99207  
    4141#include "UIIconPool.h"
    4242#include "UIHostnameDomainNameEditor.h"
    43 #include "UIWizardNewVM.h"
    44 
    4543
    4644
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/editors/UIUserNamePasswordEditor.cpp

    r98103 r99207  
    3939#include "UIIconPool.h"
    4040#include "UIUserNamePasswordEditor.h"
    41 #include "UIWizardNewVM.h"
     41
     42/* Other VBox includes: */
     43#include "iprt/assert.h"
    4244
    4345
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/editors/UIWizardDiskEditors.cpp

    r98103 r99207  
    4747#include "UIUserNamePasswordEditor.h"
    4848#include "UIWizardDiskEditors.h"
    49 #include "UIWizardNewVM.h"
    5049#include "UIWizardNewVMDiskPage.h"
    5150
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.cpp

    r98103 r99207  
    5252#include "CUSBController.h"
    5353#include "CUSBDeviceFilters.h"
    54 #include "CUnattended.h"
    5554
    5655/* Namespaces: */
     
    6160                             UIActionPool *pActionPool,
    6261                             const QString &strMachineGroup,
    63                              CUnattended &comUnattended,
    6462                             const QString &strISOFilePath /* = QString() */)
    6563    : UINativeWizard(pParent, WizardType_NewVM, WizardMode_Auto, "create-vm-wizard" /* help keyword */)
     
    8280    , m_fEmptyDiskRecommended(false)
    8381    , m_pActionPool(pActionPool)
    84     , m_comUnattended(comUnattended)
    8582    , m_fStartHeadless(false)
    8683    , m_strInitialISOFilePath(strISOFilePath)
     
    9794
    9895    connect(this, &UIWizardNewVM::rejected, this, &UIWizardNewVM::sltHandleWizardCancel);
     96
     97    /* Create installer: */
     98    m_comUnattended = uiCommon().virtualBox().CreateUnattendedInstaller();
     99    AssertMsg(!m_comUnattended.isNull(), ("Could not create unattended installer!\n"));
    99100}
    100101
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.h

    r98103 r99207  
    4141#include "CMediumFormat.h"
    4242#include "CGuestOSType.h"
     43#include "CUnattended.h"
    4344
    4445/* Forward declarations: */
     
    6364                  UIActionPool *pActionPool,
    6465                  const QString &strMachineGroup,
    65                   CUnattended &comUnattended,
    6666                  const QString &strISOFilePath = QString());
    6767
     
    7979    const QString &machineGroup() const;
    8080    QUuid createdMachineId() const;
     81
     82    CUnattended installer() const { return m_comUnattended; }
    8183
    8284    /** @name Setter/getters for vm parameters
     
    237239       QVector<KMediumVariant> m_mediumVariants;
    238240       UIActionPool *m_pActionPool;
    239        CUnattended &m_comUnattended;
     241       CUnattended m_comUnattended;
    240242       bool m_fStartHeadless;
    241243       QString m_strInitialISOFilePath;
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