mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 15:15:50 +08:00
refs #345 First wave of value classes using the CValueObjectStdTuple CRTP class template.
This commit is contained in:
@@ -27,24 +27,6 @@ namespace BlackSim
|
||||
// void
|
||||
}
|
||||
|
||||
/*
|
||||
* Operator ==
|
||||
*/
|
||||
bool CAircraftCfgEntries::operator ==(const CAircraftCfgEntries &other) const
|
||||
{
|
||||
if (this == &other) return true;
|
||||
return TupleConverter<CAircraftCfgEntries>::toTuple(*this) == TupleConverter<CAircraftCfgEntries>::toTuple(other);
|
||||
}
|
||||
|
||||
/*
|
||||
* Operator !=
|
||||
*/
|
||||
bool CAircraftCfgEntries::operator !=(const CAircraftCfgEntries &other) const
|
||||
{
|
||||
if (this == &other) return false;
|
||||
return !((*this) == other);
|
||||
}
|
||||
|
||||
/*
|
||||
* String representation
|
||||
*/
|
||||
@@ -115,79 +97,5 @@ namespace BlackSim
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Hash
|
||||
*/
|
||||
uint CAircraftCfgEntries::getValueHash() const
|
||||
{
|
||||
return qHash(TupleConverter<CAircraftCfgEntries>::toTuple(*this));
|
||||
}
|
||||
|
||||
/*
|
||||
* Register metadata
|
||||
*/
|
||||
void CAircraftCfgEntries::registerMetadata()
|
||||
{
|
||||
qRegisterMetaType<CAircraftCfgEntries>();
|
||||
qDBusRegisterMetaType<CAircraftCfgEntries>();
|
||||
}
|
||||
|
||||
/*
|
||||
* Compare
|
||||
*/
|
||||
int CAircraftCfgEntries::compareImpl(const CValueObject &otherBase) const
|
||||
{
|
||||
const auto &other = static_cast<const CAircraftCfgEntries &>(otherBase);
|
||||
return compare(TupleConverter<CAircraftCfgEntries>::toTuple(*this), TupleConverter<CAircraftCfgEntries>::toTuple(other));
|
||||
}
|
||||
|
||||
/*
|
||||
* Metatype
|
||||
*/
|
||||
int CAircraftCfgEntries::getMetaTypeId() const
|
||||
{
|
||||
return qMetaTypeId<CAircraftCfgEntries>();
|
||||
}
|
||||
|
||||
/*
|
||||
* Marshall to DBus
|
||||
*/
|
||||
void CAircraftCfgEntries::marshallToDbus(QDBusArgument &argument) const
|
||||
{
|
||||
argument << TupleConverter<CAircraftCfgEntries>::toTuple(*this);
|
||||
}
|
||||
|
||||
/*
|
||||
* Unmarshall from DBus
|
||||
*/
|
||||
void CAircraftCfgEntries::unmarshallFromDbus(const QDBusArgument &argument)
|
||||
{
|
||||
argument >> TupleConverter<CAircraftCfgEntries>::toTuple(*this);
|
||||
}
|
||||
|
||||
/*
|
||||
* To JSON
|
||||
*/
|
||||
QJsonObject CAircraftCfgEntries::toJson() const
|
||||
{
|
||||
return BlackMisc::serializeJson(CAircraftCfgEntries::jsonMembers(), TupleConverter<CAircraftCfgEntries>::toTuple(*this));
|
||||
}
|
||||
|
||||
/*
|
||||
* To JSON
|
||||
*/
|
||||
void CAircraftCfgEntries::convertFromJson(const QJsonObject &json)
|
||||
{
|
||||
BlackMisc::deserializeJson(json, CAircraftCfgEntries::jsonMembers(), TupleConverter<CAircraftCfgEntries>::toTuple(*this));
|
||||
}
|
||||
|
||||
/*
|
||||
* Members
|
||||
*/
|
||||
const QStringList &CAircraftCfgEntries::jsonMembers()
|
||||
{
|
||||
return TupleConverter<CAircraftCfgEntries>::jsonMembers();
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace BlackSim
|
||||
* \remarks an entry in the aircraft.cfg is title, atc type, ... This class already bundles
|
||||
* relevant entries, hence the class is named Entries (plural)
|
||||
*/
|
||||
class CAircraftCfgEntries: public BlackMisc::CValueObject
|
||||
class CAircraftCfgEntries: public BlackMisc::CValueObjectStdTuple<CAircraftCfgEntries>
|
||||
{
|
||||
public:
|
||||
//! Properties by index
|
||||
@@ -52,12 +52,6 @@ namespace BlackSim
|
||||
*/
|
||||
CAircraftCfgEntries(const QString &filePath, qint32 index, const QString &title, const QString &atcType, const QString &atcModel, const QString &atcParkingCode);
|
||||
|
||||
//! operator ==
|
||||
bool operator ==(const CAircraftCfgEntries &other) const;
|
||||
|
||||
//! operator !=
|
||||
bool operator !=(const CAircraftCfgEntries &other) const;
|
||||
|
||||
//! Filepath
|
||||
QString getFilePath() const { return this->m_filePath; }
|
||||
|
||||
@@ -94,49 +88,16 @@ namespace BlackSim
|
||||
//! Parking code
|
||||
void setAtcParkingCode(const QString &parkingCode) { this->m_atcParkingCode = parkingCode; }
|
||||
|
||||
//! \copydoc CValueObject::getValueHash()
|
||||
virtual uint getValueHash() const override;
|
||||
|
||||
//! \copydoc CValueObject::toQVariant
|
||||
virtual QVariant toQVariant() const override { return QVariant::fromValue(*this); }
|
||||
|
||||
//! \copydoc CValueObject::convertFromQVariant
|
||||
virtual void convertFromQVariant(const QVariant &variant) override { BlackMisc::setFromQVariant(this, variant); }
|
||||
|
||||
//! \copydoc CValueObject::toJson
|
||||
virtual QJsonObject toJson() const override;
|
||||
|
||||
//! \copydoc CValueObject::convertFromJson
|
||||
virtual void convertFromJson(const QJsonObject &json) override;
|
||||
|
||||
//! \copydoc CValueObject::propertyByIndex
|
||||
virtual QVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const override;
|
||||
|
||||
//! \copydoc CValueObject::setPropertyByIndex
|
||||
virtual void setPropertyByIndex(const QVariant &variant, const BlackMisc::CPropertyIndex &index) override;
|
||||
|
||||
//! Register the metatypes
|
||||
static void registerMetadata();
|
||||
|
||||
//! JSON member names
|
||||
static const QStringList &jsonMembers();
|
||||
|
||||
protected:
|
||||
//! \copydoc CValueObject::convertToQString
|
||||
virtual QString convertToQString(bool i18n = false) const override;
|
||||
|
||||
//! \copydoc CValueObject::marshallToDbus
|
||||
virtual void marshallToDbus(QDBusArgument &) const override;
|
||||
|
||||
//! \copydoc CValueObject::unmarshallFromDbus
|
||||
virtual void unmarshallFromDbus(const QDBusArgument &) override;
|
||||
|
||||
//! \copydoc CValueObject::compareImpl
|
||||
int compareImpl(const CValueObject &otherBase) const override;
|
||||
|
||||
//! \copydoc CValueObject::getMetaTypeId()
|
||||
int getMetaTypeId() const override;
|
||||
|
||||
private:
|
||||
BLACK_ENABLE_TUPLE_CONVERSION(CAircraftCfgEntries)
|
||||
qint32 m_index; //!< current index in given config
|
||||
|
||||
@@ -42,24 +42,6 @@ namespace BlackSim
|
||||
// void
|
||||
}
|
||||
|
||||
/*
|
||||
* Operator ==
|
||||
*/
|
||||
bool CAircraftMapping::operator ==(const CAircraftMapping &otherMapping) const
|
||||
{
|
||||
if (this == &otherMapping) return true;
|
||||
return TupleConverter<CAircraftMapping>::toTuple(*this) == TupleConverter<CAircraftMapping>::toTuple(otherMapping);
|
||||
}
|
||||
|
||||
/*
|
||||
* Operator !=
|
||||
*/
|
||||
bool CAircraftMapping::operator !=(const CAircraftMapping &otherMapping) const
|
||||
{
|
||||
if (this == &otherMapping) return false;
|
||||
return !((*this) == otherMapping);
|
||||
}
|
||||
|
||||
/*
|
||||
* String for converter
|
||||
*/
|
||||
@@ -204,71 +186,5 @@ namespace BlackSim
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Marshall to Dbus
|
||||
*/
|
||||
void CAircraftMapping::marshallToDbus(QDBusArgument &argument) const
|
||||
{
|
||||
argument << TupleConverter<CAircraftMapping>::toTuple(*this);
|
||||
}
|
||||
|
||||
/*
|
||||
* Unmarshall from Dbus
|
||||
*/
|
||||
void CAircraftMapping::unmarshallFromDbus(const QDBusArgument &argument)
|
||||
{
|
||||
argument >> TupleConverter<CAircraftMapping>::toTuple(*this);
|
||||
}
|
||||
|
||||
/*
|
||||
* Metatype id
|
||||
*/
|
||||
int CAircraftMapping::getMetaTypeId() const
|
||||
{
|
||||
return qMetaTypeId<CAircraftCfgEntries>();
|
||||
}
|
||||
|
||||
/*
|
||||
* Compare
|
||||
*/
|
||||
int CAircraftMapping::compareImpl(const CValueObject &otherBase) const
|
||||
{
|
||||
const auto &other = static_cast<const CAircraftMapping &>(otherBase);
|
||||
return compare(TupleConverter<CAircraftMapping>::toTuple(*this), TupleConverter<CAircraftMapping>::toTuple(other));
|
||||
}
|
||||
|
||||
/*
|
||||
* Register metadata
|
||||
*/
|
||||
void CAircraftMapping::registerMetadata()
|
||||
{
|
||||
qRegisterMetaType<CAircraftMapping>();
|
||||
qDBusRegisterMetaType<CAircraftMapping>();
|
||||
}
|
||||
|
||||
/*
|
||||
* To JSON
|
||||
*/
|
||||
QJsonObject CAircraftMapping::toJson() const
|
||||
{
|
||||
return BlackMisc::serializeJson(CAircraftMapping::jsonMembers(), TupleConverter<CAircraftMapping>::toTuple(*this));
|
||||
}
|
||||
|
||||
/*
|
||||
* To JSON
|
||||
*/
|
||||
void CAircraftMapping::convertFromJson(const QJsonObject &json)
|
||||
{
|
||||
BlackMisc::deserializeJson(json, CAircraftMapping::jsonMembers(), TupleConverter<CAircraftMapping>::toTuple(*this));
|
||||
}
|
||||
|
||||
/*
|
||||
* Members
|
||||
*/
|
||||
const QStringList &CAircraftMapping::jsonMembers()
|
||||
{
|
||||
return TupleConverter<CAircraftMapping>::jsonMembers();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -23,24 +23,11 @@ namespace BlackSim
|
||||
namespace FsCommon
|
||||
{
|
||||
//! Aircraft mapping class, represents one particular mapping
|
||||
class CAircraftMapping : public BlackMisc::CValueObject
|
||||
class CAircraftMapping : public BlackMisc::CValueObjectStdTuple<CAircraftMapping>
|
||||
{
|
||||
public:
|
||||
static const qint32 InvalidId = -1; //!< Invalid mapping id
|
||||
|
||||
//! \copydoc CValueObject::marshallToDbus
|
||||
virtual void marshallToDbus(QDBusArgument &) const override;
|
||||
|
||||
//! \copydoc CValueObject::unmarshallFromDbus
|
||||
virtual void unmarshallFromDbus(const QDBusArgument &) override;
|
||||
|
||||
//! \copydoc CValueObject::getMetaTypeId()
|
||||
int getMetaTypeId() const;
|
||||
|
||||
//! \copydoc CValueObject::compareImpl
|
||||
int compareImpl(const CValueObject &otherBase) const override;
|
||||
|
||||
public:
|
||||
//! Columns
|
||||
enum ColumnIndex
|
||||
{
|
||||
@@ -74,16 +61,6 @@ namespace BlackSim
|
||||
*/
|
||||
CAircraftMapping(qint32 mappingId, qint32 proposalId, const QString &fsAircraftKey, const QString &icaoAircraftDesignator, const QString &icaoAirline, const QString &icaoAircraftType, const QString &icaoWakeTurbulenceCategory, const QString &painting, const QString &lastChanged, CSimulatorInfo simulator);
|
||||
|
||||
//! Virtual destructor
|
||||
virtual ~CAircraftMapping()
|
||||
{}
|
||||
|
||||
//! operator ==
|
||||
bool operator ==(const CAircraftMapping &otherMapping) const;
|
||||
|
||||
//! operator !=
|
||||
bool operator !=(const CAircraftMapping &otherMapping) const;
|
||||
|
||||
//! Mapping id
|
||||
qint32 getMappingId() const { return this->m_mappingId; }
|
||||
|
||||
@@ -172,12 +149,6 @@ namespace BlackSim
|
||||
//! \copydoc CValueObject::getValueHash()
|
||||
virtual uint getValueHash() const override;
|
||||
|
||||
//! \copydoc CValueObject::toQVariant
|
||||
virtual QVariant toQVariant() const override { return QVariant::fromValue(*this); }
|
||||
|
||||
//! \copydoc CValueObject::convertFromQVariant
|
||||
virtual void convertFromQVariant(const QVariant &variant) override { BlackMisc::setFromQVariant(this, variant); }
|
||||
|
||||
//! Current UTC timestamp
|
||||
static QString currentUtcTimestamp()
|
||||
{
|
||||
@@ -189,8 +160,6 @@ namespace BlackSim
|
||||
protected:
|
||||
//! \copydoc CValueObject::convertToQString
|
||||
virtual QString convertToQString(bool i18n = false) const;
|
||||
//! \copydoc CValueObject::toJson
|
||||
virtual QJsonObject toJson() const override;
|
||||
|
||||
private:
|
||||
BLACK_ENABLE_TUPLE_CONVERSION(CAircraftMapping)
|
||||
@@ -205,14 +174,6 @@ namespace BlackSim
|
||||
QString m_lastChanged; //!< Simple timestamp as YYYYMMDDhhmmss
|
||||
BlackSim::CSimulatorInfo m_simulatorInfo; //!< Mapping is for simulator
|
||||
bool m_changed; //! Changed flag
|
||||
//! \copydoc CValueObject::convertFromJson
|
||||
virtual void convertFromJson(const QJsonObject &json) override;
|
||||
|
||||
//! Register metadata
|
||||
static void registerMetadata();
|
||||
|
||||
//! JSON member names
|
||||
static const QStringList &jsonMembers();
|
||||
};
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -37,97 +37,6 @@ namespace BlackSim
|
||||
return s;
|
||||
}
|
||||
|
||||
/*
|
||||
* metaTypeId
|
||||
*/
|
||||
int CSettingsSimulator::getMetaTypeId() const
|
||||
{
|
||||
return qMetaTypeId<CSettingsSimulator>();
|
||||
}
|
||||
|
||||
/*
|
||||
* is a
|
||||
*/
|
||||
bool CSettingsSimulator::isA(int metaTypeId) const
|
||||
{
|
||||
if (metaTypeId == qMetaTypeId<CSettingsSimulator>()) { return true; }
|
||||
return this->CValueObject::isA(metaTypeId);
|
||||
}
|
||||
|
||||
/*
|
||||
* Compare
|
||||
*/
|
||||
int CSettingsSimulator::compareImpl(const CValueObject &otherBase) const
|
||||
{
|
||||
const auto &other = static_cast<const CSettingsSimulator &>(otherBase);
|
||||
return compare(TupleConverter<CSettingsSimulator>::toTuple(*this), TupleConverter<CSettingsSimulator>::toTuple(other));
|
||||
}
|
||||
|
||||
/*
|
||||
* Marshall
|
||||
*/
|
||||
void CSettingsSimulator::marshallToDbus(QDBusArgument &argument) const
|
||||
{
|
||||
argument << TupleConverter<CSettingsSimulator>::toTuple(*this);
|
||||
}
|
||||
|
||||
/*
|
||||
* Unmarshall
|
||||
*/
|
||||
void CSettingsSimulator::unmarshallFromDbus(const QDBusArgument &argument)
|
||||
{
|
||||
argument >> TupleConverter<CSettingsSimulator>::toTuple(*this);
|
||||
}
|
||||
|
||||
/*
|
||||
* Equal?
|
||||
*/
|
||||
bool CSettingsSimulator::operator ==(const CSettingsSimulator &other) const
|
||||
{
|
||||
if (this == &other) return true;
|
||||
return compare(*this, other) == 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Unequal?
|
||||
*/
|
||||
bool CSettingsSimulator::operator !=(const CSettingsSimulator &other) const
|
||||
{
|
||||
return !((*this) == other);
|
||||
}
|
||||
|
||||
/*
|
||||
* Hash
|
||||
*/
|
||||
uint CSettingsSimulator::getValueHash() const
|
||||
{
|
||||
return qHash(TupleConverter<CSettingsSimulator>::toTuple(*this));
|
||||
}
|
||||
|
||||
/*
|
||||
* To JSON
|
||||
*/
|
||||
QJsonObject CSettingsSimulator::toJson() const
|
||||
{
|
||||
return BlackMisc::serializeJson(TupleConverter<CSettingsSimulator>::toMetaTuple(*this));
|
||||
}
|
||||
|
||||
/*
|
||||
* From JSON
|
||||
*/
|
||||
void CSettingsSimulator::convertFromJson(const QJsonObject &json)
|
||||
{
|
||||
BlackMisc::deserializeJson(json, TupleConverter<CSettingsSimulator>::toMetaTuple(*this));
|
||||
}
|
||||
|
||||
/*
|
||||
* Members
|
||||
*/
|
||||
const QStringList &CSettingsSimulator::jsonMembers()
|
||||
{
|
||||
return TupleConverter<CSettingsSimulator>::jsonMembers();
|
||||
}
|
||||
|
||||
/*
|
||||
* Default values
|
||||
*/
|
||||
@@ -138,15 +47,6 @@ namespace BlackSim
|
||||
this->m_timeSync = false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Register metadata
|
||||
*/
|
||||
void CSettingsSimulator::registerMetadata()
|
||||
{
|
||||
qRegisterMetaType<CSettingsSimulator>();
|
||||
qDBusRegisterMetaType<CSettingsSimulator>();
|
||||
}
|
||||
|
||||
/*
|
||||
* Value
|
||||
*/
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace BlackSim
|
||||
namespace Settings
|
||||
{
|
||||
//! Value object encapsulating information of simulator related settings.
|
||||
class CSettingsSimulator : public BlackMisc::CValueObject
|
||||
class CSettingsSimulator : public BlackMisc::CValueObjectStdTuple<CSettingsSimulator>
|
||||
{
|
||||
public:
|
||||
//! Default constructor.
|
||||
@@ -68,58 +68,16 @@ namespace BlackSim
|
||||
//! Set time synchronization
|
||||
void setTimeSyncEnabled(bool enabled) { this->m_timeSync = enabled; }
|
||||
|
||||
//! Equal operator ==
|
||||
bool operator ==(const CSettingsSimulator &other) const;
|
||||
|
||||
//! Unequal operator !=
|
||||
bool operator !=(const CSettingsSimulator &other) const;
|
||||
|
||||
//! Init with meaningful default values
|
||||
void initDefaultValues();
|
||||
|
||||
//! \copydoc BlackCore::IContextSettings::value
|
||||
virtual BlackMisc::CStatusMessage value(const QString &path, const QString &command, const BlackMisc::CVariant &value, bool &changedFlag);
|
||||
|
||||
//! \copydoc CValueObject::getValueHash
|
||||
virtual uint getValueHash() const override;
|
||||
|
||||
//! \copydoc CValueObject::toJson
|
||||
virtual QJsonObject toJson() const override;
|
||||
|
||||
//! \copydoc CValueObject::convertFromJson
|
||||
virtual void convertFromJson(const QJsonObject &json) override;
|
||||
|
||||
//! \copydoc CValueObject::toQVariant
|
||||
virtual QVariant toQVariant() const override { return QVariant::fromValue(*this); }
|
||||
|
||||
//! \copydoc CValueObject::convertFromQVariant
|
||||
virtual void convertFromQVariant(const QVariant &variant) override { BlackMisc::setFromQVariant(this, variant); }
|
||||
|
||||
//! \copydoc CValueObject::registerMetadata
|
||||
static void registerMetadata();
|
||||
|
||||
//! JSON member names
|
||||
static const QStringList &jsonMembers();
|
||||
|
||||
protected:
|
||||
//! \copydoc CValueObject::convertToQString
|
||||
virtual QString convertToQString(bool i18n = false) const override;
|
||||
|
||||
//! \copydoc CValueObject::getMetaTypeId
|
||||
virtual int getMetaTypeId() const override;
|
||||
|
||||
//! \copydoc CValueObject::isA
|
||||
virtual bool isA(int metaTypeId) const override;
|
||||
|
||||
//! \copydoc CValueObject::compareImpl
|
||||
virtual int compareImpl(const CValueObject &other) const override;
|
||||
|
||||
//! \copydoc CValueObject::marshallToDbus
|
||||
virtual void marshallToDbus(QDBusArgument &argument) const override;
|
||||
|
||||
//! \copydoc CValueObject::unmarshallFromDbus
|
||||
virtual void unmarshallFromDbus(const QDBusArgument &argument) override;
|
||||
|
||||
private:
|
||||
BLACK_ENABLE_TUPLE_CONVERSION(CSettingsSimulator)
|
||||
BlackSim::CSimulatorInfo m_selectedPlugin;
|
||||
|
||||
@@ -22,11 +22,6 @@ namespace BlackSim
|
||||
CSimulatorInfo::CSimulatorInfo() : m_fullName("Unknown"), m_shortName("Unknown")
|
||||
{}
|
||||
|
||||
uint CSimulatorInfo::getValueHash() const
|
||||
{
|
||||
return qHash(TupleConverter<CSimulatorInfo>::toTuple(*this));
|
||||
}
|
||||
|
||||
QVariant CSimulatorInfo::getSimulatorSetupValue(int index) const
|
||||
{
|
||||
return this->m_simsetup.value(index);
|
||||
@@ -55,57 +50,4 @@ namespace BlackSim
|
||||
Q_UNUSED(i18n);
|
||||
return QString(this->m_shortName).append(" (").append(this->m_fullName).append(")");
|
||||
}
|
||||
|
||||
int CSimulatorInfo::getMetaTypeId() const
|
||||
{
|
||||
return qMetaTypeId<CSimulatorInfo>();
|
||||
}
|
||||
|
||||
bool CSimulatorInfo::operator ==(const CSimulatorInfo &other) const
|
||||
{
|
||||
if (this == &other) return true;
|
||||
return TupleConverter<CSimulatorInfo>::toTuple(*this) == TupleConverter<CSimulatorInfo>::toTuple(other);
|
||||
}
|
||||
|
||||
bool CSimulatorInfo::operator !=(const CSimulatorInfo &other) const
|
||||
{
|
||||
return !((*this) == other);
|
||||
}
|
||||
|
||||
int CSimulatorInfo::compareImpl(const BlackMisc::CValueObject &otherBase) const
|
||||
{
|
||||
const auto &other = static_cast<const CSimulatorInfo &>(otherBase);
|
||||
return compare(TupleConverter<CSimulatorInfo>::toTuple(*this), TupleConverter<CSimulatorInfo>::toTuple(other));
|
||||
}
|
||||
|
||||
void CSimulatorInfo::marshallToDbus(QDBusArgument &argument) const
|
||||
{
|
||||
argument << TupleConverter<CSimulatorInfo>::toTuple(*this);
|
||||
}
|
||||
|
||||
void CSimulatorInfo::unmarshallFromDbus(const QDBusArgument &argument)
|
||||
{
|
||||
argument >> TupleConverter<CSimulatorInfo>::toTuple(*this);
|
||||
}
|
||||
|
||||
const QStringList &CSimulatorInfo::jsonMembers()
|
||||
{
|
||||
return TupleConverter<CSimulatorInfo>::jsonMembers();
|
||||
}
|
||||
|
||||
QJsonObject CSimulatorInfo::toJson() const
|
||||
{
|
||||
return BlackMisc::serializeJson(CSimulatorInfo::jsonMembers(), TupleConverter<CSimulatorInfo>::toTuple(*this));
|
||||
}
|
||||
|
||||
void CSimulatorInfo::convertFromJson(const QJsonObject &json)
|
||||
{
|
||||
BlackMisc::deserializeJson(json, CSimulatorInfo::jsonMembers(), TupleConverter<CSimulatorInfo>::toTuple(*this));
|
||||
}
|
||||
|
||||
void CSimulatorInfo::registerMetadata()
|
||||
{
|
||||
qRegisterMetaType<CSimulatorInfo>();
|
||||
qDBusRegisterMetaType<CSimulatorInfo>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
namespace BlackSim
|
||||
{
|
||||
//! Describing a simulator
|
||||
class CSimulatorInfo : public BlackMisc::CValueObject
|
||||
class CSimulatorInfo : public BlackMisc::CValueObjectStdTuple<CSimulatorInfo>
|
||||
{
|
||||
public:
|
||||
//! Default constructor
|
||||
@@ -28,12 +28,6 @@ namespace BlackSim
|
||||
//! Unspecified simulator
|
||||
bool isUnspecified() const { return this->m_shortName.isEmpty() || this->m_shortName.startsWith("Unspecified", Qt::CaseInsensitive); }
|
||||
|
||||
//! Equal operator ==
|
||||
bool operator ==(const CSimulatorInfo &other) const;
|
||||
|
||||
//! Unequal operator !=
|
||||
bool operator !=(const CSimulatorInfo &other) const;
|
||||
|
||||
//! Single setting value
|
||||
QVariant getSimulatorSetupValue(int index) const;
|
||||
|
||||
@@ -52,27 +46,6 @@ namespace BlackSim
|
||||
//! Compare on names only, ignore setup
|
||||
bool isSameSimulator(const CSimulatorInfo &otherSimulator) const;
|
||||
|
||||
//! \copydoc CValueObject::getValueHash()
|
||||
virtual uint getValueHash() const override;
|
||||
|
||||
//! \copydoc CValueObject::toQVariant()
|
||||
virtual QVariant toQVariant() const override { return QVariant::fromValue(*this); }
|
||||
|
||||
//! \copydoc CValueObject::convertFromQVariant
|
||||
virtual void convertFromQVariant(const QVariant &variant) override { BlackMisc::setFromQVariant(this, variant); }
|
||||
|
||||
//! \copydoc CValueObject::toJson
|
||||
virtual QJsonObject toJson() const override;
|
||||
|
||||
//! \copydoc CValueObject::convertFromJson
|
||||
virtual void convertFromJson(const QJsonObject &json) override;
|
||||
|
||||
//! JSON member names
|
||||
static const QStringList &jsonMembers();
|
||||
|
||||
//! Register the metatypes
|
||||
static void registerMetadata();
|
||||
|
||||
//! Simulator is FS9 - Microsoft Flight Simulator 2004
|
||||
static const CSimulatorInfo &FS9()
|
||||
{
|
||||
@@ -105,18 +78,6 @@ namespace BlackSim
|
||||
//! \copydoc CValueObject::convertToQString
|
||||
virtual QString convertToQString(bool i18n = false) const override;
|
||||
|
||||
//! \copydoc CValueObject::getMetaTypeId
|
||||
virtual int getMetaTypeId() const override;
|
||||
|
||||
//! \copydoc CValueObject::compareImpl
|
||||
virtual int compareImpl(const CValueObject &otherBase) const override;
|
||||
|
||||
//! \copydoc CValueObject::marshallToDbus()
|
||||
virtual void marshallToDbus(QDBusArgument &argument) const override;
|
||||
|
||||
//! \copydoc CValueObject::unmarshallFromDbus()
|
||||
virtual void unmarshallFromDbus(const QDBusArgument &argument) override;
|
||||
|
||||
private:
|
||||
BLACK_ENABLE_TUPLE_CONVERSION(CSimulatorInfo)
|
||||
QString m_fullName;
|
||||
|
||||
Reference in New Issue
Block a user