VirtualBox

Changeset 85150 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Jul 9, 2020 12:56:45 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
139101
Message:

FE/Qt: bugref:9515. Marking more widgets.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/extensions/QILineEdit.cpp

    r82968 r85150  
    2020
    2121/* Qt includes: */
     22#include <QPalette>
    2223#include <QStyleOptionFrame>
    2324
     25QILineEdit::QILineEdit(QWidget *pParent /* = 0 */)
     26    : QLineEdit(pParent)
     27{
     28    m_originalBaseColor = palette().color(QPalette::Base);
     29}
    2430
    2531void QILineEdit::setMinimumWidthByText(const QString &strText)
     
    5258    return sa;
    5359}
     60
     61void QILineEdit::mark(bool fError)
     62{
     63    QPalette newPalette = palette();
     64    if (fError)
     65        newPalette.setColor(QPalette::Base, QColor(255, 180, 180));
     66    else
     67        newPalette.setColor(QPalette::Base, m_originalBaseColor);
     68    setPalette(newPalette);
     69}
  • trunk/src/VBox/Frontends/VirtualBox/src/extensions/QILineEdit.h

    r82968 r85150  
    3636
    3737    /** Constructs label-separator passing @a pParent to the base-class. */
    38     QILineEdit(QWidget *pParent = 0)
    39         : QLineEdit(pParent) {}
     38    QILineEdit(QWidget *pParent = 0);
     39
    4040    /** Constructs label-separator passing @a pParent to the base-class.
    4141      * @param  strContents  Brings the line-edit text. */
     
    4848    void setFixedWidthByText(const QString &strText);
    4949
     50    /** Sets the color to some reddish color when @p fError is true. Usually used to indicate some error. */
     51    void mark(bool fError);
     52
    5053private:
    5154
    5255    /** Calculates suitable @a strText size. */
    5356    QSize featTextWidth(const QString &strText) const;
     57    /** The original background base color. Used when marking/unmarking the combo box. */
     58    QColor m_originalBaseColor;
    5459};
    5560
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UINameAndSystemEditor.cpp

    r85104 r85150  
    254254}
    255255
     256void UINameAndSystemEditor::markNameLineEdit(bool fError)
     257{
     258    if (m_pNameLineEdit)
     259        m_pNameLineEdit->mark(fError);
     260}
     261
    256262void UINameAndSystemEditor::retranslateUi()
    257263{
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UINameAndSystemEditor.h

    r85104 r85150  
    113113    void setNameFieldValidator(const QString &strValidator);
    114114
     115    /** Passes the @p fError to QILineEdit::mark(bool) effectively changing the background color. */
     116    void markNameLineEdit(bool fError);
     117
    115118protected:
    116119
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIUserNamePasswordEditor.cpp

    r85118 r85150  
    119119    , m_pPasswordLabel(0)
    120120    , m_pPasswordRepeatLabel(0)
     121    , m_fForceUnmark(false)
    121122{
    122123    prepare();
     
    180181}
    181182
     183void UIUserNamePasswordEditor::setForceUnmark(bool fForceUnmark)
     184{
     185    m_fForceUnmark = fForceUnmark;
     186    isUserNameComplete();
     187    isPasswordComplete();
     188}
     189
    182190void UIUserNamePasswordEditor::retranslateUi()
    183191{
     
    227235        return;
    228236    QPalette palette = pLineEdit->palette();
    229     if (fError)
     237    if (!fError || m_fForceUnmark)
     238        palette.setColor(QPalette::Base, m_orginalLineEditBaseColor);
     239    else
    230240        palette.setColor(QPalette::Base, QColor(255, 180, 180));
    231     else
    232         palette.setColor(QPalette::Base, m_orginalLineEditBaseColor);
    233241    pLineEdit->setPalette(palette);
    234242}
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIUserNamePasswordEditor.h

    r85118 r85150  
    8585    /** Returns false if username or password fields are empty, or password fields do not match. */
    8686    bool isComplete();
     87    /** Sets m_fForceUnmark flag. see it for more info. */
     88    void setForceUnmark(bool fForceUnmark);
    8789
    8890protected:
     
    114116    QLabel *m_pPasswordRepeatLabel;
    115117    QColor m_orginalLineEditBaseColor;
     118    /** When true line edits are not marked even if they have to be. */
     119    bool m_fForceUnmark;
    116120};
    117121
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.cpp

    r85064 r85150  
    427427}
    428428
     429void UIWizardNewVM::sltCustomButtonClicked(int iId)
     430{
     431    UIWizard::sltCustomButtonClicked(iId);
     432    setFieldsFromDefaultUnttendedInstallData();
     433}
     434
    429435void UIWizardNewVM::retranslateUi()
    430436{
     
    505511void UIWizardNewVM::setDefaultUnattendedInstallData(const UIUnattendedInstallData &unattendedInstallData)
    506512{
    507     setField("userName", unattendedInstallData.m_strUserName);
    508     setField("password", unattendedInstallData.m_strPassword);
    509     setField("hostname", unattendedInstallData.m_strHostname);
    510     setField("installGuestAdditions", unattendedInstallData.m_fInstallGuestAdditions);
    511     setField("guestAdditionsISOPath", unattendedInstallData.m_strGuestAdditionsISOPath);
     513    m_unattendedInstallData = unattendedInstallData;
     514    setFieldsFromDefaultUnttendedInstallData();
     515}
     516
     517void UIWizardNewVM::setFieldsFromDefaultUnttendedInstallData()
     518{
     519    setField("userName", m_unattendedInstallData.m_strUserName);
     520    setField("password", m_unattendedInstallData.m_strPassword);
     521    setField("hostname", m_unattendedInstallData.m_strHostname);
     522    setField("installGuestAdditions", m_unattendedInstallData.m_fInstallGuestAdditions);
     523    setField("guestAdditionsISOPath", m_unattendedInstallData.m_strGuestAdditionsISOPath);
    512524}
    513525
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.h

    r85135 r85150  
    105105    void sltHandleWizardCancel();
    106106    void sltHandleDetectedOSTypeChange();
     107    virtual void sltCustomButtonClicked(int iId) /* override */;
    107108
    108109private:
     
    114115    /* Helping stuff: */
    115116    QString getNextControllerName(KStorageBus type);
     117    void setFieldsFromDefaultUnttendedInstallData();
    116118
    117119    /* Variables: */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic1.cpp

    r85135 r85150  
    492492{
    493493    if (m_pISOFilePathSelector)
    494         m_pISOFilePathSelector->mark(isISOFileSelectorComplete());
     494        m_pISOFilePathSelector->mark(!isISOFileSelectorComplete());
     495    if (m_pNameAndSystemEditor)
     496        m_pNameAndSystemEditor->markNameLineEdit(m_pNameAndSystemEditor->name().isEmpty());
    495497}
    496498
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic2.cpp

    r85104 r85150  
    185185}
    186186
     187void UIWizardNewVMPage2::markWidgets() const
     188{
     189    if (m_pGAISOFilePathSelector)
     190        m_pGAISOFilePathSelector->mark(!checkGAISOFile());
     191}
     192
    187193UIWizardNewVMPageBasic2::UIWizardNewVMPageBasic2()
    188194    : m_pLabel(0)
     
    268274bool UIWizardNewVMPageBasic2::isComplete() const
    269275{
     276    markWidgets();
    270277    if (!checkGAISOFile())
    271278        return false;
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic2.h

    r85104 r85150  
    7272
    7373    bool checkGAISOFile() const;
     74    void markWidgets() const;
    7475
    7576    /** @name Widgets
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.cpp

    r85135 r85150  
    334334}
    335335
     336void UIWizardNewVMPageExpert::markWidgets() const
     337{
     338    UIWizardNewVMPage1::markWidgets();
     339
     340    if (m_pGAISOFilePathSelector)
     341        m_pGAISOFilePathSelector->mark(isUnattendedEnabled() && !checkGAISOFile());
     342}
     343
    336344bool UIWizardNewVMPageExpert::isComplete() const
    337345{
    338     UIWizardNewVMPage1::markWidgets();
     346    markWidgets();
     347
    339348    /* Make sure mandatory fields are complete,
    340349     * 'ram' field feats the bounds,
     
    352361        if (!checkGAISOFile())
    353362            return false;
    354     }
    355     if (m_pUserNamePasswordEditor)
    356     {
    357         if (!m_pUserNamePasswordEditor->isComplete())
    358             return false;
     363        if (m_pUserNamePasswordEditor)
     364        {
     365            if (!m_pUserNamePasswordEditor->isComplete())
     366                return false;
     367        }
    359368    }
    360369    return true;
     
    421430    if (m_pUsernameHostnameContainer)
    422431        m_pUsernameHostnameContainer->setEnabled(fEnabled);
     432    if (m_pUserNamePasswordEditor)
     433        m_pUserNamePasswordEditor->setForceUnmark(!fEnabled);
    423434    if (m_pProductKeyLabel)
    424435        m_pProductKeyLabel->setEnabled(isProductKeyWidgetEnabled());
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.h

    r85104 r85150  
    110110    bool isProductKeyWidgetEnabled() const;
    111111    void disableEnableUnattendedRelatedWidgets(bool fEnabled);
    112 
     112    void markWidgets() const;
    113113    /** Widgets. */
    114114    QWidget *m_pNameAndSystemContainer;
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