From 26c270c9a6fc429f3131577e6055e4b2e4d71c5f Mon Sep 17 00:00:00 2001 From: Mathew Sutcliffe Date: Wed, 11 Jun 2014 19:35:32 +0100 Subject: [PATCH] refs #246 passing c++11 brace-initialized QStringList to CRuntime::logSlot --- src/blackcore/context_network_impl.cpp | 4 ++-- src/blackcore/context_runtime.cpp | 10 ++++++++++ src/blackcore/context_runtime.h | 10 ++++++++-- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/blackcore/context_network_impl.cpp b/src/blackcore/context_network_impl.cpp index 8a53867dd..323859d3b 100644 --- a/src/blackcore/context_network_impl.cpp +++ b/src/blackcore/context_network_impl.cpp @@ -331,7 +331,7 @@ namespace BlackCore */ void CContextNetwork::psFsdConnectionStatusChanged(INetwork::ConnectionStatus from, INetwork::ConnectionStatus to, const QString &message) { - if (this->getRuntime()->isSlotLogForNetworkEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO, QString::number(from), QString::number(to)); + if (this->getRuntime()->isSlotLogForNetworkEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO, { QString::number(from), QString::number(to) }); CStatusMessageList msgs; // send 1st position if (to == INetwork::Connected) @@ -358,7 +358,7 @@ namespace BlackCore */ void CContextNetwork::psFsdRealNameReplyReceived(const CCallsign &callsign, const QString &realname) { - if (this->getRuntime()->isSlotLogForNetworkEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO, callsign.toQString(), realname); + if (this->getRuntime()->isSlotLogForNetworkEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO, { callsign.toQString(), realname }); if (realname.isEmpty()) return; CIndexVariantMap vm(CAtcStation::IndexControllerRealName, realname); this->m_atcStationsOnline.applyIf(&CAtcStation::getCallsign, callsign, vm); diff --git a/src/blackcore/context_runtime.cpp b/src/blackcore/context_runtime.cpp index c03354ce8..9f559c4ae 100644 --- a/src/blackcore/context_runtime.cpp +++ b/src/blackcore/context_runtime.cpp @@ -250,6 +250,16 @@ namespace BlackCore qDebug() << func << p1 << p2 << p3 << p4; } + void CRuntime::logSlot(const char *func, const QString ¶m) const + { + qDebug() << func << param; + } + + void CRuntime::logSlot(const char *func, const QStringList ¶ms) const + { + qDebug() << func << params; + } + void CRuntime::logSlot(const char *func, bool boolValue) const { qDebug() << func << boolValue; diff --git a/src/blackcore/context_runtime.h b/src/blackcore/context_runtime.h index ece7a646e..70ead9367 100644 --- a/src/blackcore/context_runtime.h +++ b/src/blackcore/context_runtime.h @@ -103,8 +103,14 @@ namespace BlackCore bool isSlotLogForSimulatorEnabled() const { return this->m_slotLogSimulator; } //! Slot logging - //! \todo to be replace if initializer lists becomes available - void logSlot(const char *func, const QString &p1 = "", const QString &p2 = "", const QString &p3 = "", const QString &p4 = "") const; + //! \deprecated Use a brace-initialized QStringList + void logSlot(const char *func, const QString ¶m, const QString &p2, const QString &p3 = "", const QString &p4 = "") const; + + //! Slot logging + void logSlot(const char *func, const QString ¶m = "") const; + + //! Slot logging + void logSlot(const char *func, const QStringList ¶ms) const; //! Slot logging for bool value void logSlot(const char *func, bool boolValue) const;