VirtualBox

Ignore:
Timestamp:
Aug 7, 2017 6:03:54 PM (7 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:8400: Medium manager: Separate handling of the apply/reset buttons availability status.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/medium
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumDetailsWidget.cpp

    r68325 r68326  
    5858    , m_pLabelSize(0), m_pEditorSize(0), m_pErrorPaneSize(0)
    5959    , m_pButtonBox(0)
     60    , m_fValid(true)
    6061    , m_pLayoutDetails(0)
    6162{
     
    638639void UIMediumDetailsWidget::revalidate(QWidget *pWidget /* = 0 */)
    639640{
     641    /* Reset the result: */
     642    m_fValid = true;
     643
    640644    /* Validate 'Options' tab content: */
    641645    if (!pWidget || pWidget == m_pErrorPaneType)
     
    644648        const bool fError = false;
    645649        m_pErrorPaneType->setVisible(fError);
     650        if (fError)
     651            m_fValid = false;
    646652    }
    647653    if (!pWidget || pWidget == m_pErrorPaneLocation)
     
    650656        const bool fError = false;
    651657        m_pErrorPaneLocation->setVisible(fError);
     658        if (fError)
     659            m_fValid = false;
    652660    }
    653661    if (!pWidget || pWidget == m_pErrorPaneDescription)
     
    656664        const bool fError = false;
    657665        m_pErrorPaneDescription->setVisible(fError);
     666        if (fError)
     667            m_fValid = false;
    658668    }
    659669    if (!pWidget || pWidget == m_pErrorPaneSize)
     
    662672        const bool fError = false;
    663673        m_pErrorPaneSize->setVisible(fError);
     674        if (fError)
     675            m_fValid = false;
    664676    }
    665677
     
    706718    {
    707719        m_pButtonBox->button(QDialogButtonBox::Cancel)->setEnabled(m_oldData != m_newData);
    708         m_pButtonBox->button(QDialogButtonBox::Ok)->setEnabled(m_oldData != m_newData);
     720        m_pButtonBox->button(QDialogButtonBox::Ok)->setEnabled((m_oldData != m_newData) && m_fValid);
    709721    }
    710722
    711723    /* Notify listeners as well: */
    712     emit sigDataChanged(m_oldData != m_newData);
     724    emit sigRejectAllowed(m_oldData != m_newData);
     725    emit sigAcceptAllowed((m_oldData != m_newData) && m_fValid);
    713726}
    714727
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumDetailsWidget.h

    r67986 r68326  
    170170signals:
    171171
    172     /** Notifies listeners about data changed and whether it @a fDiffers. */
    173     void sigDataChanged(bool fDiffers);
     172    /** Notifies listeners about accept is allowed. */
     173    void sigAcceptAllowed(bool fAllowed);
     174    /** Notifies listeners about reject is allowed. */
     175    void sigRejectAllowed(bool fAllowed);
    174176
    175177    /** Notifies listeners about data change rejected and should be reseted. */
     
    306308        /** Holds the button-box instance. */
    307309        QIDialogButtonBox *m_pButtonBox;
     310
     311        /** Holds whether options are valid. */
     312        bool m_fValid;
    308313    /** @} */
    309314
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp

    r68315 r68326  
    15601560        m_pDetailsWidget->setVisible(false);
    15611561        m_pDetailsWidget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
    1562         connect(m_pDetailsWidget, &UIMediumDetailsWidget::sigDataChanged,
    1563                 this, &UIMediumManagerWidget::sigMediumDetailsDataChanged);
     1562        connect(m_pDetailsWidget, &UIMediumDetailsWidget::sigAcceptAllowed,
     1563                this, &UIMediumManagerWidget::sigAcceptAllowed);
     1564        connect(m_pDetailsWidget, &UIMediumDetailsWidget::sigRejectAllowed,
     1565                this, &UIMediumManagerWidget::sigRejectAllowed);
    15641566        connect(m_pDetailsWidget, &UIMediumDetailsWidget::sigDataChangeRejected,
    15651567                this, &UIMediumManagerWidget::sltResetMediumDetailsChanges);
     
    23172319    connect(widget(), &UIMediumManagerWidget::sigMediumDetailsVisibilityChanged,
    23182320            button(ButtonType_Reset), &QPushButton::setVisible);
    2319     connect(widget(), &UIMediumManagerWidget::sigMediumDetailsDataChanged,
     2321    connect(widget(), &UIMediumManagerWidget::sigAcceptAllowed,
    23202322            button(ButtonType_Apply), &QPushButton::setEnabled);
    2321     connect(widget(), &UIMediumManagerWidget::sigMediumDetailsDataChanged,
     2323    connect(widget(), &UIMediumManagerWidget::sigRejectAllowed,
    23222324            button(ButtonType_Reset), &QPushButton::setEnabled);
    23232325    connect(buttonBox(), &QIDialogButtonBox::clicked,
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.h

    r67765 r68326  
    6464    /** Notifies listeners about medium details-widget @a fVisible. */
    6565    void sigMediumDetailsVisibilityChanged(bool fVisible);
    66     /** Notifies listeners about medium details data @a fDiffers. */
    67     void sigMediumDetailsDataChanged(bool fDiffers);
     66    /** Notifies listeners about accept is @a fAllowed. */
     67    void sigAcceptAllowed(bool fAllowed);
     68    /** Notifies listeners about reject is @a fAllowed. */
     69    void sigRejectAllowed(bool fAllowed);
    6870
    6971public:
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