Changeset 90688 in vbox
- Timestamp:
- Aug 15, 2021 2:36:44 PM (3 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationModel.cpp
r90485 r90688 16 16 */ 17 17 18 /* Qt includes: */ 19 #include <QSet> 20 18 21 /* GUI includes: */ 19 22 #include "UICommon.h" 23 #include "UIExtraDataManager.h" 20 24 #include "UINotificationModel.h" 21 25 #include "UINotificationObject.h" … … 75 79 } 76 80 77 void UINotificationModel::sltHandleAboutToClose( )81 void UINotificationModel::sltHandleAboutToClose(bool fDismiss) 78 82 { 79 83 /* Determine sender: */ 80 84 UINotificationObject *pSender = qobject_cast<UINotificationObject*>(sender()); 81 85 AssertPtrReturnVoid(pSender); 86 87 /* Dismiss message if requested: */ 88 if (fDismiss && !pSender->internalName().isEmpty()) 89 { 90 QSet<QString> suppressedMessages = gEDataManager->suppressedMessages().toSet(); 91 suppressedMessages << pSender->internalName(); 92 gEDataManager->setSuppressedMessages(suppressedMessages.toList()); 93 } 94 82 95 /* Revoke it from internal storage: */ 83 96 const QUuid uId = m_objects.key(pSender); -
trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationModel.h
r90485 r90688 63 63 private slots: 64 64 65 /** Handles request about to close sender() notification object. */ 66 void sltHandleAboutToClose(); 65 /** Handles request about to close sender() notification object. 66 * @param fDismiss Brings whether message closed as dismissed. */ 67 void sltHandleAboutToClose(bool fDismiss); 67 68 68 69 /** Handles broadcast request to detach COM stuff. */ -
trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObject.cpp
r90679 r90688 34 34 } 35 35 36 void UINotificationObject::dismiss() 37 { 38 emit sigAboutToClose(true); 39 } 40 36 41 void UINotificationObject::close() 37 42 { 38 emit sigAboutToClose( );43 emit sigAboutToClose(false); 39 44 } 40 45 … … 70 75 } 71 76 77 QString UINotificationSimple::internalName() const 78 { 79 return m_strInternalName; 80 } 81 72 82 void UINotificationSimple::handle() 73 83 { … … 122 132 { 123 133 return true; 134 } 135 136 QString UINotificationProgress::internalName() const 137 { 138 return QString(); 124 139 } 125 140 … … 195 210 { 196 211 return true; 212 } 213 214 QString UINotificationDownloader::internalName() const 215 { 216 return QString(); 197 217 } 198 218 … … 292 312 } 293 313 314 QString UINotificationNewVersionChecker::internalName() const 315 { 316 return QString(); 317 } 318 294 319 void UINotificationNewVersionChecker::handle() 295 320 { -
trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObject.h
r90679 r90688 45 45 signals: 46 46 47 /** Notifies model about closing. */ 48 void sigAboutToClose(); 47 /** Notifies model about closing. 48 * @param fDismiss Brings whether message closed as dismissed. */ 49 void sigAboutToClose(bool fDismiss); 49 50 50 51 public: … … 59 60 /** Returns object details. */ 60 61 virtual QString details() const = 0; 62 /** Returns object internal name. */ 63 virtual QString internalName() const = 0; 61 64 /** Handles notification-object being added. */ 62 65 virtual void handle() = 0; … … 64 67 public slots: 65 68 69 /** Notifies model about dismissing. */ 70 virtual void dismiss(); 66 71 /** Notifies model about closing. */ 67 72 virtual void close(); … … 91 96 /** Returns object details. */ 92 97 virtual QString details() const /* override final */; 98 /** Returns object internal name. */ 99 virtual QString internalName() const /* override final */; 93 100 /** Handles notification-object being added. */ 94 101 virtual void handle() /* override final */; … … 143 150 /** Returns whether object is critical. */ 144 151 virtual bool isCritical() const /* override */; 152 /** Returns object internal name. */ 153 virtual QString internalName() const /* override final */; 145 154 /** Handles notification-object being added. */ 146 155 virtual void handle() /* override final */; … … 205 214 /** Returns whether object is critical. */ 206 215 virtual bool isCritical() const /* override */; 216 /** Returns object internal name. */ 217 virtual QString internalName() const /* override final */; 207 218 /** Handles notification-object being added. */ 208 219 virtual void handle() /* override final */; … … 268 279 /** Returns whether object is critical. */ 269 280 virtual bool isCritical() const /* override */; 281 /** Returns object internal name. */ 282 virtual QString internalName() const /* override final */; 270 283 /** Handles notification-object being added. */ 271 284 virtual void handle() /* override final */; -
trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjectItem.cpp
r90675 r90688 44 44 , m_pLayoutUpper(0) 45 45 , m_pLabelName(0) 46 , m_pButtonForget(0) 46 47 , m_pButtonClose(0) 47 48 , m_pLabelDetails(0) … … 66 67 m_pLabelName->setText(m_pObject->name()); 67 68 m_pLayoutUpper->addWidget(m_pLabelName); 69 } 70 71 /* Prepare forget button: */ 72 if (!m_pObject->internalName().isEmpty()) 73 m_pButtonForget = new QIToolButton(this); 74 if (m_pButtonForget) 75 { 76 m_pButtonForget->setIcon(UIIconPool::iconSet(":/close_popup_16px.png")); 77 m_pButtonForget->setIconSize(QSize(10, 10)); 78 connect(m_pButtonForget, &QIToolButton::clicked, 79 m_pObject, &UINotificationObject::dismiss); 80 81 m_pLayoutUpper->addWidget(m_pButtonForget); 68 82 } 69 83 … … 92 106 m_pLabelDetails->setBrowserFont(myFont); 93 107 m_pLabelDetails->setVisible(false); 94 const int iHint = m_pLabelName->minimumSizeHint().width() 95 + m_pLayoutUpper->spacing() 96 + m_pButtonClose->minimumSizeHint().width(); 108 int iHint = m_pLabelName->minimumSizeHint().width(); 109 if (m_pButtonForget) 110 iHint += m_pLayoutUpper->spacing() + m_pButtonForget->minimumSizeHint().width(); 111 if (m_pButtonClose) 112 iHint += m_pLayoutUpper->spacing() + m_pButtonClose->minimumSizeHint().width(); 97 113 m_pLabelDetails->setMinimumTextWidth(iHint); 98 114 m_pLabelDetails->setText(m_pObject->details()); -
trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjectItem.h
r90606 r90688 67 67 /** Holds the name label instance. */ 68 68 QLabel *m_pLabelName; 69 /** Holds the forget button instance. */ 70 QIToolButton *m_pButtonForget; 69 71 /** Holds the close button instance. */ 70 72 QIToolButton *m_pButtonClose;
Note:
See TracChangeset
for help on using the changeset viewer.