mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 04:25:35 +08:00
Ref T566, added DBus streaming operators so the DECLARED enums can be used with DBus
This commit is contained in:
committed by
Mat Sutcliffe
parent
df119c6e98
commit
269bad3c42
@@ -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<int>(QLatin1String("isReverseLookupMessagesEnabled"));
|
||||
return static_cast<ReverseLookupLogging>(r);
|
||||
return m_dBusInterface->callDBusRet<ReverseLookupLogging>(QLatin1String("isReverseLookupMessagesEnabled"));
|
||||
}
|
||||
|
||||
void CContextNetworkProxy::enableReverseLookupMessages(ReverseLookupLogging enable)
|
||||
|
||||
@@ -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<int>(QLatin1String("isMatchingMessagesEnabled"));
|
||||
return static_cast<MatchingLog>(r);
|
||||
return m_dBusInterface->callDBusRet<MatchingLog>(QLatin1String("isMatchingMessagesEnabled"));
|
||||
}
|
||||
|
||||
void CContextSimulatorProxy::enableMatchingMessages(MatchingLog enabled)
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
#include <QStringList>
|
||||
#include <QMetaType>
|
||||
#include <QDBusArgument>
|
||||
|
||||
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<int>(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<BlackMisc::Simulation::MatchingLog>(temp);
|
||||
return arg;
|
||||
}
|
||||
|
||||
#endif // guard
|
||||
|
||||
@@ -58,13 +58,15 @@ namespace BlackMisc
|
||||
qRegisterMetaType<ReverseLookupLoggingFlag>();
|
||||
qRegisterMetaType<ReverseLookupLogging>();
|
||||
|
||||
// the ones generate with Q_DECLARE_FLAGS fail here
|
||||
// the ones generate with Q_DECLARE_FLAGS and no streamin operator fail here
|
||||
qDBusRegisterMetaType<CInterpolationAndRenderingSetupBase::InterpolatorMode>();
|
||||
qDBusRegisterMetaType<CAircraftMatcherSetup::MatchingAlgorithm>();
|
||||
qDBusRegisterMetaType<CAircraftMatcherSetup::MatchingModeFlag>();
|
||||
qDBusRegisterMetaType<MatchingLogFlag>();
|
||||
qDBusRegisterMetaType<MatchingLog>();
|
||||
qDBusRegisterMetaType<CAircraftMatcherSetup::PickSimilarStrategy>();
|
||||
qDBusRegisterMetaType<ReverseLookupLoggingFlag>();
|
||||
qDBusRegisterMetaType<ReverseLookupLogging>();
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
@@ -12,20 +12,21 @@
|
||||
#define BLACKMISC_SIMULATION_REVERSELOOKUP_H
|
||||
|
||||
#include <QMetaType>
|
||||
#include <QDBusArgument>
|
||||
|
||||
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<int>(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<BlackMisc::Simulation::ReverseLookupLogging>(temp);
|
||||
return arg;
|
||||
}
|
||||
|
||||
#endif // guard
|
||||
|
||||
Reference in New Issue
Block a user