VirtualBox

Changeset 90687 in vbox


Ignore:
Timestamp:
Aug 15, 2021 2:08:18 PM (3 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10067: A possibility to revoke shown UINotificationMessage.

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

Legend:

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

    r90679 r90687  
    4040
    4141/* static */
     42QMap<QString, QUuid> UINotificationMessage::m_messages = QMap<QString, QUuid>();
     43
     44UINotificationMessage::UINotificationMessage(const QString &strName,
     45                                             const QString &strDetails,
     46                                             const QString &strInternalName)
     47    : UINotificationSimple(strName,
     48                           strDetails,
     49                           strInternalName)
     50{
     51}
     52
     53UINotificationMessage::~UINotificationMessage()
     54{
     55    /* Remove message from known: */
     56    m_messages.remove(m_strInternalName);
     57}
     58
     59/* static */
    4260void UINotificationMessage::createMessage(const QString &strName,
    4361                                          const QString &strDetails,
    44                                           const QString &strInternalName)
     62                                          const QString &strInternalName /* = QString() */)
    4563{
    4664    /* Check if message suppressed: */
    4765    if (isSuppressed(strInternalName))
    4866        return;
     67    /* Check if message already exists: */
     68    if (m_messages.contains(strInternalName))
     69        return;
    4970
    5071    /* Create message finally: */
    51     gpNotificationCenter->append(new UINotificationMessage(strName,
    52                                                            strDetails,
    53                                                            strInternalName));
    54 }
    55 
     72    m_messages[strInternalName] = gpNotificationCenter->append(new UINotificationMessage(strName,
     73                                                                                         strDetails,
     74                                                                                         strInternalName));
     75}
     76
     77/* static */
     78void UINotificationMessage::destroyMessage(const QString &strInternalName)
     79{
     80    /* Check if message really exists: */
     81    if (!m_messages.contains(strInternalName))
     82        return;
     83
     84    /* Destroy message finally: */
     85    gpNotificationCenter->revoke(m_messages.value(strInternalName));
     86    m_messages.remove(strInternalName);
     87}
    5688
    5789/*********************************************************************************************************************************
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.h

    r90679 r90687  
    5858      * @param  strInternalName  Brings the message internal name. */
    5959    UINotificationMessage(const QString &strName,
    60                                 const QString &strDetails,
    61                                 const QString &strInternalName)
    62         : UINotificationSimple(strName,
    63                                strDetails,
    64                                strInternalName)
    65     {}
     60                          const QString &strDetails,
     61                          const QString &strInternalName);
     62    /** Destructs message notification-object. */
     63    virtual ~UINotificationMessage() /* override final */;
    6664
    6765private:
     
    7371    static void createMessage(const QString &strName,
    7472                              const QString &strDetails,
    75                               const QString &strInternalName);
     73                              const QString &strInternalName = QString());
     74    /** Destroys message.
     75      * @param  strInternalName  Brings the message internal name. */
     76    static void destroyMessage(const QString &strInternalName);
     77
     78    /** Holds the IDs of messages registered. */
     79    static QMap<QString, QUuid>  m_messages;
    7680
    7781    /** Holds the message 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