From f62f85b26369748e0052ad00d1e58872ec4fbd5f Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Mon, 15 Dec 2014 23:19:52 +0100 Subject: [PATCH] refs #359, fixed loghandler, removed / fine tuning of some output / log messages see also discussion in #359 --- src/blackgui/components/atcstationcomponent.cpp | 3 +-- src/blackgui/components/usercomponent.cpp | 3 +-- src/blackmisc/loghandler.cpp | 1 + src/blackmisc/loghandler.h | 1 + src/swiftcore/main.cpp | 6 ++---- src/swiftgui_standard/main.cpp | 15 +++++++-------- 6 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/blackgui/components/atcstationcomponent.cpp b/src/blackgui/components/atcstationcomponent.cpp index 0441c6f6d..d799815c5 100644 --- a/src/blackgui/components/atcstationcomponent.cpp +++ b/src/blackgui/components/atcstationcomponent.cpp @@ -100,8 +100,7 @@ namespace BlackGui bool hasData = this->countBookedStations() > 0 || this->countOnlineStations() > 0; if (hasData && !this->isVisibleWidget()) { - // KWB remove: qDebug() will be removed soon - qDebug() << this->objectName() << "Skipping update, not visible"; + // Update skipped, as not visible return; } diff --git a/src/blackgui/components/usercomponent.cpp b/src/blackgui/components/usercomponent.cpp index 86630459f..8cc0f1a88 100644 --- a/src/blackgui/components/usercomponent.cpp +++ b/src/blackgui/components/usercomponent.cpp @@ -60,8 +60,7 @@ namespace BlackGui bool withData = countUsers() > 0 || countClients() > 0; if (withData && !isVisibleWidget()) { - // KWB remove: qDebug() will be removed soo - qDebug() << this->objectName() << "Skipping update"; + // Skip update, invisible return; } diff --git a/src/blackmisc/loghandler.cpp b/src/blackmisc/loghandler.cpp index 6f6847581..abe1d02c8 100644 --- a/src/blackmisc/loghandler.cpp +++ b/src/blackmisc/loghandler.cpp @@ -168,6 +168,7 @@ namespace BlackMisc if (m_handler) { + if (! m_inheritFallThrough) { m_handler->inheritConsoleOutput(); } m_handler->disconnect(this); } } diff --git a/src/blackmisc/loghandler.h b/src/blackmisc/loghandler.h index f54e98428..77c2c8df0 100644 --- a/src/blackmisc/loghandler.h +++ b/src/blackmisc/loghandler.h @@ -167,6 +167,7 @@ namespace BlackMisc bool canBeDeleted() { + if (! m_inheritFallThrough) { return false; } static const auto signal = QMetaMethod::fromSignal(&CLogPatternHandler::messageLogged); return ! isSignalConnected(signal); } diff --git a/src/swiftcore/main.cpp b/src/swiftcore/main.cpp index c3c315b0b..e5e33e3c0 100644 --- a/src/swiftcore/main.cpp +++ b/src/swiftcore/main.cpp @@ -39,9 +39,7 @@ int main(int argc, char *argv[]) QTextStream cin(stdin); QTextStream cout(stdout); - cout << BlackMisc::CProject::version(); - cout << BlackMisc::CProject::compiledInfo(); - cout << endl; + cout << BlackMisc::CProject::version() << " " << BlackMisc::CProject::compiledInfo() << endl; cout << "1 + la/ra .. session DBus server (default)" << endl; cout << "2 + la/ra .. system DBus server" << endl; @@ -78,7 +76,7 @@ int main(int argc, char *argv[]) // tool to allow input indepent from event loop QtConcurrent::run(BlackMiscTest::Tool::serverLoop, core); // QFuture future - cout << "Server event loop, pid:" << BlackMiscTest::Tool::getPid() << "Thread id:" << QThread::currentThreadId(); + cout << "Server event loop, pid: " << BlackMiscTest::Tool::getPid() << " Thread id: " << QThread::currentThreadId() << endl; // end return a.exec(); diff --git a/src/swiftgui_standard/main.cpp b/src/swiftgui_standard/main.cpp index 2ec1ad6de..77c483550 100644 --- a/src/swiftgui_standard/main.cpp +++ b/src/swiftgui_standard/main.cpp @@ -46,14 +46,13 @@ int main(int argc, char *argv[]) // application QApplication a(argc, argv); CLogHandler::instance()->install(); - CLogHandler::instance()->enableConsoleOutput(false); - -// CLogHandler::instance()->handlerForPattern( -// CLogPattern::anyOf({ CLogCategory::contextSlot(), CLogCategory::context() }) -// )->enableConsoleOutput(false); -// CLogHandler::instance()->handlerForPattern( -// CLogPattern::anyOf({ CLogCategory::contextSlot(), CLogCategory::context() }).withSeverityAtOrAbove(CStatusMessage::SeverityInfo) -// )->enableConsoleOutput(true); + CLogHandler::instance()->enableConsoleOutput(true); + CLogHandler::instance()->handlerForPattern( + CLogPattern::anyOf({ CLogCategory::contextSlot(), CLogCategory::context() }) + )->enableConsoleOutput(false); + CLogHandler::instance()->handlerForPattern( + CLogPattern::anyOf({ CLogCategory::contextSlot(), CLogCategory::context() }).withSeverityAtOrAbove(CStatusMessage::SeverityInfo) + )->enableConsoleOutput(true); // Translations QFile file(":blackmisc/translations/blackmisc_i18n_de.qm");