VirtualBox

Changeset 88115 in vbox


Ignore:
Timestamp:
Mar 15, 2021 9:34:32 AM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9950. Attaching the selected ISO file to the new vm in case unattended install is skipped

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

Legend:

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

    r88019 r88115  
    422422        }
    423423
    424         /* Attach empty optical drive: */
     424        /* Attach optical drive: */
    425425        KStorageBus enmDVDBus = comGuestType.GetRecommendedDVDStorageBus();
    426426        CStorageController comDVDController = m_machine.GetStorageControllerByInstance(enmDVDBus, 0);
    427427        if (!comDVDController.isNull())
    428428        {
    429             machine.AttachDevice(comDVDController.GetName(), 1, 0, KDeviceType_DVD, CMedium());
     429            CMedium opticalDisk;
     430            QString strISOFilePath = getStringFieldValue("ISOFilePath");
     431            if (!strISOFilePath.isEmpty() && !getBoolFieldValue("isUnattendedEnabled"))
     432            {
     433                QFileInfo isoFileInfo(strISOFilePath);
     434                if (isoFileInfo.exists() && isoFileInfo.isReadable())
     435                {
     436                    CVirtualBox vbox = uiCommon().virtualBox();
     437                    opticalDisk =
     438                        vbox.OpenMedium(strISOFilePath, KDeviceType_DVD,  KAccessMode_ReadWrite, false);
     439                    if (!vbox.isOk())
     440                        msgCenter().cannotOpenMedium(vbox, strISOFilePath, this);
     441                }
     442            }
     443            machine.AttachDevice(comDVDController.GetName(), 1, 0, KDeviceType_DVD, opticalDisk);
    430444            if (!machine.isOk())
    431445                msgCenter().cannotAttachDevice(machine, UIMediumDeviceType_DVD, QString(),
    432446                                               StorageSlot(enmDVDBus, 1, 0), this);
    433 
    434447        }
    435448
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic1.cpp

    r88114 r88115  
    361361        m_pSkipUnattendedCheckBox->setToolTip(UIWizardNewVM::tr("<p>When checked selected ISO file will be mounted to the CD drive "
    362362                                                                "of the virtual machine but the unattended installation will "
    363                                                                 "not start</p>"));
     363                                                                "not start.</p>"));
    364364    }
    365365}
     
    378378    const QString &strPath = m_pNameAndSystemEditor->ISOFilePath();
    379379    if (strPath.isNull() || strPath.isEmpty())
     380        return false;
     381    if (m_pSkipUnattendedCheckBox && m_pSkipUnattendedCheckBox->isChecked())
    380382        return false;
    381383    return true;
     
    422424}
    423425
    424 void UIWizardNewVMPage1::setSkipCheckBoxEnable(bool fEnable)
    425 {
    426     if (m_pSkipUnattendedCheckBox)
    427         m_pSkipUnattendedCheckBox->setEnabled(fEnable);
     426void UIWizardNewVMPage1::setSkipCheckBoxEnable()
     427{
     428    if (!m_pSkipUnattendedCheckBox)
     429        return;
     430    if (m_pNameAndSystemEditor)
     431    {
     432        const QString &strPath = m_pNameAndSystemEditor->ISOFilePath();
     433        m_pSkipUnattendedCheckBox->setEnabled(!strPath.isNull() && !strPath.isEmpty());
     434    }
    428435}
    429436
     
    471478    registerField("ISOFilePath", this, "ISOFilePath");
    472479    registerField("isUnattendedEnabled", this, "isUnattendedEnabled");
    473     registerField("skipUnattendedInstall", this, "skipUnattendedInstall");
     480    //registerField("skipUnattendedInstall", this, "skipUnattendedInstall");
    474481    registerField("detectedOSTypeId", this, "detectedOSTypeId");
    475482}
     
    542549    if (m_pNameAndSystemEditor)
    543550        m_pNameAndSystemEditor->setFocus();
    544     setSkipCheckBoxEnable(isUnattendedEnabled());
     551    setSkipCheckBoxEnable();
    545552}
    546553
     
    567574    if (fileInfo.exists() && fileInfo.isReadable())
    568575        uiCommon().updateRecentlyUsedMediumListAndFolder(UIMediumDeviceType_DVD, strPath);
    569     setSkipCheckBoxEnable(isUnattendedEnabled());
     576    setSkipCheckBoxEnable();
    570577    emit completeChanged();
    571578}
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic1.h

    r88114 r88115  
    8686    /** Return false if ISO path is not empty but points to an missing or unreadable file. */
    8787    bool checkISOFile() const;
    88     void setSkipCheckBoxEnable(bool fEnable);
     88    void setSkipCheckBoxEnable();
    8989    /** @name Widgets
    9090     * @{ */
     
    126126    Q_PROPERTY(QString ISOFilePath READ ISOFilePath);
    127127    Q_PROPERTY(bool isUnattendedEnabled READ isUnattendedEnabled);
    128     Q_PROPERTY(bool skipUnattendedInstall READ skipUnattendedInstall);
     128    //Q_PROPERTY(bool skipUnattendedInstall READ skipUnattendedInstall);
    129129    Q_PROPERTY(QString detectedOSTypeId READ detectedOSTypeId);
    130130
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.cpp

    r88110 r88115  
    8383    registerField("ISOFilePath", this, "ISOFilePath");
    8484    registerField("isUnattendedEnabled", this, "isUnattendedEnabled");
    85     registerField("skipUnattendedInstall", this, "skipUnattendedInstall");
     85    //registerField("skipUnattendedInstall", this, "skipUnattendedInstall");
    8686    registerField("startHeadless", this, "startHeadless");
    8787    registerField("detectedOSTypeId", this, "detectedOSTypeId");
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.h

    r88110 r88115  
    5555    Q_PROPERTY(QString ISOFilePath READ ISOFilePath);
    5656    Q_PROPERTY(bool isUnattendedEnabled READ isUnattendedEnabled);
    57     Q_PROPERTY(bool skipUnattendedInstall READ skipUnattendedInstall);
     57    //Q_PROPERTY(bool skipUnattendedInstall READ skipUnattendedInstall);
    5858    Q_PROPERTY(bool startHeadless READ startHeadless);
    5959    Q_PROPERTY(QString detectedOSTypeId READ detectedOSTypeId);
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