CManagedStatusBar: don't display a message if already displaying one with a higher severity.

This commit is contained in:
Mathew Sutcliffe
2017-03-30 02:10:09 +01:00
parent 3011c3a7ed
commit 5ba438699f
2 changed files with 6 additions and 0 deletions

View File

@@ -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();

View File

@@ -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