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

@@ -1048,7 +1048,7 @@ namespace BlackCore
QStringLiteral("\n\n") % QStringLiteral("\n\n") %
QStringLiteral("Situation: ") % s.toQString(false, true, true, true, true, sep); QStringLiteral("Situation: ") % s.toQString(false, true, true, true, true, sep);
} }
if (p.tsCurrent > 0) { dm += (dm.isEmpty() ? QStringLiteral("") : QStringLiteral("\n\n")) % QStringLiteral("Parts: ") % p.toQString(sep); } if (p.tsCurrent > 0) { dm += (dm.isEmpty() ? QString() : QStringLiteral("\n\n")) % QStringLiteral("Parts: ") % p.toQString(sep); }
return dm; return dm;
} }

View File

@@ -324,9 +324,9 @@ namespace BlackGui
QString CCopyConfigurationComponent::getOtherVersionsSelectedDirectory() const QString CCopyConfigurationComponent::getOtherVersionsSelectedDirectory() const
{ {
if (ui->cb_OtherVersions->count() < 1) { return QStringLiteral(""); } if (ui->cb_OtherVersions->count() < 1) { return {}; }
const QFileInfoList dirs(CDirectoryUtils::applicationDataDirectories()); const QFileInfoList dirs(CDirectoryUtils::applicationDataDirectories());
if (dirs.isEmpty()) { return QStringLiteral(""); } if (dirs.isEmpty()) { return {}; }
const QString otherVersionDir = m_otherVersionDirs.at(ui->cb_OtherVersions->currentIndex()); const QString otherVersionDir = m_otherVersionDirs.at(ui->cb_OtherVersions->currentIndex());
QString dir; QString dir;
for (const QFileInfo &info : dirs) for (const QFileInfo &info : dirs)
@@ -337,7 +337,7 @@ namespace BlackGui
break; break;
} }
} }
if (dir.isEmpty()) { return QStringLiteral(""); } if (dir.isEmpty()) { return {}; }
dir = CFileUtils::appendFilePaths(dir, ui->rb_Cache->isChecked() ? dir = CFileUtils::appendFilePaths(dir, ui->rb_Cache->isChecked() ?
CDataCache::relativeFilePath() : CDataCache::relativeFilePath() :
CSettingsCache::relativeFilePath()); CSettingsCache::relativeFilePath());

View File

@@ -701,7 +701,7 @@ namespace BlackGui
{ {
if (ui->cb_Heavy->isChecked()) { return QStringLiteral("H"); } if (ui->cb_Heavy->isChecked()) { return QStringLiteral("H"); }
else if (ui->cb_Tcas->isChecked()) { return QStringLiteral("T"); } else if (ui->cb_Tcas->isChecked()) { return QStringLiteral("T"); }
return QStringLiteral(""); return {};
} }
CAircraftIcaoCode CFlightPlanComponent::getAircraftIcaoCode() const CAircraftIcaoCode CFlightPlanComponent::getAircraftIcaoCode() const

View File

@@ -586,8 +586,8 @@ namespace BlackGui
{ {
const QString ac( const QString ac(
ownAircraft.getAircraftIcaoCodeDesignator() % ownAircraft.getAircraftIcaoCodeDesignator() %
(ownAircraft.hasAirlineDesignator() ? (QLatin1Char(' ') % ownAircraft.getAirlineIcaoCodeDesignator()) : QStringLiteral("")) % (ownAircraft.hasAirlineDesignator() ? (QLatin1Char(' ') % ownAircraft.getAirlineIcaoCodeDesignator()) : QString()) %
(ownAircraft.hasModelString() ? (QLatin1Char(' ') % ownAircraft.getModelString()) : QStringLiteral("")) (ownAircraft.hasModelString() ? (QLatin1Char(' ') % ownAircraft.getModelString()) : QString())
); );
ui->le_LoginSince->setText(QDateTime::currentDateTimeUtc().toString()); ui->le_LoginSince->setText(QDateTime::currentDateTimeUtc().toString());
ui->le_LoginAsAircaft->setText(ac); ui->le_LoginAsAircaft->setText(ac);

View File

@@ -539,7 +539,7 @@ namespace BlackGui
if (index < 0 || index == ui->tw_TextMessages->indexOf(ui->tb_TextMessagesAll)) if (index < 0 || index == ui->tw_TextMessages->indexOf(ui->tb_TextMessagesAll))
{ {
CLogMessage(this).validationError("Incorrect message channel"); CLogMessage(this).validationError("Incorrect message channel");
return QStringLiteral(""); return {};
} }
else else
{ {

View File

@@ -575,7 +575,7 @@ namespace BlackGui
void CDockWidget::forceStyleSheetUpdate() void CDockWidget::forceStyleSheetUpdate()
{ {
const QString qss = this->styleSheet(); const QString qss = this->styleSheet();
this->setStyleSheet(qss.isEmpty() ? QStringLiteral(" ") : QStringLiteral("")); this->setStyleSheet(qss.isEmpty() ? QStringLiteral(" ") : QString());
this->setStyleSheet(qss); this->setStyleSheet(qss);
} }

View File

@@ -61,7 +61,7 @@ namespace BlackGui
const CUser user( const CUser user(
ui->le_NetworkId->text().trimmed(), ui->le_NetworkId->text().trimmed(),
ui->le_RealName->text().trimmed().simplified(), ui->le_RealName->text().trimmed().simplified(),
QStringLiteral(""), QString(),
ui->le_Password->text().trimmed() ui->le_Password->text().trimmed()
); );
const CFsdSetup fsdSetup(ui->form_ServerFsd->getValue()); const CFsdSetup fsdSetup(ui->form_ServerFsd->getValue());

View File

@@ -617,7 +617,7 @@ namespace BlackGui
QString CGuiUtility::asSimpleHtmlImageWidth(const CIcon &icon, int width) QString CGuiUtility::asSimpleHtmlImageWidth(const CIcon &icon, int width)
{ {
if (!icon.hasFileResourcePath()) return QStringLiteral(""); if (!icon.hasFileResourcePath()) return {};
const QString p = icon.getFileResourcePath(); const QString p = icon.getFileResourcePath();
static const QString htmlNoWidth("<img src=\"%1\">"); static const QString htmlNoWidth("<img src=\"%1\">");
@@ -630,7 +630,7 @@ namespace BlackGui
QString CGuiUtility::asSimpleHtmlImageHeight(const CIcon &icon, int height) QString CGuiUtility::asSimpleHtmlImageHeight(const CIcon &icon, int height)
{ {
if (height < 0) { return CGuiUtility::asSimpleHtmlImageWidth(icon); } if (height < 0) { return CGuiUtility::asSimpleHtmlImageWidth(icon); }
if (!icon.hasFileResourcePath()) return QStringLiteral(""); if (!icon.hasFileResourcePath()) return {};
const QString p = icon.getFileResourcePath(); const QString p = icon.getFileResourcePath();
static const QString htmlHeight("<img src=\"%1\" height=%2>"); static const QString htmlHeight("<img src=\"%1\" height=%2>");

View File

@@ -89,7 +89,7 @@ namespace BlackGui
if (column.getFormatter()->supportsRole(Qt::DecorationRole)) if (column.getFormatter()->supportsRole(Qt::DecorationRole))
{ {
const QIcon icon = column.getFormatter()->decorationRole(v).toPixmap(); const QIcon icon = column.getFormatter()->decorationRole(v).toPixmap();
si = new QStandardItem(icon, QStringLiteral("")); si = new QStandardItem(icon, QString());
} }
else if (column.getFormatter()->supportsRole(Qt::DisplayRole)) else if (column.getFormatter()->supportsRole(Qt::DisplayRole))
{ {

View File

@@ -144,7 +144,7 @@ namespace BlackGui
const CVariant &CDefaultFormatter::emptyStringVariant() const CVariant &CDefaultFormatter::emptyStringVariant()
{ {
static const CVariant e = CVariant::from(QStringLiteral("")); static const CVariant e = CVariant::from(QString());
return e; return e;
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -47,7 +47,7 @@ namespace BlackMisc
QString CArtifact::getFileSizeHumanReadable() const QString CArtifact::getFileSizeHumanReadable() const
{ {
if (m_size < 0) { return QStringLiteral(""); } if (m_size < 0) { return {}; }
return CFileUtils::humanReadableFileSize(m_size); return CFileUtils::humanReadableFileSize(m_size);
} }
@@ -208,14 +208,14 @@ namespace BlackMisc
QString CArtifact::versionNumberFromFilename(const QString &filename) QString CArtifact::versionNumberFromFilename(const QString &filename)
{ {
if (filename.isEmpty()) { return QStringLiteral(""); } if (filename.isEmpty()) { return {}; }
// swift-installer-linux-64-0.7.3_2017-03-25_11-24-50.run // swift-installer-linux-64-0.7.3_2017-03-25_11-24-50.run
thread_local const QRegularExpression firstSegments("\\d+\\.\\d+\\.\\d+"); thread_local const QRegularExpression firstSegments("\\d+\\.\\d+\\.\\d+");
const QRegularExpressionMatch firstSegmentsMatch = firstSegments.match(filename); const QRegularExpressionMatch firstSegmentsMatch = firstSegments.match(filename);
if (!firstSegmentsMatch.hasMatch()) if (!firstSegmentsMatch.hasMatch())
{ {
return QStringLiteral(""); // no version, invalid return {}; // no version, invalid
} }
QString v = firstSegmentsMatch.captured(0); // first 3 segments, like 0.9.3 QString v = firstSegmentsMatch.captured(0); // first 3 segments, like 0.9.3
if (!v.endsWith('.')) { v += '.'; } if (!v.endsWith('.')) { v += '.'; }

View File

@@ -22,13 +22,13 @@ namespace BlackMisc
{ {
QString IDatastoreObjectWithIntegerKey::getDbKeyAsString() const QString IDatastoreObjectWithIntegerKey::getDbKeyAsString() const
{ {
if (m_dbKey < 0) { return QStringLiteral(""); } if (m_dbKey < 0) { return {}; }
return QString::number(m_dbKey); return QString::number(m_dbKey);
} }
QString IDatastoreObjectWithIntegerKey::getDbKeyAsStringInParentheses(const QString &prefix) const QString IDatastoreObjectWithIntegerKey::getDbKeyAsStringInParentheses(const QString &prefix) const
{ {
if (m_dbKey < 0) { return QStringLiteral(""); } if (m_dbKey < 0) { return {}; }
return prefix % QStringLiteral("(") % QString::number(m_dbKey) % QStringLiteral(")"); return prefix % QStringLiteral("(") % QString::number(m_dbKey) % QStringLiteral(")");
} }

View File

@@ -135,7 +135,7 @@ namespace BlackMisc
QString p = normalizeFilePathToQtStandard(path); QString p = normalizeFilePathToQtStandard(path);
int i = p.indexOf('/'); int i = p.indexOf('/');
if (i < 0) { return p; } if (i < 0) { return p; }
if ((i + 1) >= path.length()) { return QStringLiteral(""); } if ((i + 1) >= path.length()) { return {}; }
return path.mid(i + 1); return path.mid(i + 1);
} }
@@ -168,7 +168,7 @@ namespace BlackMisc
QString CFileUtils::lastPathSegment(const QString &path) QString CFileUtils::lastPathSegment(const QString &path)
{ {
if (path.isEmpty()) { return QStringLiteral(""); } if (path.isEmpty()) { return {}; }
if (path.endsWith('/')) { return CFileUtils::lastPathSegment(path.left(path.length() - 1)); } if (path.endsWith('/')) { return CFileUtils::lastPathSegment(path.left(path.length() - 1)); }
if (!path.contains('/')) { return path; } if (!path.contains('/')) { return path; }
return path.mid(path.lastIndexOf('/') + 1); return path.mid(path.lastIndexOf('/') + 1);
@@ -484,7 +484,7 @@ namespace BlackMisc
QString CFileUtils::windowsUncMachine(const QString &filePath) QString CFileUtils::windowsUncMachine(const QString &filePath)
{ {
if (!CFileUtils::isWindowsUncPath(filePath)) { return QStringLiteral(""); } if (!CFileUtils::isWindowsUncPath(filePath)) { return {}; }
QString f = filePath; QString f = filePath;
f.replace("\\", "/"); f.replace("\\", "/");
f.replace("//", ""); f.replace("//", "");

View File

@@ -14,10 +14,9 @@ namespace BlackMisc
{ {
QString toHtmTable(const QStringList &values, int columns) QString toHtmTable(const QStringList &values, int columns)
{ {
if (values.isEmpty() || columns < 1) { return QStringLiteral(""); } if (values.isEmpty() || columns < 1) { return {}; }
QString html; QString html;
QString row;
const int size = values.size(); const int size = values.size();
for (int i = 0; i < size; i++) for (int i = 0; i < size; i++)
{ {

View File

@@ -51,7 +51,7 @@ namespace BlackMisc
{ {
Q_UNUSED(i18n); Q_UNUSED(i18n);
if (m_realname.isEmpty()) { return QStringLiteral("<no realname>"); } if (m_realname.isEmpty()) { return QStringLiteral("<no realname>"); }
return m_realname % (this->hasValidDbKey() ? this->getDbKeyAsStringInParentheses(" ") : QStringLiteral("")); return m_realname % (this->hasValidDbKey() ? this->getDbKeyAsStringInParentheses(" ") : QString());
} }
CAuthenticatedUser CAuthenticatedUser::fromDatabaseJson(const QJsonObject &json) CAuthenticatedUser CAuthenticatedUser::fromDatabaseJson(const QJsonObject &json)

View File

@@ -67,7 +67,7 @@ namespace BlackMisc
if (cap.testFlag(FsdWithAircraftConfig)) sl << "aircraft config"; if (cap.testFlag(FsdWithAircraftConfig)) sl << "aircraft config";
if (cap.testFlag(FsdWithGroundFlag)) sl << "gnd.flag"; if (cap.testFlag(FsdWithGroundFlag)) sl << "gnd.flag";
if (cap.testFlag(FsdModelString)) sl << "modelstring"; if (cap.testFlag(FsdModelString)) sl << "modelstring";
if (sl.isEmpty()) { return QStringLiteral(""); } if (sl.isEmpty()) { return {}; }
return sl.join(", "); return sl.join(", ");
} }

View File

@@ -30,7 +30,7 @@ namespace BlackMisc
QString CRemoteFile::getNameAndSize() const QString CRemoteFile::getNameAndSize() const
{ {
if (!this->hasName()) { return QStringLiteral(""); } if (!this->hasName()) { return {}; }
static const QString s("%1 (%2)"); static const QString s("%1 (%2)");
return s.arg(this->getName(), this->getSizeHumanReadable()); return s.arg(this->getName(), this->getSizeHumanReadable());
} }

View File

@@ -189,7 +189,7 @@ namespace BlackMisc
QString CServer::getServerSessionId() const QString CServer::getServerSessionId() const
{ {
if (!this->isConnected()) { return ""; } if (!this->isConnected()) { return {}; }
static const QString session("%1 %2:%3 [%4] %5 %6"); static const QString session("%1 %2:%3 [%4] %5 %6");
return session.arg(this->getName(), this->getAddress()).arg(this->getPort()).arg(this->getEcosystem().getSystemString(), this->getUser().getRealName(), this->getFormattedUtcTimestampHms()); return session.arg(this->getName(), this->getAddress()).arg(this->getPort()).arg(this->getEcosystem().getSystemString(), this->getUser().getRealName(), this->getFormattedUtcTimestampHms());
} }

View File

@@ -59,7 +59,7 @@ namespace BlackMisc
QString CAircraftModel::convertToQString(bool i18n) const QString CAircraftModel::convertToQString(bool i18n) const
{ {
const QString s = const QString s =
(this->hasModelString() ? inApostrophes(m_modelString, true) % QStringLiteral(" ") : QStringLiteral("")) % (this->hasModelString() ? inApostrophes(m_modelString, true) % QStringLiteral(" ") : QString()) %
QStringLiteral(" type: '") % this->getModelTypeAsString() % QStringLiteral(" type: '") % this->getModelTypeAsString() %
QStringLiteral("' ICAO: '") % this->getAircraftIcaoCode().toQString(i18n) % QStringLiteral("' ICAO: '") % this->getAircraftIcaoCode().toQString(i18n) %
QStringLiteral(" CG: ") % this->getCG().valueRoundedWithUnit(1) % QStringLiteral(" CG: ") % this->getCG().valueRoundedWithUnit(1) %
@@ -534,11 +534,11 @@ namespace BlackMisc
QString CAircraftModel::getSwiftLiveryString() const QString CAircraftModel::getSwiftLiveryString() const
{ {
const QString l = const QString l =
(this->getLivery().hasValidDbKey() ? QStringLiteral("l") % this->getLivery().getDbKeyAsString() : QStringLiteral("")) % (this->getLivery().hasValidDbKey() ? QStringLiteral("l") % this->getLivery().getDbKeyAsString() : QString()) %
(this->getAircraftIcaoCode().hasValidDbKey() ? QStringLiteral("a") % this->getAircraftIcaoCode().getDbKeyAsString() : QStringLiteral("")) % (this->getAircraftIcaoCode().hasValidDbKey() ? QStringLiteral("a") % this->getAircraftIcaoCode().getDbKeyAsString() : QString()) %
(this->hasValidDbKey() ? QStringLiteral("m") % this->getDbKeyAsString() : QStringLiteral("")); (this->hasValidDbKey() ? QStringLiteral("m") % this->getDbKeyAsString() : QString());
return l.isEmpty() ? QStringLiteral("") : liveryStringPrefix() % l; return l.isEmpty() ? QString() : liveryStringPrefix() % l;
} }
DBTripleIds CAircraftModel::parseNetworkLiveryString(const QString &liveryString) DBTripleIds CAircraftModel::parseNetworkLiveryString(const QString &liveryString)

View File

@@ -1217,7 +1217,7 @@ namespace BlackMisc
( (
checkModel.hasAirlineDesignator() ? checkModel.hasAirlineDesignator() ?
QStringLiteral(" airline '") % checkModel.getAirlineIcaoCodeDesignator() % QStringLiteral("': ") % boolToYesNo(airlineForModel) : QStringLiteral(" airline '") % checkModel.getAirlineIcaoCodeDesignator() % QStringLiteral("': ") % boolToYesNo(airlineForModel) :
QStringLiteral("") QString()
); );
} }

View File

@@ -118,7 +118,7 @@ namespace BlackMisc
QString CFsCommonUtil::fsxSimObjectsDirFromSimDir(const QString &simDir) QString CFsCommonUtil::fsxSimObjectsDirFromSimDir(const QString &simDir)
{ {
if (simDir.isEmpty()) { return QStringLiteral(""); } if (simDir.isEmpty()) { return {}; }
return CFileUtils::appendFilePaths(simDir, "SimObjects"); return CFileUtils::appendFilePaths(simDir, "SimObjects");
} }
@@ -221,7 +221,7 @@ namespace BlackMisc
QString CFsCommonUtil::p3dSimObjectsDirFromSimDir(const QString &simDir) QString CFsCommonUtil::p3dSimObjectsDirFromSimDir(const QString &simDir)
{ {
if (simDir.isEmpty()) { return QStringLiteral(""); } if (simDir.isEmpty()) { return {}; }
return CFileUtils::appendFilePaths(simDir, "SimObjects"); return CFileUtils::appendFilePaths(simDir, "SimObjects");
} }
@@ -293,7 +293,7 @@ namespace BlackMisc
QString fs9AircraftDirFromRegistryImpl() QString fs9AircraftDirFromRegistryImpl()
{ {
QString fs9Path = CFsCommonUtil::fs9DirFromRegistry(); QString fs9Path = CFsCommonUtil::fs9DirFromRegistry();
if (fs9Path.isEmpty()) { return QStringLiteral(""); } if (fs9Path.isEmpty()) { return {}; }
return CFsCommonUtil::fs9AircraftDirFromSimDir(fs9Path); return CFsCommonUtil::fs9AircraftDirFromSimDir(fs9Path);
} }
@@ -306,7 +306,7 @@ namespace BlackMisc
QString fs9AircraftDirImpl() QString fs9AircraftDirImpl()
{ {
const QString dir(CFsCommonUtil::fs9Dir()); const QString dir(CFsCommonUtil::fs9Dir());
if (dir.isEmpty()) { return QStringLiteral(""); } if (dir.isEmpty()) { return {}; }
return CFsCommonUtil::fs9AircraftDirFromSimDir(dir); return CFsCommonUtil::fs9AircraftDirFromSimDir(dir);
} }
@@ -318,7 +318,7 @@ namespace BlackMisc
QString CFsCommonUtil::fs9AircraftDirFromSimDir(const QString &simDir) QString CFsCommonUtil::fs9AircraftDirFromSimDir(const QString &simDir)
{ {
if (simDir.isEmpty()) { return QStringLiteral(""); } if (simDir.isEmpty()) { return {}; }
return CFileUtils::appendFilePaths(simDir, "Aircraft"); return CFileUtils::appendFilePaths(simDir, "Aircraft");
} }

View File

@@ -339,7 +339,7 @@ namespace BlackMisc
QStringLiteral("<td>") % log.cgAboveGround.valueRoundedWithUnit(ft, 0) % QStringLiteral("</td>") % QStringLiteral("<td>") % log.cgAboveGround.valueRoundedWithUnit(ft, 0) % QStringLiteral("</td>") %
QStringLiteral("<td>") % boolToYesNo(log.useParts) % QStringLiteral("</td>") % QStringLiteral("<td>") % boolToYesNo(log.useParts) % QStringLiteral("</td>") %
(changedParts ? QStringLiteral("<td class=\"changed\">*</td>") : QStringLiteral("<td></td>")) % (changedParts ? QStringLiteral("<td class=\"changed\">*</td>") : QStringLiteral("<td></td>")) %
QStringLiteral("<td>") % (log.useParts ? log.parts.toQString(true) : QStringLiteral("")) % QStringLiteral("</td>") % QStringLiteral("<td>") % (log.useParts ? log.parts.toQString(true) : QString()) % QStringLiteral("</td>") %
QStringLiteral("</tr>\n"); QStringLiteral("</tr>\n");
} }
@@ -411,13 +411,13 @@ namespace BlackMisc
return ( return (
withSetup ? withSetup ?
QStringLiteral("setup: ") % usedSetup.toQString(true) % separator : QStringLiteral("setup: ") % usedSetup.toQString(true) % separator :
QStringLiteral("") QString()
) % ) %
( (
withElevation ? withElevation ?
QStringLiteral("Elev.info: ") % elevationInfo % QStringLiteral("Elev.info: ") % elevationInfo %
QStringLiteral(" scenery os: ") % sceneryOffset.valueRoundedWithUnit(1) % separator : QStringLiteral(" scenery os: ") % sceneryOffset.valueRoundedWithUnit(1) % separator :
QStringLiteral("") QString()
) % ) %
QStringLiteral("change: ") % change.toQString(true) % QStringLiteral("change: ") % change.toQString(true) %
separator % separator %
@@ -441,13 +441,13 @@ namespace BlackMisc
QStringLiteral(" | old int.pos.: ") % situationOldInterpolation.getTimestampAndOffset(true) % QStringLiteral(" | old int.pos.: ") % situationOldInterpolation.getTimestampAndOffset(true) %
QStringLiteral(" | new int.pos.: ") % situationNewInterpolation.getTimestampAndOffset(true) % QStringLiteral(" | new int.pos.: ") % situationNewInterpolation.getTimestampAndOffset(true) %
QStringLiteral(" | #int.pos.: ") % QString::number(interpolationSituations.size()) : QStringLiteral(" | #int.pos.: ") % QString::number(interpolationSituations.size()) :
QStringLiteral("") QString()
) % ) %
( (
withCurrentSituation ? withCurrentSituation ?
separator % separator %
QStringLiteral("cur.sit.(interpolated): ") % situationCurrent.toQString(true) : QStringLiteral("cur.sit.(interpolated): ") % situationCurrent.toQString(true) :
QStringLiteral("") QString()
) % ) %
( (
withOtherPositions ? withOtherPositions ?
@@ -455,7 +455,7 @@ namespace BlackMisc
QStringLiteral("old: ") % situationOldInterpolation.toQString(true) % QStringLiteral("old: ") % situationOldInterpolation.toQString(true) %
separator % separator %
QStringLiteral("new: ") % situationNewInterpolation.toQString(true) : QStringLiteral("new: ") % situationNewInterpolation.toQString(true) :
QStringLiteral("") QString()
); );
} }

View File

@@ -650,7 +650,7 @@ namespace BlackMisc
QStringLiteral(" | situation valid: ") % boolToYesNo(m_isValidSituation) % QStringLiteral(" | situation valid: ") % boolToYesNo(m_isValidSituation) %
QStringLiteral(" | same: ") % boolToYesNo(m_isSameSituation) % QStringLiteral(" | same: ") % boolToYesNo(m_isSameSituation) %
( (
m_extraInfo.isEmpty() ? QStringLiteral("") : QStringLiteral(" info: ") % m_extraInfo m_extraInfo.isEmpty() ? QString() : QStringLiteral(" info: ") % m_extraInfo
); );
} }

View File

@@ -156,11 +156,11 @@ namespace BlackMisc
Q_UNUSED(i18n); Q_UNUSED(i18n);
const Simulator s = getSimulator(); const Simulator s = getSimulator();
const QString str = const QString str =
(s.testFlag(FSX) ? QStringLiteral("FSX ") : QStringLiteral("")) % (s.testFlag(FSX) ? QStringLiteral("FSX ") : QString()) %
(s.testFlag(FS9) ? QStringLiteral("FS9 ") : QStringLiteral("")) % (s.testFlag(FS9) ? QStringLiteral("FS9 ") : QString()) %
(s.testFlag(P3D) ? QStringLiteral("P3D ") : QStringLiteral("")) % (s.testFlag(P3D) ? QStringLiteral("P3D ") : QString()) %
(s.testFlag(XPLANE) ? QStringLiteral("XPlane ") : QStringLiteral("")) % (s.testFlag(XPLANE) ? QStringLiteral("XPlane ") : QString()) %
(s.testFlag(FG) ? QStringLiteral("FG ") : QStringLiteral("")); (s.testFlag(FG) ? QStringLiteral("FG ") : QString());
return str.trimmed(); return str.trimmed();
} }

View File

@@ -183,7 +183,7 @@ namespace BlackMisc
QString CStatusMessage::getHumanReadablePattern() const QString CStatusMessage::getHumanReadablePattern() const
{ {
const QStringList patternNames(getHumanReadablePatterns()); const QStringList patternNames(getHumanReadablePatterns());
return patternNames.isEmpty() ? QStringLiteral("") : patternNames.join(", "); return patternNames.isEmpty() ? QString() : patternNames.join(", ");
} }
QStringList CStatusMessage::getHumanReadablePatterns() const QStringList CStatusMessage::getHumanReadablePatterns() const

View File

@@ -395,7 +395,6 @@ namespace BlackMisc
QString joinStringSet(const QSet<QString> &set, const QString &separator) QString joinStringSet(const QSet<QString> &set, const QString &separator)
{ {
if (set.isEmpty()) { return QStringLiteral(""); }
return set.toList().join(separator); return set.toList().join(separator);
} }

View File

@@ -32,7 +32,7 @@ CStatusMessageList CSwiftGuiStdApplication::startHookIn()
Q_ASSERT_X(m_parsed, Q_FUNC_INFO, "Not yet parsed cmd line arguments"); Q_ASSERT_X(m_parsed, Q_FUNC_INFO, "Not yet parsed cmd line arguments");
QString dBusAddress(this->getCmdDBusAddressValue()); QString dBusAddress(this->getCmdDBusAddressValue());
const QString coreModeStr = this->isParserOptionSet(m_cmdFacadeMode) ? this->getParserValue(m_cmdFacadeMode) : QStringLiteral(""); const QString coreModeStr = this->isParserOptionSet(m_cmdFacadeMode) ? this->getParserValue(m_cmdFacadeMode) : QString();
CoreModes::CoreMode coreMode = CoreModes::stringToCoreMode(coreModeStr); CoreModes::CoreMode coreMode = CoreModes::stringToCoreMode(coreModeStr);
// Valid combination? // Valid combination?