VirtualBox

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


Ignore:
Timestamp:
Nov 15, 2021 3:46:47 PM (3 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10067: UINotificationCenter: Support for Ascending/Descending notification sorting button.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationCenter.cpp

    r92429 r92431  
    152152    , m_pLayoutButtons(0)
    153153    , m_pButtonOpen(0)
     154    , m_pButtonToggleSorting(0)
    154155    , m_pButtonKeepFinished(0)
    155156    , m_pButtonRemoveFinished(0)
     
    279280    if (m_pButtonOpen)
    280281        m_pButtonOpen->setToolTip(tr("Open notification center"));
     282    if (m_pButtonToggleSorting)
     283        m_pButtonToggleSorting->setToolTip(tr("Toggle ascending/descending order"));
    281284    if (m_pButtonKeepFinished)
    282285        m_pButtonKeepFinished->setToolTip(tr("Keep finished progresses"));
     
    353356}
    354357
     358void UINotificationCenter::sltIssueOrderChange()
     359{
     360    const Qt::SortOrder enmSortOrder = m_pButtonToggleSorting->isChecked()
     361                                     ? Qt::AscendingOrder
     362                                     : Qt::DescendingOrder;
     363    gEDataManager->setNotificationCenterOrder(enmSortOrder);
     364}
     365
    355366void UINotificationCenter::sltHandleOrderChange()
    356367{
     
    497508            /* Add stretch: */
    498509            m_pLayoutButtons->addStretch(1);
     510
     511            /* Prepare toggle-sorting button: */
     512            m_pButtonToggleSorting = new QIToolButton(this);
     513            if (m_pButtonToggleSorting)
     514            {
     515                m_pButtonToggleSorting->setIcon(UIIconPool::iconSet(":/sort_16px.png"));
     516                m_pButtonToggleSorting->setCheckable(true);
     517                m_pButtonToggleSorting->setChecked(gEDataManager->notificationCenterOrder() == Qt::AscendingOrder);
     518                connect(m_pButtonToggleSorting, &QIToolButton::toggled, this, &UINotificationCenter::sltIssueOrderChange);
     519                m_pLayoutButtons->addWidget(m_pButtonToggleSorting);
     520            }
    499521
    500522            /* Prepare keep-finished button: */
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationCenter.h

    r92429 r92431  
    101101private slots:
    102102
     103    /** Issues order changes. */
     104    void sltIssueOrderChange();
    103105    /** Handles order changes. */
    104106    void sltHandleOrderChange();
     
    164166    /** Holds the open button instance. */
    165167    QIToolButton *m_pButtonOpen;
     168    /** Holds the toggle-sorting button instance. */
     169    QIToolButton *m_pButtonToggleSorting;
    166170    /** Holds the keep-finished button instance. */
    167171    QIToolButton *m_pButtonKeepFinished;
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