mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-06 01:45:38 +08:00
Formatting, minor tweaks
This commit is contained in:
@@ -72,14 +72,9 @@ namespace BlackMisc
|
||||
|
||||
QString CAircraftIcaoCode::getDesignatorDbKey() const
|
||||
{
|
||||
if (this->isLoadedFromDb())
|
||||
{
|
||||
return this->getDesignator() + " " + this->getDbKeyAsStringInParentheses();
|
||||
}
|
||||
else
|
||||
{
|
||||
return this->getDesignator();
|
||||
}
|
||||
return (this->isLoadedFromDb()) ?
|
||||
this->getDesignator() % QStringLiteral(" ") % this->getDbKeyAsStringInParentheses() :
|
||||
this->getDesignator();
|
||||
}
|
||||
|
||||
QString CAircraftIcaoCode::convertToQString(bool i18n) const
|
||||
|
||||
@@ -80,8 +80,11 @@ namespace BlackMisc
|
||||
//! Designator and DB key
|
||||
QString getDesignatorDbKey() const;
|
||||
|
||||
//! Designator + Manufacturer
|
||||
QString getDesignatorManufacturer() const;
|
||||
|
||||
//! Set ICAO designator, e.g. "B737"
|
||||
void setDesignator(const QString &icaoDesignator) { this->m_designator = icaoDesignator.trimmed().toUpper(); }
|
||||
void setDesignator(const QString &icaoDesignator) { m_designator = icaoDesignator.trimmed().toUpper(); }
|
||||
|
||||
//! Aircraft designator?
|
||||
bool hasDesignator() const;
|
||||
@@ -99,10 +102,10 @@ namespace BlackMisc
|
||||
const QString &getIataCode() const { return m_iataCode; }
|
||||
|
||||
//! Set IATA code
|
||||
void setIataCode(const QString &iata) { this->m_iataCode = iata.toUpper().trimmed(); }
|
||||
void setIataCode(const QString &iata) { m_iataCode = iata.toUpper().trimmed(); }
|
||||
|
||||
//! Has IATA code?
|
||||
bool hasIataCode() const { return !this->m_iataCode.isEmpty(); }
|
||||
bool hasIataCode() const { return !m_iataCode.isEmpty(); }
|
||||
|
||||
//! IATA code same as designator?
|
||||
bool isIataSameAsDesignator() const;
|
||||
@@ -111,16 +114,16 @@ namespace BlackMisc
|
||||
const QString &getFamily() const { return m_family; }
|
||||
|
||||
//! Set family
|
||||
void setFamily(const QString &family) { this->m_family = family.toUpper().trimmed(); }
|
||||
void setFamily(const QString &family) { m_family = family.toUpper().trimmed(); }
|
||||
|
||||
//! Has family?
|
||||
bool hasFamily() const { return !this->m_family.isEmpty(); }
|
||||
bool hasFamily() const { return !m_family.isEmpty(); }
|
||||
|
||||
//! Family same as designator?
|
||||
bool isFamilySameAsDesignator() const;
|
||||
|
||||
//! Get type, e.g. "L2J"
|
||||
const QString &getCombinedType() const { return this->m_combinedType; }
|
||||
const QString &getCombinedType() const { return m_combinedType; }
|
||||
|
||||
//! Combined type available?
|
||||
bool hasValidCombinedType() const;
|
||||
@@ -138,7 +141,7 @@ namespace BlackMisc
|
||||
QString getAircraftType() const;
|
||||
|
||||
//! Set type
|
||||
void setCombinedType(const QString &type) { this->m_combinedType = type.trimmed().toUpper(); }
|
||||
void setCombinedType(const QString &type) { m_combinedType = type.trimmed().toUpper(); }
|
||||
|
||||
//! Get IACO model description, e.g. "A-330-200"
|
||||
const QString &getModelDescription() const { return m_modelDescription; }
|
||||
@@ -159,9 +162,6 @@ namespace BlackMisc
|
||||
//! \remark * can be used as wildcard, e.g. L*J, L**
|
||||
bool matchesCombinedType(const QString &combinedType) const;
|
||||
|
||||
//! Designator + Manufacturer
|
||||
QString getDesignatorManufacturer() const;
|
||||
|
||||
//! Set the model description (ICAO description)
|
||||
void setModelDescription(const QString &modelDescription) { m_modelDescription = modelDescription.trimmed(); }
|
||||
|
||||
@@ -172,13 +172,13 @@ namespace BlackMisc
|
||||
void setModelSwiftDescription(const QString &modelDescription) { m_modelSwiftDescription = modelDescription.trimmed(); }
|
||||
|
||||
//! Has model description?
|
||||
bool hasModelDescription() const { return !this->m_modelDescription.isEmpty(); }
|
||||
bool hasModelDescription() const { return !m_modelDescription.isEmpty(); }
|
||||
|
||||
//! Has IATA model description?
|
||||
bool hasModelIataDescription() const { return !this->m_modelIataDescription.isEmpty(); }
|
||||
bool hasModelIataDescription() const { return !m_modelIataDescription.isEmpty(); }
|
||||
|
||||
//! Has swift model description?
|
||||
bool hasModelSwiftDescription() const { return !this->m_modelSwiftDescription.isEmpty(); }
|
||||
bool hasModelSwiftDescription() const { return !m_modelSwiftDescription.isEmpty(); }
|
||||
|
||||
//! Get manufacturer, e.g. "Airbus"
|
||||
const QString &getManufacturer() const { return m_manufacturer; }
|
||||
|
||||
@@ -411,23 +411,23 @@ namespace BlackMisc
|
||||
return CAirlineIcaoCode();
|
||||
}
|
||||
|
||||
QString designator(json.value(prefix % QLatin1String("designator")).toString());
|
||||
QString designator(json.value(prefix % QStringLiteral("designator")).toString());
|
||||
if (!CAirlineIcaoCode::isValidAirlineDesignator(designator))
|
||||
{
|
||||
designator = CAirlineIcaoCode::normalizeDesignator(designator);
|
||||
}
|
||||
|
||||
const QString iata(json.value(prefix % QLatin1String("iata")).toString());
|
||||
const QString telephony(json.value(prefix % QLatin1String("callsign")).toString());
|
||||
const QString name(json.value(prefix % QLatin1String("name")).toString());
|
||||
const QString countryIso(json.value(prefix % QLatin1String("country")).toString());
|
||||
const QString countryName(json.value(prefix % QLatin1String("countryname")).toString());
|
||||
const QString groupName(json.value(prefix % QLatin1String("groupname")).toString());
|
||||
const QString groupDesignator(json.value(prefix % QLatin1String("groupdesignator")).toString());
|
||||
const int groupId(json.value(prefix % QLatin1String("groupid")).toInt(-1));
|
||||
const bool va = CDatastoreUtility::dbBoolStringToBool(json.value(prefix % QLatin1String("va")).toString());
|
||||
const bool operating = CDatastoreUtility::dbBoolStringToBool(json.value(prefix % QLatin1String("operating")).toString());
|
||||
const bool military = CDatastoreUtility::dbBoolStringToBool(json.value(prefix % QLatin1String("military")).toString());
|
||||
const QString iata(json.value(prefix % QStringLiteral("iata")).toString());
|
||||
const QString telephony(json.value(prefix % QStringLiteral("callsign")).toString());
|
||||
const QString name(json.value(prefix % QStringLiteral("name")).toString());
|
||||
const QString countryIso(json.value(prefix % QStringLiteral("country")).toString());
|
||||
const QString countryName(json.value(prefix % QStringLiteral("countryname")).toString());
|
||||
const QString groupName(json.value(prefix % QStringLiteral("groupname")).toString());
|
||||
const QString groupDesignator(json.value(prefix % QStringLiteral("groupdesignator")).toString());
|
||||
const int groupId(json.value(prefix % QStringLiteral("groupid")).toInt(-1));
|
||||
const bool va = CDatastoreUtility::dbBoolStringToBool(json.value(prefix % QStringLiteral("va")).toString());
|
||||
const bool operating = CDatastoreUtility::dbBoolStringToBool(json.value(prefix % QStringLiteral("operating")).toString());
|
||||
const bool military = CDatastoreUtility::dbBoolStringToBool(json.value(prefix % QStringLiteral("military")).toString());
|
||||
|
||||
CAirlineIcaoCode code(
|
||||
designator, name,
|
||||
|
||||
@@ -21,14 +21,14 @@ namespace BlackMisc
|
||||
{
|
||||
QString IDatastoreObjectWithIntegerKey::getDbKeyAsString() const
|
||||
{
|
||||
if (this->m_dbKey < 0) { return ""; }
|
||||
return QString::number(this->m_dbKey);
|
||||
if (m_dbKey < 0) { return ""; }
|
||||
return QString::number(m_dbKey);
|
||||
}
|
||||
|
||||
QString IDatastoreObjectWithIntegerKey::getDbKeyAsStringInParentheses(const QString &prefix) const
|
||||
{
|
||||
if (this->m_dbKey < 0) { return ""; }
|
||||
return prefix + "(" + QString::number(this->m_dbKey) + ")";
|
||||
if (m_dbKey < 0) { return ""; }
|
||||
return prefix + "(" + QString::number(m_dbKey) + ")";
|
||||
}
|
||||
|
||||
void IDatastoreObjectWithIntegerKey::setDbKey(const QString &key)
|
||||
@@ -36,7 +36,7 @@ namespace BlackMisc
|
||||
bool ok;
|
||||
int k = key.toInt(&ok);
|
||||
if (!ok) { k = -1; }
|
||||
this->m_dbKey = k;
|
||||
m_dbKey = k;
|
||||
}
|
||||
|
||||
bool IDatastoreObjectWithIntegerKey::isLoadedFromDb() const
|
||||
@@ -68,7 +68,7 @@ namespace BlackMisc
|
||||
|
||||
QJsonValue IDatastoreObjectWithIntegerKey::getDbKeyAsJsonValue() const
|
||||
{
|
||||
if (this->hasValidDbKey()) { return QJsonValue(this->m_dbKey); }
|
||||
if (this->hasValidDbKey()) { return QJsonValue(m_dbKey); }
|
||||
return QJsonValue();
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ namespace BlackMisc
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
case IndexDbIntegerKey: return CVariant::from(this->m_dbKey);
|
||||
case IndexDbIntegerKey: return CVariant::from(m_dbKey);
|
||||
case IndexDbKeyAsString: return CVariant::from(this->getDbKeyAsString());
|
||||
case IndexIsLoadedFromDb: return CVariant::from(this->hasValidDbKey());
|
||||
case IndexDatabaseIcon: return CVariant::from(this->toDatabaseIcon());
|
||||
@@ -112,10 +112,10 @@ namespace BlackMisc
|
||||
switch (i)
|
||||
{
|
||||
case IndexDbIntegerKey:
|
||||
this->m_dbKey = variant.toInt();
|
||||
m_dbKey = variant.toInt();
|
||||
break;
|
||||
case IndexDbKeyAsString:
|
||||
this->m_dbKey = stringToDbKey(variant.toQString());
|
||||
m_dbKey = stringToDbKey(variant.toQString());
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -128,7 +128,7 @@ namespace BlackMisc
|
||||
switch (i)
|
||||
{
|
||||
case IndexDbKeyAsString: // fall thru
|
||||
case IndexDbIntegerKey: return Compare::compare(this->m_dbKey, compareValue.getDbKey());
|
||||
case IndexDbIntegerKey: return Compare::compare(m_dbKey, compareValue.getDbKey());
|
||||
case IndexDatabaseIcon: return Compare::compare(this->hasValidDbKey(), compareValue.hasValidDbKey());
|
||||
default: break;
|
||||
}
|
||||
@@ -145,14 +145,14 @@ namespace BlackMisc
|
||||
|
||||
QJsonValue IDatastoreObjectWithStringKey::getDbKeyAsJsonValue() const
|
||||
{
|
||||
if (this->hasValidDbKey()) { return QJsonValue(this->m_dbKey); }
|
||||
if (this->hasValidDbKey()) { return QJsonValue(m_dbKey); }
|
||||
static const QJsonValue null;
|
||||
return null;
|
||||
}
|
||||
|
||||
QString IDatastoreObjectWithStringKey::getDbKeyAsStringInParentheses(const QString &prefix) const
|
||||
{
|
||||
if (this->m_dbKey.isEmpty()) { return ""; }
|
||||
if (m_dbKey.isEmpty()) { return ""; }
|
||||
return prefix + "(" + m_dbKey + ")";
|
||||
}
|
||||
|
||||
@@ -190,9 +190,9 @@ namespace BlackMisc
|
||||
switch (i)
|
||||
{
|
||||
case IndexDbKeyAsString: // fall thru
|
||||
case IndexDbStringKey: return CVariant::from(this->m_dbKey);
|
||||
case IndexDbStringKey: return CVariant::from(m_dbKey);
|
||||
case IndexDatabaseIcon: return CVariant::from(this->toDatabaseIcon());
|
||||
case IndexIsLoadedFromDb: return CVariant::from(this->m_loadedFromDb);
|
||||
case IndexIsLoadedFromDb: return CVariant::from(m_loadedFromDb);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -207,10 +207,10 @@ namespace BlackMisc
|
||||
{
|
||||
case IndexDbStringKey:
|
||||
case IndexDbKeyAsString:
|
||||
this->m_dbKey = variant.value<QString>();
|
||||
m_dbKey = variant.value<QString>();
|
||||
break;
|
||||
case IndexIsLoadedFromDb:
|
||||
this->m_loadedFromDb = variant.toBool();
|
||||
m_loadedFromDb = variant.toBool();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -224,7 +224,7 @@ namespace BlackMisc
|
||||
switch (i)
|
||||
{
|
||||
case IndexDbKeyAsString: // fall thru
|
||||
case IndexDbStringKey: return this->m_dbKey.compare(compareValue.getDbKey());
|
||||
case IndexDbStringKey: return m_dbKey.compare(compareValue.getDbKey());
|
||||
case IndexDatabaseIcon: return Compare::compare(this->hasValidDbKey(), compareValue.hasValidDbKey());
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace BlackMisc
|
||||
IndexSystemString
|
||||
};
|
||||
|
||||
//! Known system
|
||||
//! Known systems
|
||||
enum System
|
||||
{
|
||||
Unspecified, //!< unspecified
|
||||
|
||||
@@ -452,17 +452,17 @@ namespace BlackMisc
|
||||
|
||||
int CAircraftModelList::keepModelsWithString(const QStringList &modelStrings, Qt::CaseSensitivity sensitivity)
|
||||
{
|
||||
int cs = this->size();
|
||||
const int cs = this->size();
|
||||
(*this) = (findByModelStrings(modelStrings, sensitivity));
|
||||
int d = cs - this->size();
|
||||
const int d = cs - this->size();
|
||||
return d;
|
||||
}
|
||||
|
||||
int CAircraftModelList::removeModelsWithString(const QStringList &modelStrings, Qt::CaseSensitivity sensitivity)
|
||||
{
|
||||
int cs = this->size();
|
||||
const int cs = this->size();
|
||||
(*this) = (this->findByNotInModelStrings(modelStrings, sensitivity));
|
||||
int d = cs - this->size();
|
||||
const int d = cs - this->size();
|
||||
return d;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user