14 using namespace swift::misc::aviation;
15 using namespace swift::misc::simulation;
19 namespace swift::misc::simulation::fscommon
21 CVPilotModelRule::CVPilotModelRule() {}
23 CVPilotModelRule::CVPilotModelRule(
const QString &modelName,
const QString &folder,
const QString &typeCode,
24 const QString &callsignPrefix, qint64 updated)
25 :
ITimestampBased(updated), m_modelName(modelName.trimmed().toUpper()), m_folder(folder.trimmed().toUpper()),
26 m_typeCode(typeCode.trimmed().toUpper()), m_callsignPrefix(callsignPrefix.trimmed().toUpper()),
27 m_updatedMsSinceEpoch(updated)
32 QString f(this->
getFolder().toUpper().simplified());
34 if (f.isEmpty())
return (
"UNKNOWN");
35 if (f.startsWith(
"WOAI", Qt::CaseInsensitive)) {
return "WOAI"; }
36 if (f.startsWith(
"WORLDOFAI", Qt::CaseInsensitive)) {
return "WOAI"; }
37 if (f.startsWith(
"IVAO", Qt::CaseInsensitive)) {
return "IVAO"; }
38 if (f.startsWith(
"P3D", Qt::CaseInsensitive)) {
return "P3D"; }
39 if (f.startsWith(
"FSX", Qt::CaseInsensitive)) {
return "FSX"; }
40 if (f.startsWith(
"MYTRAFFIC", Qt::CaseInsensitive)) {
return "MYTRAFFIC"; }
41 if (f.startsWith(
"JUSTFLIGHT", Qt::CaseInsensitive)) {
return "JUSTFLIGHT"; }
42 if (f.startsWith(
"ULTIMATETRAFFIC", Qt::CaseInsensitive)) {
return "ULTIMATETRAFFIC"; }
43 if (f.startsWith(
"VIP", Qt::CaseInsensitive)) {
return "VIP"; }
49 if (index.
isMyself()) {
return QVariant::fromValue(*
this); }
54 case IndexModelName:
return QVariant::fromValue(this->m_modelName);
55 case IndexFolder:
return QVariant::fromValue(this->m_folder);
56 case IndexTypeCode:
return QVariant::fromValue(this->m_typeCode);
57 case IndexCallsignPrefix:
return QVariant::fromValue(this->m_callsignPrefix);
77 case IndexModelName: this->
setModelName(variant.value<QString>());
break;
78 case IndexFolder: this->
setFolder(variant.value<QString>());
break;
79 case IndexTypeCode: this->
setTypeCode(variant.value<QString>());
break;
80 case IndexCallsignPrefix: this->
setCallsignPrefix(variant.value<QString>());
break;
88 QString s(this->m_modelName);
94 QString al(m_callsignPrefix);
98 if (al.startsWith(
"USAF")) { al =
"AIO"; }
100 const QString liveryPseudoCode(al.length() != 3 ?
"" : al +
"." + CLivery::standardLiveryMarker());
103 const CLivery livery(liveryPseudoCode, airlineIcao,
"vPilot rule based");
106 aircraftIcao, livery);
Non-owning reference to a CPropertyIndex with a subset of its features.
CastType frontCasted() const
First element casted to given type, usually the PropertIndex enum.
bool isMyself() const
Myself index, used with nesting.
void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
Set property by index.
static bool canHandleIndex(CPropertyIndexRef index)
Can given index be handled.
qint64 m_timestampMSecsSinceEpoch
timestamp value
QVariant propertyByIndex(CPropertyIndexRef index) const
Property by index.
void setMSecsSinceEpoch(qint64 mSecsSinceEpoch)
Timestamp as ms value.
Value object for ICAO classification.
Value object for ICAO classification.
Value object encapsulating information about an airpot.
ColumnIndex
Base class enums.
void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
Set property by index.
QVariant propertyByIndex(CPropertyIndexRef index) const
Property by index.
Aircraft model (used by another pilot, my models on disk)
@ TypeVPilotRuleBased
based on a vPilot rule
void setSimulator(const CSimulatorInfo &simulator)
Set simulator info.
void setDistributor(const CDistributor &distributor)
Set distributor.
static const QString & autoGenerated()
Hint, that model was automatically generated (e.g. by auto stashing)
Value object encapsulating information of software distributor.
Simple hardcoded info about the corresponding simulator.
Value object encapsulating information of software distributor.
QString getDistributor() const
Distributor derived from folder (hardcoded)
void setModelName(const QString &name)
Model name.
void setTypeCode(const QString &code)
Type code.
const QString & getFolder() const
Get folder.
QString convertToQString(bool i18n=false) const
Cast as QString.
void setCallsignPrefix(const QString &callsign)
Callsign prefix.
QVariant propertyByIndex(swift::misc::CPropertyIndexRef index) const
Property by index.
void setFolder(const QString &folder)
Folder.
CAircraftModel toAircraftModel() const
Convert into aircraft model.
void setPropertyByIndex(swift::misc::CPropertyIndexRef index, const QVariant &variant)
Set property by index.
#define SWIFT_DEFINE_VALUEOBJECT_MIXINS(Namespace, Class)
Explicit template definition of mixins for a CValueObject subclass.