VirtualBox

Changeset 87355 in vbox


Ignore:
Timestamp:
Jan 21, 2021 4:24:07 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9515. More fixes.

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

    r87322 r87355  
    525525    setField("password", m_unattendedInstallData.m_strPassword);
    526526    setField("hostname", m_unattendedInstallData.m_strHostname);
     527    setField("installGuestAdditions", m_unattendedInstallData.m_fInstallGuestAdditions);
    527528    setField("guestAdditionsISOPath", m_unattendedInstallData.m_strGuestAdditionsISOPath);
    528529}
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic2.cpp

    r87348 r87355  
    3737    , m_pHostnameLineEdit(0)
    3838    , m_pHostnameLabel(0)
     39    , m_pGAInstallCheckBox(0)
    3940    , m_pGAISOPathLabel(0)
    4041    , m_pGAISOFilePathSelector(0)
     
    8687bool UIWizardNewVMPage2::installGuestAdditions() const
    8788{
    88     if (!m_pGAISOFilePathSelector)
     89    if (!m_pGAInstallCheckBox)
    8990        return false;
    90     return m_pGAISOFilePathSelector->isValid();
     91    return m_pGAInstallCheckBox->isChecked();
     92}
     93
     94void UIWizardNewVMPage2::setInstallGuestAdditions(bool fInstallGA)
     95{
     96    if (m_pGAInstallCheckBox)
     97        m_pGAInstallCheckBox->setChecked(fInstallGA);
    9198}
    9299
     
    175182bool UIWizardNewVMPage2::checkGAISOFile() const
    176183{
     184    if (!m_pGAISOFilePathSelector)
     185        return false;
    177186    const QString &strPath = m_pGAISOFilePathSelector->path();
    178187    if (strPath.isNull() || strPath.isEmpty())
    179188        return true;
    180     QFile fileInfo(strPath);
     189    QFileInfo fileInfo(strPath);
    181190    if (!fileInfo.exists() || !fileInfo.isReadable())
    182191        return false;
     
    199208    if (m_pGAISOFilePathSelector)
    200209        m_pGAISOFilePathSelector->setToolTip(UIWizardNewVM::tr("Please select an installation medium (ISO file)"));
     210    if (m_pGAInstallCheckBox)
     211        m_pGAInstallCheckBox->setText(UIWizardNewVM::tr("Install Guest Additions"));
    201212    if (m_pProductKeyLabel)
    202213        m_pProductKeyLabel->setText(UIWizardNewVM::tr("Product Key:"));
     214}
     215
     216void UIWizardNewVMPage2::disableEnableGAWidgets(bool fEnabled)
     217{
     218    if (m_pGAISOPathLabel)
     219        m_pGAISOPathLabel->setEnabled(fEnabled);
     220    if (m_pGAISOFilePathSelector)
     221        m_pGAISOFilePathSelector->setEnabled(fEnabled);
    203222}
    204223
     
    305324void UIWizardNewVMPageBasic2::sltInstallGACheckBoxToggle(bool fEnabled)
    306325{
    307     if (m_pGAISOPathLabel)
    308         m_pGAISOPathLabel->setEnabled(fEnabled);
    309     if (m_pGAISOFilePathSelector)
    310         m_pGAISOFilePathSelector->setEnabled(fEnabled);
     326    disableEnableGAWidgets(fEnabled);
    311327    emit completeChanged();
    312328}
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic2.h

    r87322 r87355  
    5353        void setHostname(const QString &strHostName);
    5454        bool installGuestAdditions() const;
     55        void setInstallGuestAdditions(bool fInstallGA);
    5556        QString guestAdditionsISOPath() const;
    5657        void setGuestAdditionsISOPath(const QString &strISOPath);
     
    7475    void markWidgets() const;
    7576    void retranslateWidgets();
     77    void disableEnableGAWidgets(bool fEnabled);
    7678
    7779    /** @name Widgets
     
    8082        QLineEdit *m_pHostnameLineEdit;
    8183        QLabel  *m_pHostnameLabel;
     84        QCheckBox *m_pGAInstallCheckBox;
    8285        QLabel  *m_pGAISOPathLabel;
    8386        UIFilePathSelector *m_pGAISOFilePathSelector;
     
    8689        QLabel  *m_pProductKeyLabel;
    8790    /** @} */
    88 
    8991};
    9092
     
    9597    Q_PROPERTY(QString password READ password WRITE setPassword);
    9698    Q_PROPERTY(QString hostname READ hostname WRITE setHostname);
    97     Q_PROPERTY(bool installGuestAdditions READ installGuestAdditions);
     99    Q_PROPERTY(bool installGuestAdditions READ installGuestAdditions WRITE setInstallGuestAdditions);
    98100    Q_PROPERTY(QString guestAdditionsISOPath READ guestAdditionsISOPath WRITE setGuestAdditionsISOPath);
    99101    Q_PROPERTY(QString productKey READ productKey);
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.cpp

    r87348 r87355  
    201201        m_pAdditionalOptionsContainer->setTitle(UIWizardNewVM::tr("Additional options"));
    202202    if (m_pGAInstallationISOContainer)
    203         m_pGAInstallationISOContainer->setTitle(UIWizardNewVM::tr("Guest Additions Installation Medium (ISO)"));
     203        m_pGAInstallationISOContainer->setTitle(UIWizardNewVM::tr("Guest Additions"));
    204204    if (m_pToolBox)
    205205    {
     
    209209        m_pToolBox->setItemText(ExpertToolboxItems_Hardware, UIWizardNewVM::tr("Hardware"));
    210210    }
     211}
     212
     213void UIWizardNewVMPageExpert::sltInstallGACheckBoxToggle(bool fEnabled)
     214{
     215    disableEnableGAWidgets(fEnabled);
     216    emit completeChanged();
    211217}
    212218
     
    237243        connect(m_pGAISOFilePathSelector, &UIFilePathSelector::pathChanged,
    238244                this, &UIWizardNewVMPageExpert::sltGAISOPathChanged);
     245
     246    if (m_pGAInstallCheckBox)
     247        connect(m_pGAInstallCheckBox, &QCheckBox::toggled,
     248                this, &UIWizardNewVMPageExpert::sltInstallGACheckBoxToggle);
    239249
    240250    /* Connections for disk and hardware stuff: */
     
    382392            pAdditionalOptionsContainerLayout->addWidget(m_pHostnameLineEdit, 2, 1, 1, 3);
    383393
    384         // pAdditionalOptionsContainerLayout->addWidget(createHostNameWidgets());
    385 
    386         // pAdditionalOptionsContainerLayout->addStretch();
    387394        pLayout->addWidget(m_pAdditionalOptionsContainer, iRow, 2, 1, 2);
    388395    }
     
    391398    {
    392399        m_pGAInstallationISOContainer = new QGroupBox;
    393         QHBoxLayout *pGAInstallationISOContainer = new QHBoxLayout(m_pGAInstallationISOContainer);
     400        QGridLayout *pGAInstallationISOContainer = new QGridLayout(m_pGAInstallationISOContainer);
     401        m_pGAInstallCheckBox = new QCheckBox;
     402        if (m_pGAInstallCheckBox)
     403            pGAInstallationISOContainer->addWidget(m_pGAInstallCheckBox, 0, 0, 1, 8);
     404        m_pGAISOPathLabel = new QLabel;
     405        if (m_pGAISOPathLabel)
     406            pGAInstallationISOContainer->addWidget(m_pGAISOPathLabel, 1, 1, 1, 1);
     407
    394408        m_pGAISOFilePathSelector = new UIFilePathSelector;
    395409        {
     
    398412            m_pGAISOFilePathSelector->setFileDialogFilters("*.iso *.ISO");
    399413            m_pGAISOFilePathSelector->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
    400             pGAInstallationISOContainer->addWidget(m_pGAISOFilePathSelector);
     414            pGAInstallationISOContainer->addWidget(m_pGAISOFilePathSelector, 1, 2, 1, 6);
    401415        }
    402416        pLayout->addWidget(m_pGAInstallationISOContainer, iRow, 0, 1, 4);
     
    440454        if (!checkGAISOFile())
    441455        {
    442             // m_pToolBox->setItemIcon(ExpertToolboxItems_Unattended,
    443             //                         UIIconPool::iconSet(":/status_error_16px.png"));
     456            m_pToolBox->setItemIcon(ExpertToolboxItems_Unattended,
     457                                    UIIconPool::iconSet(":/status_error_16px.png"));
    444458            fIsComplete = false;
    445459        }
     
    499513    UIWizardNewVM *pWizard = qobject_cast<UIWizardNewVM*>(wizard());
    500514    if (!pWizard || !pWizard->isUnattendedEnabled() || !pWizard->isGuestOSTypeWindows())
     515        return false;
     516    return true;
     517}
     518
     519bool UIWizardNewVMPageExpert::isGAInstallEnabled() const
     520{
     521    UIWizardNewVM *pWizard = qobject_cast<UIWizardNewVM*>(wizard());
     522    if (!pWizard || !isUnattendedEnabled() || !m_pGAInstallCheckBox->isChecked())
    501523        return false;
    502524    return true;
     
    512534        m_pGAInstallationISOContainer->setEnabled(fEnabled);
    513535    disableEnableProductKeyWidgets(isProductKeyWidgetEnabled());
     536    disableEnableGAWidgets(isGAInstallEnabled());
    514537}
    515538
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.h

    r87348 r87355  
    5353    Q_PROPERTY(QString password READ password WRITE setPassword);
    5454    Q_PROPERTY(QString hostname READ hostname WRITE setHostname);
    55     Q_PROPERTY(bool installGuestAdditions READ installGuestAdditions);
     55    Q_PROPERTY(bool installGuestAdditions READ installGuestAdditions WRITE setInstallGuestAdditions);
    5656    Q_PROPERTY(QString guestAdditionsISOPath READ guestAdditionsISOPath WRITE setGuestAdditionsISOPath);
    5757    Q_PROPERTY(QString productKey READ productKey);
     
    8383    void sltGAISOPathChanged(const QString &strPath);
    8484    void sltOSFamilyTypeChanged();
     85    void sltInstallGACheckBoxToggle(bool fEnabled);
    8586
    8687private:
     
    106107
    107108    bool isProductKeyWidgetEnabled() const;
     109    bool isGAInstallEnabled() const;
    108110    void disableEnableUnattendedRelatedWidgets(bool fEnabled);
    109111    void disableEnableProductKeyWidgets(bool fEnabled);
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