- Timestamp:
- Nov 9, 2021 2:32:19 PM (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/UINotificationCenter.cpp
r92294 r92295 152 152 , m_pOpenButton(0) 153 153 , m_pKeepButton(0) 154 , m_pRemoveFinishedButton(0) 154 155 , m_pLayoutItems(0) 155 156 , m_pStateMachineSliding(0) … … 279 280 if (m_pKeepButton) 280 281 m_pKeepButton->setToolTip(tr("Keep finished progresses")); 282 if (m_pRemoveFinishedButton) 283 m_pRemoveFinishedButton->setToolTip(tr("Delete finished notifications")); 281 284 } 282 285 … … 362 365 } 363 366 367 void UINotificationCenter::sltHandleRemoveFinishedButtonClicked() 368 { 369 m_pModel->revokeFinishedObjects(); 370 } 371 364 372 void UINotificationCenter::sltHandleOpenTimerTimeout() 365 373 { … … 469 477 m_pLayoutButtons->addWidget(m_pOpenButton); 470 478 } 479 480 /* Add stretch: */ 481 m_pLayoutButtons->addStretch(1); 471 482 472 483 /* Prepare keep-button: */ … … 481 492 } 482 493 483 m_pLayoutButtons->addStretch(); 494 /* Prepare remove-finished-button: */ 495 m_pRemoveFinishedButton = new QIToolButton(this); 496 if (m_pRemoveFinishedButton) 497 { 498 m_pRemoveFinishedButton->setIcon(UIIconPool::iconSet(":/edata_remove_16px_x3.png")); 499 connect(m_pRemoveFinishedButton, &QIToolButton::clicked, this, &UINotificationCenter::sltHandleRemoveFinishedButtonClicked); 500 m_pLayoutButtons->addWidget(m_pRemoveFinishedButton); 501 } 484 502 485 503 /* Add to layout: */ -
trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationCenter.h
r92012 r92295 105 105 /** Toggles notification-progresses keep approach. */ 106 106 void sltHandleKeepButtonToggled(bool fToggled); 107 /** Removes finished notifications. */ 108 void sltHandleRemoveFinishedButtonClicked(); 107 109 108 110 /** Handles open-timer timeout. */ … … 154 156 /** Holds the buttons layout instance. */ 155 157 QHBoxLayout *m_pLayoutButtons; 156 /** Holds the open 158 /** Holds the open-button instance. */ 157 159 QIToolButton *m_pOpenButton; 158 /** Holds the keep 160 /** Holds the keep-button instance. */ 159 161 QIToolButton *m_pKeepButton; 162 /** Holds the remove-finished-button instance. */ 163 QIToolButton *m_pRemoveFinishedButton; 160 164 /** Holds the items layout instance. */ 161 165 QVBoxLayout *m_pLayoutItems; -
trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationModel.cpp
r91225 r92295 74 74 } 75 75 76 void UINotificationModel::revokeFinishedObjects() 77 { 78 /* Check whether there are done objects: */ 79 bool fChanged = false; 80 foreach (const QUuid &uId, m_ids) 81 { 82 UINotificationObject *pObject = m_objects.value(uId); 83 AssertPtrReturnVoid(pObject); 84 if (pObject->isDone()) 85 { 86 /* Remove ID and object: */ 87 delete m_objects.take(uId); 88 m_ids.removeAll(uId); 89 fChanged = true; 90 } 91 } 92 /* Notify listeners: */ 93 if (fChanged) 94 emit sigChanged(); 95 } 96 76 97 QList<QUuid> UINotificationModel::ids() const 77 98 { -
trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationModel.h
r91225 r92295 57 57 /** Returns whether there is a notification object referenced by @a uId. */ 58 58 bool hasObject(const QUuid &uId) const; 59 /** Revokes finished notification objects. */ 60 void revokeFinishedObjects(); 59 61 60 62 /** Returns a list of registered notification object IDs. */
Note:
See TracChangeset
for help on using the changeset viewer.