VirtualBox

Ignore:
Timestamp:
Jul 19, 2021 11:13:47 AM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9996. Working on the isComplete stuff of the expert page.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UINameAndSystemEditor.h

    r90033 r90236  
    123123    void setNameFieldValidator(const QString &strValidator);
    124124
    125     /** Passes the @p fError to QILineEdit::mark(bool) effectively changing the background color. */
     125    /** Passes the @p fError to QILineEdit::mark(bool) effectively marking it for error. */
    126126    void markNameEditor(bool fError);
    127127    /** Passes the @p fError and @a strErrorMessage to UIFilePathSelector::mark(bool)
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/editors/UIHostnameDomainNameEditor.cpp

    r90193 r90236  
    5656    return m_pHostnameLineEdit && m_pHostnameLineEdit->hasAcceptableInput() &&
    5757        m_pDomainNameLineEdit && m_pDomainNameLineEdit->hasAcceptableInput();
     58}
     59
     60void UIHostnameDomainNameEditor::mark()
     61{
     62    if (m_pHostnameLineEdit)
     63        m_pHostnameLineEdit->mark(!m_pHostnameLineEdit->hasAcceptableInput(),
     64                                  tr("Hostname should be at least 2 character lomg. Allowed characters are alphanumerics, \"-\" and \".\""));
     65    if (m_pDomainNameLineEdit)
     66        m_pDomainNameLineEdit->mark(!m_pDomainNameLineEdit->hasAcceptableInput(),
     67                                  tr("Domain name should be at least 2 character lomg. Allowed characters are alphanumerics, \"-\" and \".\""));
    5868}
    5969
     
    120130
    121131    pLayout->addWidget(pLineEdit, iRow, 1, 1, 3);
    122     // QRegularExpression hostNameRegex("^[a-zA-Z0-9-.]{2,}\\.[a-zA-Z0-9-.]+$");^[a-zA-Z0-9-.]{2,}\.[a-zA-Z0-9-.]+$
    123     /* Host name and domain should be strings of minimum length of 2 and composed of alpha numerics, '-', and '.': */
    124     m_pHostnameLineEdit->setValidator(new QRegularExpressionValidator(QRegularExpression("^[a-zA-Z0-9-.]{2,}"), this));
    125 
    126132    pLabel->setBuddy(pLineEdit);
    127133    ++iRow;
     
    140146    addLineEdit(iRow, m_pHostnameLabel, m_pHostnameLineEdit, pMainLayout);
    141147    addLineEdit(iRow, m_pDomainNameLabel, m_pDomainNameLineEdit, pMainLayout);
     148
     149    // QRegularExpression hostNameRegex("^[a-zA-Z0-9-.]{2,}\\.[a-zA-Z0-9-.]+$");^[a-zA-Z0-9-.]{2,}\.[a-zA-Z0-9-.]+$
     150    /* Host name and domain should be strings of minimum length of 2 and composed of alpha numerics, '-', and '.': */
     151    m_pHostnameLineEdit->setValidator(new QRegularExpressionValidator(QRegularExpression("^[a-zA-Z0-9-.]{2,}"), this));
     152    m_pDomainNameLineEdit->setValidator(new QRegularExpressionValidator(QRegularExpression("^[a-zA-Z0-9-.]{2,}"), this));
    142153
    143154    connect(m_pHostnameLineEdit, &QILineEdit::textChanged,
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/editors/UIHostnameDomainNameEditor.h

    r90157 r90236  
    5757
    5858    bool isComplete() const;
     59    void mark();
    5960
    6061protected:
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/editors/UIWizardNewVMEditors.cpp

    r90232 r90236  
    2828#include "UIFilePathSelector.h"
    2929#include "UIUserNamePasswordEditor.h"
     30#include "UIVirtualCPUEditor.h"
    3031#include "UIWizardNewVM.h"
    3132#include "UIWizardNewVMEditors.h"
    32 #include "UIVirtualCPUEditor.h"
     33#include "UIWizardNewVMUnattendedPageBasic.h"
    3334
    3435/* Other VBox includes: */
     
    178179}
    179180
    180 void UIGAInstallationGroupBox::mark(bool fError, const QString &strErrorMessage /* = QString() */)
    181 {
    182     if (m_pGAISOFilePathSelector)
    183         m_pGAISOFilePathSelector->mark(fError, strErrorMessage);
    184 }
    185 
     181void UIGAInstallationGroupBox::mark()
     182{
     183    bool fError = !UIWizardNewVMUnattendedPage::checkGAISOFile(path());
     184    if (m_pGAISOFilePathSelector)
     185        m_pGAISOFilePathSelector->mark(fError, tr("Invalid Guest Additions installation media"));
     186}
     187
     188bool UIGAInstallationGroupBox::isComplete() const
     189{
     190    if (!isChecked())
     191        return true;
     192    return UIWizardNewVMUnattendedPage::checkGAISOFile(path());
     193}
    186194
    187195void UIGAInstallationGroupBox::sltToggleWidgetsEnabled(bool fEnabled)
     
    249257                this, &UIAdditionalUnattendedOptions::sigStartHeadlessChanged);
    250258
    251 
    252259    retranslateUi();
    253260}
     
    306313        return m_pHostnameDomainNameEditor->isComplete();
    307314    return false;
     315}
     316
     317void UIAdditionalUnattendedOptions::mark()
     318{
     319    if (m_pHostnameDomainNameEditor)
     320        m_pHostnameDomainNameEditor->mark();
    308321}
    309322
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/editors/UIWizardNewVMEditors.h

    r90232 r90236  
    9090        QString path() const;
    9191        void setPath(const QString &strPath, bool fRefreshText = true);
    92         void mark(bool fError, const QString &strErrorMessage = QString());
     92        void mark();
     93        bool isComplete() const;
    9394    /** @} */
    9495
     
    128129        QString hostnameDomainName() const;
    129130        bool isComplete() const;
     131        void mark();
    130132        void disableEnableProductKeyWidgets(bool fEnabled);
    131133    /** @} */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.cpp

    r90233 r90236  
    403403        updateHostnameDomainNameFromMachineName();
    404404
     405    if (m_pGAInstallationISOContainer && !m_userModifiedParameters.contains("InstallGuestAdditions"))
     406    {
     407        m_pGAInstallationISOContainer->blockSignals(true);
     408        m_pGAInstallationISOContainer->setChecked(pWizard->installGuestAdditions());
     409        m_pGAInstallationISOContainer->blockSignals(false);
     410    }
    405411
    406412    setOSTypeDependedValues();
     
    418424void UIWizardNewVMPageExpert::markWidgets() const
    419425{
    420     // UIWizardNewVMPageBaseNameOSType::markWidgets();
    421     // UIWizardNewVMPageBaseUnattended::markWidgets();
     426    if (m_pNameAndSystemEditor)
     427    {
     428        m_pNameAndSystemEditor->markNameEditor(m_pNameAndSystemEditor->name().isEmpty());
     429        m_pNameAndSystemEditor->markImageEditor(!UIWizardNewVMNameOSTypePage::checkISOFile(m_pNameAndSystemEditor),
     430                                                UIWizardNewVM::tr("Invalid file path or unreadable file"));
     431    }
     432    UIWizardNewVM *pWizard = qobject_cast<UIWizardNewVM*>(wizard());
     433    if (pWizard && pWizard->installGuestAdditions() && m_pGAInstallationISOContainer)
     434        m_pGAInstallationISOContainer->mark();
     435    if (isUnattendedEnabled())
     436        m_pAdditionalOptionsContainer->mark();
    422437}
    423438
     
    498513bool UIWizardNewVMPageExpert::isComplete() const
    499514{
    500     //markWidgets();
     515    markWidgets();
    501516    bool fIsComplete = true;
    502     // m_pToolBox->setPageTitleIcon(ExpertToolboxItems_NameAndOSType, QIcon());
    503     // m_pToolBox->setPageTitleIcon(ExpertToolboxItems_Unattended, QIcon());
    504     // m_pToolBox->setPageTitleIcon(ExpertToolboxItems_Disk, QIcon());
    505     // m_pToolBox->setPageTitleIcon(ExpertToolboxItems_Hardware, QIcon());
    506 
    507     // if (!UIWizardPage::isComplete())
    508     // {
    509     //     m_pToolBox->setPageTitleIcon(ExpertToolboxItems_NameAndOSType,
    510     //                                  UIIconPool::iconSet(":/status_error_16px.png"),
    511     //                                  UIWizardNewVM::tr("A valid VM name is required"));
    512     //     fIsComplete = false;
    513     // }
    514 
    515     // if (m_pDiskExisting && m_pDiskExisting->isChecked() && uiCommon().medium(m_pDiskSelector->id()).isNull())
    516     // {
    517     //     m_pToolBox->setPageTitleIcon(ExpertToolboxItems_Disk,
    518     //                                  UIIconPool::iconSet(":/status_error_16px.png"), UIWizardNewVM::tr("No valid disk is selected"));
    519     //     fIsComplete = false;
    520     // }
    521 
    522     // if (m_pDiskNew && m_pDiskNew->isChecked())
    523     // {
    524     //     qulonglong uSize = field("mediumSize").toULongLong();
    525     //     if (uSize <= 0)
    526     //     {
    527     //         m_pToolBox->setPageTitleIcon(ExpertToolboxItems_Disk,
    528     //                                      UIIconPool::iconSet(":/status_error_16px.png"), UIWizardNewVM::tr("Invalid disk size"));
    529     //         fIsComplete = false;
    530     //     }
    531     // }
    532 
    533     // /* Check unattended install related stuff: */
    534     // if (isUnattendedEnabled())
    535     // {
    536     //     /* Check the installation medium: */
    537     //     if (!checkISOFile())
    538     //     {
    539     //         m_pToolBox->setPageTitleIcon(ExpertToolboxItems_NameAndOSType,
    540     //                                      UIIconPool::iconSet(":/status_error_16px.png"),
    541     //                                      UIWizardNewVM::tr("Invalid path or unreadable ISO file"));
    542     //         fIsComplete = false;
    543     //     }
    544     //     /* Check the GA installation medium: */
    545     //     if (m_pGAInstallationISOContainer && m_pGAInstallationISOContainer->isChecked() && !checkGAISOFile())
    546     //     {
    547     //         m_pToolBox->setPageTitleIcon(ExpertToolboxItems_Unattended,
    548     //                                      UIIconPool::iconSet(":/status_error_16px.png"),
    549     //                                      UIWizardNewVM::tr("Invalid path or unreadable ISO file"));
    550 
    551     //         fIsComplete = false;
    552     //     }
    553     //     if (m_pUserNamePasswordGroupBox)
    554     //     {
    555     //         if (!m_pUserNamePasswordGroupBox->isComplete())
    556     //         {
    557     //             m_pToolBox->setPageTitleIcon(ExpertToolboxItems_Unattended,
    558     //                                          UIIconPool::iconSet(":/status_error_16px.png"),
    559     //                                          UIWizardNewVM::tr("Invalid username and/or password"));
    560     //             fIsComplete = false;
    561     //         }
    562     //     }
    563     // }
     517    m_pToolBox->setPageTitleIcon(ExpertToolboxItems_NameAndOSType, QIcon());
     518    m_pToolBox->setPageTitleIcon(ExpertToolboxItems_Unattended, QIcon());
     519    m_pToolBox->setPageTitleIcon(ExpertToolboxItems_Disk, QIcon());
     520    m_pToolBox->setPageTitleIcon(ExpertToolboxItems_Hardware, QIcon());
     521
     522    UIWizardNewVM *pWizard = qobject_cast<UIWizardNewVM*>(wizard());
     523    AssertReturn(pWizard, false);
     524
     525    /* Check unattended install related stuff: */
     526    if (isUnattendedEnabled())
     527    {
     528        /* Check the installation medium: */
     529        if (!UIWizardNewVMNameOSTypePage::checkISOFile(m_pNameAndSystemEditor))
     530        {
     531            m_pToolBox->setPageTitleIcon(ExpertToolboxItems_NameAndOSType,
     532                                         UIIconPool::iconSet(":/status_error_16px.png"),
     533                                         UIWizardNewVM::tr("Invalid path or unreadable ISO file"));
     534            fIsComplete = false;
     535        }
     536        /* Check the GA installation medium: */
     537        if (m_pGAInstallationISOContainer && !m_pGAInstallationISOContainer->isComplete())
     538        {
     539            m_pToolBox->setPageTitleIcon(ExpertToolboxItems_Unattended,
     540                                         UIIconPool::iconSet(":/status_error_16px.png"),
     541                                         UIWizardNewVM::tr("Invalid path or unreadable ISO file"));
     542
     543            fIsComplete = false;
     544        }
     545        if (m_pUserNamePasswordGroupBox)
     546        {
     547            if (!m_pUserNamePasswordGroupBox->isComplete())
     548            {
     549                m_pToolBox->setPageTitleIcon(ExpertToolboxItems_Unattended,
     550                                             UIIconPool::iconSet(":/status_error_16px.png"),
     551                                             UIWizardNewVM::tr("Invalid username and/or password"));
     552                fIsComplete = false;
     553            }
     554        }
     555        if (m_pAdditionalOptionsContainer)
     556        {
     557            if (!m_pAdditionalOptionsContainer->isComplete())
     558            {
     559                m_pToolBox->setPageTitleIcon(ExpertToolboxItems_Unattended,
     560                                             UIIconPool::iconSet(":/status_error_16px.png"),
     561                                             UIWizardNewVM::tr("Invalid hostname or domain name"));
     562                fIsComplete = false;
     563            }
     564        }
     565    }
     566
     567    if (m_pNameAndSystemEditor)
     568    {
     569        if (m_pNameAndSystemEditor->name().isEmpty())
     570        {
     571            m_pToolBox->setPageTitleIcon(ExpertToolboxItems_NameAndOSType,
     572                                         UIIconPool::iconSet(":/status_error_16px.png"),
     573                                         UIWizardNewVM::tr("Virtual machine name is invalid"));
     574            fIsComplete = false;
     575        }
     576        if (!UIWizardNewVMNameOSTypePage::checkISOFile(m_pNameAndSystemEditor))
     577        {
     578            m_pToolBox->setPageTitleIcon(ExpertToolboxItems_NameAndOSType,
     579                                         UIIconPool::iconSet(":/status_error_16px.png"),
     580                                         UIWizardNewVM::tr("Invalid ISO file"));
     581            fIsComplete = false;
     582        }
     583    }
     584
     585    if (m_pDiskExisting && m_pDiskExisting->isChecked() && uiCommon().medium(m_pDiskSelector->id()).isNull())
     586    {
     587        m_pToolBox->setPageTitleIcon(ExpertToolboxItems_Disk,
     588                                     UIIconPool::iconSet(":/status_error_16px.png"), UIWizardNewVM::tr("No valid disk is selected"));
     589        fIsComplete = false;
     590    }
     591
     592    if (m_pDiskNew && m_pDiskNew->isChecked())
     593    {
     594        qulonglong uSize = pWizard->mediumSize();
     595        if (uSize <= 0)
     596        {
     597            m_pToolBox->setPageTitleIcon(ExpertToolboxItems_Disk,
     598                                         UIIconPool::iconSet(":/status_error_16px.png"), UIWizardNewVM::tr("Invalid disk size"));
     599            fIsComplete = false;
     600        }
     601    }
     602
    564603
    565604     // return !mediumFormat().isNull() &&
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMUnattendedPageBasic.cpp

    r90232 r90236  
    255255    UIWizardNewVM *pWizard = qobject_cast<UIWizardNewVM*>(wizard());
    256256    if (pWizard && pWizard->installGuestAdditions() && m_pGAInstallationISOContainer)
    257         m_pGAInstallationISOContainer->mark(!UIWizardNewVMUnattendedPage::checkGAISOFile(m_pGAInstallationISOContainer->path()));
    258 }
     257        m_pGAInstallationISOContainer->mark();
     258}
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