mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
CManagedStatusBar: don't display a message if already displaying one with a higher severity.
This commit is contained in:
@@ -102,6 +102,9 @@ namespace BlackGui
|
||||
Q_ASSERT_X(this->m_statusBarIcon, Q_FUNC_INFO, "Missing status bar icon");
|
||||
Q_ASSERT_X(this->m_statusBar, Q_FUNC_INFO, "Missing status bar");
|
||||
|
||||
// already displaying a message with severity higher than this one?
|
||||
if (!statusMessage.isSeverityHigherOrEqual(m_currentSeverity)) { return; }
|
||||
|
||||
// used with log subscriber, make sure it is not displayed twice
|
||||
if (statusMessage.wasHandledBy(this)) { return; }
|
||||
statusMessage.markAsHandledBy(this);
|
||||
@@ -110,6 +113,7 @@ namespace BlackGui
|
||||
this->m_timerStatusBar->start(3000); // start / restart
|
||||
this->m_statusBarIcon->setPixmap(statusMessage.toPixmap());
|
||||
this->m_statusBarLabel->setText(statusMessage.getMessage());
|
||||
m_currentSeverity = statusMessage.getSeverity();
|
||||
|
||||
// restrict size for own status bars
|
||||
if (this->m_ownStatusBar)
|
||||
@@ -130,6 +134,7 @@ namespace BlackGui
|
||||
|
||||
void CManagedStatusBar::ps_clearStatusBar()
|
||||
{
|
||||
m_currentSeverity = StatusSeverity::SeverityDebug;
|
||||
if (!this->m_statusBar) { return; }
|
||||
this->m_statusBarIcon->clear();
|
||||
this->m_statusBarLabel->clear();
|
||||
|
||||
@@ -66,6 +66,7 @@ namespace BlackGui
|
||||
QLabel *m_statusBarLabel = nullptr; //!< status bar label
|
||||
QTimer *m_timerStatusBar = nullptr; //!< cleaning up status bar (own cleaning as I need to clean window / icon)
|
||||
bool m_ownStatusBar = false;
|
||||
BlackMisc::StatusSeverity m_currentSeverity = BlackMisc::StatusSeverity::SeverityDebug; // severity currently displayed
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user