VirtualBox

Changeset 92429 in vbox


Ignore:
Timestamp:
Nov 15, 2021 2:25:27 PM (3 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10067: A bit of cleanup for UINotificationCenter.

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

Legend:

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

    r92400 r92429  
    151151    , m_pLayoutMain(0)
    152152    , m_pLayoutButtons(0)
    153     , m_pOpenButton(0)
    154     , m_pKeepButton(0)
    155     , m_pRemoveFinishedButton(0)
     153    , m_pButtonOpen(0)
     154    , m_pButtonKeepFinished(0)
     155    , m_pButtonRemoveFinished(0)
    156156    , m_pLayoutItems(0)
    157157    , m_pStateMachineSliding(0)
     
    192192{
    193193    /* Open if center isn't opened yet: */
    194     if (!m_pOpenButton->isChecked())
    195         m_pOpenButton->animateClick();
     194    if (!m_pButtonOpen->isChecked())
     195        m_pButtonOpen->animateClick();
    196196}
    197197
     
    212212
    213213    /* If object is critical and center isn't opened yet: */
    214     if (!m_pOpenButton->isChecked() && fCritical)
     214    if (!m_pButtonOpen->isChecked() && fCritical)
    215215    {
    216216        /* We should delay progresses for a bit: */
     
    277277void UINotificationCenter::retranslateUi()
    278278{
    279     if (m_pOpenButton)
    280         m_pOpenButton->setToolTip(tr("Open notification center"));
    281     if (m_pKeepButton)
    282         m_pKeepButton->setToolTip(tr("Keep finished progresses"));
    283     if (m_pRemoveFinishedButton)
    284         m_pRemoveFinishedButton->setToolTip(tr("Delete finished notifications"));
     279    if (m_pButtonOpen)
     280        m_pButtonOpen->setToolTip(tr("Open notification center"));
     281    if (m_pButtonKeepFinished)
     282        m_pButtonKeepFinished->setToolTip(tr("Keep finished progresses"));
     283    if (m_pButtonRemoveFinished)
     284        m_pButtonRemoveFinished->setToolTip(tr("Delete finished notifications"));
    285285}
    286286
     
    388388
    389389    /* Check whether we really closed: */
    390     if (m_pOpenButton->isChecked())
     390    if (m_pButtonOpen->isChecked())
    391391        return;
    392392
     
    395395        return;
    396396
    397     /* Toggle open-button: */
    398     m_pOpenButton->animateClick();
     397    /* Toggle open button: */
     398    m_pButtonOpen->animateClick();
    399399}
    400400
     
    423423    /* Hide and slide away if there are no notifications to show: */
    424424    setHidden(m_pModel->ids().isEmpty());
    425     if (m_pModel->ids().isEmpty() && m_pOpenButton->isChecked())
    426         m_pOpenButton->toggle();
     425    if (m_pModel->ids().isEmpty() && m_pButtonOpen->isChecked())
     426        m_pButtonOpen->toggle();
    427427}
    428428
     
    485485            m_pLayoutButtons->setContentsMargins(0, 0, 0, 0);
    486486
    487             /* Prepare open-button: */
    488             m_pOpenButton = new QIToolButton(this);
    489             if (m_pOpenButton)
     487            /* Prepare open button: */
     488            m_pButtonOpen = new QIToolButton(this);
     489            if (m_pButtonOpen)
    490490            {
    491                 m_pOpenButton->setIcon(UIIconPool::iconSet(":/reset_warnings_16px.png"));
    492                 m_pOpenButton->setCheckable(true);
    493                 connect(m_pOpenButton, &QIToolButton::toggled, this, &UINotificationCenter::sltHandleOpenButtonToggled);
    494                 m_pLayoutButtons->addWidget(m_pOpenButton);
     491                m_pButtonOpen->setIcon(UIIconPool::iconSet(":/reset_warnings_16px.png"));
     492                m_pButtonOpen->setCheckable(true);
     493                connect(m_pButtonOpen, &QIToolButton::toggled, this, &UINotificationCenter::sltHandleOpenButtonToggled);
     494                m_pLayoutButtons->addWidget(m_pButtonOpen);
    495495            }
    496496
     
    498498            m_pLayoutButtons->addStretch(1);
    499499
    500             /* Prepare keep-button: */
    501             m_pKeepButton = new QIToolButton(this);
    502             if (m_pKeepButton)
     500            /* Prepare keep-finished button: */
     501            m_pButtonKeepFinished = new QIToolButton(this);
     502            if (m_pButtonKeepFinished)
    503503            {
    504                 m_pKeepButton->setIcon(UIIconPool::iconSet(":/pin_16px.png"));
    505                 m_pKeepButton->setCheckable(true);
    506                 m_pKeepButton->setChecked(gEDataManager->keepSuccessfullNotificationProgresses());
    507                 connect(m_pKeepButton, &QIToolButton::toggled, this, &UINotificationCenter::sltHandleKeepButtonToggled);
    508                 m_pLayoutButtons->addWidget(m_pKeepButton);
     504                m_pButtonKeepFinished->setIcon(UIIconPool::iconSet(":/pin_16px.png"));
     505                m_pButtonKeepFinished->setCheckable(true);
     506                m_pButtonKeepFinished->setChecked(gEDataManager->keepSuccessfullNotificationProgresses());
     507                connect(m_pButtonKeepFinished, &QIToolButton::toggled, this, &UINotificationCenter::sltHandleKeepButtonToggled);
     508                m_pLayoutButtons->addWidget(m_pButtonKeepFinished);
    509509            }
    510510
    511             /* Prepare remove-finished-button: */
    512             m_pRemoveFinishedButton = new QIToolButton(this);
    513             if (m_pRemoveFinishedButton)
     511            /* Prepare remove-finished button: */
     512            m_pButtonRemoveFinished = new QIToolButton(this);
     513            if (m_pButtonRemoveFinished)
    514514            {
    515                 m_pRemoveFinishedButton->setIcon(UIIconPool::iconSet(":/edata_remove_16px_x3.png"));
    516                 connect(m_pRemoveFinishedButton, &QIToolButton::clicked, this, &UINotificationCenter::sltHandleRemoveFinishedButtonClicked);
    517                 m_pLayoutButtons->addWidget(m_pRemoveFinishedButton);
     515                m_pButtonRemoveFinished->setIcon(UIIconPool::iconSet(":/edata_remove_16px_x3.png"));
     516                connect(m_pButtonRemoveFinished, &QIToolButton::clicked, this, &UINotificationCenter::sltHandleRemoveFinishedButtonClicked);
     517                m_pLayoutButtons->addWidget(m_pButtonRemoveFinished);
    518518            }
    519519
     
    729729    int iL, iT, iR, iB;
    730730    m_pLayoutMain->getContentsMargins(&iL, &iT, &iR, &iB);
    731     const int iMinimumButtonWidth = m_pOpenButton->minimumSizeHint().width() + iL + iR;
     731    const int iMinimumButtonWidth = m_pButtonOpen->minimumSizeHint().width() + iL + iR;
    732732
    733733    /* Make sure we have some default width if there is no contents: */
     
    744744    QRegion region;
    745745    if (!m_iAnimatedValue)
    746         region += QRect(m_pOpenButton->mapToParent(QPoint(0, 0)), m_pOpenButton->size());
     746        region += QRect(m_pButtonOpen->mapToParent(QPoint(0, 0)), m_pButtonOpen->size());
    747747    setMask(region);
    748748}
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationCenter.h

    r92400 r92429  
    162162    /** Holds the buttons layout instance. */
    163163    QHBoxLayout  *m_pLayoutButtons;
    164     /** Holds the open-button instance. */
    165     QIToolButton *m_pOpenButton;
    166     /** Holds the keep-button instance. */
    167     QIToolButton *m_pKeepButton;
    168     /** Holds the remove-finished-button instance. */
    169     QIToolButton *m_pRemoveFinishedButton;
     164    /** Holds the open button instance. */
     165    QIToolButton *m_pButtonOpen;
     166    /** Holds the keep-finished button instance. */
     167    QIToolButton *m_pButtonKeepFinished;
     168    /** Holds the remove-finished button instance. */
     169    QIToolButton *m_pButtonRemoveFinished;
    170170    /** Holds the items layout instance. */
    171171    QVBoxLayout  *m_pLayoutItems;
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