- Timestamp:
- Aug 13, 2021 10:45:43 AM (3 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObject.cpp
r90626 r90679 17 17 18 18 /* GUI includes: */ 19 #include "UIExtraDataManager.h" 19 20 #include "UINotificationObject.h" 20 21 #include "UINotificationProgressTask.h" … … 36 37 { 37 38 emit sigAboutToClose(); 39 } 40 41 42 /********************************************************************************************************************************* 43 * Class UINotificationSimple implementation. * 44 *********************************************************************************************************************************/ 45 46 UINotificationSimple::UINotificationSimple(const QString &strName, 47 const QString &strDetails, 48 const QString &strInternalName, 49 bool fCritical /* = true */) 50 : m_strName(strName) 51 , m_strDetails(strDetails) 52 , m_strInternalName(strInternalName) 53 , m_fCritical(fCritical) 54 { 55 } 56 57 bool UINotificationSimple::isCritical() const 58 { 59 return m_fCritical; 60 } 61 62 QString UINotificationSimple::name() const 63 { 64 return m_strName; 65 } 66 67 QString UINotificationSimple::details() const 68 { 69 return m_strDetails; 70 } 71 72 void UINotificationSimple::handle() 73 { 74 } 75 76 /* static */ 77 bool UINotificationSimple::isSuppressed(const QString &strInternalName) 78 { 79 /* Sanity check: */ 80 if (strInternalName.isEmpty()) 81 return false; 82 83 /* Acquire and check suppressed message names: */ 84 const QStringList suppressedMessages = gEDataManager->suppressedMessages(); 85 return suppressedMessages.contains(strInternalName) 86 || suppressedMessages.contains("all"); 38 87 } 39 88 -
trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObject.h
r90626 r90679 68 68 }; 69 69 70 /** UINotificationObject extension for notification-simple. */ 71 class SHARED_LIBRARY_STUFF UINotificationSimple : public UINotificationObject 72 { 73 Q_OBJECT; 74 75 protected: 76 77 /** Constructs notification-simple. 78 * @param strName Brings the message name. 79 * @param strDetails Brings the message details. 80 * @param strInternalName Brings the message internal name. 81 * @param fCritical Brings whether message is critical. */ 82 UINotificationSimple(const QString &strName, 83 const QString &strDetails, 84 const QString &strInternalName, 85 bool fCritical = true); 86 87 /** Returns whether object is critical. */ 88 virtual bool isCritical() const /* override */; 89 /** Returns object name. */ 90 virtual QString name() const /* override final */; 91 /** Returns object details. */ 92 virtual QString details() const /* override final */; 93 /** Handles notification-object being added. */ 94 virtual void handle() /* override final */; 95 96 /** Returns whether message with passed @a strInternalName is suppressed. */ 97 static bool isSuppressed(const QString &strInternalName); 98 99 private: 100 101 /** Holds the message name. */ 102 QString m_strName; 103 /** Holds the message details. */ 104 QString m_strDetails; 105 /** Holds the message internal name. */ 106 QString m_strInternalName; 107 /** Holds whether message is critical. */ 108 bool m_fCritical; 109 }; 110 70 111 /** UINotificationObject extension for notification-progress. */ 71 112 class SHARED_LIBRARY_STUFF UINotificationProgress : public UINotificationObject … … 101 142 102 143 /** Returns whether object is critical. */ 103 virtual bool isCritical() const ;144 virtual bool isCritical() const /* override */; 104 145 /** Handles notification-object being added. */ 105 146 virtual void handle() /* override final */; … … 163 204 164 205 /** Returns whether object is critical. */ 165 virtual bool isCritical() const ;206 virtual bool isCritical() const /* override */; 166 207 /** Handles notification-object being added. */ 167 208 virtual void handle() /* override final */; … … 226 267 227 268 /** Returns whether object is critical. */ 228 virtual bool isCritical() const ;269 virtual bool isCritical() const /* override */; 229 270 /** Handles notification-object being added. */ 230 271 virtual void handle() /* override final */; -
trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.cpp
r90663 r90679 22 22 /* GUI includes: */ 23 23 #include "UICommon.h" 24 #include "UINotificationCenter.h" 24 25 #include "UINotificationObjects.h" 25 26 #ifdef VBOX_GUI_WITH_NETWORK_MANAGER … … 32 33 /* COM includes: */ 33 34 #include "CConsole.h" 35 36 37 /********************************************************************************************************************************* 38 * Class UINotificationMessage implementation. * 39 *********************************************************************************************************************************/ 40 41 /* static */ 42 void UINotificationMessage::createMessage(const QString &strName, 43 const QString &strDetails, 44 const QString &strInternalName) 45 { 46 /* Check if message suppressed: */ 47 if (isSuppressed(strInternalName)) 48 return; 49 50 /* Create message finally: */ 51 gpNotificationCenter->append(new UINotificationMessage(strName, 52 strDetails, 53 strInternalName)); 54 } 34 55 35 56 -
trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.h
r90663 r90679 44 44 #include "CVirtualSystemDescription.h" 45 45 46 /** UINotificationObject extension for message functionality. */ 47 class SHARED_LIBRARY_STUFF UINotificationMessage : public UINotificationSimple 48 { 49 Q_OBJECT; 50 51 public: 52 53 protected: 54 55 /** Constructs message notification-object. 56 * @param strName Brings the message name. 57 * @param strDetails Brings the message details. 58 * @param strInternalName Brings the message internal name. */ 59 UINotificationMessage(const QString &strName, 60 const QString &strDetails, 61 const QString &strInternalName) 62 : UINotificationSimple(strName, 63 strDetails, 64 strInternalName) 65 {} 66 67 private: 68 69 /** Creates message. 70 * @param strName Brings the message name. 71 * @param strDetails Brings the message details. 72 * @param strInternalName Brings the message internal name. */ 73 static void createMessage(const QString &strName, 74 const QString &strDetails, 75 const QString &strInternalName); 76 77 /** Holds the message name. */ 78 QString m_strName; 79 /** Holds the message details. */ 80 QString m_strDetails; 81 /** Holds the message internal name. */ 82 QString m_strInternalName; 83 }; 84 46 85 /** UINotificationProgress extension for medium create functionality. */ 47 86 class SHARED_LIBRARY_STUFF UINotificationProgressMediumCreate : public UINotificationProgress
Note:
See TracChangeset
for help on using the changeset viewer.