Revise string literal usage

This commit covers src/gui folder.
PR #16757.
This commit is contained in:
Chocobo1 2022-03-29 10:41:17 +08:00 committed by GitHub
parent 746fe7ba09
commit 75c93d72be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
36 changed files with 275 additions and 280 deletions

View file

@ -60,8 +60,8 @@ namespace
const Version currentVersion {QBT_VERSION_MAJOR, QBT_VERSION_MINOR, QBT_VERSION_BUGFIX, QBT_VERSION_BUILD};
if (newVersion == currentVersion)
{
const bool isDevVersion = QString::fromLatin1(QBT_VERSION_STATUS).contains(
QRegularExpression(QLatin1String("(alpha|beta|rc)")));
const bool isDevVersion = QStringLiteral(QBT_VERSION_STATUS).contains(
QRegularExpression(u"(alpha|beta|rc)"_qs));
if (isDevVersion)
return true;
}
@ -76,7 +76,7 @@ namespace
void ProgramUpdater::checkForUpdates() const
{
const auto RSS_URL = QString::fromLatin1("https://www.fosshub.com/feed/5b8793a7f9ee5a5c3e97a3b2.xml");
const auto RSS_URL = u"https://www.fosshub.com/feed/5b8793a7f9ee5a5c3e97a3b2.xml"_qs;
// Don't change this User-Agent. In case our updater goes haywire,
// the filehost can identify it and contact us.
Net::DownloadManager::instance()->download(
@ -128,18 +128,18 @@ void ProgramUpdater::rssDownloadFinished(const Net::DownloadResult &result)
if (xml.isStartElement())
{
if (xml.name() == QLatin1String("item"))
if (xml.name() == u"item")
inItem = true;
else if (inItem && (xml.name() == QLatin1String("link")))
else if (inItem && (xml.name() == u"link"))
updateLink = getStringValue(xml);
else if (inItem && (xml.name() == QLatin1String("type")))
else if (inItem && (xml.name() == u"type"))
type = getStringValue(xml);
else if (inItem && (xml.name() == QLatin1String("version")))
else if (inItem && (xml.name() == u"version"))
version = getStringValue(xml);
}
else if (xml.isEndElement())
{
if (inItem && (xml.name() == QLatin1String("item")))
if (inItem && (xml.name() == u"item"))
{
if (type.compare(OS_TYPE, Qt::CaseInsensitive) == 0)
{