mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-01 22:55:41 +08:00
Ref T298, move matcher setup into BlackMisc::Simulation
This commit is contained in:
@@ -30,7 +30,6 @@ using namespace BlackMisc;
|
|||||||
using namespace BlackMisc::Aviation;
|
using namespace BlackMisc::Aviation;
|
||||||
using namespace BlackMisc::Network;
|
using namespace BlackMisc::Network;
|
||||||
using namespace BlackMisc::Simulation;
|
using namespace BlackMisc::Simulation;
|
||||||
using namespace BlackCore::Settings;
|
|
||||||
|
|
||||||
namespace BlackCore
|
namespace BlackCore
|
||||||
{
|
{
|
||||||
@@ -1075,70 +1074,4 @@ namespace BlackCore
|
|||||||
if (!sApp || sApp->isShuttingDown() || !sApp->hasWebDataServices()) { return true; }
|
if (!sApp || sApp->isShuttingDown() || !sApp->hasWebDataServices()) { return true; }
|
||||||
return (sApp->getWebDataServices()->containsAirlineIcaoDesignator(designator));
|
return (sApp->getWebDataServices()->containsAirlineIcaoDesignator(designator));
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString &CAircraftMatcherSetup::modeFlagToString(MatchingModeFlag modeFlag)
|
|
||||||
{
|
|
||||||
static const QString ms("by model string");
|
|
||||||
static const QString icao("by ICAO");
|
|
||||||
static const QString family("by family");
|
|
||||||
static const QString livery("by livery");
|
|
||||||
static const QString combined("by combined combined");
|
|
||||||
|
|
||||||
switch (modeFlag)
|
|
||||||
{
|
|
||||||
case ByModelString: return ms;
|
|
||||||
case ByIcaoData: return icao;
|
|
||||||
case ByFamily: return family;
|
|
||||||
case ByLivery: return livery;
|
|
||||||
case ByCombinedType: return combined;
|
|
||||||
default: break;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const QString unknown("unknown");
|
|
||||||
return unknown;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString CAircraftMatcherSetup::modeToString(MatchingMode mode)
|
|
||||||
{
|
|
||||||
if (mode == ModeAll) { return "all"; }
|
|
||||||
|
|
||||||
QStringList modes;
|
|
||||||
if (mode.testFlag(ByModelString)) { modes << modeFlagToString(ByModelString); }
|
|
||||||
if (mode.testFlag(ByIcaoData)) { modes << modeFlagToString(ByIcaoData); }
|
|
||||||
if (mode.testFlag(ByFamily)) { modes << modeFlagToString(ByFamily); }
|
|
||||||
if (mode.testFlag(ByLivery)) { modes << modeFlagToString(ByLivery); }
|
|
||||||
if (mode.testFlag(ByCombinedType)) { modes << modeFlagToString(ByCombinedType); }
|
|
||||||
return modes.join(", ");
|
|
||||||
}
|
|
||||||
|
|
||||||
QString CAircraftMatcherSetup::convertToQString(bool i18n) const
|
|
||||||
{
|
|
||||||
Q_UNUSED(i18n);
|
|
||||||
return modeToString(this->getMatchingMode());
|
|
||||||
}
|
|
||||||
|
|
||||||
CVariant CAircraftMatcherSetup::propertyByIndex(const CPropertyIndex &index) const
|
|
||||||
{
|
|
||||||
if (index.isMyself()) { return CVariant::from(*this); }
|
|
||||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
|
||||||
switch (i)
|
|
||||||
{
|
|
||||||
case IndexMatchingMode: return CVariant::fromValue(m_mode);
|
|
||||||
default: break;
|
|
||||||
}
|
|
||||||
return CValueObject::propertyByIndex(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CAircraftMatcherSetup::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant)
|
|
||||||
{
|
|
||||||
if (index.isMyself()) { (*this) = variant.to<CAircraftMatcherSetup>(); return; }
|
|
||||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
|
||||||
switch (i)
|
|
||||||
{
|
|
||||||
case IndexMatchingMode: m_mode = variant.toInt(); break;
|
|
||||||
default: break;
|
|
||||||
}
|
|
||||||
CValueObject::setPropertyByIndex(index, variant);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#define BLACKCORE_AIRCRAFTMATCHER_H
|
#define BLACKCORE_AIRCRAFTMATCHER_H
|
||||||
|
|
||||||
#include "blackcore/blackcoreexport.h"
|
#include "blackcore/blackcoreexport.h"
|
||||||
|
#include "blackmisc/simulation/aircraftmatchersetup.h"
|
||||||
#include "blackmisc/simulation/aircraftmodellist.h"
|
#include "blackmisc/simulation/aircraftmodellist.h"
|
||||||
#include "blackmisc/simulation/matchingstatistics.h"
|
#include "blackmisc/simulation/matchingstatistics.h"
|
||||||
#include "blackmisc/statusmessage.h"
|
#include "blackmisc/statusmessage.h"
|
||||||
@@ -33,64 +34,6 @@ namespace BlackMisc
|
|||||||
|
|
||||||
namespace BlackCore
|
namespace BlackCore
|
||||||
{
|
{
|
||||||
namespace Settings
|
|
||||||
{
|
|
||||||
//! Matcher settings
|
|
||||||
class BLACKCORE_EXPORT CAircraftMatcherSetup : public BlackMisc::CValueObject<CAircraftMatcherSetup>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
//! Enabled matching mode flags
|
|
||||||
enum MatchingModeFlag
|
|
||||||
{
|
|
||||||
ByModelString = 1 << 0,
|
|
||||||
ByIcaoData = 1 << 1,
|
|
||||||
ByFamily = 1 << 2,
|
|
||||||
ByLivery = 1 << 3,
|
|
||||||
ByCombinedType = 1 << 4,
|
|
||||||
ModeAll = ByModelString | ByIcaoData | ByFamily | ByLivery | ByCombinedType
|
|
||||||
};
|
|
||||||
Q_DECLARE_FLAGS(MatchingMode, MatchingModeFlag)
|
|
||||||
|
|
||||||
//! Enumeration as string
|
|
||||||
static const QString &modeFlagToString(MatchingModeFlag modeFlag);
|
|
||||||
|
|
||||||
//! Enumeration as string
|
|
||||||
static QString modeToString(MatchingMode mode);
|
|
||||||
|
|
||||||
//! Properties by index
|
|
||||||
enum ColumnIndex
|
|
||||||
{
|
|
||||||
IndexMatchingMode = BlackMisc::CPropertyIndex::GlobalIndexCAircraftMatcherSetup
|
|
||||||
};
|
|
||||||
|
|
||||||
//! Constructor
|
|
||||||
CAircraftMatcherSetup() {}
|
|
||||||
|
|
||||||
//! Matching mode
|
|
||||||
MatchingMode getMatchingMode() const { return static_cast<MatchingMode>(m_mode); }
|
|
||||||
|
|
||||||
//! Dynamic offset values?
|
|
||||||
void setMatchingMode(MatchingMode mode) { m_mode = static_cast<int>(mode); }
|
|
||||||
|
|
||||||
//! \copydoc BlackMisc::Mixin::String::toQString
|
|
||||||
QString convertToQString(bool i18n = false) const;
|
|
||||||
|
|
||||||
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
|
|
||||||
BlackMisc::CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const;
|
|
||||||
|
|
||||||
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
|
|
||||||
void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const BlackMisc::CVariant &variant);
|
|
||||||
|
|
||||||
private:
|
|
||||||
int m_mode = static_cast<int>(ModeAll);
|
|
||||||
|
|
||||||
BLACK_METACLASS(
|
|
||||||
CAircraftMatcherSetup,
|
|
||||||
BLACK_METAMEMBER(mode)
|
|
||||||
);
|
|
||||||
};
|
|
||||||
} // ns
|
|
||||||
|
|
||||||
//! Matcher for all models.
|
//! Matcher for all models.
|
||||||
//! \details Reads the model set (ie the models the user wants to use).
|
//! \details Reads the model set (ie the models the user wants to use).
|
||||||
//! Also Allows to reverse lookup a model (from network to DB data).
|
//! Also Allows to reverse lookup a model (from network to DB data).
|
||||||
@@ -103,7 +46,7 @@ namespace BlackCore
|
|||||||
static const BlackMisc::CLogCategoryList &getLogCategories();
|
static const BlackMisc::CLogCategoryList &getLogCategories();
|
||||||
|
|
||||||
//! Constructor
|
//! Constructor
|
||||||
CAircraftMatcher(const Settings::CAircraftMatcherSetup &setup, QObject *parent = nullptr);
|
CAircraftMatcher(const BlackMisc::Simulation::CAircraftMatcherSetup &setup, QObject *parent = nullptr);
|
||||||
|
|
||||||
//! Constructor
|
//! Constructor
|
||||||
CAircraftMatcher(QObject *parent = nullptr);
|
CAircraftMatcher(QObject *parent = nullptr);
|
||||||
@@ -111,8 +54,8 @@ namespace BlackCore
|
|||||||
//! Destructor
|
//! Destructor
|
||||||
virtual ~CAircraftMatcher();
|
virtual ~CAircraftMatcher();
|
||||||
|
|
||||||
//! Set the enabled matching modes
|
//! Set the setup
|
||||||
void setSetup(const Settings::CAircraftMatcherSetup matchingModes);
|
void setSetup(const BlackMisc::Simulation::CAircraftMatcherSetup &setup) { m_setup = setup; }
|
||||||
|
|
||||||
//! Get the closest matching aircraft model from set.
|
//! Get the closest matching aircraft model from set.
|
||||||
//! Result depends on enabled modes.
|
//! Result depends on enabled modes.
|
||||||
@@ -228,11 +171,11 @@ namespace BlackCore
|
|||||||
private:
|
private:
|
||||||
//! The search based implementation
|
//! The search based implementation
|
||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
BlackMisc::Simulation::CAircraftModel getClosestMatchSearchImplementation(Settings::CAircraftMatcherSetup::MatchingMode mode, const BlackMisc::Simulation::CAircraftModelList &modelSet, const BlackMisc::Simulation::CSimulatedAircraft &remoteAircraft, BlackMisc::CStatusMessageList *log = nullptr) const;
|
BlackMisc::Simulation::CAircraftModel getClosestMatchSearchImplementation(BlackMisc::Simulation::CAircraftMatcherSetup::MatchingMode mode, const BlackMisc::Simulation::CAircraftModelList &modelSet, const BlackMisc::Simulation::CSimulatedAircraft &remoteAircraft, BlackMisc::CStatusMessageList *log = nullptr) const;
|
||||||
|
|
||||||
//! The score based implementation
|
//! The score based implementation
|
||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
BlackMisc::Simulation::CAircraftModel getClosestMatchScoreImplementation(Settings::CAircraftMatcherSetup::MatchingMode mode, const BlackMisc::Simulation::CAircraftModelList &modelSet, const BlackMisc::Simulation::CSimulatedAircraft &remoteAircraft, BlackMisc::CStatusMessageList *log = nullptr) const;
|
BlackMisc::Simulation::CAircraftModel getClosestMatchScoreImplementation(BlackMisc::Simulation::CAircraftMatcherSetup::MatchingMode mode, const BlackMisc::Simulation::CAircraftModelList &modelSet, const BlackMisc::Simulation::CSimulatedAircraft &remoteAircraft, BlackMisc::CStatusMessageList *log = nullptr) const;
|
||||||
|
|
||||||
//! Get combined type default model, i.e. get a default model under consideration of the combined code such as "L2J"
|
//! Get combined type default model, i.e. get a default model under consideration of the combined code such as "L2J"
|
||||||
//! \see BlackMisc::Simulation::CSimulatedAircraft::getAircraftIcaoCombinedType
|
//! \see BlackMisc::Simulation::CSimulatedAircraft::getAircraftIcaoCombinedType
|
||||||
@@ -288,18 +231,13 @@ namespace BlackCore
|
|||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
static bool isValidAirlineIcaoDesignator(const QString &designator, bool checkAgainstSwiftDb);
|
static bool isValidAirlineIcaoDesignator(const QString &designator, bool checkAgainstSwiftDb);
|
||||||
|
|
||||||
Settings::CAircraftMatcherSetup m_setup; //!< setup
|
BlackMisc::Simulation::CAircraftMatcherSetup m_setup; //!< setup
|
||||||
BlackMisc::Simulation::CAircraftModel m_defaultModel; //!< model to be used as default model
|
BlackMisc::Simulation::CAircraftModel m_defaultModel; //!< model to be used as default model
|
||||||
BlackMisc::Simulation::CAircraftModelList m_modelSet; //!< models used for model matching
|
BlackMisc::Simulation::CAircraftModelList m_modelSet; //!< models used for model matching
|
||||||
BlackMisc::Simulation::CSimulatorInfo m_simulator; //!< simulator (optional)
|
BlackMisc::Simulation::CSimulatorInfo m_simulator; //!< simulator (optional)
|
||||||
BlackMisc::Simulation::CMatchingStatistics m_statistics; //!< matching statistics
|
BlackMisc::Simulation::CMatchingStatistics m_statistics; //!< matching statistics
|
||||||
QString m_modelSetInfo; //!< info string
|
QString m_modelSetInfo; //!< info string
|
||||||
};
|
};
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(BlackCore::Settings::CAircraftMatcherSetup)
|
|
||||||
Q_DECLARE_METATYPE(BlackCore::Settings::CAircraftMatcherSetup::MatchingMode)
|
|
||||||
Q_DECLARE_METATYPE(BlackCore::Settings::CAircraftMatcherSetup::MatchingModeFlag)
|
|
||||||
Q_DECLARE_OPERATORS_FOR_FLAGS(BlackCore::Settings::CAircraftMatcherSetup::MatchingMode)
|
|
||||||
|
|
||||||
#endif // guard
|
#endif // guard
|
||||||
|
|||||||
@@ -36,8 +36,6 @@ namespace BlackCore
|
|||||||
qRegisterMetaType<IVoiceChannel::ConnectionStatus>();
|
qRegisterMetaType<IVoiceChannel::ConnectionStatus>();
|
||||||
qRegisterMetaType<CWebReaderFlags::WebReader>();
|
qRegisterMetaType<CWebReaderFlags::WebReader>();
|
||||||
qRegisterMetaType<CWebReaderFlags::WebReaderFlag>();
|
qRegisterMetaType<CWebReaderFlags::WebReaderFlag>();
|
||||||
qRegisterMetaType<Settings::CAircraftMatcherSetup::MatchingMode>();
|
|
||||||
qRegisterMetaType<Settings::CAircraftMatcherSetup::MatchingModeFlag>();
|
|
||||||
|
|
||||||
qDBusRegisterMetaType<Context::CLogSubscriptionHash>();
|
qDBusRegisterMetaType<Context::CLogSubscriptionHash>();
|
||||||
qDBusRegisterMetaType<Context::CLogSubscriptionPair>();
|
qDBusRegisterMetaType<Context::CLogSubscriptionPair>();
|
||||||
@@ -45,15 +43,12 @@ namespace BlackCore
|
|||||||
qDBusRegisterMetaType<INetwork::ConnectionStatus>();
|
qDBusRegisterMetaType<INetwork::ConnectionStatus>();
|
||||||
qDBusRegisterMetaType<INetwork::LoginMode>();
|
qDBusRegisterMetaType<INetwork::LoginMode>();
|
||||||
qDBusRegisterMetaType<IVoiceChannel::ConnectionStatus>();
|
qDBusRegisterMetaType<IVoiceChannel::ConnectionStatus>();
|
||||||
// qDBusRegisterMetaType<Settings::CAircraftMatcherSetup::MatchingMode>();
|
|
||||||
qDBusRegisterMetaType<Settings::CAircraftMatcherSetup::MatchingModeFlag>();
|
|
||||||
|
|
||||||
Db::CDatabaseReaderConfig::registerMetadata();
|
Db::CDatabaseReaderConfig::registerMetadata();
|
||||||
Db::CDatabaseReaderConfigList::registerMetadata();
|
Db::CDatabaseReaderConfigList::registerMetadata();
|
||||||
Data::CGlobalSetup::registerMetadata();
|
Data::CGlobalSetup::registerMetadata();
|
||||||
Data::CVatsimSetup::registerMetadata();
|
Data::CVatsimSetup::registerMetadata();
|
||||||
Data::CLauncherSetup::registerMetadata();
|
Data::CLauncherSetup::registerMetadata();
|
||||||
Settings::CAircraftMatcherSetup::registerMetadata();
|
|
||||||
Vatsim::CReaderSettings::registerMetadata();
|
Vatsim::CReaderSettings::registerMetadata();
|
||||||
Vatsim::CRawFsdMessageSettings::registerMetadata();
|
Vatsim::CRawFsdMessageSettings::registerMetadata();
|
||||||
}
|
}
|
||||||
|
|||||||
91
src/blackmisc/simulation/aircraftmatchersetup.cpp
Normal file
91
src/blackmisc/simulation/aircraftmatchersetup.cpp
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
/* Copyright (C) 2018
|
||||||
|
* swift project Community / Contributors
|
||||||
|
*
|
||||||
|
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||||
|
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||||
|
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||||
|
* contained in the LICENSE file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "aircraftmatchersetup.h"
|
||||||
|
|
||||||
|
namespace BlackMisc
|
||||||
|
{
|
||||||
|
namespace Simulation
|
||||||
|
{
|
||||||
|
QString CAircraftMatcherSetup::convertToQString(bool i18n) const
|
||||||
|
{
|
||||||
|
Q_UNUSED(i18n);
|
||||||
|
return modeToString(this->getMatchingMode());
|
||||||
|
}
|
||||||
|
|
||||||
|
CVariant CAircraftMatcherSetup::propertyByIndex(const CPropertyIndex &index) const
|
||||||
|
{
|
||||||
|
if (index.isMyself()) { return CVariant::from(*this); }
|
||||||
|
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||||
|
switch (i)
|
||||||
|
{
|
||||||
|
case IndexMatchingMode: return CVariant::fromValue(m_mode);
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
return CValueObject::propertyByIndex(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAircraftMatcherSetup::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant)
|
||||||
|
{
|
||||||
|
if (index.isMyself()) { (*this) = variant.to<CAircraftMatcherSetup>(); return; }
|
||||||
|
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||||
|
switch (i)
|
||||||
|
{
|
||||||
|
case IndexMatchingMode: m_mode = variant.toInt(); break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
CValueObject::setPropertyByIndex(index, variant);
|
||||||
|
}
|
||||||
|
|
||||||
|
const QString &CAircraftMatcherSetup::modeFlagToString(MatchingModeFlag modeFlag)
|
||||||
|
{
|
||||||
|
static const QString ms("by model string");
|
||||||
|
static const QString icao("by ICAO");
|
||||||
|
static const QString family("by family");
|
||||||
|
static const QString livery("by livery");
|
||||||
|
static const QString combined("by combined combined");
|
||||||
|
|
||||||
|
switch (modeFlag)
|
||||||
|
{
|
||||||
|
case ByModelString: return ms;
|
||||||
|
case ByIcaoData: return icao;
|
||||||
|
case ByFamily: return family;
|
||||||
|
case ByLivery: return livery;
|
||||||
|
case ByCombinedType: return combined;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const QString unknown("unknown");
|
||||||
|
return unknown;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CAircraftMatcherSetup::modeToString(MatchingMode mode)
|
||||||
|
{
|
||||||
|
if (mode == ModeAll) { return "all"; }
|
||||||
|
|
||||||
|
QStringList modes;
|
||||||
|
if (mode.testFlag(ByModelString)) { modes << modeFlagToString(ByModelString); }
|
||||||
|
if (mode.testFlag(ByIcaoData)) { modes << modeFlagToString(ByIcaoData); }
|
||||||
|
if (mode.testFlag(ByFamily)) { modes << modeFlagToString(ByFamily); }
|
||||||
|
if (mode.testFlag(ByLivery)) { modes << modeFlagToString(ByLivery); }
|
||||||
|
if (mode.testFlag(ByCombinedType)) { modes << modeFlagToString(ByCombinedType); }
|
||||||
|
return modes.join(", ");
|
||||||
|
}
|
||||||
|
|
||||||
|
CAircraftMatcherSetup::MatchingMode CAircraftMatcherSetup::matchingMode(bool byModelString, bool byIcaoData, bool byFamily, bool byLivery, bool byCombinedType)
|
||||||
|
{
|
||||||
|
MatchingMode mode = byModelString ? ByModelString : ModeNone;
|
||||||
|
if (byIcaoData) { mode |= ByIcaoData; }
|
||||||
|
if (byFamily) { mode |= ByFamily; }
|
||||||
|
if (byLivery) { mode |= ByLivery; }
|
||||||
|
if (byCombinedType) { mode |= ByCombinedType; }
|
||||||
|
return mode;
|
||||||
|
}
|
||||||
|
} // namespace
|
||||||
|
} // namespace
|
||||||
89
src/blackmisc/simulation/aircraftmatchersetup.h
Normal file
89
src/blackmisc/simulation/aircraftmatchersetup.h
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
/* Copyright (C) 2018
|
||||||
|
* swift project Community / Contributors
|
||||||
|
*
|
||||||
|
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||||
|
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||||
|
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||||
|
* contained in the LICENSE file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
//! \file
|
||||||
|
|
||||||
|
#ifndef BLACKMISC_SIMULATION_AIRCRAFTMATCHERSETUP_H
|
||||||
|
#define BLACKMISC_SIMULATION_AIRCRAFTMATCHERSETUP_H
|
||||||
|
|
||||||
|
#include "blackmisc/valueobject.h"
|
||||||
|
#include "blackmisc/blackmiscexport.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace BlackMisc
|
||||||
|
{
|
||||||
|
namespace Simulation
|
||||||
|
{
|
||||||
|
//! Matcher settings
|
||||||
|
class BLACKMISC_EXPORT CAircraftMatcherSetup : public CValueObject<CAircraftMatcherSetup>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//! Enabled matching mode flags
|
||||||
|
enum MatchingModeFlag
|
||||||
|
{
|
||||||
|
ByModelString = 1 << 0,
|
||||||
|
ByIcaoData = 1 << 1,
|
||||||
|
ByFamily = 1 << 2,
|
||||||
|
ByLivery = 1 << 3,
|
||||||
|
ByCombinedType = 1 << 4,
|
||||||
|
ModeAll = ByModelString | ByIcaoData | ByFamily | ByLivery | ByCombinedType,
|
||||||
|
ModeNone = 0
|
||||||
|
};
|
||||||
|
Q_DECLARE_FLAGS(MatchingMode, MatchingModeFlag)
|
||||||
|
|
||||||
|
//! Properties by index
|
||||||
|
enum ColumnIndex
|
||||||
|
{
|
||||||
|
IndexMatchingMode = CPropertyIndex::GlobalIndexCAircraftMatcherSetup
|
||||||
|
};
|
||||||
|
|
||||||
|
//! Constructor
|
||||||
|
CAircraftMatcherSetup() {}
|
||||||
|
|
||||||
|
//! Matching mode
|
||||||
|
MatchingMode getMatchingMode() const { return static_cast<MatchingMode>(m_mode); }
|
||||||
|
|
||||||
|
//! Dynamic offset values?
|
||||||
|
void setMatchingMode(MatchingMode mode) { m_mode = static_cast<int>(mode); }
|
||||||
|
|
||||||
|
//! \copydoc BlackMisc::Mixin::String::toQString
|
||||||
|
QString convertToQString(bool i18n = false) const;
|
||||||
|
|
||||||
|
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
|
||||||
|
BlackMisc::CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const;
|
||||||
|
|
||||||
|
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
|
||||||
|
void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const BlackMisc::CVariant &variant);
|
||||||
|
|
||||||
|
//! Enumeration as string
|
||||||
|
static const QString &modeFlagToString(MatchingModeFlag modeFlag);
|
||||||
|
|
||||||
|
//! Enumeration as string
|
||||||
|
static QString modeToString(MatchingMode mode);
|
||||||
|
|
||||||
|
//! Mode by flags
|
||||||
|
static MatchingMode matchingMode(bool byModelString, bool byIcaoData, bool byFamily, bool byLivery, bool byCombinedType);
|
||||||
|
|
||||||
|
private:
|
||||||
|
int m_mode = static_cast<int>(ModeAll);
|
||||||
|
|
||||||
|
BLACK_METACLASS(
|
||||||
|
CAircraftMatcherSetup,
|
||||||
|
BLACK_METAMEMBER(mode)
|
||||||
|
);
|
||||||
|
};
|
||||||
|
} // ns
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
Q_DECLARE_METATYPE(BlackMisc::Simulation::CAircraftMatcherSetup)
|
||||||
|
Q_DECLARE_METATYPE(BlackMisc::Simulation::CAircraftMatcherSetup::MatchingMode)
|
||||||
|
Q_DECLARE_METATYPE(BlackMisc::Simulation::CAircraftMatcherSetup::MatchingModeFlag)
|
||||||
|
Q_DECLARE_OPERATORS_FOR_FLAGS(BlackMisc::Simulation::CAircraftMatcherSetup::MatchingMode)
|
||||||
|
|
||||||
|
#endif // guard
|
||||||
@@ -49,6 +49,10 @@ namespace BlackMisc
|
|||||||
CSwiftPluginSettings::registerMetadata();
|
CSwiftPluginSettings::registerMetadata();
|
||||||
CVPilotModelRule::registerMetadata();
|
CVPilotModelRule::registerMetadata();
|
||||||
CVPilotModelRuleSet::registerMetadata();
|
CVPilotModelRuleSet::registerMetadata();
|
||||||
|
qRegisterMetaType<CAircraftMatcherSetup::MatchingMode>();
|
||||||
|
qRegisterMetaType<CAircraftMatcherSetup::MatchingModeFlag>();
|
||||||
|
qDBusRegisterMetaType<CAircraftMatcherSetup::MatchingModeFlag>();
|
||||||
|
CAircraftMatcherSetup::registerMetadata();
|
||||||
}
|
}
|
||||||
} // ns
|
} // ns
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
* \brief Generic simulation related class, but not OS or driver dependent
|
* \brief Generic simulation related class, but not OS or driver dependent
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "blackmisc/simulation/aircraftmatchersetup.h"
|
||||||
#include "blackmisc/simulation/aircraftmodellist.h"
|
#include "blackmisc/simulation/aircraftmodellist.h"
|
||||||
#include "blackmisc/simulation/airspaceaircraftsnapshot.h"
|
#include "blackmisc/simulation/airspaceaircraftsnapshot.h"
|
||||||
#include "blackmisc/simulation/distributorlist.h"
|
#include "blackmisc/simulation/distributorlist.h"
|
||||||
|
|||||||
Reference in New Issue
Block a user