Fixed clazy warnings: empty QStringLiteral.

This commit is contained in:
Mat Sutcliffe
2018-12-17 16:40:59 +00:00
parent 268d858e2d
commit 333ea1b8df
37 changed files with 81 additions and 83 deletions

View File

@@ -399,7 +399,7 @@ namespace BlackMisc
QString CAircraftIcaoCode::getDesignatorManufacturer() const
{
return (this->hasDesignator() ? this->getDesignator() : QStringLiteral("????")) %
(this->hasManufacturer() ? (QStringLiteral(" ") % this->getManufacturer()) : QStringLiteral(""));
(this->hasManufacturer() ? (QStringLiteral(" ") % this->getManufacturer()) : QString());
}
bool CAircraftIcaoCode::hasManufacturer() const
@@ -478,8 +478,8 @@ namespace BlackMisc
QString CAircraftIcaoCode::getCombinedIcaoStringWithKey() const
{
return (this->hasDesignator() ? this->getDesignator() : QStringLiteral("????")) %
(this->hasManufacturer() ? (QStringLiteral(" ") % this->getManufacturer()) : QStringLiteral("")) %
(this->hasModelDescription() ? (QStringLiteral(" ") % this->getModelDescription()) : QStringLiteral("")) %
(this->hasManufacturer() ? (QStringLiteral(" ") % this->getManufacturer()) : QString()) %
(this->hasModelDescription() ? (QStringLiteral(" ") % this->getModelDescription()) : QString()) %
this->getDbKeyAsStringInParentheses(" ");
}
@@ -487,9 +487,9 @@ namespace BlackMisc
{
if (!this->hasIataCode()) { return ""; }
return this->getIataCode() % QStringLiteral(" [IATA") %
(this->hasDesignator() ? (QStringLiteral(" ") % this->getDesignator()) : QStringLiteral("")) %
(this->hasManufacturer() ? (QStringLiteral(" ") % this->getManufacturer()) : QStringLiteral("")) %
(this->hasModelDescription() ? (QStringLiteral(" ") % this->getModelDescription()) : QStringLiteral("")) %
(this->hasDesignator() ? (QStringLiteral(" ") % this->getDesignator()) : QString()) %
(this->hasManufacturer() ? (QStringLiteral(" ") % this->getManufacturer()) : QString()) %
(this->hasModelDescription() ? (QStringLiteral(" ") % this->getModelDescription()) : QString()) %
this->getDbKeyAsStringInParentheses(" ");
}
@@ -497,9 +497,9 @@ namespace BlackMisc
{
if (!this->hasFamily()) { return ""; }
return this->getFamily() % QStringLiteral(" [family") %
(this->hasDesignator() ? (QStringLiteral(" ") % this->getDesignator()) : QStringLiteral("")) %
(this->hasManufacturer() ? (QStringLiteral(" ") % this->getManufacturer()) : QStringLiteral("")) %
(this->hasModelDescription() ? (QStringLiteral(" ") % this->getModelDescription()) : QStringLiteral("")) %
(this->hasDesignator() ? (QStringLiteral(" ") % this->getDesignator()) : QString()) %
(this->hasManufacturer() ? (QStringLiteral(" ") % this->getManufacturer()) : QString()) %
(this->hasModelDescription() ? (QStringLiteral(" ") % this->getModelDescription()) : QString()) %
this->getDbKeyAsStringInParentheses(" ");
}

View File

@@ -46,7 +46,7 @@ namespace BlackMisc
{
return QStringLiteral("ts: ") % this->getFormattedTimestampAndOffset(true) %
QStringLiteral(" details: ") % this->getPartsDetailsAsString() %
(m_guessingDetails.isEmpty() ? QStringLiteral("") : QStringLiteral(" - ") % m_guessingDetails) %
(m_guessingDetails.isEmpty() ? QString() : QStringLiteral(" - ") % m_guessingDetails) %
QStringLiteral(" | on ground: ") % BlackMisc::boolToYesNo(m_isOnGround) %
QStringLiteral(" | lights: ") % m_lights.toQString(i18n) %
QStringLiteral(" | gear down: ") % BlackMisc::boolToYesNo(m_gearDown) %

View File

@@ -72,7 +72,7 @@ namespace BlackMisc
QStringLiteral(" | alt: ") % this->getAltitude().valueRoundedWithUnit(CLengthUnit::ft(), 1) %
QStringLiteral(" ") % this->getCorrectedAltitude().valueRoundedWithUnit(CLengthUnit::ft(), 1) %
QStringLiteral("[cor] | og: ") % this->getOnGroundInfo() %
(m_onGroundGuessingDetails.isEmpty() ? QStringLiteral("") : QStringLiteral(" ") % m_onGroundGuessingDetails) %
(m_onGroundGuessingDetails.isEmpty() ? QString() : QStringLiteral(" ") % m_onGroundGuessingDetails) %
QStringLiteral(" | cg: ") %
(m_cg.isNull() ? QStringLiteral("null") : m_cg.valueRoundedWithUnit(CLengthUnit::m(), 1) % QStringLiteral(" ") % m_cg.valueRoundedWithUnit(CLengthUnit::ft(), 1)) %
QStringLiteral(" | offset: ") %

View File

@@ -91,8 +91,8 @@ namespace BlackMisc
QString CAirlineIcaoCode::getDesignatorNameCountry() const
{
return this->getDesignator() %
(this->hasName() ? (QStringLiteral(" ") % this->getName()) : QStringLiteral("")) %
(this->hasValidCountry() ? (QStringLiteral(" ") % this->getCountryIso()) : QStringLiteral(""));
(this->hasName() ? (QStringLiteral(" ") % this->getName()) : QString()) %
(this->hasValidCountry() ? (QStringLiteral(" ") % this->getCountryIso()) : QString());
}
QString CAirlineIcaoCode::getSimplifiedName() const
@@ -185,7 +185,7 @@ namespace BlackMisc
{
Q_UNUSED(i18n);
return this->getDesignatorDbKey() %
(this->hasName() ? QStringLiteral(" ") % m_name : QStringLiteral("")) %
(this->hasName() ? QStringLiteral(" ") % m_name : QString()) %
QStringLiteral(" Op: ") % boolToYesNo(this->isOperating()) %
QStringLiteral(" VA: ") % boolToYesNo(this->isVirtualAirline()) %
QStringLiteral(" Mil: ") % boolToYesNo(this->isMilitary());
@@ -302,8 +302,8 @@ namespace BlackMisc
QString CAirlineIcaoCode::getCombinedStringWithKey() const
{
return (this->hasValidDesignator() ? this->getVDesignator() : QStringLiteral("")) %
(this->hasName() ? QStringLiteral(" ") % m_name : QStringLiteral("")) %
return (this->hasValidDesignator() ? this->getVDesignator() : QString()) %
(this->hasName() ? QStringLiteral(" ") % m_name : QString()) %
this->getDbKeyAsStringInParentheses(" ");
}

View File

@@ -316,7 +316,7 @@ namespace BlackMisc
QString CAltitude::asFpICAOAltitudeString() const
{
if (this->isNull()) { return QStringLiteral(""); }
if (this->isNull()) { return {}; }
if (this->isFlightLevel())
{
if (this->getUnit() == CLengthUnit::m())

View File

@@ -107,18 +107,18 @@ namespace BlackMisc
QLatin1String(" online: ") % boolToYesNo(m_isOnline) %
// controller
(m_controller.isNull() ? QStringLiteral("") :
(m_controller.isNull() ? QString() :
QStringLiteral(" ") % m_controller.toQString(i18n)) %
// frequency
QLatin1Char(' ') % m_frequency.valueRoundedWithUnit(3, i18n) %
// ATIS
(!this->hasAtis() ? QStringLiteral("") :
(!this->hasAtis() ? QString() :
QStringLiteral(" ") % m_atis.toQString(i18n)) %
// METAR
(!this->hasMetar() ? QStringLiteral("") :
(!this->hasMetar() ? QString() :
QStringLiteral(" ") % m_metar.toQString(i18n)) %
// range

View File

@@ -132,7 +132,7 @@ namespace BlackMisc
return m_callsign.left(4).toUpper();
}
}
return QStringLiteral("");
return {};
}
bool CCallsign::isAtcAlikeCallsign() const

View File

@@ -50,7 +50,7 @@ namespace BlackMisc
QString CCallsignSet::getCallsignsAsString(bool sorted, const QString &separator) const
{
if (this->isEmpty()) { return QStringLiteral(""); }
if (this->isEmpty()) { return {}; }
return this->getCallsignStrings(sorted).join(separator);
}

View File

@@ -65,11 +65,11 @@ namespace BlackMisc
QString CFlightPlanRemarks::convertToQString(bool i18n) const
{
const QString s =
(m_registration.isEmpty() ? QStringLiteral("") : QStringLiteral("reg.: ") % m_registration.toQString(i18n))
% (!this->hasValidAirlineIcao() ? QStringLiteral("") : QStringLiteral(" airline: ") % m_airlineIcao.getDesignator())
% (m_radioTelephony.isEmpty() ? QStringLiteral("") : QStringLiteral(" radio tel.:") % m_radioTelephony)
% (m_flightOperator.isEmpty() ? QStringLiteral("") : QStringLiteral(" operator: ") % m_flightOperator)
% (!m_selcalCode.isValid() ? QStringLiteral("") : QStringLiteral(" SELCAL: ") % m_selcalCode.getCode())
(m_registration.isEmpty() ? QString() : QStringLiteral("reg.: ") % m_registration.toQString(i18n))
% (!this->hasValidAirlineIcao() ? QString() : QStringLiteral(" airline: ") % m_airlineIcao.getDesignator())
% (m_radioTelephony.isEmpty() ? QString() : QStringLiteral(" radio tel.:") % m_radioTelephony)
% (m_flightOperator.isEmpty() ? QString() : QStringLiteral(" operator: ") % m_flightOperator)
% (!m_selcalCode.isValid() ? QString() : QStringLiteral(" SELCAL: ") % m_selcalCode.getCode())
% QStringLiteral(" voice: ") % m_voiceCapabilities.toQString(i18n);
return s.simplified().trimmed();
}
@@ -587,7 +587,7 @@ namespace BlackMisc
QString s = prefix;
if (!icao.isEmpty())
{
s += (s.isEmpty() ? QStringLiteral("") : QStringLiteral("/")) % icao;
s += (s.isEmpty() ? QString() : QStringLiteral("/")) % icao;
}
if (suffix.isEmpty()) { return s; }
if (s.isEmpty()) { return suffix; }

View File

@@ -71,7 +71,7 @@ namespace BlackMisc
{
return this->getCombinedCode() % (
this->getDescription().isEmpty() ?
QStringLiteral("") :
QString() :
(QStringLiteral(" ") % this->getDescription())
);
}