mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-19 03:45:30 +08:00
Issue #15 [GUI] Use CLogHistoryReplica in CLogComponent and swift applications
This commit is contained in:
@@ -37,6 +37,7 @@ int main(int argc, char *argv[])
|
||||
a.addParserOption({{"i", "installer"}, QCoreApplication::translate("main", "Installer setup.")});
|
||||
if (!a.parseAndSynchronizeSetup()) { return EXIT_FAILURE; }
|
||||
a.useWebDataServices(BlackCore::CWebReaderFlags::AllSwiftDbReaders, CDatabaseReaderConfigList::forLauncher());
|
||||
a.useFacadeNoContexts();
|
||||
if (!a.start())
|
||||
{
|
||||
a.gracefulShutdown();
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "blackmisc/icons.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include "blackmisc/loghandler.h"
|
||||
#include "blackmisc/sharedstate/datalinkdbus.h"
|
||||
#include "blackconfig/buildconfig.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
@@ -311,13 +312,13 @@ void CSwiftLauncher::initLogDisplay()
|
||||
{
|
||||
CLogHandler::instance()->install(true);
|
||||
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->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)
|
||||
@@ -559,24 +560,6 @@ void CSwiftLauncher::showStatusMessage(const QString &htmlMsg)
|
||||
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()
|
||||
{
|
||||
ui->sw_SwiftLauncher->setCurrentWidget(ui->pg_SwiftLauncherMain);
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "blackmisc/simulation/data/modelcaches.h"
|
||||
#include "blackmisc/db/artifact.h"
|
||||
#include "blackmisc/identifiable.h"
|
||||
#include "blackmisc/loghistory.h"
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
#include "blackmisc/macos/microphoneaccess.h"
|
||||
@@ -102,6 +103,7 @@ private:
|
||||
QScopedPointer<BlackGui::Components::CConfigurationWizard> m_wizard;
|
||||
QScopedPointer<BlackGui::Components::CTextEditDialog> m_textEditDialog;
|
||||
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
|
||||
BlackMisc::CMacOSMicrophoneAccess m_micAccess;
|
||||
#endif
|
||||
@@ -177,12 +179,6 @@ private:
|
||||
//! Display status message as overlay
|
||||
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
|
||||
void showMainPage();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user