Changeset 91225 in vbox
- Timestamp:
- Sep 14, 2021 10:32:37 AM (3 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter
- Files:
-
- 4 edited
-
UINotificationCenter.cpp (modified) (6 diffs)
-
UINotificationCenter.h (modified) (4 diffs)
-
UINotificationModel.cpp (modified) (1 diff)
-
UINotificationModel.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationCenter.cpp
r90627 r91225 27 27 #include <QStateMachine> 28 28 #include <QStyle> 29 #include <QTimer> 29 30 #include <QVBoxLayout> 30 31 … … 176 177 const QUuid uId = m_pModel->appendObject(pObject); 177 178 178 /* Open if object is critical and center isn't opened yet: */179 /* If object is critical and center isn't opened yet: */ 179 180 if (!m_pOpenButton->isChecked() && pObject->isCritical()) 180 m_pOpenButton->animateClick(); 181 { 182 /* We should delay progresses for a bit: */ 183 const int iDelay = pObject->inherits("UINotificationProgress") ? 2000 : 0; 184 /* We should issue an open request: */ 185 AssertPtrReturn(m_pTimerOpen, uId); 186 m_uOpenObjectId = uId; 187 m_pTimerOpen->start(iDelay); 188 } 181 189 182 190 return uId; … … 198 206 , m_pStateMachineSliding(0) 199 207 , m_iAnimatedValue(0) 208 , m_pTimerOpen(0) 200 209 { 201 210 s_pInstance = this; … … 284 293 } 285 294 295 void UINotificationCenter::sltHandleOpenTimerTimeout() 296 { 297 /* Check whether we really closed: */ 298 if (m_pOpenButton->isChecked()) 299 return; 300 301 /* Check whether message with particular ID exists: */ 302 if (!m_pModel->hasObject(m_uOpenObjectId)) 303 return; 304 305 /* Toggle open-button: */ 306 m_pOpenButton->animateClick(); 307 } 308 286 309 void UINotificationCenter::sltModelChanged() 287 310 { … … 320 343 prepareWidgets(); 321 344 prepareStateMachineSliding(); 345 prepareOpenTimer(); 322 346 } 323 347 … … 456 480 } 457 481 482 void UINotificationCenter::prepareOpenTimer() 483 { 484 m_pTimerOpen = new QTimer(this); 485 if (m_pTimerOpen) 486 connect(m_pTimerOpen, &QTimer::timeout, 487 this, &UINotificationCenter::sltHandleOpenTimerTimeout); 488 } 489 458 490 void UINotificationCenter::paintBackground(QPainter *pPainter) 459 491 { -
trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationCenter.h
r90564 r91225 34 34 class QPainter; 35 35 class QStateMachine; 36 class QTimer; 36 37 class QVBoxLayout; 37 38 class QIToolButton; … … 92 93 /** Issues request to make open button @a fToggled. */ 93 94 void sltHandleOpenButtonToggled(bool fToggled); 95 /** Handles open-timer timeout. */ 96 void sltHandleOpenTimerTimeout(); 94 97 95 98 /** Handles signal about model being updated. */ … … 106 109 /** Prepares sliding state-machine. */ 107 110 void prepareStateMachineSliding(); 111 /** Prepares open-timer. */ 112 void prepareOpenTimer(); 108 113 109 114 /** Paints background using pre-configured @a pPainter. */ … … 141 146 /** Holds the sliding animation current value. */ 142 147 int m_iAnimatedValue; 148 149 /** Holds the open-timer instance. */ 150 QTimer *m_pTimerOpen; 151 /** Holds the open-object ID. */ 152 QUuid m_uOpenObjectId; 143 153 }; 144 154 -
trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationModel.cpp
r90688 r91225 69 69 } 70 70 71 bool UINotificationModel::hasObject(const QUuid &uId) const 72 { 73 return m_objects.contains(uId); 74 } 75 71 76 QList<QUuid> UINotificationModel::ids() const 72 77 { -
trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationModel.h
r90688 r91225 55 55 /** Revokes a notification object referenced by @a uId from intenal storage. */ 56 56 void revokeObject(const QUuid &uId); 57 /** Returns whether there is a notification object referenced by @a uId. */ 58 bool hasObject(const QUuid &uId) const; 57 59 58 60 /** Returns a list of registered notification object IDs. */
Note:
See TracChangeset
for help on using the changeset viewer.

