VirtualBox

Changeset 87570 in vbox


Ignore:
Timestamp:
Feb 3, 2021 3:07:34 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
142597
Message:

FE/Qt: bugref:9515. Moving unattended ISO selection to 1st page in the guided mode.

Location:
trunk/src/VBox/Frontends/VirtualBox
Files:
2 deleted
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk

    r87430 r87570  
    654654        src/wizards/newvm/UIWizardNewVM.h \
    655655        src/wizards/newvm/UIWizardNewVMPageBasic1.h \
    656         src/wizards/newvm/UIWizardNewVMPageBasic2.h \
    657656        src/wizards/newvm/UIWizardNewVMPageBasic3.h \
    658657        src/wizards/newvm/UIWizardNewVMPageBasic4.h \
     
    11371136        src/wizards/newvm/UIWizardNewVM.cpp \
    11381137        src/wizards/newvm/UIWizardNewVMPageBasic1.cpp \
    1139         src/wizards/newvm/UIWizardNewVMPageBasic2.cpp \
    11401138        src/wizards/newvm/UIWizardNewVMPageBasic3.cpp \
    11411139        src/wizards/newvm/UIWizardNewVMPageBasic4.cpp \
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.cpp

    r87430 r87570  
    2424#include "UIWizardNewVM.h"
    2525#include "UIWizardNewVMPageBasic1.h"
    26 #include "UIWizardNewVMPageBasic2.h"
    2726#include "UIWizardNewVMPageBasic3.h"
    2827#include "UIWizardNewVMPageBasic4.h"
     
    8281        {
    8382            setPage(Page1, new UIWizardNewVMPageBasic1(m_strGroup));
    84             setPage(Page2, new UIWizardNewVMPageBasic2);
    8583            setPage(Page3, new UIWizardNewVMPageBasic3);
    8684            setPage(Page4, new UIWizardNewVMPageBasic4);
     
    430428void UIWizardNewVM::sltHandleDetectedOSTypeChange()
    431429{
    432     UIWizardNewVMPageBasic2 *pPage = qobject_cast<UIWizardNewVMPageBasic2*>(page(Page1));
     430    UIWizardNewVMPageBasic1 *pPage = qobject_cast<UIWizardNewVMPageBasic1*>(page(Page1));
    433431    if (!pPage)
    434432        return;
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.h

    r87430 r87570  
    6161    {
    6262        Page1,
    63         Page2,
    6463        Page3,
    6564        Page4,
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic1.cpp

    r87414 r87570  
    182182    : m_pNameAndSystemEditor(0)
    183183    , m_pNameOSTypeLabel(0)
     184    , m_pISOFilePathSelector(0)
     185    , m_pUnattendedLabel(0)
     186    , m_pISOPathSelectorLabel(0)
    184187    , m_strGroup(strGroup)
    185188{
     
    351354    if (m_pNameAndSystemEditor)
    352355        m_pNameAndSystemEditor->markNameLineEdit(m_pNameAndSystemEditor->name().isEmpty());
     356    if (m_pISOFilePathSelector)
     357        m_pISOFilePathSelector->mark(!checkISOFile());
    353358}
    354359
    355360void UIWizardNewVMPage1::retranslateWidgets()
    356361{
     362}
     363
     364QString UIWizardNewVMPage1::ISOFilePath() const
     365{
     366    if (!m_pISOFilePathSelector)
     367        return QString();
     368    return m_pISOFilePathSelector->path();
     369}
     370
     371bool UIWizardNewVMPage1::isUnattendedEnabled() const
     372{
     373    if (!m_pISOFilePathSelector)
     374        return false;
     375    const QString &strPath = m_pISOFilePathSelector->path();
     376    if (strPath.isNull() || strPath.isEmpty())
     377        return false;
     378    return true;
     379}
     380
     381const QString &UIWizardNewVMPage1::detectedOSTypeId() const
     382{
     383    return m_strDetectedOSTypeId;
     384}
     385
     386bool UIWizardNewVMPage1::determineOSType(const QString &strISOPath)
     387{
     388    QFileInfo isoFileInfo(strISOPath);
     389    if (!isoFileInfo.exists())
     390    {
     391        m_strDetectedOSTypeId.clear();
     392        return false;
     393    }
     394
     395    CUnattended comUnatteded = uiCommon().virtualBox().CreateUnattendedInstaller();
     396    comUnatteded.SetIsoPath(strISOPath);
     397    comUnatteded.DetectIsoOS();
     398
     399    m_strDetectedOSTypeId = comUnatteded.GetDetectedOSTypeId();
     400    return true;
     401}
     402
     403bool UIWizardNewVMPage1::checkISOFile() const
     404{
     405    if (!m_pISOFilePathSelector)
     406        return true;
     407    const QString &strPath = m_pISOFilePathSelector->path();
     408    if (strPath.isNull() || strPath.isEmpty())
     409        return true;
     410    QFileInfo fileInfo(strPath);
     411    if (!fileInfo.exists() || !fileInfo.isReadable())
     412        return false;
     413    return true;
     414}
     415
     416void UIWizardNewVMPage1::setTypeByISODetectedOSType(const QString &strDetectedOSType)
     417{
     418    Q_UNUSED(strDetectedOSType);
     419    // if (!strDetectedOSType.isEmpty())
     420    //     onNameChanged(strDetectedOSType);
    357421}
    358422
     
    367431    QVBoxLayout *pPageLayout = new QVBoxLayout(this);
    368432    pPageLayout->addWidget(createNameOSTypeWidgets(/* fCreateLabels */ true));
     433
     434    m_pUnattendedLabel = new QIRichTextLabel;
     435    if (m_pUnattendedLabel)
     436        pPageLayout->addWidget(m_pUnattendedLabel);
     437
     438    QHBoxLayout *pISOSelectorLayout = new QHBoxLayout;
     439
     440    m_pISOPathSelectorLabel = new QLabel;
     441    pISOSelectorLayout->addWidget(m_pISOPathSelectorLabel);
     442    m_pISOPathSelectorLabel->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed);
     443
     444    m_pISOFilePathSelector = new UIFilePathSelector;
     445    if (m_pISOFilePathSelector)
     446    {
     447        m_pISOFilePathSelector->setResetEnabled(false);
     448        m_pISOFilePathSelector->setMode(UIFilePathSelector::Mode_File_Open);
     449        m_pISOFilePathSelector->setFileDialogFilters("*.iso *.ISO");
     450        m_pISOFilePathSelector->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
     451        pISOSelectorLayout->addWidget(m_pISOFilePathSelector);
     452    }
     453
     454    pPageLayout->addLayout(pISOSelectorLayout);
    369455    pPageLayout->addStretch();
     456
     457
     458
    370459
    371460    createConnections();
     
    378467    registerField("guestOSFamiyId", this, "guestOSFamiyId");
    379468    registerField("startHeadless", this, "startHeadless");
     469    registerField("ISOFilePath", this, "ISOFilePath");
     470    registerField("isUnattendedEnabled", this, "isUnattendedEnabled");
     471    registerField("detectedOSTypeId", this, "detectedOSTypeId");
    380472}
    381473
    382474void UIWizardNewVMPageBasic1::createConnections()
    383475{
    384     connect(m_pNameAndSystemEditor, &UINameAndSystemEditor::sigNameChanged, this, &UIWizardNewVMPageBasic1::sltNameChanged);
    385     connect(m_pNameAndSystemEditor, &UINameAndSystemEditor::sigPathChanged, this, &UIWizardNewVMPageBasic1::sltPathChanged);
    386     connect(m_pNameAndSystemEditor, &UINameAndSystemEditor::sigOsTypeChanged, this, &UIWizardNewVMPageBasic1::sltOsTypeChanged);
     476    if (m_pNameAndSystemEditor)
     477    {
     478        connect(m_pNameAndSystemEditor, &UINameAndSystemEditor::sigNameChanged, this, &UIWizardNewVMPageBasic1::sltNameChanged);
     479        connect(m_pNameAndSystemEditor, &UINameAndSystemEditor::sigPathChanged, this, &UIWizardNewVMPageBasic1::sltPathChanged);
     480        connect(m_pNameAndSystemEditor, &UINameAndSystemEditor::sigOsTypeChanged, this, &UIWizardNewVMPageBasic1::sltOsTypeChanged);
     481    }
     482    if (m_pISOFilePathSelector)
     483        connect(m_pISOFilePathSelector, &UIFilePathSelector::pathChanged, this, &UIWizardNewVMPageBasic1::sltISOPathChanged);
     484
    387485}
    388486
     
    392490    if (m_pNameAndSystemEditor->name().isEmpty())
    393491        return false;
    394     return true;
     492    return checkISOFile();
     493}
     494
     495int UIWizardNewVMPageBasic1::nextId() const
     496{
     497    if (isUnattendedEnabled())
     498        return UIWizardNewVM::Page3;
     499    return UIWizardNewVM::Page4;
    395500}
    396501
     
    418523    /* Translate page: */
    419524    setTitle(UIWizardNewVM::tr("Virtual machine name and operating system"));
     525
     526    if (m_pUnattendedLabel)
     527        m_pUnattendedLabel->setText(UIWizardNewVM::tr("Please decide whether you want to start an unattended guest OS install "
     528                                             "in which case you will have to select a valid installation medium. If not, "
     529                                             "your virtual disk will have an empty virtual hard disk after vm creation."));
    420530
    421531    if (m_pNameOSTypeLabel)
     
    424534                                             "The name you choose will be used throughout VirtualBox "
    425535                                             "to identify this machine."));
    426 
    427     // if (   m_pNameAndSystemEditor
    428     //        && m_pSystemTypeEditor
    429     //        && m_pISOSelectorLabel)
    430     // {
    431     //     int iMinWidthHint = 0;
    432     //     iMinWidthHint = qMax(iMinWidthHint, m_pISOSelectorLabel->minimumSizeHint().width());
    433     //     m_pNameAndSystemEditor->setMinimumLayoutIndent(iMinWidthHint);
    434     //     m_pSystemTypeEditor->setMinimumLayoutIndent(iMinWidthHint);
    435     // }
     536    if (m_pISOPathSelectorLabel)
     537        m_pISOPathSelectorLabel->setText(UIWizardNewVM::tr("Installation ISO:"));
     538
     539    if (m_pNameAndSystemEditor && m_pISOPathSelectorLabel)
     540        m_pNameAndSystemEditor->setMinimumLayoutIndent(m_pISOPathSelectorLabel->width());
    436541}
    437542
     
    457562    return createMachineFolder();
    458563}
     564
     565void UIWizardNewVMPageBasic1::sltISOPathChanged(const QString &strPath)
     566{
     567    determineOSType(strPath);
     568    setTypeByISODetectedOSType(m_strDetectedOSTypeId);
     569
     570    emit completeChanged();
     571}
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic1.h

    r87414 r87570  
    8787
    8888
     89
     90    QString ISOFilePath() const;
     91    bool isUnattendedEnabled() const;
     92    const QString &detectedOSTypeId() const;
     93    bool determineOSType(const QString &strISOPath);
     94    bool isISOFileSelectorComplete() const;
     95    void setTypeByISODetectedOSType(const QString &strDetectedOSType);
     96    /** Return false if ISO path is not empty but points to an missing or unreadable file. */
     97    bool checkISOFile() const;
     98
     99    /** @name Widgets
     100      * @{ */
     101        mutable UIFilePathSelector *m_pISOFilePathSelector;
     102        QIRichTextLabel *m_pUnattendedLabel;
     103    /** @} */
     104
     105    QString m_strDetectedOSTypeId;
     106    QLabel *m_pISOPathSelectorLabel;
     107
    89108private:
    90109
     
    115134    Q_PROPERTY(QString machineBaseName READ machineBaseName WRITE setMachineBaseName);
    116135    Q_PROPERTY(QString guestOSFamiyId READ guestOSFamiyId);
     136    Q_PROPERTY(QString ISOFilePath READ ISOFilePath);
     137    Q_PROPERTY(bool isUnattendedEnabled READ isUnattendedEnabled);
     138    Q_PROPERTY(QString detectedOSTypeId READ detectedOSTypeId);
     139
    117140
    118141public:
     
    121144    UIWizardNewVMPageBasic1(const QString &strGroup);
    122145    virtual bool isComplete() const; /* override */
     146    virtual int nextId() const /* override */;
    123147
    124148protected:
     
    133157    void sltPathChanged(const QString &strNewPath);
    134158    void sltOsTypeChanged();
     159    void sltISOPathChanged(const QString &strPath);
    135160
    136161private:
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.cpp

    r87433 r87570  
    183183{
    184184    UIWizardNewVMPage1::retranslateWidgets();
    185     UIWizardNewVMPage2::retranslateWidgets();
    186185    UIWizardNewVMPage3::retranslateWidgets();
    187186    UIWizardNewVMPage4::retranslateWidgets();
     
    306305{
    307306    UIWizardNewVMPage1::markWidgets();
    308     UIWizardNewVMPage2::markWidgets();
    309307    UIWizardNewVMPage3::markWidgets();
    310308}
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.h

    r87430 r87570  
    2424/* Local includes: */
    2525#include "UIWizardNewVMPageBasic1.h"
    26 #include "UIWizardNewVMPageBasic2.h"
    2726#include "UIWizardNewVMPageBasic3.h"
    2827#include "UIWizardNewVMPageBasic4.h"
     
    3635class UIWizardNewVMPageExpert : public UIWizardPage,
    3736                                public UIWizardNewVMPage1,
    38                                 public UIWizardNewVMPage2,
    3937                                public UIWizardNewVMPage3,
    4038                                public UIWizardNewVMPage4,
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