VirtualBox

Changeset 91075 in vbox for trunk/src


Ignore:
Timestamp:
Sep 1, 2021 6:43:24 PM (3 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10067: Extend notification-objects with possibility to have help keyword/button.

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

Legend:

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

    r90688 r91075  
    5252                                           const QString &strDetails,
    5353                                           const QString &strInternalName,
     54                                           const QString &strHelpKeyword,
    5455                                           bool fCritical /* = true */)
    5556    : m_strName(strName)
    5657    , m_strDetails(strDetails)
    5758    , m_strInternalName(strInternalName)
     59    , m_strHelpKeyword(strHelpKeyword)
    5860    , m_fCritical(fCritical)
    5961{
     
    7880{
    7981    return m_strInternalName;
     82}
     83
     84QString UINotificationSimple::helpKeyword() const
     85{
     86    return m_strHelpKeyword;
    8087}
    8188
     
    135142
    136143QString UINotificationProgress::internalName() const
     144{
     145    return QString();
     146}
     147
     148QString UINotificationProgress::helpKeyword() const
    137149{
    138150    return QString();
     
    213225
    214226QString UINotificationDownloader::internalName() const
     227{
     228    return QString();
     229}
     230
     231QString UINotificationDownloader::helpKeyword() const
    215232{
    216233    return QString();
     
    317334}
    318335
     336QString UINotificationNewVersionChecker::helpKeyword() const
     337{
     338    return QString();
     339}
     340
    319341void UINotificationNewVersionChecker::handle()
    320342{
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObject.h

    r90688 r91075  
    6262    /** Returns object internal name. */
    6363    virtual QString internalName() const = 0;
     64    /** Returns object help heyword. */
     65    virtual QString helpKeyword() const = 0;
    6466    /** Handles notification-object being added. */
    6567    virtual void handle() = 0;
     
    8486      * @param  strDetails       Brings the message details.
    8587      * @param  strInternalName  Brings the message internal name.
     88      * @param  strHelpKeyword   Brings the message help keyword.
    8689      * @param  fCritical        Brings whether message is critical. */
    8790    UINotificationSimple(const QString &strName,
    8891                         const QString &strDetails,
    8992                         const QString &strInternalName,
     93                         const QString &strHelpKeyword,
    9094                         bool fCritical = true);
    9195
     
    98102    /** Returns object internal name. */
    99103    virtual QString internalName() const /* override final */;
     104    /** Returns object help heyword. */
     105    virtual QString helpKeyword() const /* override final */;
    100106    /** Handles notification-object being added. */
    101107    virtual void handle() /* override final */;
     
    112118    /** Holds the message internal name. */
    113119    QString  m_strInternalName;
     120    /** Holds the message help keyword. */
     121    QString  m_strHelpKeyword;
    114122    /** Holds whether message is critical. */
    115123    bool     m_fCritical;
     
    152160    /** Returns object internal name. */
    153161    virtual QString internalName() const /* override final */;
     162    /** Returns object help heyword. */
     163    virtual QString helpKeyword() const /* override final */;
    154164    /** Handles notification-object being added. */
    155165    virtual void handle() /* override final */;
     
    216226    /** Returns object internal name. */
    217227    virtual QString internalName() const /* override final */;
     228    /** Returns object help heyword. */
     229    virtual QString helpKeyword() const /* override final */;
    218230    /** Handles notification-object being added. */
    219231    virtual void handle() /* override final */;
     
    281293    /** Returns object internal name. */
    282294    virtual QString internalName() const /* override final */;
     295    /** Returns object help heyword. */
     296    virtual QString helpKeyword() const /* override final */;
    283297    /** Handles notification-object being added. */
    284298    virtual void handle() /* override final */;
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjectItem.cpp

    r90688 r91075  
    3030#include "QIToolButton.h"
    3131#include "UIIconPool.h"
     32#include "UIMessageCenter.h"
    3233#include "UINotificationObject.h"
    3334#include "UINotificationObjectItem.h"
     
    4445    , m_pLayoutUpper(0)
    4546    , m_pLabelName(0)
     47    , m_pButtonHelp(0)
    4648    , m_pButtonForget(0)
    4749    , m_pButtonClose(0)
     
    6769                m_pLabelName->setText(m_pObject->name());
    6870                m_pLayoutUpper->addWidget(m_pLabelName);
     71            }
     72
     73            /* Prepare help button: */
     74            if (!m_pObject->helpKeyword().isEmpty())
     75                m_pButtonHelp = new QIToolButton(this);
     76            if (m_pButtonHelp)
     77            {
     78                m_pButtonHelp->setIcon(UIIconPool::iconSet(":/help_16px.png"));
     79                m_pButtonHelp->setIconSize(QSize(10, 10));
     80                m_pButtonHelp->setProperty("helpkeyword", m_pObject->helpKeyword());
     81                connect(m_pButtonHelp, &QIToolButton::clicked,
     82                        &msgCenter(), &UIMessageCenter::sltHandleHelpRequest);
     83
     84                m_pLayoutUpper->addWidget(m_pButtonHelp);
    6985            }
    7086
     
    107123            m_pLabelDetails->setVisible(false);
    108124            int iHint = m_pLabelName->minimumSizeHint().width();
     125            if (m_pButtonHelp)
     126                iHint += m_pLayoutUpper->spacing() + m_pButtonHelp->minimumSizeHint().width();
    109127            if (m_pButtonForget)
    110128                iHint += m_pLayoutUpper->spacing() + m_pButtonForget->minimumSizeHint().width();
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjectItem.h

    r90688 r91075  
    6767    /** Holds the name label instance. */
    6868    QLabel          *m_pLabelName;
     69    /** Holds the help button instance. */
     70    QIToolButton    *m_pButtonHelp;
    6971    /** Holds the forget button instance. */
    7072    QIToolButton    *m_pButtonForget;
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.cpp

    r91029 r91075  
    382382UINotificationMessage::UINotificationMessage(const QString &strName,
    383383                                             const QString &strDetails,
    384                                              const QString &strInternalName)
     384                                             const QString &strInternalName,
     385                                             const QString &strHelpKeyword)
    385386    : UINotificationSimple(strName,
    386387                           strDetails,
    387                            strInternalName)
     388                           strInternalName,
     389                           strHelpKeyword)
    388390{
    389391}
     
    398400void UINotificationMessage::createMessage(const QString &strName,
    399401                                          const QString &strDetails,
    400                                           const QString &strInternalName /* = QString() */)
     402                                          const QString &strInternalName /* = QString() */,
     403                                          const QString &strHelpKeyword /* = QString() */)
    401404{
    402405    /* Check if message suppressed: */
     
    410413    m_messages[strInternalName] = gpNotificationCenter->append(new UINotificationMessage(strName,
    411414                                                                                         strDetails,
    412                                                                                          strInternalName));
     415                                                                                         strInternalName,
     416                                                                                         strHelpKeyword));
    413417}
    414418
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.h

    r91029 r91075  
    168168      * @param  strName          Brings the message name.
    169169      * @param  strDetails       Brings the message details.
    170       * @param  strInternalName  Brings the message internal name. */
     170      * @param  strInternalName  Brings the message internal name.
     171      * @param  strHelpKeyword   Brings the message help keyword. */
    171172    UINotificationMessage(const QString &strName,
    172173                          const QString &strDetails,
    173                           const QString &strInternalName);
     174                          const QString &strInternalName,
     175                          const QString &strHelpKeyword);
    174176    /** Destructs message notification-object. */
    175177    virtual ~UINotificationMessage() /* override final */;
     
    180182      * @param  strName          Brings the message name.
    181183      * @param  strDetails       Brings the message details.
    182       * @param  strInternalName  Brings the message internal name. */
     184      * @param  strInternalName  Brings the message internal name.
     185      * @param  strHelpKeyword   Brings the message help keyword. */
    183186    static void createMessage(const QString &strName,
    184187                              const QString &strDetails,
    185                               const QString &strInternalName = QString());
     188                              const QString &strInternalName = QString(),
     189                              const QString &strHelpKeyword = QString());
    186190    /** Destroys message.
    187191      * @param  strInternalName  Brings the message internal name. */
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