diff --git a/src/blackcore/context/contextnetworkproxy.cpp b/src/blackcore/context/contextnetworkproxy.cpp index c549c444d..8fda31160 100644 --- a/src/blackcore/context/contextnetworkproxy.cpp +++ b/src/blackcore/context/contextnetworkproxy.cpp @@ -275,9 +275,7 @@ namespace BlackCore ReverseLookupLogging CContextNetworkProxy::isReverseLookupMessagesEnabled() const { - //! \fixme KB 2019-04 directly return MatchingLog causes issues with QDbusArgument - const int r = m_dBusInterface->callDBusRet(QLatin1String("isReverseLookupMessagesEnabled")); - return static_cast(r); + return m_dBusInterface->callDBusRet(QLatin1String("isReverseLookupMessagesEnabled")); } void CContextNetworkProxy::enableReverseLookupMessages(ReverseLookupLogging enable) diff --git a/src/blackcore/context/contextsimulatorproxy.cpp b/src/blackcore/context/contextsimulatorproxy.cpp index 2b36aa992..9dae478df 100644 --- a/src/blackcore/context/contextsimulatorproxy.cpp +++ b/src/blackcore/context/contextsimulatorproxy.cpp @@ -309,9 +309,7 @@ namespace BlackCore MatchingLog CContextSimulatorProxy::isMatchingMessagesEnabled() const { - //! \fixme KB 2019-04 directly return MatchingLog causes issues with QDbusArgument - const int r = m_dBusInterface->callDBusRet(QLatin1String("isMatchingMessagesEnabled")); - return static_cast(r); + return m_dBusInterface->callDBusRet(QLatin1String("isMatchingMessagesEnabled")); } void CContextSimulatorProxy::enableMatchingMessages(MatchingLog enabled) diff --git a/src/blackmisc/simulation/matchinglog.h b/src/blackmisc/simulation/matchinglog.h index 638103826..0d45b55e3 100644 --- a/src/blackmisc/simulation/matchinglog.h +++ b/src/blackmisc/simulation/matchinglog.h @@ -14,6 +14,7 @@ #include "blackmisc/blackmiscexport.h" #include #include +#include namespace BlackMisc { @@ -45,4 +46,28 @@ Q_DECLARE_METATYPE(BlackMisc::Simulation::MatchingLog) Q_DECLARE_METATYPE(BlackMisc::Simulation::MatchingLogFlag) Q_DECLARE_OPERATORS_FOR_FLAGS(BlackMisc::Simulation::MatchingLog) +/*! + * Operator for streaming enums to QDBusArgument. + */ +inline QDBusArgument &operator <<(QDBusArgument &arg, const BlackMisc::Simulation::MatchingLog &value) +{ + arg.beginStructure(); + arg << static_cast(value); + arg.endStructure(); + return arg; +} + +/*! + * Operator for streaming enums from QDBusArgument. + */ +inline const QDBusArgument &operator >>(const QDBusArgument &arg, BlackMisc::Simulation::MatchingLog &value) +{ + int temp; + arg.beginStructure(); + arg >> temp; + arg.endStructure(); + value = static_cast(temp); + return arg; +} + #endif // guard diff --git a/src/blackmisc/simulation/registermetadatasimulation.cpp b/src/blackmisc/simulation/registermetadatasimulation.cpp index b8104b07d..6478deb1c 100644 --- a/src/blackmisc/simulation/registermetadatasimulation.cpp +++ b/src/blackmisc/simulation/registermetadatasimulation.cpp @@ -58,13 +58,15 @@ namespace BlackMisc qRegisterMetaType(); qRegisterMetaType(); - // the ones generate with Q_DECLARE_FLAGS fail here + // the ones generate with Q_DECLARE_FLAGS and no streamin operator fail here qDBusRegisterMetaType(); qDBusRegisterMetaType(); qDBusRegisterMetaType(); qDBusRegisterMetaType(); + qDBusRegisterMetaType(); qDBusRegisterMetaType(); qDBusRegisterMetaType(); + qDBusRegisterMetaType(); } } // ns } // ns diff --git a/src/blackmisc/simulation/reverselookup.h b/src/blackmisc/simulation/reverselookup.h index a3292bb0f..3dc305c29 100644 --- a/src/blackmisc/simulation/reverselookup.h +++ b/src/blackmisc/simulation/reverselookup.h @@ -12,20 +12,21 @@ #define BLACKMISC_SIMULATION_REVERSELOOKUP_H #include +#include namespace BlackMisc { namespace Simulation { - //! Lookup log.messages - enum ReverseLookupLoggingFlag - { - RevLogDisabled = 0, - RevLogEnabled = 1 << 0, - RevLogSimplifiedInfo = 1 << 1, - RevLogEnabledSimplified = RevLogEnabled | RevLogSimplifiedInfo - }; - Q_DECLARE_FLAGS(ReverseLookupLogging, ReverseLookupLoggingFlag) + //! Lookup log.messages + enum ReverseLookupLoggingFlag + { + RevLogDisabled = 0, + RevLogEnabled = 1 << 0, + RevLogSimplifiedInfo = 1 << 1, + RevLogEnabledSimplified = RevLogEnabled | RevLogSimplifiedInfo + }; + Q_DECLARE_FLAGS(ReverseLookupLogging, ReverseLookupLoggingFlag) } // ns } // ns @@ -33,4 +34,28 @@ Q_DECLARE_METATYPE(BlackMisc::Simulation::ReverseLookupLogging) Q_DECLARE_METATYPE(BlackMisc::Simulation::ReverseLookupLoggingFlag) Q_DECLARE_OPERATORS_FOR_FLAGS(BlackMisc::Simulation::ReverseLookupLogging) +/*! + * Operator for streaming enums to QDBusArgument. + */ +inline QDBusArgument &operator <<(QDBusArgument &arg, const BlackMisc::Simulation::ReverseLookupLogging &value) +{ + arg.beginStructure(); + arg << static_cast(value); + arg.endStructure(); + return arg; +} + +/*! + * Operator for streaming enums from QDBusArgument. + */ +inline const QDBusArgument &operator >>(const QDBusArgument &arg, BlackMisc::Simulation::ReverseLookupLogging &value) +{ + int temp; + arg.beginStructure(); + arg >> temp; + arg.endStructure(); + value = static_cast(temp); + return arg; +} + #endif // guard