mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-03 07:35:53 +08:00
feat: Add warn/error log buttons
Add buttons to highlight that error or warning messages were logged. Fixes #106
This commit is contained in:
@@ -132,6 +132,7 @@ private:
|
||||
BlackCore::CActionBindings m_menuHotkeyHandlers;
|
||||
BlackGui::CManagedStatusBar m_statusBar;
|
||||
BlackMisc::CLogHistoryReplica m_logHistoryForStatus { this };
|
||||
BlackMisc::CLogHistoryReplica m_logHistoryForLogButtons { this };
|
||||
BlackMisc::CLogHistoryReplica m_logHistoryForOverlay { this };
|
||||
BlackMisc::CSetting<BlackMisc::Audio::TSettings> m_audioSettings { this };
|
||||
|
||||
|
||||
@@ -77,6 +77,7 @@ void SwiftGuiStd::init()
|
||||
// log messages
|
||||
m_logHistoryForStatus.setFilter(CLogPattern().withSeverityAtOrAbove(CStatusMessage::SeverityInfo));
|
||||
m_logHistoryForOverlay.setFilter(CLogPattern().withSeverityAtOrAbove(CStatusMessage::SeverityError));
|
||||
m_logHistoryForLogButtons.setFilter(CLogPattern().withSeverityAtOrAbove(SeverityWarning));
|
||||
connect(&m_logHistoryForStatus, &CLogHistoryReplica::elementAdded, this, [this](const CStatusMessage &message) {
|
||||
m_statusBar.displayStatusMessage(message);
|
||||
ui->comp_MainInfoArea->displayStatusMessage(message);
|
||||
@@ -85,8 +86,19 @@ void SwiftGuiStd::init()
|
||||
//! \todo filter out validation messages at CLogPattern level
|
||||
if (!message.getCategories().contains(CLogCategories::validation())) { ui->fr_CentralFrameInside->showOverlayMessage(message); }
|
||||
});
|
||||
connect(&m_logHistoryForLogButtons, &CLogHistoryReplica::elementAdded, this, [this](const CStatusMessage &message) {
|
||||
if (message.getSeverity() == CStatusMessage::SeverityError)
|
||||
{
|
||||
m_statusBar.showErrorButton();
|
||||
}
|
||||
else if (message.getSeverity() == CStatusMessage::SeverityWarning)
|
||||
{
|
||||
m_statusBar.showWarningButton();
|
||||
}
|
||||
});
|
||||
m_logHistoryForStatus.initialize(sApp->getDataLinkDBus());
|
||||
m_logHistoryForOverlay.initialize(sApp->getDataLinkDBus());
|
||||
m_logHistoryForLogButtons.initialize(sApp->getDataLinkDBus());
|
||||
|
||||
// style
|
||||
this->initStyleSheet();
|
||||
@@ -116,6 +128,7 @@ void SwiftGuiStd::init()
|
||||
|
||||
// info bar and status bar
|
||||
m_statusBar.initStatusBar(ui->sb_MainStatusBar);
|
||||
connect(&m_statusBar, &CManagedStatusBar::requestLogPage, ui->comp_MainInfoArea, &CMainInfoAreaComponent::displayLog);
|
||||
ui->dw_InfoBarStatus->allowStatusBar(false);
|
||||
ui->dw_InfoBarStatus->setPreferredSizeWhenFloating(ui->dw_InfoBarStatus->size()); // set floating size
|
||||
|
||||
|
||||
Reference in New Issue
Block a user