VirtualBox

Changeset 93642 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Feb 7, 2022 2:36:58 PM (3 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9515. Addendum to r149783. Getting rid of temporary CUanttended instance during OS detection from ISO.

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

    r93638 r93642  
    560560}
    561561
    562 // void UIWizardNewVM::setDefaultUnattendedInstallData(const UIUnattendedInstallData &unattendedInstallData)
    563 // {
    564 //     m_unattendedInstallData = unattendedInstallData;
    565 // }
    566 
    567562CMedium &UIWizardNewVM::virtualDisk()
    568563{
     
    634629}
    635630
    636 const QString &UIWizardNewVM::detectedOSTypeId() const
    637 {
    638     return m_strDetectedOSTypeId;
    639 }
    640 
    641 void UIWizardNewVM::setDetectedOSTypeId(const QString &strDetectedOSTypeId)
    642 {
    643     m_strDetectedOSTypeId = strDetectedOSTypeId;
     631QString UIWizardNewVM::detectedOSTypeId() const
     632{
     633    AssertReturn(!m_comUnattended.isNull(), QString());
     634    return m_comUnattended.GetDetectedOSTypeId();
    644635}
    645636
     
    717708void UIWizardNewVM::setISOFilePath(const QString &strISOFilePath)
    718709{
     710    /* am I being a paranoid?: */
     711    QFileInfo isoFileInfo(strISOFilePath);
     712    if (!isoFileInfo.exists())
     713        return;
     714
    719715    AssertReturnVoid(!m_comUnattended.isNull());
    720716    m_comUnattended.SetIsoPath(strISOFilePath);
     
    722718    setUnattendedPageVisible(isUnattendedEnabled());
    723719    AssertReturnVoid(checkUnattendedInstallError(m_comUnattended));
     720
     721    m_comUnattended.DetectIsoOS();
     722
     723    const QVector<ULONG> &indices = m_comUnattended.GetDetectedImageIndices();
     724    QVector<ulong> qIndices;
     725    for (int i = 0; i < indices.size(); ++i)
     726        qIndices << indices[i];
     727    setDetectedWindowsImageNamesAndIndices(m_comUnattended.GetDetectedImageNames(), qIndices);
    724728}
    725729
     
    929933bool UIWizardNewVM::isOSTypeDetectionOK() const
    930934{
    931     if (m_strDetectedOSTypeId.isEmpty())
     935    QString strDetectedOSTypeId = detectedOSTypeId();
     936    if (strDetectedOSTypeId.isEmpty())
    932937        return false;
    933     if (m_strDetectedOSTypeId.contains("other", Qt::CaseInsensitive))
     938    if (strDetectedOSTypeId.contains("other", Qt::CaseInsensitive))
    934939        return false;
    935940    return true;
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.h

    r93638 r93642  
    8383        void setCreatedMachineFolder(const QString &strCreatedMachineFolder);
    8484
    85         const QString &detectedOSTypeId() const;
    86         void setDetectedOSTypeId(const QString &strDetectedOSTypeId);
     85        QString detectedOSTypeId() const;
    8786
    8887        const QString &guestOSFamilyId() const;
     
    198197       QString m_strMachineBaseName;
    199198
    200        /** Type Id od the OS detected from the ISO file by IUnattended. */
    201        QString m_strDetectedOSTypeId;
    202199       /* Name and index lists of the images detected from an ISO. Currently only for Windows ISOs. */
    203200       QVector<QString> m_detectedWindowsImageNames;
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMExpertPage.cpp

    r93638 r93642  
    148148    AssertReturnVoid(pWizard);
    149149
    150     UIWizardNewVMNameOSTypeCommon::detectOSAndImagesFromISO(strISOPath, pWizard);
     150    pWizard->setISOFilePath(strISOPath);
    151151
    152152    if (UIWizardNewVMNameOSTypeCommon::guessOSTypeDetectedOSTypeString(m_pNameAndSystemEditor, pWizard->detectedOSTypeId()))
     
    154154    else /* Remove GuestOSTypeFromISO from the set if it is there: */
    155155        m_userModifiedParameters.remove("GuestOSTypeFromISO");
    156 
    157     pWizard->setISOFilePath(strISOPath);
    158156
    159157    /* Update the global recent ISO path: */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMNameOSTypePage.cpp

    r93607 r93642  
    311311}
    312312
    313 void UIWizardNewVMNameOSTypeCommon::detectOSAndImagesFromISO(const QString &strISOPath, UIWizardNewVM *pWizard)
    314 {
    315     if (!pWizard)
    316         return;
    317 
    318     QFileInfo isoFileInfo(strISOPath);
    319     if (!isoFileInfo.exists())
    320     {
    321         pWizard->setDetectedOSTypeId(QString());
    322         return;
    323     }
    324 
    325     CUnattended comUnatteded = uiCommon().virtualBox().CreateUnattendedInstaller();
    326     comUnatteded.SetIsoPath(strISOPath);
    327     comUnatteded.DetectIsoOS();
    328     pWizard->setDetectedOSTypeId(comUnatteded.GetDetectedOSTypeId());
    329 
    330     const QVector<ULONG> &indices = comUnatteded.GetDetectedImageIndices();
    331     QVector<ulong> qIndices;
    332     for (int i = 0; i < indices.size(); ++i)
    333         qIndices << indices[i];
    334     pWizard->setDetectedWindowsImageNamesAndIndices(comUnatteded.GetDetectedImageNames(), qIndices);
    335 }
    336 
    337313bool UIWizardNewVMNameOSTypeCommon::checkISOFile(UINameAndSystemEditor *pNameAndSystemEditor)
    338314{
     
    486462    UIWizardNewVM *pWizard = qobject_cast<UIWizardNewVM*>(this->wizard());
    487463    AssertReturnVoid(pWizard);
    488     UIWizardNewVMNameOSTypeCommon::detectOSAndImagesFromISO(strPath, pWizard);
     464
     465    pWizard->setISOFilePath(strPath);
    489466
    490467    if (UIWizardNewVMNameOSTypeCommon::guessOSTypeDetectedOSTypeString(m_pNameAndSystemEditor, pWizard->detectedOSTypeId()))
     
    492469    else /* Remove GuestOSTypeFromISO fromthe set if it is there: */
    493470        m_userModifiedParameters.remove("GuestOSTypeFromISO");
    494 
    495     pWizard->setISOFilePath(strPath);
    496471
    497472    /* Update the global recent ISO path: */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMNameOSTypePage.h

    r93607 r93642  
    4343    bool cleanupMachineFolder(UIWizardNewVM *pWizard, bool fWizardCancel = false);
    4444    void composeMachineFilePath(UINameAndSystemEditor *pNameAndSystemEditor, UIWizardNewVM *pWizard);
    45     void detectOSAndImagesFromISO(const QString &strISOPath, UIWizardNewVM *pWizard);
    4645    /** Return false if ISO path is not empty but points to an missing or unreadable file. */
    4746    bool checkISOFile(UINameAndSystemEditor *pNameAndSystemEditor);
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