VirtualBox

Ignore:
Timestamp:
Jul 9, 2020 6:59:35 AM (5 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9515. Marking the iso file selector if it breaks isComplete.

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

Legend:

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

    r82968 r85135  
    303303}
    304304
     305void QIComboBox::mark(bool fError)
     306{
     307    if (!m_pComboBox)
     308        return;
     309    QPalette palette = m_pComboBox->palette();
     310    if (fError)
     311        palette.setColor(QPalette::Base, QColor(255, 180, 180));
     312    else
     313        palette.setColor(QPalette::Base, m_originalBaseColor);
     314    m_pComboBox->setPalette(palette);
     315}
     316
    305317void QIComboBox::clear()
    306318{
     
    376388        AssertPtrReturnVoid(m_pComboBox);
    377389        {
     390            /* Cache original base color: */
     391            m_originalBaseColor = m_pComboBox->palette().color(QPalette::Base);
    378392            /* Configure combo-box: */
    379393            setFocusProxy(m_pComboBox);
  • trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIComboBox.h

    r82968 r85135  
    119119    /** Defines size adjust @a enmPolicy. */
    120120    void setSizeAdjustPolicy(QComboBox::SizeAdjustPolicy enmPolicy);
     121    /** Paints the file selectors background to a reddish color when @p fError is true. */
     122    void mark(bool fError);
    121123
    122124public slots:
     
    154156    /** Holds the original combo-box instance. */
    155157    QComboBox *m_pComboBox;
     158
     159    /** The original background base color. Used when marking/unmarking the combo box. */
     160    QColor m_originalBaseColor;
    156161};
    157162
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIFilePathSelector.cpp

    r82968 r85135  
    2727# include <QListView>
    2828#endif
     29#include <QPalette>
    2930
    3031/* GUI includes: */
     
    184185}
    185186
     187
    186188void UIFilePathSelector::setPath(const QString &strPath, bool fRefreshText /* = true */)
    187189{
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIFilePathSelector.h

    r82968 r85135  
    118118    const QString& defaultPath() const;
    119119
     120    /** Paints the file selectors background to a reddish color when @p fError is true. */
     121    void markFileSelector(bool fError);
     122
    120123public slots:
    121124
     
    213216    /** Path is set to m_strDefaultPath when it is reset. */
    214217    QString m_strDefaultPath;
     218
    215219};
    216220
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.h

    r85064 r85135  
    7272    };
    7373
    74     /* Constructor: */
     74    /** Constructor: */
    7575    UIWizardNewVM(QWidget *pParent, const QString &strGroup = QString());
    7676
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic1.cpp

    r85110 r85135  
    483483}
    484484
     485void UIWizardNewVMPage1::setTypeByISODetectedOSType(const QString &strDetectedOSType)
     486{
     487    if (!strDetectedOSType.isEmpty())
     488        onNameChanged(strDetectedOSType);
     489}
     490
     491void UIWizardNewVMPage1::markWidgets() const
     492{
     493    if (m_pISOFilePathSelector)
     494        m_pISOFilePathSelector->mark(isISOFileSelectorComplete());
     495}
     496
     497bool UIWizardNewVMPage1::isISOFileSelectorComplete() const
     498{
     499    if (!m_pISOFilePathSelector)
     500        return false;
     501    return checkISOFile();
     502}
     503
    485504UIWizardNewVMPageBasic1::UIWizardNewVMPageBasic1(const QString &strGroup)
    486505    : UIWizardNewVMPage1(strGroup)
     
    525544}
    526545
    527 void UIWizardNewVMPage1::setTypeByISODetectedOSType(const QString &strDetectedOSType)
    528 {
    529     if (!strDetectedOSType.isEmpty())
    530         onNameChanged(strDetectedOSType);
    531 }
    532 
    533546bool UIWizardNewVMPageBasic1::isComplete() const
    534547{
     548    markWidgets();
    535549    if (m_pNameAndSystemEditor->name().isEmpty())
    536550        return false;
    537     return checkISOFile();
     551    return isISOFileSelectorComplete();
    538552}
    539553
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic1.h

    r85104 r85135  
    7171    /** @} */
    7272
    73 
    7473    bool determineOSType(const QString &strISOPath);
    7574    /** calls CVirtualBox::ComposeMachineFilename(...) and sets related member variables */
    7675    void composeMachineFilePath();
    77     bool checkISOFile() const;
    7876    /** Creates the page widgets and adds them into the @p pGridLayout. */
    7977    void createNameOSTypeWidgets(QGridLayout *pGridLayout, bool fCreateLabels = true);
    8078    void setTypeByISODetectedOSType(const QString &strDetectedOSType);
     79    /** Colors the widgets red if they cause isComplete to fail. */
     80    void markWidgets() const;
     81
     82    bool isISOFileSelectorComplete() const;
    8183
    8284    /** @name Widgets
     
    8991       QLabel *m_pISOSelectorLabel;
    9092       /** Holds the ISO selector editor instance. */
    91        UIFilePathSelector *m_pISOFilePathSelector;
     93       mutable UIFilePathSelector *m_pISOFilePathSelector;
    9294       /** Holds the headless start label instance. */
    9395       QLabel *m_pStartHeadlessLabel;
     
    105107private:
    106108
     109    bool checkISOFile() const;
    107110
    108111    /** Full path (including the file name) of the machine's configuration file. */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.cpp

    r85110 r85135  
    336336bool UIWizardNewVMPageExpert::isComplete() const
    337337{
     338    UIWizardNewVMPage1::markWidgets();
    338339    /* Make sure mandatory fields are complete,
    339340     * 'ram' field feats the bounds,
     
    346347    {
    347348        /* Check the installation medium: */
    348         if (!checkISOFile())
     349        if (!isISOFileSelectorComplete())
    349350            return false;
    350351        /* Check the GA installation medium: */
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