mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-16 18:35:35 +08:00
refs #316 Swiftcore, swiftgui, and samples use CLogHandler to display subscribed messages.
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include "blacksim/blacksimfreefunctions.h"
|
||||
#include "blackmisc/blackmiscfreefunctions.h"
|
||||
#include "blackmisc/icons.h"
|
||||
#include "blackmisc/loghandler.h"
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QApplication>
|
||||
@@ -41,6 +42,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
// application
|
||||
QApplication a(argc, argv);
|
||||
CLogHandler::instance()->install();
|
||||
QIcon icon(BlackMisc::CIcons::swift24());
|
||||
QApplication::setWindowIcon(icon);
|
||||
const QString s = CStyleSheetUtility::instance().styles(
|
||||
|
||||
@@ -297,6 +297,9 @@ bool MainWindow::isContextAudioAvailableCheck()
|
||||
*/
|
||||
void MainWindow::ps_displayStatusMessageInGui(const CStatusMessage &statusMessage)
|
||||
{
|
||||
if (statusMessage.isRedundant()) return;
|
||||
if (statusMessage.getSeverity() == CStatusMessage::SeverityDebug) return;
|
||||
|
||||
if (!this->m_init) return;
|
||||
this->ui->sb_MainStatusBar->show();
|
||||
this->m_timerStatusBar->start(3000);
|
||||
@@ -307,19 +310,10 @@ void MainWindow::ps_displayStatusMessageInGui(const CStatusMessage &statusMessag
|
||||
this->ui->comp_MainInfoArea->getLogComponent()->appendStatusMessageToList(statusMessage);
|
||||
|
||||
// display overlay for errors, but not for validation
|
||||
if (statusMessage.getSeverity() == CStatusMessage::SeverityError && statusMessage.getType() != CStatusMessage::TypeValidation)
|
||||
this->m_compInfoWindow->displayStatusMessage(statusMessage);
|
||||
}
|
||||
|
||||
/*
|
||||
* Display a status message
|
||||
*/
|
||||
void MainWindow::ps_displayStatusMessagesInGui(const CStatusMessageList &messages)
|
||||
{
|
||||
if (!this->m_init || messages.isEmpty()) return;
|
||||
foreach(CStatusMessage msg, messages)
|
||||
// TODO smarter use of CLogCategoryHandler to dispatch different categories of message to different MainWindow slots
|
||||
if (statusMessage.getSeverity() == CStatusMessage::SeverityError && ! statusMessage.getCategory().endsWith(".validation"))
|
||||
{
|
||||
this->ps_displayStatusMessageInGui(msg);
|
||||
this->m_compInfoWindow->displayStatusMessage(statusMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -182,10 +182,7 @@ private slots:
|
||||
bool ps_reloadOwnAircraft();
|
||||
|
||||
//! Display status message
|
||||
void ps_displayStatusMessageInGui(const BlackMisc::CStatusMessage &sendStatusMessage);
|
||||
|
||||
//! Display status messages
|
||||
void ps_displayStatusMessagesInGui(const BlackMisc::CStatusMessageList &messages);
|
||||
void ps_displayStatusMessageInGui(const BlackMisc::CStatusMessage &);
|
||||
|
||||
//! Settings have been changed
|
||||
void ps_onChangedSetttings(uint typeValue);
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "blackmisc/avselcal.h"
|
||||
#include "blackmisc/project.h"
|
||||
#include "blackmisc/hotkeyfunction.h"
|
||||
#include "blackmisc/loghandler.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <QSizeGrip>
|
||||
@@ -110,6 +111,10 @@ void MainWindow::init(const CRuntimeConfig &runtimeConfig)
|
||||
this->connect(this->ui->comp_MainInfoArea->getSettingsComponent(), &CSettingsComponent::changedAircraftsUpdateInterval, this->ui->comp_MainInfoArea->getAircraftComponent(), &CAircraftComponent::setUpdateIntervalSeconds);
|
||||
this->connect(this->ui->comp_MainInfoArea->getSettingsComponent(), &CSettingsComponent::changedAtcStationsUpdateInterval, this->ui->comp_MainInfoArea->getAtcStationComponent(), &::CAtcStationComponent::setUpdateIntervalSeconds);
|
||||
|
||||
// log messages
|
||||
this->connect(CLogHandler::instance(), &CLogHandler::localMessageLogged, this, &MainWindow::ps_displayStatusMessageInGui);
|
||||
this->connect(CLogHandler::instance(), &CLogHandler::remoteMessageLogged, this, &MainWindow::ps_displayStatusMessageInGui);
|
||||
|
||||
Q_ASSERT(connect);
|
||||
Q_UNUSED(connect); // suppress GCC warning in release build
|
||||
|
||||
|
||||
Reference in New Issue
Block a user