mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
refs #773, sent model name to DB
* improved model parsing for FSX family * improved description for model name #772 and Ref T1 contain the related backend fixes
This commit is contained in:
committed by
Mathew Sutcliffe
parent
bf8198e2c2
commit
cda3ece82b
@@ -75,6 +75,7 @@ namespace BlackMisc
|
||||
|
||||
// filename not in DB
|
||||
obj.insert("id", this->getDbKeyAsJsonValue());
|
||||
obj.insert("name", this->getName());
|
||||
obj.insert("modelstring", QJsonValue(this->m_modelString));
|
||||
obj.insert("description", QJsonValue(this->m_description));
|
||||
obj.insert("mode", QJsonValue(getModelModeAsString().left(1).toUpper()));
|
||||
|
||||
@@ -58,10 +58,16 @@ namespace BlackMisc
|
||||
QString CAircraftCfgEntries::getUiCombinedDescription() const
|
||||
{
|
||||
QString d(this->m_uiManufacturer);
|
||||
if (m_uiType.isEmpty()) { return d; }
|
||||
if (d.isEmpty()) { return m_uiType; }
|
||||
d += " ";
|
||||
d += m_uiType;
|
||||
if (!this->getUiType().isEmpty())
|
||||
{
|
||||
d += " ";
|
||||
d += this->getUiType();
|
||||
}
|
||||
if (!this->getUiVariation().isEmpty())
|
||||
{
|
||||
d += " ";
|
||||
d += this->getUiVariation();
|
||||
}
|
||||
return d;
|
||||
}
|
||||
|
||||
@@ -124,7 +130,7 @@ namespace BlackMisc
|
||||
{
|
||||
// creates raw, unconsolidated data
|
||||
CAircraftModel model(this->getTitle(), CAircraftModel::TypeOwnSimulatorModel);
|
||||
model.setDescription(this->getUiCombinedDescription()); // Manufacturer and type
|
||||
model.setDescription(this->getUiCombinedDescription()); // Manufacturer, variation, type
|
||||
model.setFileName(this->getFileName());
|
||||
model.setName(this->getSimName());
|
||||
model.setUtcTimestamp(this->getUtcTimestamp()); // aircraft.cfg file last modified
|
||||
@@ -187,10 +193,12 @@ namespace BlackMisc
|
||||
case IndexAirline: return CVariant::from(this->m_atcAirline);
|
||||
case IndexAtcType: return CVariant::from(this->m_atcType);
|
||||
case IndexAtcModel: return CVariant::from(this->m_atcModel);
|
||||
case IndexAtcIdColor: return CVariant::from(this->m_atcIdColor);
|
||||
case IndexParkingCode: return CVariant::from(this->m_atcParkingCode);
|
||||
case IndexDescription: return CVariant::from(this->m_description);
|
||||
case IndexUiType: return CVariant::from(this->m_uiType);
|
||||
case IndexUiManufacturer: return CVariant::from(this->m_uiManufacturer);
|
||||
case IndexUiVariation: return CVariant::from(this->m_uiVariation);
|
||||
case IndexTexture: return CVariant::from(this->m_texture);
|
||||
case IndexSimulatorName: return CVariant::from(this->m_simName);
|
||||
case IndexCreatedBy: return CVariant::from(this->m_createdBy);
|
||||
@@ -212,9 +220,11 @@ namespace BlackMisc
|
||||
case IndexAirline: this->setTitle(this->m_atcAirline); break;
|
||||
case IndexAtcType: this->setAtcType(variant.toQString()); break;
|
||||
case IndexAtcModel: this->setAtcModel(variant.toQString()); break;
|
||||
case IndexAtcIdColor: this->setAtcIdColor(variant.toQString()); break;
|
||||
case IndexParkingCode: this->setAtcParkingCode(variant.toQString()); break;
|
||||
case IndexDescription: this->setDescription(variant.toQString()); break;
|
||||
case IndexUiType: this->setUiType(variant.toQString()); break;
|
||||
case IndexUiVariation: this->setUiVariation(variant.toQString()); break;
|
||||
case IndexUiManufacturer: this->setUiManufacturer(variant.toQString()); break;
|
||||
case IndexTexture: this->setTexture(variant.toQString()); break;
|
||||
case IndexSimulatorName: this->setSimName(variant.toQString()); break;
|
||||
|
||||
@@ -46,9 +46,11 @@ namespace BlackMisc
|
||||
IndexAirline,
|
||||
IndexAtcType,
|
||||
IndexAtcModel,
|
||||
IndexAtcIdColor,
|
||||
IndexParkingCode,
|
||||
IndexDescription,
|
||||
IndexUiType,
|
||||
IndexUiVariation,
|
||||
IndexUiManufacturer,
|
||||
IndexTexture,
|
||||
IndexSimulatorName,
|
||||
@@ -86,6 +88,9 @@ namespace BlackMisc
|
||||
//! ATC airline
|
||||
const QString &getAtcAirline() const { return this->m_atcAirline; }
|
||||
|
||||
//! ATC id color (e.g. 0xffffffff)
|
||||
const QString &getAtcIdColor() const { return this->m_atcIdColor; }
|
||||
|
||||
//! Sim name
|
||||
const QString &getSimName() const { return this->m_simName; }
|
||||
|
||||
@@ -98,6 +103,9 @@ namespace BlackMisc
|
||||
//! UI type (e.g. A321-231 IAE)
|
||||
const QString &getUiType() const { return this->m_uiType; }
|
||||
|
||||
//! UI variation (e.g. White,Green)
|
||||
const QString &getUiVariation() const { return this->m_uiVariation; }
|
||||
|
||||
//! UI manufacturer (e.g. Airbus)
|
||||
const QString &getUiManufacturer() const { return this->m_uiManufacturer; }
|
||||
|
||||
@@ -134,6 +142,9 @@ namespace BlackMisc
|
||||
//! Airline
|
||||
void setAtcAirline(const QString &airline);
|
||||
|
||||
//! ATC color (e.g. 0xffffffff)
|
||||
void setAtcIdColor(const QString &color) { this->m_atcIdColor = color.trimmed(); }
|
||||
|
||||
//! Simulator name
|
||||
void setSimName(const QString &simName);
|
||||
|
||||
@@ -149,6 +160,9 @@ namespace BlackMisc
|
||||
//! UI type (e.g. A321-231 IAE)
|
||||
void setUiType(const QString &type);
|
||||
|
||||
//! UI variation (e.g. White,Green)
|
||||
void setUiVariation(const QString &variation) { this->m_uiVariation = variation.trimmed(); }
|
||||
|
||||
//! UI manufacturer (e.g. Airbus)
|
||||
void setUiManufacturer(const QString &manufacturer) { this->m_uiManufacturer = manufacturer.trimmed(); }
|
||||
|
||||
@@ -182,9 +196,11 @@ namespace BlackMisc
|
||||
QString m_atcModel; //!< ATC model
|
||||
QString m_atcAirline; //!< ATC airline
|
||||
QString m_atcParkingCode; //!< ATC parking code
|
||||
QString m_atcIdColor; //!< e.g. 0xffffffff (not for all aircrafts)
|
||||
QString m_description; //!< descriptive text
|
||||
QString m_uiType; //!< e.g. A321-231 IAE
|
||||
QString m_uiManufacturer; //!< e.g. Airbus
|
||||
QString m_uiVariation; //!< e.g. White,Green
|
||||
QString m_texture; //!< texture, needed to identify thumbnail.jpg
|
||||
QString m_simName; //!< name in simulator
|
||||
QString m_createdBy; //!< created by, "distributor"
|
||||
@@ -198,9 +214,11 @@ namespace BlackMisc
|
||||
BLACK_METAMEMBER(atcType),
|
||||
BLACK_METAMEMBER(atcModel),
|
||||
BLACK_METAMEMBER(atcParkingCode),
|
||||
BLACK_METAMEMBER(atcIdColor),
|
||||
BLACK_METAMEMBER(description),
|
||||
BLACK_METAMEMBER(uiType),
|
||||
BLACK_METAMEMBER(uiManufacturer),
|
||||
BLACK_METAMEMBER(uiVariation),
|
||||
BLACK_METAMEMBER(texture),
|
||||
BLACK_METAMEMBER(simName),
|
||||
BLACK_METAMEMBER(createdBy),
|
||||
|
||||
@@ -166,7 +166,7 @@ namespace BlackMisc
|
||||
}
|
||||
|
||||
// set directory with name filters, get aircraft.cfg and sub directories
|
||||
QDir dir(directory, fileFilter(), QDir::Name, QDir::Files | QDir::AllDirs | QDir::NoDotAndDotDot);
|
||||
const QDir dir(directory, fileFilter(), QDir::Name, QDir::Files | QDir::AllDirs | QDir::NoDotAndDotDot);
|
||||
if (!dir.exists())
|
||||
{
|
||||
*ok = true;
|
||||
@@ -177,7 +177,7 @@ namespace BlackMisc
|
||||
CAircraftCfgEntriesList result;
|
||||
|
||||
// Dirs last is crucial,since I will break recursion on "aircraft.cfg" level
|
||||
QFileInfoList files = dir.entryInfoList(QDir::Files | QDir::AllDirs | QDir::NoDotAndDotDot, QDir::DirsLast);
|
||||
const QFileInfoList files = dir.entryInfoList(QDir::Files | QDir::AllDirs | QDir::NoDotAndDotDot, QDir::DirsLast);
|
||||
for (const auto &fileInfo : files)
|
||||
{
|
||||
if (m_cancelLoading) { return CAircraftCfgEntriesList(); }
|
||||
@@ -251,9 +251,15 @@ namespace BlackMisc
|
||||
if (lineFixed.startsWith("//")) { break; }
|
||||
if (atcType.isEmpty() || atcModel.isEmpty())
|
||||
{
|
||||
QString c = getFixedIniLineContent(lineFixed);
|
||||
if (lineFixed.startsWith("atc_type", Qt::CaseInsensitive)) { atcType = c; }
|
||||
else if (lineFixed.startsWith("atc_model", Qt::CaseInsensitive)) { atcModel = c; }
|
||||
const QString c = getFixedIniLineContent(lineFixed);
|
||||
if (lineFixed.startsWith("atc_type", Qt::CaseInsensitive))
|
||||
{
|
||||
atcType = c;
|
||||
}
|
||||
else if (lineFixed.startsWith("atc_model", Qt::CaseInsensitive))
|
||||
{
|
||||
atcModel = c;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -261,31 +267,45 @@ namespace BlackMisc
|
||||
{
|
||||
if (lineFixed.startsWith("//")) { break; }
|
||||
CAircraftCfgEntries &e = tempEntries[tempEntries.size() - 1];
|
||||
if (lineFixed.startsWith("atc_parking_codes", Qt::CaseInsensitive))
|
||||
if (lineFixed.startsWith("atc_", Qt::CaseInsensitive))
|
||||
{
|
||||
e.setAtcParkingCode(getFixedIniLineContent(lineFixed));
|
||||
if (lineFixed.startsWith("atc_parking_codes", Qt::CaseInsensitive))
|
||||
{
|
||||
e.setAtcParkingCode(getFixedIniLineContent(lineFixed));
|
||||
}
|
||||
else if (lineFixed.startsWith("atc_airline", Qt::CaseInsensitive))
|
||||
{
|
||||
e.setAtcAirline(getFixedIniLineContent(lineFixed));
|
||||
}
|
||||
else if (lineFixed.startsWith("atc_id_color", Qt::CaseInsensitive))
|
||||
{
|
||||
e.setAtcIdColor(getFixedIniLineContent(lineFixed));
|
||||
}
|
||||
}
|
||||
else if (lineFixed.startsWith("atc_airline", Qt::CaseInsensitive))
|
||||
else if (lineFixed.startsWith("ui_", Qt::CaseInsensitive))
|
||||
{
|
||||
e.setAtcAirline(getFixedIniLineContent(lineFixed));
|
||||
if (lineFixed.startsWith("ui_manufacturer", Qt::CaseInsensitive))
|
||||
{
|
||||
e.setUiManufacturer(getFixedIniLineContent(lineFixed));
|
||||
}
|
||||
else if (lineFixed.startsWith("ui_typerole", Qt::CaseInsensitive))
|
||||
{
|
||||
bool r = getFixedIniLineContent(lineFixed).toLower().contains("rotor");
|
||||
e.setRotorcraft(r);
|
||||
}
|
||||
else if (lineFixed.startsWith("ui_type", Qt::CaseInsensitive))
|
||||
{
|
||||
e.setUiType(getFixedIniLineContent(lineFixed));
|
||||
}
|
||||
else if (lineFixed.startsWith("ui_variation", Qt::CaseInsensitive))
|
||||
{
|
||||
e.setUiVariation(getFixedIniLineContent(lineFixed));
|
||||
}
|
||||
}
|
||||
else if (lineFixed.startsWith("description", Qt::CaseInsensitive))
|
||||
{
|
||||
e.setDescription(getFixedIniLineContent(lineFixed));
|
||||
}
|
||||
else if (lineFixed.startsWith("ui_manufacturer", Qt::CaseInsensitive))
|
||||
{
|
||||
e.setUiManufacturer(getFixedIniLineContent(lineFixed));
|
||||
}
|
||||
else if (lineFixed.startsWith("ui_typerole", Qt::CaseInsensitive))
|
||||
{
|
||||
bool r = getFixedIniLineContent(lineFixed).toLower().contains("rotor");
|
||||
e.setRotorcraft(r);
|
||||
}
|
||||
else if (lineFixed.startsWith("ui_type", Qt::CaseInsensitive))
|
||||
{
|
||||
e.setUiType(getFixedIniLineContent(lineFixed));
|
||||
}
|
||||
else if (lineFixed.startsWith("texture", Qt::CaseInsensitive))
|
||||
{
|
||||
e.setTexture(getFixedIniLineContent(lineFixed));
|
||||
|
||||
Reference in New Issue
Block a user