mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-03 07:35:48 +08:00
Return a default-constructed QString instead of implicitly converting an empty string literal.
This commit is contained in:
@@ -613,8 +613,8 @@ namespace BlackCore
|
||||
|
||||
QString CAircraftMatcher::reverseLookupAirlineName(const QString &candidate, const CCallsign &callsign, CStatusMessageList *log)
|
||||
{
|
||||
if (!sApp || sApp->isShuttingDown() || !sApp->hasWebDataServices()) { return ""; }
|
||||
if (candidate.isEmpty()) { return ""; }
|
||||
if (!sApp || sApp->isShuttingDown() || !sApp->hasWebDataServices()) { return {}; }
|
||||
if (candidate.isEmpty()) { return {}; }
|
||||
const QStringList names = sApp->getWebDataServices()->getAirlineNames();
|
||||
if (names.contains(candidate, Qt::CaseInsensitive))
|
||||
{
|
||||
@@ -623,13 +623,13 @@ namespace BlackCore
|
||||
}
|
||||
|
||||
CMatchingUtils::addLogDetailsToList(log, callsign, QString("Airline name '%1' not found in DB").arg(candidate));
|
||||
return "";
|
||||
return {};
|
||||
}
|
||||
|
||||
QString CAircraftMatcher::reverseLookupTelephonyDesignator(const QString &candidate, const CCallsign &callsign, CStatusMessageList *log)
|
||||
{
|
||||
if (!sApp || sApp->isShuttingDown() || !sApp->hasWebDataServices()) { return ""; }
|
||||
if (candidate.isEmpty()) { return ""; }
|
||||
if (!sApp || sApp->isShuttingDown() || !sApp->hasWebDataServices()) { return {}; }
|
||||
if (candidate.isEmpty()) { return {}; }
|
||||
const QStringList designators = sApp->getWebDataServices()->getTelephonyDesignators();
|
||||
if (designators.contains(candidate, Qt::CaseInsensitive))
|
||||
{
|
||||
@@ -638,7 +638,7 @@ namespace BlackCore
|
||||
}
|
||||
|
||||
CMatchingUtils::addLogDetailsToList(log, callsign, QString("Airline name '%1' not found").arg(candidate));
|
||||
return "";
|
||||
return {};
|
||||
}
|
||||
|
||||
bool CAircraftMatcher::isKnowAircraftDesignator(const QString &candidate, const CCallsign &callsign, CStatusMessageList *log)
|
||||
@@ -1291,7 +1291,7 @@ namespace BlackCore
|
||||
|
||||
QString CAircraftMatcher::scoresToString(const ScoredModels &scores, int lastElements)
|
||||
{
|
||||
if (scores.isEmpty()) { return ""; }
|
||||
if (scores.isEmpty()) { return {}; }
|
||||
QMapIterator<int, CAircraftModel> i(scores);
|
||||
i.toBack();
|
||||
int c = 0;
|
||||
|
||||
@@ -284,14 +284,14 @@ namespace BlackCore
|
||||
case CApplicationInfo::PilotClientGui: searchFor = "gui"; break;
|
||||
default: break;
|
||||
}
|
||||
if (searchFor.isEmpty()) { return ""; }
|
||||
if (searchFor.isEmpty()) { return {}; }
|
||||
|
||||
for (const QString &executable : CFileUtils::getSwiftExecutables())
|
||||
{
|
||||
if (!executable.contains("swift", Qt::CaseInsensitive)) { continue; }
|
||||
if (executable.contains(searchFor, Qt::CaseInsensitive)) { return executable; }
|
||||
}
|
||||
return "";
|
||||
return {};
|
||||
}
|
||||
|
||||
bool CApplication::startLauncher()
|
||||
@@ -1283,7 +1283,7 @@ namespace BlackCore
|
||||
|
||||
QString CApplication::getCmdDBusAddressValue() const
|
||||
{
|
||||
if (!this->isParserOptionSet(m_cmdDBusAddress)) { return ""; }
|
||||
if (!this->isParserOptionSet(m_cmdDBusAddress)) { return {}; }
|
||||
const QString v(this->getParserValue(m_cmdDBusAddress));
|
||||
const QString dBusAddress(CDBusServer::normalizeAddress(v));
|
||||
return dBusAddress;
|
||||
@@ -1407,7 +1407,7 @@ namespace BlackCore
|
||||
{
|
||||
QStringList args = QCoreApplication::arguments();
|
||||
if (!withExecutable && !args.isEmpty()) args.removeFirst();
|
||||
if (args.isEmpty()) return "";
|
||||
if (args.isEmpty()) return {};
|
||||
return args.join(' ');
|
||||
}
|
||||
|
||||
@@ -1556,13 +1556,13 @@ namespace BlackCore
|
||||
|
||||
QString CApplication::getLastSuccesfulSetupUrl() const
|
||||
{
|
||||
if (!this->hasSetupReader()) { return ""; }
|
||||
if (!this->hasSetupReader()) { return {}; }
|
||||
return m_setupReader->getLastSuccessfulSetupUrl();
|
||||
}
|
||||
|
||||
QString CApplication::getLastSuccesfulDistributionUrl() const
|
||||
{
|
||||
if (!this->hasSetupReader()) { return ""; }
|
||||
if (!this->hasSetupReader()) { return {}; }
|
||||
return m_setupReader->getLastSuccessfulUpdateInfoUrl();
|
||||
}
|
||||
|
||||
|
||||
@@ -197,7 +197,7 @@ namespace BlackCore
|
||||
|
||||
QString CContextApplicationProxy::readFromFile(const QString &fileName) const
|
||||
{
|
||||
if (fileName.isEmpty()) { return ""; }
|
||||
if (fileName.isEmpty()) { return {}; }
|
||||
return m_dBusInterface->callDBusRet<QString>(QLatin1String("readFromFile"), fileName);
|
||||
}
|
||||
|
||||
|
||||
@@ -50,11 +50,11 @@ namespace BlackCore
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case CoreInGuiProcess: return "coreinguiprocess";
|
||||
case CoreExternalCoreAudio: return "coreexternal";
|
||||
case CoreExternalAudioGui: return "coreexternalaudiogui";
|
||||
case CoreInGuiProcess: return QStringLiteral("coreinguiprocess");
|
||||
case CoreExternalCoreAudio: return QStringLiteral("coreexternal");
|
||||
case CoreExternalAudioGui: return QStringLiteral("coreexternalaudiogui");
|
||||
}
|
||||
return "";
|
||||
return {};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -201,7 +201,7 @@ namespace BlackCore
|
||||
|
||||
QString CGlobalSetup::buildBootstrapFileUrl(const QString &candidate)
|
||||
{
|
||||
if (candidate.isEmpty()) return ""; // not possible
|
||||
if (candidate.isEmpty()) return {}; // not possible
|
||||
static const QString version(QString(CGlobalSetup::schemaVersionString()).append("/"));
|
||||
if (candidate.endsWith(CDirectoryUtils::bootstrapFileName())) { return candidate; }
|
||||
CUrl url(candidate);
|
||||
|
||||
@@ -688,7 +688,7 @@ namespace BlackCore
|
||||
|
||||
QString CDatabaseReader::dateTimeToDbLatestTs(const QDateTime &ts)
|
||||
{
|
||||
if (!ts.isValid()) { return ""; }
|
||||
if (!ts.isValid()) { return {}; }
|
||||
return ts.toUTC().toString(Qt::ISODate);
|
||||
}
|
||||
|
||||
@@ -709,7 +709,7 @@ namespace BlackCore
|
||||
|
||||
QString CDatabaseReader::queryLatestTimestamp(const QDateTime &ts)
|
||||
{
|
||||
if (!ts.isValid()) return "";
|
||||
if (!ts.isValid()) return {};
|
||||
const QString q = parameterLatestTimestamp() + "=" + dateTimeToDbLatestTs(ts);
|
||||
return q;
|
||||
}
|
||||
|
||||
@@ -541,7 +541,7 @@ namespace BlackCore
|
||||
|
||||
QString CSetupReader::getCmdLineBootstrapUrl() const
|
||||
{
|
||||
if (m_ignoreCmdBootstrapUrl) return "";
|
||||
if (m_ignoreCmdBootstrapUrl) return {};
|
||||
return sApp->getParserValue(m_cmdBootstrapUrl);
|
||||
}
|
||||
|
||||
@@ -635,12 +635,12 @@ namespace BlackCore
|
||||
{
|
||||
switch (m_bootstrapMode)
|
||||
{
|
||||
case CacheOnly: return "cache only";
|
||||
case Explicit: return "explicit";
|
||||
case Implicit: return "implicit";
|
||||
case CacheOnly: return QStringLiteral("cache only");
|
||||
case Explicit: return QStringLiteral("explicit");
|
||||
case Implicit: return QStringLiteral("implicit");
|
||||
default: break;
|
||||
}
|
||||
return "";
|
||||
return {};
|
||||
}
|
||||
|
||||
void CSetupReader::setLastSetupReadErrorMessages(const CStatusMessageList &messages)
|
||||
|
||||
Reference in New Issue
Block a user