VirtualBox

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


Ignore:
Timestamp:
Sep 14, 2021 5:05:22 PM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
146894
Message:

FE/Qt: bugref:10067: UINotificationCenter: Togglable option to keep finished progresses alive.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp

    r91227 r91236  
    23452345}
    23462346
     2347void UIExtraDataManager::setKeepSuccessfullNotificationProgresses(bool fKeep)
     2348{
     2349    /* 'True' if feature allowed, null-string otherwise: */
     2350    setExtraDataString(GUI_KeepSuccessfullNotificationProgresses, toFeatureAllowed(fKeep));
     2351}
     2352
    23472353#if !defined(VBOX_BLEEDING_EDGE) && !defined(DEBUG)
    23482354QString UIExtraDataManager::preventBetaBuildWarningForVersion()
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h

    r91227 r91236  
    186186        /** Returns whether successfull notification-progresses should NOT close automatically. */
    187187        bool keepSuccessfullNotificationProgresses();
     188        /** Defines whether successfull notification-progresses should NOT close (@a fKeep) automatically. */
     189        void setKeepSuccessfullNotificationProgresses(bool fKeep);
    188190
    189191#if !defined(VBOX_BLEEDING_EDGE) && !defined(DEBUG)
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationCenter.cpp

    r91231 r91236  
    3232/* GUI includes: */
    3333#include "QIToolButton.h"
     34#include "UIExtraDataManager.h"
    3435#include "UIIconPool.h"
    3536#include "UINotificationCenter.h"
     
    154155
    155156    /* Reparent: */
    156     QWidget::setParent(pParent);
     157    QIWithRetranslateUI<QWidget>::setParent(pParent);
    157158
    158159    /* Install filter to new parent: */
     
    198199
    199200UINotificationCenter::UINotificationCenter(QWidget *pParent)
    200     : QWidget(pParent)
     201    : QIWithRetranslateUI<QWidget>(pParent)
    201202    , m_pModel(0)
    202203    , m_pLayoutMain(0)
    203     , m_pLayoutOpenButton(0)
     204    , m_pLayoutButtons(0)
    204205    , m_pOpenButton(0)
     206    , m_pKeepButton(0)
    205207    , m_pLayoutItems(0)
    206208    , m_pStateMachineSliding(0)
     
    215217{
    216218    s_pInstance = 0;
     219}
     220
     221void UINotificationCenter::retranslateUi()
     222{
     223    if (m_pOpenButton)
     224        m_pOpenButton->setToolTip(tr("Open notification center"));
     225    if (m_pKeepButton)
     226        m_pKeepButton->setToolTip(tr("Keep finished progresses"));
    217227}
    218228
     
    238248
    239249    /* Call to base-class: */
    240     return QWidget::eventFilter(pObject, pEvent);
     250    return QIWithRetranslateUI<QWidget>::eventFilter(pObject, pEvent);
    241251}
    242252
     
    266276
    267277    /* Call to base-class: */
    268     return QWidget::event(pEvent);
     278    return QIWithRetranslateUI<QWidget>::event(pEvent);
    269279}
    270280
     
    291301    else
    292302        emit sigClose();
     303}
     304
     305void UINotificationCenter::sltHandleKeepButtonToggled(bool fToggled)
     306{
     307    gEDataManager->setKeepSuccessfullNotificationProgresses(fToggled);
    293308}
    294309
     
    352367    prepareStateMachineSliding();
    353368    prepareOpenTimer();
     369
     370    /* Apply language settings: */
     371    retranslateUi();
    354372}
    355373
     
    368386    if (m_pLayoutMain)
    369387    {
    370         /* Prepare open-button layout: */
    371         m_pLayoutOpenButton = new QHBoxLayout;
    372         if (m_pLayoutOpenButton)
    373         {
    374             m_pLayoutOpenButton->setContentsMargins(0, 0, 0, 0);
     388        /* Prepare buttons layout: */
     389        m_pLayoutButtons = new QHBoxLayout;
     390        if (m_pLayoutButtons)
     391        {
     392            m_pLayoutButtons->setContentsMargins(0, 0, 0, 0);
    375393
    376394            /* Prepare open-button: */
     
    381399                m_pOpenButton->setCheckable(true);
    382400                connect(m_pOpenButton, &QIToolButton::toggled, this, &UINotificationCenter::sltHandleOpenButtonToggled);
    383                 m_pLayoutOpenButton->addWidget(m_pOpenButton);
     401                m_pLayoutButtons->addWidget(m_pOpenButton);
    384402            }
    385403
    386             m_pLayoutOpenButton->addStretch();
     404            /* Prepare keep-button: */
     405            m_pKeepButton = new QIToolButton(this);
     406            if (m_pKeepButton)
     407            {
     408                m_pKeepButton->setIcon(UIIconPool::iconSet(":/pin_16px.png"));
     409                m_pKeepButton->setCheckable(true);
     410                m_pKeepButton->setChecked(gEDataManager->keepSuccessfullNotificationProgresses());
     411                connect(m_pKeepButton, &QIToolButton::toggled, this, &UINotificationCenter::sltHandleKeepButtonToggled);
     412                m_pLayoutButtons->addWidget(m_pKeepButton);
     413            }
     414
     415            m_pLayoutButtons->addStretch();
    387416
    388417            /* Add to layout: */
    389             m_pLayoutMain->addLayout(m_pLayoutOpenButton);
     418            m_pLayoutMain->addLayout(m_pLayoutButtons);
    390419        }
    391420
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationCenter.h

    r91225 r91236  
    2727
    2828/* GUI includes: */
     29#include "QIWithRetranslateUI.h"
    2930#include "UILibraryDefs.h"
    3031#include "UINotificationObjects.h"
     
    4142
    4243/** QWidget-based notification-center overlay. */
    43 class SHARED_LIBRARY_STUFF UINotificationCenter : public QWidget
     44class SHARED_LIBRARY_STUFF UINotificationCenter : public QIWithRetranslateUI<QWidget>
    4445{
    4546    Q_OBJECT;
     
    8081    virtual ~UINotificationCenter() /* override final */;
    8182
     83    /** Handles translation event. */
     84    virtual void retranslateUi() /* override final */;
     85
    8286    /** Preprocesses any Qt @a pEvent for passed @a pObject. */
    8387    virtual bool eventFilter(QObject *pObject, QEvent *pEvent) /* override final */;
     
    9397    /** Issues request to make open button @a fToggled. */
    9498    void sltHandleOpenButtonToggled(bool fToggled);
     99    /** Toggles notification-progresses keep approach. */
     100    void sltHandleKeepButtonToggled(bool fToggled);
     101
    95102    /** Handles open-timer timeout. */
    96103    void sltHandleOpenTimerTimeout();
     
    135142    /** Holds the main layout instance. */
    136143    QVBoxLayout  *m_pLayoutMain;
    137     /** Holds the open button layout instance. */
    138     QHBoxLayout  *m_pLayoutOpenButton;
     144    /** Holds the buttons layout instance. */
     145    QHBoxLayout  *m_pLayoutButtons;
    139146    /** Holds the open button instance. */
    140147    QIToolButton *m_pOpenButton;
     148    /** Holds the keep button instance. */
     149    QIToolButton *m_pKeepButton;
    141150    /** Holds the items layout instance. */
    142151    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