mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-14 00:25:35 +08:00
refs #338 Added class CLogSubscriber, a helper for subscribing to log messages matching a certain pattern, with the ability to change the pattern at runtime.
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
#include "blackgui/models/statusmessagelistmodel.h"
|
||||
#include "blackgui/models/keyboardkeylistmodel.h"
|
||||
#include "blackmisc/nwtextmessage.h"
|
||||
#include "blackmisc/loghandler.h"
|
||||
#include "blacksound/soundgenerator.h"
|
||||
#include <QMainWindow>
|
||||
#include <QTextEdit>
|
||||
@@ -88,6 +89,8 @@ private:
|
||||
GuiModes::WindowMode m_windowMode;
|
||||
BlackInput::IKeyboard *m_keyboard; //!< hotkeys
|
||||
|
||||
BlackMisc::CLogSubscriber m_logSubscriber { this, &MainWindow::ps_displayStatusMessageInGui };
|
||||
|
||||
// contexts
|
||||
bool m_coreAvailable;
|
||||
bool m_contextNetworkAvailable;
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#include "blackmisc/avselcal.h"
|
||||
#include "blackmisc/project.h"
|
||||
#include "blackmisc/hotkeyfunction.h"
|
||||
#include "blackmisc/loghandler.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <QSizeGrip>
|
||||
@@ -112,7 +111,7 @@ void MainWindow::init(const CRuntimeConfig &runtimeConfig)
|
||||
this->connect(this->ui->comp_MainInfoArea->getSettingsComponent(), &CSettingsComponent::changedAtcStationsUpdateInterval, this->ui->comp_MainInfoArea->getAtcStationComponent(), &::CAtcStationComponent::setUpdateIntervalSeconds);
|
||||
|
||||
// log messages
|
||||
CLogHandler::instance()->handlerForPattern(CLogPattern().withSeverityAtOrAbove(CStatusMessage::SeverityInfo))->subscribe(this, &MainWindow::ps_displayStatusMessageInGui);
|
||||
m_logSubscriber.changeSubscription(CLogPattern().withSeverityAtOrAbove(CStatusMessage::SeverityInfo));
|
||||
|
||||
Q_ASSERT(connect);
|
||||
Q_UNUSED(connect); // suppress GCC warning in release build
|
||||
|
||||
Reference in New Issue
Block a user