refs #768, misc adjustments

* changed signature of ownAircraftModelChanged to model
* added function for a reverse lookup of a model (string->model) and use it when model changed
* renamed function to updateByLocalFileNames
This commit is contained in:
Klaus Basan
2016-10-06 21:24:54 +02:00
committed by Mathew Sutcliffe
parent 501bea0960
commit bf8198e2c2
10 changed files with 112 additions and 42 deletions

View File

@@ -101,7 +101,7 @@ namespace BlackMisc
QString CAircraftModel::toDatabaseJsonString(QJsonDocument::JsonFormat format) const
{
return QJsonDocument(toDatabaseJson()).toJson(format);
return QJsonDocument(this->toDatabaseJson()).toJson(format);
}
bool CAircraftModel::canInitializeFromFsd() const
@@ -453,12 +453,13 @@ namespace BlackMisc
return;
}
this->updateByLocalFileNames(otherModel);
this->updateLocalFileNames(otherModel);
if (this->m_callsign.isEmpty()) { this->setCallsign(otherModel.getCallsign()); }
if (this->m_modelString.isEmpty()) { this->setModelString(otherModel.getModelString()); }
if (this->m_description.isEmpty() || this->m_description.startsWith(CAircraftModel::autoGenerated(), Qt::CaseInsensitive)) { this->setDescription(otherModel.getDescription()); }
if (this->m_name.isEmpty()) { this->setName(otherModel.getName()); }
if (this->m_modelType == TypeUnknown) { this->m_modelType = otherModel.getModelType(); }
if (this->m_modelMode == Undefined) { this->m_modelType = otherModel.getModelType(); }
if (this->m_description.isEmpty() || this->m_description.startsWith(CAircraftModel::autoGenerated(), Qt::CaseInsensitive)) { this->setDescription(otherModel.getDescription()); }
if (this->m_simulator.isUnspecified())
{
this->setSimulator(otherModel.getSimulator());
@@ -517,7 +518,7 @@ namespace BlackMisc
this->m_fileName = CAircraftModel::normalizeFileNameForDb(this->m_fileName);
}
void CAircraftModel::updateByLocalFileNames(const CAircraftModel &model)
void CAircraftModel::updateLocalFileNames(const CAircraftModel &model)
{
if (this->getModelType() == CAircraftModel::TypeOwnSimulatorModel)
{