mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-21 04:45:31 +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_statusBarIcon, Q_FUNC_INFO, "Missing status bar icon");
|
||||||
Q_ASSERT_X(this->m_statusBar, Q_FUNC_INFO, "Missing status bar");
|
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
|
// used with log subscriber, make sure it is not displayed twice
|
||||||
if (statusMessage.wasHandledBy(this)) { return; }
|
if (statusMessage.wasHandledBy(this)) { return; }
|
||||||
statusMessage.markAsHandledBy(this);
|
statusMessage.markAsHandledBy(this);
|
||||||
@@ -110,6 +113,7 @@ namespace BlackGui
|
|||||||
this->m_timerStatusBar->start(3000); // start / restart
|
this->m_timerStatusBar->start(3000); // start / restart
|
||||||
this->m_statusBarIcon->setPixmap(statusMessage.toPixmap());
|
this->m_statusBarIcon->setPixmap(statusMessage.toPixmap());
|
||||||
this->m_statusBarLabel->setText(statusMessage.getMessage());
|
this->m_statusBarLabel->setText(statusMessage.getMessage());
|
||||||
|
m_currentSeverity = statusMessage.getSeverity();
|
||||||
|
|
||||||
// restrict size for own status bars
|
// restrict size for own status bars
|
||||||
if (this->m_ownStatusBar)
|
if (this->m_ownStatusBar)
|
||||||
@@ -130,6 +134,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
void CManagedStatusBar::ps_clearStatusBar()
|
void CManagedStatusBar::ps_clearStatusBar()
|
||||||
{
|
{
|
||||||
|
m_currentSeverity = StatusSeverity::SeverityDebug;
|
||||||
if (!this->m_statusBar) { return; }
|
if (!this->m_statusBar) { return; }
|
||||||
this->m_statusBarIcon->clear();
|
this->m_statusBarIcon->clear();
|
||||||
this->m_statusBarLabel->clear();
|
this->m_statusBarLabel->clear();
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ namespace BlackGui
|
|||||||
QLabel *m_statusBarLabel = nullptr; //!< status bar label
|
QLabel *m_statusBarLabel = nullptr; //!< status bar label
|
||||||
QTimer *m_timerStatusBar = nullptr; //!< cleaning up status bar (own cleaning as I need to clean window / icon)
|
QTimer *m_timerStatusBar = nullptr; //!< cleaning up status bar (own cleaning as I need to clean window / icon)
|
||||||
bool m_ownStatusBar = false;
|
bool m_ownStatusBar = false;
|
||||||
|
BlackMisc::StatusSeverity m_currentSeverity = BlackMisc::StatusSeverity::SeverityDebug; // severity currently displayed
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
Reference in New Issue
Block a user