mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-03 15:45:46 +08:00
refs #640, support for simulator in distributor
* changed backend (JSON) and added support for simulator data * get distributors by simulator * renamed to setSimulator / getSimulator
This commit is contained in:
@@ -37,7 +37,7 @@ namespace BlackMisc
|
||||
m_aircraftIcao(icao), m_livery(livery), m_modelString(model.trimmed().toUpper()), m_description(description.trimmed()), m_modelType(type)
|
||||
{}
|
||||
|
||||
CAircraftModel::CAircraftModel(const QString &model, CAircraftModel::ModelType type, CSimulatorInfo &simulator, const QString &name, const QString &description, const CAircraftIcaoCode &icao, const CLivery &livery) :
|
||||
CAircraftModel::CAircraftModel(const QString &model, CAircraftModel::ModelType type, const CSimulatorInfo &simulator, const QString &name, const QString &description, const CAircraftIcaoCode &icao, const CLivery &livery) :
|
||||
m_aircraftIcao(icao), m_livery(livery), m_simulator(simulator), m_modelString(model.trimmed().toUpper()), m_name(name.trimmed()), m_description(description.trimmed()), m_modelType(type)
|
||||
{ }
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace BlackMisc
|
||||
obj.insert("mode", QJsonValue(getModelModeAsString().left(1).toUpper()));
|
||||
|
||||
// sims
|
||||
const CSimulatorInfo sim(getSimulatorInfo());
|
||||
const CSimulatorInfo sim(getSimulator());
|
||||
QString flag = CDatastoreUtility::boolToDbYN(sim.fsx());
|
||||
obj.insert("simfsx", QJsonValue(flag));
|
||||
flag = CDatastoreUtility::boolToDbYN(sim.p3d());
|
||||
@@ -223,7 +223,7 @@ namespace BlackMisc
|
||||
return this->m_description.compare(compareValue.getDescription(), Qt::CaseInsensitive);
|
||||
case IndexSimulatorInfoAsString:
|
||||
case IndexSimulatorInfo:
|
||||
return this->m_simulator.comparePropertyByIndex(compareValue.getSimulatorInfo(), index.copyFrontRemoved());
|
||||
return this->m_simulator.comparePropertyByIndex(compareValue.getSimulator(), index.copyFrontRemoved());
|
||||
case IndexName:
|
||||
return this->m_name.compare(compareValue.getName(), Qt::CaseInsensitive);
|
||||
case IndexCallsign:
|
||||
@@ -339,7 +339,7 @@ namespace BlackMisc
|
||||
|
||||
bool CAircraftModel::matchesSimulator(const CSimulatorInfo &simulator) const
|
||||
{
|
||||
return (static_cast<int>(simulator.getSimulator()) & static_cast<int>(this->getSimulatorInfo().getSimulator())) > 0;
|
||||
return (static_cast<int>(simulator.getSimulator()) & static_cast<int>(this->getSimulator().getSimulator())) > 0;
|
||||
}
|
||||
|
||||
CPixmap CAircraftModel::loadIcon(CStatusMessage &success) const
|
||||
@@ -383,11 +383,11 @@ namespace BlackMisc
|
||||
if (this->m_modelMode == Undefined) { this->m_modelType = otherModel.getModelType(); }
|
||||
if (this->m_simulator.isUnspecified())
|
||||
{
|
||||
this->setSimulatorInfo(otherModel.getSimulatorInfo());
|
||||
this->setSimulator(otherModel.getSimulator());
|
||||
}
|
||||
else
|
||||
{
|
||||
this->m_simulator.add(otherModel.getSimulatorInfo());
|
||||
this->m_simulator.add(otherModel.getSimulator());
|
||||
}
|
||||
|
||||
this->m_livery.updateMissingParts(otherModel.getLivery());
|
||||
@@ -487,16 +487,11 @@ namespace BlackMisc
|
||||
QString modelName(json.value(prefix + "name").toString());
|
||||
QString modelMode(json.value(prefix + "mode").toString());
|
||||
|
||||
bool fsx = CDatastoreUtility::dbBoolStringToBool(json.value(prefix + "simfsx").toString());
|
||||
bool fs9 = CDatastoreUtility::dbBoolStringToBool(json.value(prefix + "simfs9").toString());
|
||||
bool xp = CDatastoreUtility::dbBoolStringToBool(json.value(prefix + "simxplane").toString());
|
||||
bool p3d = CDatastoreUtility::dbBoolStringToBool(json.value(prefix + "simp3d").toString());
|
||||
const CSimulatorInfo simInfo = CSimulatorInfo::fromDatabaseJson(json, prefix);
|
||||
const CAircraftIcaoCode aircraftIcao(CAircraftIcaoCode::fromDatabaseJson(json, "ac_"));
|
||||
const CLivery livery(CLivery::fromDatabaseJson(json, "liv_"));
|
||||
const CDistributor distributor(CDistributor::fromDatabaseJson(json, "dist_"));
|
||||
|
||||
CAircraftIcaoCode aircraftIcao(CAircraftIcaoCode::fromDatabaseJson(json, "ac_"));
|
||||
CLivery livery(CLivery::fromDatabaseJson(json, "liv_"));
|
||||
CDistributor distributor(CDistributor::fromDatabaseJson(json, "dist_"));
|
||||
|
||||
CSimulatorInfo simInfo(fsx, fs9, xp, p3d);
|
||||
CAircraftModel model(
|
||||
modelString, CAircraftModel::TypeDatabaseEntry, simInfo, modelName, modelDescription, aircraftIcao, livery
|
||||
);
|
||||
|
||||
@@ -95,7 +95,7 @@ namespace BlackMisc
|
||||
CAircraftModel(const QString &model, ModelType type, const QString &description, const BlackMisc::Aviation::CAircraftIcaoCode &icao, const BlackMisc::Aviation::CLivery &livery = BlackMisc::Aviation::CLivery());
|
||||
|
||||
//! Constructor.
|
||||
CAircraftModel(const QString &model, ModelType type, CSimulatorInfo &simulator, const QString &name, const QString &description, const BlackMisc::Aviation::CAircraftIcaoCode &icao, const BlackMisc::Aviation::CLivery &livery = BlackMisc::Aviation::CLivery());
|
||||
CAircraftModel(const QString &model, ModelType type, const CSimulatorInfo &simulator, const QString &name, const QString &description, const BlackMisc::Aviation::CAircraftIcaoCode &icao, const BlackMisc::Aviation::CLivery &livery = BlackMisc::Aviation::CLivery());
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
|
||||
CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const;
|
||||
@@ -227,10 +227,10 @@ namespace BlackMisc
|
||||
void setModelModeAsString(const QString &mode);
|
||||
|
||||
//! Simulator info
|
||||
CSimulatorInfo getSimulatorInfo() const { return this->m_simulator; }
|
||||
CSimulatorInfo getSimulator() const { return this->m_simulator; }
|
||||
|
||||
//! Set simulator info
|
||||
void setSimulatorInfo(const CSimulatorInfo &simulator) { this->m_simulator = simulator; }
|
||||
void setSimulator(const CSimulatorInfo &simulator) { this->m_simulator = simulator; }
|
||||
|
||||
//! Matches given simulator?
|
||||
bool matchesSimulator(const CSimulatorInfo &simulator) const;
|
||||
|
||||
@@ -241,8 +241,8 @@ namespace BlackMisc
|
||||
const CSimulatorInfo::Simulator s = info.getSimulator();
|
||||
for (CAircraftModel &model : (*this))
|
||||
{
|
||||
if (model.getSimulatorInfo().getSimulator() == s) { continue; }
|
||||
model.setSimulatorInfo(info);
|
||||
if (model.getSimulator().getSimulator() == s) { continue; }
|
||||
model.setSimulator(info);
|
||||
c++;
|
||||
}
|
||||
return c;
|
||||
@@ -253,7 +253,7 @@ namespace BlackMisc
|
||||
CSimulatorInfo::Simulator s = CSimulatorInfo::None;
|
||||
for (const CAircraftModel &model : (*this))
|
||||
{
|
||||
s |= model.getSimulatorInfo().getSimulator();
|
||||
s |= model.getSimulator().getSimulator();
|
||||
if (s == CSimulatorInfo::All) { break; }
|
||||
}
|
||||
return CSimulatorInfo(s);
|
||||
@@ -403,7 +403,7 @@ namespace BlackMisc
|
||||
CCountPerSimulator count;
|
||||
for (const CAircraftModel &model : (*this))
|
||||
{
|
||||
count.increaseSimulatorCounts(model.getSimulatorInfo());
|
||||
count.increaseSimulatorCounts(model.getSimulator());
|
||||
}
|
||||
return count;
|
||||
}
|
||||
@@ -439,6 +439,20 @@ namespace BlackMisc
|
||||
}
|
||||
}
|
||||
|
||||
CDistributorList CAircraftModelList::getDistributors(bool onlyDbDistributors) const
|
||||
{
|
||||
if (this->isEmpty()) { return CDistributorList(); }
|
||||
CDistributorList distributors;
|
||||
for (const CAircraftModel &model : *this)
|
||||
{
|
||||
const CDistributor d(model.getDistributor());
|
||||
if (onlyDbDistributors && !d.hasValidDbKey()) { continue; }
|
||||
if (distributors.contains(d)) { continue; }
|
||||
distributors.push_back(d);
|
||||
}
|
||||
return distributors;
|
||||
}
|
||||
|
||||
void CAircraftModelList::updateAircraftIcao(const CAircraftIcaoCode &icao)
|
||||
{
|
||||
for (CAircraftModel &model : *this)
|
||||
|
||||
@@ -153,9 +153,12 @@ namespace BlackMisc
|
||||
//! Which simulator(s) have the most entries
|
||||
CSimulatorInfo simulatorsWithMaxEntries() const;
|
||||
|
||||
//! Update distributors
|
||||
//! Update distributor, all models in list are set to given distributor
|
||||
void updateDistributor(const CDistributor &distributor);
|
||||
|
||||
//! All distributors used with models of this list
|
||||
CDistributorList getDistributors(bool onlyDbDistributors = true) const;
|
||||
|
||||
//! Update aircraft ICAO
|
||||
void updateAircraftIcao(const BlackMisc::Aviation::CAircraftIcaoCode &icao);
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@ namespace BlackMisc
|
||||
this->setDbKey(key);
|
||||
}
|
||||
|
||||
CDistributor::CDistributor(const QString &id, const QString &description, const QString &alias1, const QString &alias2) :
|
||||
m_description(description), m_alias1(alias1.trimmed().toUpper()), m_alias2(alias2.trimmed().toUpper())
|
||||
CDistributor::CDistributor(const QString &id, const QString &description, const QString &alias1, const QString &alias2, const CSimulatorInfo &simulator) :
|
||||
m_description(description), m_alias1(alias1.trimmed().toUpper()), m_alias2(alias2.trimmed().toUpper()), m_simulator(simulator)
|
||||
{
|
||||
this->setDbKey(id);
|
||||
}
|
||||
@@ -41,16 +41,24 @@ namespace BlackMisc
|
||||
return (distributor.hasAlias2() && this->matchesKeyOrAlias(distributor.getAlias2()));
|
||||
}
|
||||
|
||||
bool CDistributor::matchesSimulator(const CSimulatorInfo &simulator) const
|
||||
{
|
||||
return this->m_simulator.matchesAny(simulator);
|
||||
}
|
||||
|
||||
CVariant CDistributor::propertyByIndex(const CPropertyIndex &index) const
|
||||
{
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
if (IDatastoreObjectWithStringKey::canHandleIndex(index)) { return IDatastoreObjectWithStringKey::propertyByIndex(index); }
|
||||
if (IOrderable::canHandleIndex(index)) { return IOrderable::propertyByIndex(index); }
|
||||
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
case IndexAlias1: return CVariant::from(this->m_alias1);
|
||||
case IndexAlias2: return CVariant::from(this->m_alias2);
|
||||
case IndexDescription: return CVariant::from(this->m_description);
|
||||
case IndexSimulator: return m_simulator.propertyByIndex(index.copyFrontRemoved());
|
||||
default:
|
||||
return CValueObject::propertyByIndex(index);
|
||||
}
|
||||
@@ -60,6 +68,8 @@ namespace BlackMisc
|
||||
{
|
||||
if (index.isMyself()) { (*this) = variant.to<CDistributor>(); return; }
|
||||
if (IDatastoreObjectWithStringKey::canHandleIndex(index)) { IDatastoreObjectWithStringKey::setPropertyByIndex(variant, index); return; }
|
||||
if (IOrderable::canHandleIndex(index)) { IOrderable::setPropertyByIndex(variant, index); return; }
|
||||
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
@@ -72,6 +82,9 @@ namespace BlackMisc
|
||||
case IndexDescription:
|
||||
this->m_description = variant.value<QString>();
|
||||
break;
|
||||
case IndexSimulator:
|
||||
this->m_simulator.setPropertyByIndex(variant, index.copyFrontRemoved());
|
||||
break;
|
||||
default:
|
||||
CValueObject::setPropertyByIndex(variant, index);
|
||||
break;
|
||||
@@ -81,15 +94,14 @@ namespace BlackMisc
|
||||
int CDistributor::comparePropertyByIndex(const CDistributor &compareValue, const CPropertyIndex &index) const
|
||||
{
|
||||
if (IDatastoreObjectWithStringKey::canHandleIndex(index)) { return IDatastoreObjectWithStringKey::comparePropertyByIndex(compareValue, index); }
|
||||
if (IOrderable::canHandleIndex(index)) { return IOrderable::comparePropertyByIndex(compareValue, index); }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
case IndexAlias1:
|
||||
return this->m_alias1.compare(compareValue.m_alias1, Qt::CaseInsensitive);
|
||||
case IndexAlias2:
|
||||
return this->m_alias2.compare(compareValue.m_alias2, Qt::CaseInsensitive);
|
||||
case IndexDescription:
|
||||
return this->m_description.compare(compareValue.getDescription(), Qt::CaseInsensitive);
|
||||
case IndexAlias1: return this->m_alias1.compare(compareValue.m_alias1, Qt::CaseInsensitive);
|
||||
case IndexAlias2: return this->m_alias2.compare(compareValue.m_alias2, Qt::CaseInsensitive);
|
||||
case IndexDescription: return this->m_description.compare(compareValue.getDescription(), Qt::CaseInsensitive);
|
||||
case IndexSimulator: return this->m_simulator.comparePropertyByIndex(compareValue.m_simulator, index.copyFrontRemoved());
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -145,7 +157,7 @@ namespace BlackMisc
|
||||
return CDistributor();
|
||||
}
|
||||
|
||||
QString description(json.value(prefix + "description").toString());
|
||||
const QString description(json.value(prefix + "description").toString());
|
||||
if (description.isEmpty())
|
||||
{
|
||||
// stub, only key, maybe also timestamps
|
||||
@@ -154,13 +166,13 @@ namespace BlackMisc
|
||||
return distributorStub;
|
||||
}
|
||||
|
||||
QString alias1(json.value(prefix + "alias1").toString());
|
||||
QString alias2(json.value(prefix + "alias2").toString());
|
||||
const CSimulatorInfo simulator = CSimulatorInfo::fromDatabaseJson(json, prefix);
|
||||
const QString alias1(json.value(prefix + "alias1").toString());
|
||||
const QString alias2(json.value(prefix + "alias2").toString());
|
||||
Q_ASSERT_X(!description.isEmpty(), Q_FUNC_INFO, "Missing description");
|
||||
CDistributor distributor("", description, alias1, alias2);
|
||||
CDistributor distributor("", description, alias1, alias2, simulator);
|
||||
distributor.setKeyAndTimestampFromDatabaseJson(json, prefix);
|
||||
return distributor;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -13,7 +13,9 @@
|
||||
#define BLACKMISC_SIMULATION_DISTRIBUTOR_H
|
||||
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
#include "blackmisc/simulation/simulatorinfo.h"
|
||||
#include "blackmisc/valueobject.h"
|
||||
#include "blackmisc/orderable.h"
|
||||
#include "blackmisc/datastore.h"
|
||||
#include "blackmisc/statusmessagelist.h"
|
||||
#include <QJsonObject>
|
||||
@@ -25,7 +27,8 @@ namespace BlackMisc
|
||||
//! Value object encapsulating information of software distributor.
|
||||
class BLACKMISC_EXPORT CDistributor :
|
||||
public BlackMisc::CValueObject<CDistributor>,
|
||||
public BlackMisc::IDatastoreObjectWithStringKey
|
||||
public BlackMisc::IDatastoreObjectWithStringKey,
|
||||
public BlackMisc::IOrderable
|
||||
{
|
||||
public:
|
||||
//! Property indexes
|
||||
@@ -33,7 +36,8 @@ namespace BlackMisc
|
||||
{
|
||||
IndexDescription = CPropertyIndex::GlobalIndexCDistributor,
|
||||
IndexAlias1,
|
||||
IndexAlias2
|
||||
IndexAlias2,
|
||||
IndexSimulator
|
||||
};
|
||||
|
||||
//! Default constructor.
|
||||
@@ -43,7 +47,7 @@ namespace BlackMisc
|
||||
CDistributor(const QString &key);
|
||||
|
||||
//! Constructor
|
||||
CDistributor(const QString &id, const QString &description, const QString &alias1, const QString &alias2);
|
||||
CDistributor(const QString &id, const QString &description, const QString &alias1, const QString &alias2, const BlackMisc::Simulation::CSimulatorInfo &simulator = BlackMisc::Simulation::CSimulatorInfo());
|
||||
|
||||
//! Get description
|
||||
const QString &getDescription() const { return this->m_description;}
|
||||
@@ -72,12 +76,21 @@ namespace BlackMisc
|
||||
//! Alias 2?
|
||||
bool hasAlias2() const { return !this->m_alias2.isEmpty(); }
|
||||
|
||||
//! Simulator
|
||||
const BlackMisc::Simulation::CSimulatorInfo &getSimulator() const { return m_simulator; }
|
||||
|
||||
//! Set simulator
|
||||
void setSimulator(const BlackMisc::Simulation::CSimulatorInfo &simulator) { m_simulator = simulator; }
|
||||
|
||||
//! Matches key or alias
|
||||
bool matchesKeyOrAlias(const QString &keyOrAlias) const;
|
||||
|
||||
//! Matches key or alias
|
||||
bool matchesKeyOrAlias(const CDistributor &distributor) const;
|
||||
|
||||
//! Matches simulator
|
||||
bool matchesSimulator(const CSimulatorInfo &simulator) const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
|
||||
CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const;
|
||||
|
||||
@@ -103,20 +116,22 @@ namespace BlackMisc
|
||||
static CDistributor fromDatabaseJson(const QJsonObject &json, const QString &prefix = QString());
|
||||
|
||||
private:
|
||||
QString m_description; //!< description
|
||||
QString m_alias1; //!< alias name
|
||||
QString m_alias2; //!< alias name
|
||||
QString m_description; //!< description
|
||||
QString m_alias1; //!< alias name
|
||||
QString m_alias2; //!< alias name
|
||||
BlackMisc::Simulation::CSimulatorInfo m_simulator; //!< simulator
|
||||
|
||||
BLACK_METACLASS(
|
||||
CDistributor,
|
||||
BLACK_METAMEMBER(dbKey, 0, CaseInsensitiveComparison),
|
||||
BLACK_METAMEMBER(timestampMSecsSinceEpoch),
|
||||
BLACK_METAMEMBER(order),
|
||||
BLACK_METAMEMBER(description),
|
||||
BLACK_METAMEMBER(alias1, 0, CaseInsensitiveComparison),
|
||||
BLACK_METAMEMBER(alias2, 0, CaseInsensitiveComparison)
|
||||
BLACK_METAMEMBER(alias2, 0, CaseInsensitiveComparison),
|
||||
BLACK_METAMEMBER(simulator)
|
||||
);
|
||||
};
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
|
||||
@@ -74,5 +74,18 @@ namespace BlackMisc
|
||||
return sl;
|
||||
}
|
||||
|
||||
CDistributorList CDistributorList::matchesSimulator(const BlackMisc::Simulation::CSimulatorInfo &simulator) const
|
||||
{
|
||||
if (this->isEmpty()) { return CDistributorList(); }
|
||||
CDistributorList distributors;
|
||||
for (const CDistributor &distributor : (*this))
|
||||
{
|
||||
if (distributor.matchesSimulator(simulator))
|
||||
{
|
||||
distributors.push_back(distributor);
|
||||
}
|
||||
}
|
||||
return distributors;
|
||||
}
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
#include "blackmisc/simulation/distributor.h"
|
||||
#include "blackmisc/datastoreobjectlist.h"
|
||||
#include "blackmisc/orderablelist.h"
|
||||
#include "blackmisc/collection.h"
|
||||
#include "blackmisc/sequence.h"
|
||||
#include <QObject>
|
||||
@@ -29,6 +30,7 @@ namespace BlackMisc
|
||||
class BLACKMISC_EXPORT CDistributorList :
|
||||
public BlackMisc::CSequence<CDistributor>,
|
||||
public BlackMisc::IDatastoreObjectList<CDistributor, CDistributorList, QString>,
|
||||
public BlackMisc::IOrderableList<CDistributor, CDistributorList>,
|
||||
public BlackMisc::Mixin::MetaType<CDistributorList>
|
||||
{
|
||||
public:
|
||||
@@ -51,6 +53,9 @@ namespace BlackMisc
|
||||
|
||||
//! All DB keys and aliases
|
||||
QStringList getDbKeysAndAliases(bool sort) const;
|
||||
|
||||
//! Find for given simulator
|
||||
CDistributorList matchesSimulator(const BlackMisc::Simulation::CSimulatorInfo &simulator) const;
|
||||
};
|
||||
} //namespace
|
||||
} // namespace
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace BlackMisc
|
||||
for (const CAircraftCfgEntries &entries : (*this))
|
||||
{
|
||||
CAircraftModel m(entries.toAircraftModel());
|
||||
m.setSimulatorInfo(simInfo);
|
||||
m.setSimulator(simInfo);
|
||||
ml.push_back(m);
|
||||
}
|
||||
return ml;
|
||||
|
||||
@@ -112,7 +112,7 @@ namespace BlackMisc
|
||||
const CSimulatorInfo sim(CSimulatorInfo::FSX_P3D);
|
||||
model.setMSecsSinceEpoch(m_timestampMSecsSinceEpoch);
|
||||
model.setDistributor(distributor);
|
||||
model.setSimulatorInfo(sim);
|
||||
model.setSimulator(sim);
|
||||
return model;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "simulatorinfo.h"
|
||||
#include "buildconfig.h"
|
||||
#include "blackmisc/comparefunctions.h"
|
||||
#include "blackmisc/datastoreutility.h"
|
||||
#include "blackmisc/simulation/fscommon/fscommonutil.h"
|
||||
#include <algorithm>
|
||||
|
||||
@@ -204,6 +205,17 @@ namespace BlackMisc
|
||||
return sim;
|
||||
}
|
||||
|
||||
CSimulatorInfo CSimulatorInfo::fromDatabaseJson(const QJsonObject &json, const QString prefix)
|
||||
{
|
||||
bool fsx = CDatastoreUtility::dbBoolStringToBool(json.value(prefix + "simfsx").toString());
|
||||
bool fs9 = CDatastoreUtility::dbBoolStringToBool(json.value(prefix + "simfs9").toString());
|
||||
bool xp = CDatastoreUtility::dbBoolStringToBool(json.value(prefix + "simxplane").toString());
|
||||
bool p3d = CDatastoreUtility::dbBoolStringToBool(json.value(prefix + "simp3d").toString());
|
||||
|
||||
const CSimulatorInfo simInfo(fsx, fs9, xp, p3d);
|
||||
return simInfo;
|
||||
}
|
||||
|
||||
CCountPerSimulator::CCountPerSimulator()
|
||||
{
|
||||
this->m_counts.reserve(CSimulatorInfo::NumberOfSimulators + 1);
|
||||
|
||||
@@ -146,6 +146,9 @@ namespace BlackMisc
|
||||
//! Locally installed simulators
|
||||
static const CSimulatorInfo getLocallyInstalledSimulators();
|
||||
|
||||
//! From database JSON
|
||||
static CSimulatorInfo fromDatabaseJson(const QJsonObject &json, const QString prefix);
|
||||
|
||||
private:
|
||||
int m_simulator = static_cast<int>(None);
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ namespace BlackMisc
|
||||
|
||||
CAircraftModel model;
|
||||
model.setModelType(CAircraftModel::TypeOwnSimulatorModel);
|
||||
model.setSimulatorInfo(m_simulatorInfo);
|
||||
model.setSimulator(m_simulatorInfo);
|
||||
model.setFileName(aircraftIt.filePath());
|
||||
model.setModelString(modelString);
|
||||
|
||||
@@ -262,7 +262,7 @@ namespace BlackMisc
|
||||
CDistributor distributor(package.name);
|
||||
model.setDistributor(distributor);
|
||||
|
||||
model.setSimulatorInfo(m_simulatorInfo);
|
||||
model.setSimulator(m_simulatorInfo);
|
||||
installedModels.push_back(model);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user