mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-26 18:55:38 +08:00
Issue #15 [GUI] Use CLogHistoryReplica in CLogComponent and swift applications
This commit is contained in:
@@ -906,6 +906,18 @@ namespace BlackCore
|
|||||||
return this->startCoreFacadeAndWebDataServices(); // will do nothing if setup is not yet loaded
|
return this->startCoreFacadeAndWebDataServices(); // will do nothing if setup is not yet loaded
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CStatusMessageList CApplication::useFacadeNoContexts()
|
||||||
|
{
|
||||||
|
Q_ASSERT_X(m_parsed, Q_FUNC_INFO, "Call this function after parsing");
|
||||||
|
|
||||||
|
m_useContexts = true; // otherwise startCoreFacadeAndWebDataServices will early-return
|
||||||
|
m_coreFacadeConfig = CCoreFacadeConfig::allEmpty();
|
||||||
|
const CStatusMessage msg = this->initLocalSettings();
|
||||||
|
if (msg.isFailure()) { return msg; }
|
||||||
|
|
||||||
|
return this->startCoreFacadeAndWebDataServices(); // will do nothing if setup is not yet loaded
|
||||||
|
}
|
||||||
|
|
||||||
CStatusMessageList CApplication::useWebDataServices(const CWebReaderFlags::WebReader webReaders, const CDatabaseReaderConfigList &dbReaderConfig)
|
CStatusMessageList CApplication::useWebDataServices(const CWebReaderFlags::WebReader webReaders, const CDatabaseReaderConfigList &dbReaderConfig)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(m_webDataServices.isNull(), Q_FUNC_INFO, "Services already started");
|
Q_ASSERT_X(m_webDataServices.isNull(), Q_FUNC_INFO, "Services already started");
|
||||||
|
|||||||
@@ -369,6 +369,11 @@ namespace BlackCore
|
|||||||
//! \remark requires setup loaded
|
//! \remark requires setup loaded
|
||||||
BlackMisc::CStatusMessageList useContexts(const CCoreFacadeConfig &coreConfig);
|
BlackMisc::CStatusMessageList useContexts(const CCoreFacadeConfig &coreConfig);
|
||||||
|
|
||||||
|
//! Init the core facade without any contexts
|
||||||
|
//! \sa coreFacadeStarted
|
||||||
|
//! \remark requires setup loaded
|
||||||
|
BlackMisc::CStatusMessageList useFacadeNoContexts();
|
||||||
|
|
||||||
//! Init web data services and start them
|
//! Init web data services and start them
|
||||||
//! \sa webDataServicesStarted
|
//! \sa webDataServicesStarted
|
||||||
//! \remark requires setup loaded
|
//! \remark requires setup loaded
|
||||||
|
|||||||
@@ -111,6 +111,7 @@ namespace BlackCore
|
|||||||
m_dataLinkDBus = new SharedState::CDataLinkDBus(this);
|
m_dataLinkDBus = new SharedState::CDataLinkDBus(this);
|
||||||
switch (m_config.getModeApplication())
|
switch (m_config.getModeApplication())
|
||||||
{
|
{
|
||||||
|
case CCoreFacadeConfig::NotUsed:
|
||||||
case CCoreFacadeConfig::Local:
|
case CCoreFacadeConfig::Local:
|
||||||
m_dataLinkDBus->initializeLocal(nullptr);
|
m_dataLinkDBus->initializeLocal(nullptr);
|
||||||
break;
|
break;
|
||||||
@@ -133,6 +134,12 @@ namespace BlackCore
|
|||||||
m_logHistory->initialize(m_dataLinkDBus);
|
m_logHistory->initialize(m_dataLinkDBus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_config.all(CCoreFacadeConfig::NotUsed))
|
||||||
|
{
|
||||||
|
m_initalized = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// contexts
|
// contexts
|
||||||
if (m_contextApplication) { m_contextApplication->deleteLater(); }
|
if (m_contextApplication) { m_contextApplication->deleteLater(); }
|
||||||
m_contextApplication = IContextApplication::create(this, m_config.getModeApplication(), m_dbusServer, m_dbusConnection);
|
m_contextApplication = IContextApplication::create(this, m_config.getModeApplication(), m_dbusServer, m_dbusConnection);
|
||||||
|
|||||||
@@ -37,6 +37,15 @@ namespace BlackCore
|
|||||||
m_simulator == mode);
|
m_simulator == mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CCoreFacadeConfig::all(CCoreFacadeConfig::ContextMode mode) const
|
||||||
|
{
|
||||||
|
return (m_application == mode &&
|
||||||
|
m_audio == mode &&
|
||||||
|
m_network == mode &&
|
||||||
|
m_ownAircraft == mode &&
|
||||||
|
m_simulator == mode);
|
||||||
|
}
|
||||||
|
|
||||||
bool CCoreFacadeConfig::anyRemote() const
|
bool CCoreFacadeConfig::anyRemote() const
|
||||||
{
|
{
|
||||||
return this->any(Remote);
|
return this->any(Remote);
|
||||||
|
|||||||
@@ -91,6 +91,9 @@ namespace BlackCore
|
|||||||
//! Any context in given mode
|
//! Any context in given mode
|
||||||
bool any(ContextMode mode) const;
|
bool any(ContextMode mode) const;
|
||||||
|
|
||||||
|
//! All contexts in given mode
|
||||||
|
bool all(ContextMode mode) const;
|
||||||
|
|
||||||
//! Any remote context?
|
//! Any remote context?
|
||||||
bool anyRemote() const;
|
bool anyRemote() const;
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,10 @@
|
|||||||
#include "blackgui/views/statusmessageview.h"
|
#include "blackgui/views/statusmessageview.h"
|
||||||
#include "blackgui/views/viewbase.h"
|
#include "blackgui/views/viewbase.h"
|
||||||
#include "blackgui/guiutility.h"
|
#include "blackgui/guiutility.h"
|
||||||
|
#include "blackcore/application.h"
|
||||||
#include "blackmisc/icons.h"
|
#include "blackmisc/icons.h"
|
||||||
|
#include "blackmisc/logpattern.h"
|
||||||
|
#include "blackmisc/sharedstate/datalinkdbus.h"
|
||||||
#include "ui_logcomponent.h"
|
#include "ui_logcomponent.h"
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
@@ -22,6 +25,7 @@
|
|||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
|
|
||||||
using namespace BlackMisc;
|
using namespace BlackMisc;
|
||||||
|
using namespace BlackCore;
|
||||||
using namespace BlackGui;
|
using namespace BlackGui;
|
||||||
using namespace BlackGui::Views;
|
using namespace BlackGui::Views;
|
||||||
using namespace BlackGui::Menus;
|
using namespace BlackGui::Menus;
|
||||||
@@ -46,10 +50,21 @@ namespace BlackGui
|
|||||||
}
|
}
|
||||||
|
|
||||||
CLogComponent::CLogComponent(QWidget *parent) :
|
CLogComponent::CLogComponent(QWidget *parent) :
|
||||||
QFrame(parent), ui(new Ui::CLogComponent)
|
QFrame(parent), ui(new Ui::CLogComponent), m_history(this)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
connect(ui->comp_StatusMessages, &CStatusMessagesDetail::modelDataChangedDigest, this, &CLogComponent::onStatusMessageDataChanged);
|
connect(ui->comp_StatusMessages, &CStatusMessagesDetail::modelDataChangedDigest, this, &CLogComponent::onStatusMessageDataChanged);
|
||||||
|
|
||||||
|
connect(&m_history, &CLogHistoryReplica::elementAdded, this, [this](const CStatusMessage &message)
|
||||||
|
{
|
||||||
|
ui->comp_StatusMessages->appendStatusMessageToList(message);
|
||||||
|
});
|
||||||
|
connect(&m_history, &CLogHistoryReplica::elementsReplaced, this, [this](const CStatusMessageList &messages)
|
||||||
|
{
|
||||||
|
ui->comp_StatusMessages->appendStatusMessagesToList(messages);
|
||||||
|
});
|
||||||
|
m_history.setFilter(CLogPattern().withSeverityAtOrAbove(CStatusMessage::SeverityInfo));
|
||||||
|
m_history.initialize(sApp->getDataLinkDBus());
|
||||||
}
|
}
|
||||||
|
|
||||||
CLogComponent::~CLogComponent()
|
CLogComponent::~CLogComponent()
|
||||||
@@ -123,27 +138,11 @@ namespace BlackGui
|
|||||||
ui->comp_StatusMessages->clear();
|
ui->comp_StatusMessages->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLogComponent::appendStatusMessageToConsole(const CStatusMessage &statusMessage)
|
|
||||||
{
|
|
||||||
if (statusMessage.isEmpty()) return;
|
|
||||||
ui->tep_StatusPageConsole->appendHtml(statusMessage.toHtml(false, true));
|
|
||||||
}
|
|
||||||
|
|
||||||
void CLogComponent::appendPlainTextToConsole(const QString &text)
|
void CLogComponent::appendPlainTextToConsole(const QString &text)
|
||||||
{
|
{
|
||||||
ui->tep_StatusPageConsole->appendPlainText(text);
|
ui->tep_StatusPageConsole->appendPlainText(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLogComponent::appendStatusMessageToList(const CStatusMessage &statusMessage)
|
|
||||||
{
|
|
||||||
ui->comp_StatusMessages->appendStatusMessageToList(statusMessage);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CLogComponent::appendStatusMessagesToList(const CStatusMessageList &statusMessages)
|
|
||||||
{
|
|
||||||
ui->comp_StatusMessages->appendStatusMessagesToList(statusMessages);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CLogComponent::onStatusMessageDataChanged(int count, bool withFilter)
|
void CLogComponent::onStatusMessageDataChanged(int count, bool withFilter)
|
||||||
{
|
{
|
||||||
Q_UNUSED(count);
|
Q_UNUSED(count);
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
#define BLACKGUI_LOGCOMPONENT_H
|
#define BLACKGUI_LOGCOMPONENT_H
|
||||||
|
|
||||||
#include "blackgui/blackguiexport.h"
|
#include "blackgui/blackguiexport.h"
|
||||||
|
#include "blackmisc/loghistory.h"
|
||||||
#include "blackmisc/statusmessagelist.h"
|
#include "blackmisc/statusmessagelist.h"
|
||||||
|
|
||||||
#include <QFrame>
|
#include <QFrame>
|
||||||
@@ -94,24 +95,16 @@ namespace BlackGui
|
|||||||
//! Clear
|
//! Clear
|
||||||
void clearMessages();
|
void clearMessages();
|
||||||
|
|
||||||
//! Append status message to console
|
|
||||||
void appendStatusMessageToConsole(const BlackMisc::CStatusMessage &statusMessage);
|
|
||||||
|
|
||||||
//! Append plain text to console
|
//! Append plain text to console
|
||||||
void appendPlainTextToConsole(const QString &text);
|
void appendPlainTextToConsole(const QString &text);
|
||||||
|
|
||||||
//! Append status message to list
|
|
||||||
void appendStatusMessageToList(const BlackMisc::CStatusMessage &statusMessage);
|
|
||||||
|
|
||||||
//! Append status messages to list
|
|
||||||
void appendStatusMessagesToList(const BlackMisc::CStatusMessageList &statusMessages);
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
//! Make me visible
|
//! Make me visible
|
||||||
void requestAttention();
|
void requestAttention();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QScopedPointer<Ui::CLogComponent> ui;
|
QScopedPointer<Ui::CLogComponent> ui;
|
||||||
|
BlackMisc::CLogHistoryReplica m_history;
|
||||||
|
|
||||||
//! Status messages changed
|
//! Status messages changed
|
||||||
void onStatusMessageDataChanged(int count, bool withFilter);
|
void onStatusMessageDataChanged(int count, bool withFilter);
|
||||||
|
|||||||
@@ -45,10 +45,10 @@ namespace BlackSimPlugin
|
|||||||
//! Dtor
|
//! Dtor
|
||||||
virtual ~CSimulatorEmulatedMonitorDialog() override;
|
virtual ~CSimulatorEmulatedMonitorDialog() override;
|
||||||
|
|
||||||
//! \copydoc BlackGui::Components::CLogComponent::appendStatusMessageToList
|
//! Append status message
|
||||||
void appendStatusMessageToList(const BlackMisc::CStatusMessage &statusMessage);
|
void appendStatusMessageToList(const BlackMisc::CStatusMessage &statusMessage);
|
||||||
|
|
||||||
//! \copydoc BlackGui::Components::CLogComponent::appendStatusMessagesToList
|
//! Append status messages
|
||||||
void appendStatusMessagesToList(const BlackMisc::CStatusMessageList &statusMessages);
|
void appendStatusMessagesToList(const BlackMisc::CStatusMessageList &statusMessages);
|
||||||
|
|
||||||
//! Receiving call to be written in log widget
|
//! Receiving call to be written in log widget
|
||||||
|
|||||||
@@ -68,8 +68,7 @@ CSwiftCore::CSwiftCore(QWidget *parent) :
|
|||||||
this->initMenus();
|
this->initMenus();
|
||||||
|
|
||||||
// log
|
// log
|
||||||
CStatusMessage m = CStatusMessage(this).info(u"Cmd: %1") << CGuiApplication::arguments().join(" ");
|
CLogMessage(this).info(u"Cmd: %1") << CGuiApplication::arguments().join(" ");
|
||||||
this->appendLogMessage(m);
|
|
||||||
|
|
||||||
// command line
|
// command line
|
||||||
ui->lep_CommandLineInput->setIdentifier(this->identifier());
|
ui->lep_CommandLineInput->setIdentifier(this->identifier());
|
||||||
@@ -92,11 +91,6 @@ void CSwiftCore::initStyleSheet()
|
|||||||
this->setStyleSheet(s);
|
this->setStyleSheet(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSwiftCore::appendLogMessage(const CStatusMessage &message)
|
|
||||||
{
|
|
||||||
ui->comp_InfoArea->getLogComponent()->appendStatusMessageToList(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CSwiftCore::showSettingsDialog()
|
void CSwiftCore::showSettingsDialog()
|
||||||
{
|
{
|
||||||
if (!m_settingsDialog)
|
if (!m_settingsDialog)
|
||||||
@@ -125,10 +119,6 @@ void CSwiftCore::initLogDisplay()
|
|||||||
m_mwaLogComponent->showDetails(false);
|
m_mwaLogComponent->showDetails(false);
|
||||||
CLogHandler::instance()->install(true);
|
CLogHandler::instance()->install(true);
|
||||||
CLogHandler::instance()->enableConsoleOutput(false); // default disable
|
CLogHandler::instance()->enableConsoleOutput(false); // default disable
|
||||||
auto logHandler = CLogHandler::instance()->handlerForPattern(
|
|
||||||
CLogPattern().withSeverityAtOrAbove(CStatusMessage::SeverityInfo)
|
|
||||||
);
|
|
||||||
logHandler->subscribe(this, &CSwiftCore::appendLogMessage);
|
|
||||||
ui->comp_InfoArea->getLogComponent()->showFilterDialog(); // add a filter dialog
|
ui->comp_InfoArea->getLogComponent()->showFilterDialog(); // add a filter dialog
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -61,9 +61,6 @@ private:
|
|||||||
void initMenus();
|
void initMenus();
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
//! Add a message to log UI
|
|
||||||
void appendLogMessage(const BlackMisc::CStatusMessage &message);
|
|
||||||
|
|
||||||
//! Toggled P2P mode
|
//! Toggled P2P mode
|
||||||
void p2pModeToggled(bool checked);
|
void p2pModeToggled(bool checked);
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ int main(int argc, char *argv[])
|
|||||||
a.splashScreen(CIcons::swiftDatabase256());
|
a.splashScreen(CIcons::swiftDatabase256());
|
||||||
if (!a.parseAndSynchronizeSetup()) { return EXIT_FAILURE; }
|
if (!a.parseAndSynchronizeSetup()) { return EXIT_FAILURE; }
|
||||||
a.useWebDataServices(BlackCore::CWebReaderFlags::AllSwiftDbReaders, CDatabaseReaderConfigList::forMappingTool());
|
a.useWebDataServices(BlackCore::CWebReaderFlags::AllSwiftDbReaders, CDatabaseReaderConfigList::forMappingTool());
|
||||||
|
a.useFacadeNoContexts();
|
||||||
if (!a.start())
|
if (!a.start())
|
||||||
{
|
{
|
||||||
a.gracefulShutdown();
|
a.gracefulShutdown();
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
#include "blackcore/data/globalsetup.h"
|
#include "blackcore/data/globalsetup.h"
|
||||||
#include "blackmisc/simulation/autopublishdata.h"
|
#include "blackmisc/simulation/autopublishdata.h"
|
||||||
#include "blackmisc/simulation/distributorlist.h"
|
#include "blackmisc/simulation/distributorlist.h"
|
||||||
|
#include "blackmisc/sharedstate/datalinkdbus.h"
|
||||||
#include "blackmisc/loghandler.h"
|
#include "blackmisc/loghandler.h"
|
||||||
#include "blackmisc/statusmessage.h"
|
#include "blackmisc/statusmessage.h"
|
||||||
#include "blackmisc/logmessage.h"
|
#include "blackmisc/logmessage.h"
|
||||||
@@ -80,17 +81,6 @@ void CSwiftData::closeEvent(QCloseEvent *event)
|
|||||||
this->performGracefulShutdown();
|
this->performGracefulShutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSwiftData::appendLogMessage(const CStatusMessage &message)
|
|
||||||
{
|
|
||||||
if (!ui->comp_MainInfoArea) { return; } // not initialized yet
|
|
||||||
CLogComponent *logComponent = ui->comp_MainInfoArea->getLogComponent();
|
|
||||||
Q_ASSERT_X(logComponent, Q_FUNC_INFO, "missing log component");
|
|
||||||
logComponent->appendStatusMessageToList(message);
|
|
||||||
|
|
||||||
// status bar
|
|
||||||
m_statusBar.displayStatusMessage(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CSwiftData::onStyleSheetsChanged()
|
void CSwiftData::onStyleSheetsChanged()
|
||||||
{
|
{
|
||||||
this->initStyleSheet();
|
this->initStyleSheet();
|
||||||
@@ -134,12 +124,15 @@ void CSwiftData::initLogDisplay()
|
|||||||
m_statusBar.initStatusBar(ui->sb_SwiftData);
|
m_statusBar.initStatusBar(ui->sb_SwiftData);
|
||||||
// m_statusBar.setSizeGripEnabled(false);
|
// m_statusBar.setSizeGripEnabled(false);
|
||||||
|
|
||||||
|
connect(&m_logHistory, &CLogHistoryReplica::elementAdded, this, [this](const CStatusMessage &message)
|
||||||
|
{
|
||||||
|
m_statusBar.displayStatusMessage(message);
|
||||||
|
});
|
||||||
|
m_logHistory.setFilter(CLogPattern().withSeverityAtOrAbove(CStatusMessage::SeverityInfo));
|
||||||
|
m_logHistory.initialize(sApp->getDataLinkDBus());
|
||||||
|
|
||||||
CLogHandler::instance()->install(true);
|
CLogHandler::instance()->install(true);
|
||||||
CLogHandler::instance()->enableConsoleOutput(false); // default disable
|
CLogHandler::instance()->enableConsoleOutput(false); // default disable
|
||||||
auto logHandler = CLogHandler::instance()->handlerForPattern(
|
|
||||||
CLogPattern().withSeverityAtOrAbove(CStatusMessage::SeverityInfo)
|
|
||||||
);
|
|
||||||
logHandler->subscribe(this, &CSwiftData::appendLogMessage);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSwiftData::initMenu()
|
void CSwiftData::initMenu()
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
#include "blackgui/mainwindowaccess.h"
|
#include "blackgui/mainwindowaccess.h"
|
||||||
#include "blackgui/managedstatusbar.h"
|
#include "blackgui/managedstatusbar.h"
|
||||||
#include "blackcore/db/backgrounddataupdater.h"
|
#include "blackcore/db/backgrounddataupdater.h"
|
||||||
|
#include "blackmisc/loghistory.h"
|
||||||
#include "blackmisc/identifiable.h"
|
#include "blackmisc/identifiable.h"
|
||||||
#include "blackmisc/statusmessage.h"
|
#include "blackmisc/statusmessage.h"
|
||||||
|
|
||||||
@@ -50,9 +51,6 @@ protected:
|
|||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//! Append log message
|
|
||||||
void appendLogMessage(const BlackMisc::CStatusMessage &message);
|
|
||||||
|
|
||||||
//! Style sheet has changed
|
//! Style sheet has changed
|
||||||
void onStyleSheetsChanged();
|
void onStyleSheetsChanged();
|
||||||
|
|
||||||
@@ -83,6 +81,7 @@ private:
|
|||||||
BlackGui::CManagedStatusBar m_statusBar;
|
BlackGui::CManagedStatusBar m_statusBar;
|
||||||
BlackCore::Db::CBackgroundDataUpdater *m_updater = nullptr; //!< consolidate with DB data
|
BlackCore::Db::CBackgroundDataUpdater *m_updater = nullptr; //!< consolidate with DB data
|
||||||
BlackMisc::CSettingReadOnly<BlackGui::Settings::TBackgroundConsolidation> m_consolidationSettings { this, &CSwiftData::consolidationSettingChanged }; //!< consolidation time
|
BlackMisc::CSettingReadOnly<BlackGui::Settings::TBackgroundConsolidation> m_consolidationSettings { this, &CSwiftData::consolidationSettingChanged }; //!< consolidation time
|
||||||
|
BlackMisc::CLogHistoryReplica m_logHistory { this };
|
||||||
|
|
||||||
// auto update
|
// auto update
|
||||||
BlackGui::Components::CAutoPublishDialog *m_autoPublishDialog = nullptr; //!< auto publishing dialog
|
BlackGui::Components::CAutoPublishDialog *m_autoPublishDialog = nullptr; //!< auto publishing dialog
|
||||||
|
|||||||
@@ -272,27 +272,6 @@ void SwiftGuiStd::loginRequested()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SwiftGuiStd::displayStatusMessageInGui(const CStatusMessage &statusMessage)
|
|
||||||
{
|
|
||||||
if (!m_init) { return; }
|
|
||||||
// used with log subscriber
|
|
||||||
if (statusMessage.wasHandledBy(this)) { return; }
|
|
||||||
statusMessage.markAsHandledBy(this);
|
|
||||||
m_statusBar.displayStatusMessage(statusMessage);
|
|
||||||
|
|
||||||
// main info areas
|
|
||||||
ui->comp_MainInfoArea->displayStatusMessage(statusMessage);
|
|
||||||
|
|
||||||
// list
|
|
||||||
ui->comp_MainInfoArea->getLogComponent()->appendStatusMessageToList(statusMessage);
|
|
||||||
|
|
||||||
// display overlay for errors, but not for validation
|
|
||||||
if (statusMessage.getSeverity() == CStatusMessage::SeverityError && ! statusMessage.getCategories().contains(CLogCategory::validation()))
|
|
||||||
{
|
|
||||||
ui->fr_CentralFrameInside->showOverlayMessage(statusMessage);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void SwiftGuiStd::onKickedFromNetwork(const QString &kickMessage)
|
void SwiftGuiStd::onKickedFromNetwork(const QString &kickMessage)
|
||||||
{
|
{
|
||||||
this->updateGuiStatusInformation();
|
this->updateGuiStatusInformation();
|
||||||
@@ -363,7 +342,6 @@ void SwiftGuiStd::setContextAvailability()
|
|||||||
{
|
{
|
||||||
// core has just become available (startup)
|
// core has just become available (startup)
|
||||||
// this HERE is called with and without DBus
|
// this HERE is called with and without DBus
|
||||||
sGui->getIContextApplication()->synchronizeLogSubscriptions();
|
|
||||||
sGui->getIContextApplication()->synchronizeLocalSettings();
|
sGui->getIContextApplication()->synchronizeLocalSettings();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
#include "blackmisc/identifiable.h"
|
#include "blackmisc/identifiable.h"
|
||||||
#include "blackmisc/variant.h"
|
#include "blackmisc/variant.h"
|
||||||
#include "blackmisc/loghandler.h"
|
#include "blackmisc/loghandler.h"
|
||||||
|
#include "blackmisc/loghistory.h"
|
||||||
#include "blackmisc/statusmessage.h"
|
#include "blackmisc/statusmessage.h"
|
||||||
#include "blackmisc/icons.h"
|
#include "blackmisc/icons.h"
|
||||||
|
|
||||||
@@ -127,7 +128,8 @@ private:
|
|||||||
BlackCore::CActionBind m_actionPtt2 { BlackMisc::Input::pttCom2HotkeyAction(), BlackMisc::CIcons::StandardIconRadio16, this, &SwiftGuiStd::onPttChanged };
|
BlackCore::CActionBind m_actionPtt2 { BlackMisc::Input::pttCom2HotkeyAction(), BlackMisc::CIcons::StandardIconRadio16, this, &SwiftGuiStd::onPttChanged };
|
||||||
BlackCore::CActionBindings m_menuHotkeyHandlers;
|
BlackCore::CActionBindings m_menuHotkeyHandlers;
|
||||||
BlackGui::CManagedStatusBar m_statusBar;
|
BlackGui::CManagedStatusBar m_statusBar;
|
||||||
BlackMisc::CLogSubscriber m_logSubscriber { this, &SwiftGuiStd::displayStatusMessageInGui };
|
BlackMisc::CLogHistoryReplica m_logHistoryForStatus { this };
|
||||||
|
BlackMisc::CLogHistoryReplica m_logHistoryForOverlay { this };
|
||||||
|
|
||||||
// contexts
|
// contexts
|
||||||
static constexpr int MaxCoreFailures = 5; //!< Failures counted before reconnecting
|
static constexpr int MaxCoreFailures = 5; //!< Failures counted before reconnecting
|
||||||
@@ -207,9 +209,6 @@ private:
|
|||||||
//! Reload own aircraft
|
//! Reload own aircraft
|
||||||
bool reloadOwnAircraft();
|
bool reloadOwnAircraft();
|
||||||
|
|
||||||
//! Display status message
|
|
||||||
void displayStatusMessageInGui(const BlackMisc::CStatusMessage &statusMessage);
|
|
||||||
|
|
||||||
//! Connection status changed
|
//! Connection status changed
|
||||||
//! \param from old status
|
//! \param from old status
|
||||||
//! \param to new status
|
//! \param to new status
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
#include "blackcore/context/contextaudio.h"
|
#include "blackcore/context/contextaudio.h"
|
||||||
#include "blacksound/audioutilities.h"
|
#include "blacksound/audioutilities.h"
|
||||||
#include "blackmisc/network/networkutils.h"
|
#include "blackmisc/network/networkutils.h"
|
||||||
|
#include "blackmisc/sharedstate/datalinkdbus.h"
|
||||||
#include "blackmisc/loghandler.h"
|
#include "blackmisc/loghandler.h"
|
||||||
#include "blackmisc/logmessage.h"
|
#include "blackmisc/logmessage.h"
|
||||||
#include "blackmisc/logpattern.h"
|
#include "blackmisc/logpattern.h"
|
||||||
@@ -83,7 +84,20 @@ void SwiftGuiStd::init()
|
|||||||
// if (CBuildConfig::isLocalDeveloperDebugBuild()) { BlackSound::occupyAudioInputDevice(); }
|
// if (CBuildConfig::isLocalDeveloperDebugBuild()) { BlackSound::occupyAudioInputDevice(); }
|
||||||
|
|
||||||
// log messages
|
// log messages
|
||||||
m_logSubscriber.changeSubscription(CLogPattern().withSeverityAtOrAbove(CStatusMessage::SeverityInfo));
|
m_logHistoryForStatus.setFilter(CLogPattern().withSeverityAtOrAbove(CStatusMessage::SeverityInfo));
|
||||||
|
m_logHistoryForOverlay.setFilter(CLogPattern().withSeverityAtOrAbove(CStatusMessage::SeverityError));
|
||||||
|
connect(&m_logHistoryForStatus, &CLogHistoryReplica::elementAdded, this, [this](const CStatusMessage& message)
|
||||||
|
{
|
||||||
|
m_statusBar.displayStatusMessage(message);
|
||||||
|
ui->comp_MainInfoArea->displayStatusMessage(message);
|
||||||
|
});
|
||||||
|
connect(&m_logHistoryForOverlay, &CLogHistoryReplica::elementAdded, this, [this](const CStatusMessage& message)
|
||||||
|
{
|
||||||
|
//! \todo filter out validation messages at CLogPattern level
|
||||||
|
if (!message.getCategories().contains(CLogCategory::validation())) { ui->fr_CentralFrameInside->showOverlayMessage(message); }
|
||||||
|
});
|
||||||
|
m_logHistoryForStatus.initialize(sApp->getDataLinkDBus());
|
||||||
|
m_logHistoryForOverlay.initialize(sApp->getDataLinkDBus());
|
||||||
|
|
||||||
// style
|
// style
|
||||||
this->initStyleSheet();
|
this->initStyleSheet();
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ int main(int argc, char *argv[])
|
|||||||
a.addParserOption({{"i", "installer"}, QCoreApplication::translate("main", "Installer setup.")});
|
a.addParserOption({{"i", "installer"}, QCoreApplication::translate("main", "Installer setup.")});
|
||||||
if (!a.parseAndSynchronizeSetup()) { return EXIT_FAILURE; }
|
if (!a.parseAndSynchronizeSetup()) { return EXIT_FAILURE; }
|
||||||
a.useWebDataServices(BlackCore::CWebReaderFlags::AllSwiftDbReaders, CDatabaseReaderConfigList::forLauncher());
|
a.useWebDataServices(BlackCore::CWebReaderFlags::AllSwiftDbReaders, CDatabaseReaderConfigList::forLauncher());
|
||||||
|
a.useFacadeNoContexts();
|
||||||
if (!a.start())
|
if (!a.start())
|
||||||
{
|
{
|
||||||
a.gracefulShutdown();
|
a.gracefulShutdown();
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
#include "blackmisc/icons.h"
|
#include "blackmisc/icons.h"
|
||||||
#include "blackmisc/logmessage.h"
|
#include "blackmisc/logmessage.h"
|
||||||
#include "blackmisc/loghandler.h"
|
#include "blackmisc/loghandler.h"
|
||||||
|
#include "blackmisc/sharedstate/datalinkdbus.h"
|
||||||
#include "blackconfig/buildconfig.h"
|
#include "blackconfig/buildconfig.h"
|
||||||
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
@@ -311,13 +312,13 @@ void CSwiftLauncher::initLogDisplay()
|
|||||||
{
|
{
|
||||||
CLogHandler::instance()->install(true);
|
CLogHandler::instance()->install(true);
|
||||||
CLogHandler::instance()->enableConsoleOutput(false); // default disable
|
CLogHandler::instance()->enableConsoleOutput(false); // default disable
|
||||||
auto logHandler = CLogHandler::instance()->handlerForPattern(
|
|
||||||
CLogPattern().withSeverityAtOrAbove(CStatusMessage::SeverityInfo)
|
|
||||||
);
|
|
||||||
logHandler->subscribe(this, &CSwiftLauncher::appendLogMessage);
|
|
||||||
|
|
||||||
ui->comp_SwiftLauncherLog->showFilterBar();
|
ui->comp_SwiftLauncherLog->showFilterBar();
|
||||||
ui->comp_SwiftLauncherLog->filterUseRadioButtonDescriptiveIcons(false);
|
ui->comp_SwiftLauncherLog->filterUseRadioButtonDescriptiveIcons(false);
|
||||||
|
|
||||||
|
m_logHistory.setFilter(CLogPattern().withSeverity(CStatusMessage::SeverityError));
|
||||||
|
connect(&m_logHistory, &CLogHistoryReplica::elementAdded, this, qOverload<const CStatusMessage &>(&CSwiftLauncher::showStatusMessage));
|
||||||
|
m_logHistory.initialize(sApp->getDataLinkDBus());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSwiftLauncher::setHeaderInfo(const CArtifact &latestArtifact)
|
void CSwiftLauncher::setHeaderInfo(const CArtifact &latestArtifact)
|
||||||
@@ -559,24 +560,6 @@ void CSwiftLauncher::showStatusMessage(const QString &htmlMsg)
|
|||||||
ui->fr_SwiftLauncherMain->showOverlayMessage(htmlMsg, 5000);
|
ui->fr_SwiftLauncherMain->showOverlayMessage(htmlMsg, 5000);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSwiftLauncher::appendLogMessage(const CStatusMessage &message)
|
|
||||||
{
|
|
||||||
ui->comp_SwiftLauncherLog->appendStatusMessageToList(message);
|
|
||||||
if (message.getSeverity() == CStatusMessage::SeverityError)
|
|
||||||
{
|
|
||||||
this->showStatusMessage(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CSwiftLauncher::appendLogMessages(const CStatusMessageList &messages)
|
|
||||||
{
|
|
||||||
ui->comp_SwiftLauncherLog->appendStatusMessagesToList(messages);
|
|
||||||
if (messages.hasErrorMessages())
|
|
||||||
{
|
|
||||||
this->showStatusMessage(messages.getErrorMessages().toSingleMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CSwiftLauncher::showMainPage()
|
void CSwiftLauncher::showMainPage()
|
||||||
{
|
{
|
||||||
ui->sw_SwiftLauncher->setCurrentWidget(ui->pg_SwiftLauncherMain);
|
ui->sw_SwiftLauncher->setCurrentWidget(ui->pg_SwiftLauncherMain);
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#include "blackmisc/simulation/data/modelcaches.h"
|
#include "blackmisc/simulation/data/modelcaches.h"
|
||||||
#include "blackmisc/db/artifact.h"
|
#include "blackmisc/db/artifact.h"
|
||||||
#include "blackmisc/identifiable.h"
|
#include "blackmisc/identifiable.h"
|
||||||
|
#include "blackmisc/loghistory.h"
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
#include "blackmisc/macos/microphoneaccess.h"
|
#include "blackmisc/macos/microphoneaccess.h"
|
||||||
@@ -102,6 +103,7 @@ private:
|
|||||||
QScopedPointer<BlackGui::Components::CConfigurationWizard> m_wizard;
|
QScopedPointer<BlackGui::Components::CConfigurationWizard> m_wizard;
|
||||||
QScopedPointer<BlackGui::Components::CTextEditDialog> m_textEditDialog;
|
QScopedPointer<BlackGui::Components::CTextEditDialog> m_textEditDialog;
|
||||||
BlackMisc::CData<BlackCore::Data::TLauncherSetup> m_setup { this }; //!< setup, i.e. last user selection
|
BlackMisc::CData<BlackCore::Data::TLauncherSetup> m_setup { this }; //!< setup, i.e. last user selection
|
||||||
|
BlackMisc::CLogHistoryReplica m_logHistory { this }; //!< for the overlay
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
BlackMisc::CMacOSMicrophoneAccess m_micAccess;
|
BlackMisc::CMacOSMicrophoneAccess m_micAccess;
|
||||||
#endif
|
#endif
|
||||||
@@ -177,12 +179,6 @@ private:
|
|||||||
//! Display status message as overlay
|
//! Display status message as overlay
|
||||||
void showStatusMessage(const QString &htmlMsg);
|
void showStatusMessage(const QString &htmlMsg);
|
||||||
|
|
||||||
//! Append status message
|
|
||||||
void appendLogMessage(const BlackMisc::CStatusMessage &message);
|
|
||||||
|
|
||||||
//! Append status messages
|
|
||||||
void appendLogMessages(const BlackMisc::CStatusMessageList &messages);
|
|
||||||
|
|
||||||
//! Show set main page
|
//! Show set main page
|
||||||
void showMainPage();
|
void showMainPage();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user