mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-19 23:17:21 -06:00
Use QString literals
This patch covers src/app and src/base folders.
Follow up of ab64ee872b.
This commit is contained in:
@@ -94,7 +94,7 @@ QPointer<AutoDownloader> AutoDownloader::m_instance = nullptr;
|
||||
|
||||
QString computeSmartFilterRegex(const QStringList &filters)
|
||||
{
|
||||
return QString::fromLatin1("(?:_|\\b)(?:%1)(?:_|\\b)").arg(filters.join(QString(")|(?:")));
|
||||
return u"(?:_|\\b)(?:%1)(?:_|\\b)"_qs.arg(filters.join(u")|(?:"));
|
||||
}
|
||||
|
||||
AutoDownloader::AutoDownloader()
|
||||
@@ -162,7 +162,7 @@ bool AutoDownloader::hasRule(const QString &ruleName) const
|
||||
|
||||
AutoDownloadRule AutoDownloader::ruleByName(const QString &ruleName) const
|
||||
{
|
||||
return m_rules.value(ruleName, AutoDownloadRule("Unknown Rule"));
|
||||
return m_rules.value(ruleName, AutoDownloadRule(u"Unknown Rule"_qs));
|
||||
}
|
||||
|
||||
QList<AutoDownloadRule> AutoDownloader::rules() const
|
||||
@@ -289,10 +289,10 @@ QStringList AutoDownloader::smartEpisodeFilters() const
|
||||
{
|
||||
const QStringList defaultFilters =
|
||||
{
|
||||
"s(\\d+)e(\\d+)", // Format 1: s01e01
|
||||
"(\\d+)x(\\d+)", // Format 2: 01x01
|
||||
"(\\d{4}[.\\-]\\d{1,2}[.\\-]\\d{1,2})", // Format 3: 2017.01.01
|
||||
"(\\d{1,2}[.\\-]\\d{1,2}[.\\-]\\d{4})" // Format 4: 01.01.2017
|
||||
u"s(\\d+)e(\\d+)"_qs, // Format 1: s01e01
|
||||
u"(\\d+)x(\\d+)"_qs, // Format 2: 01x01
|
||||
u"(\\d{4}[.\\-]\\d{1,2}[.\\-]\\d{1,2})"_qs, // Format 3: 2017.01.01
|
||||
u"(\\d{1,2}[.\\-]\\d{1,2}[.\\-]\\d{4})"_qs // Format 4: 01.01.2017
|
||||
};
|
||||
return defaultFilters;
|
||||
}
|
||||
|
||||
@@ -188,7 +188,7 @@ QString computeEpisodeName(const QString &article)
|
||||
|
||||
ret.append(isInt ? QString::number(x) : cap);
|
||||
}
|
||||
return ret.join('x');
|
||||
return ret.join(u'x');
|
||||
}
|
||||
|
||||
AutoDownloadRule::AutoDownloadRule(const QString &name)
|
||||
@@ -223,7 +223,7 @@ QRegularExpression AutoDownloadRule::cachedRegex(const QString &expression, cons
|
||||
|
||||
bool AutoDownloadRule::matchesExpression(const QString &articleTitle, const QString &expression) const
|
||||
{
|
||||
const QRegularExpression whitespace {"\\s+"};
|
||||
const QRegularExpression whitespace {u"\\s+"_qs};
|
||||
|
||||
if (expression.isEmpty())
|
||||
{
|
||||
@@ -286,13 +286,13 @@ bool AutoDownloadRule::matchesEpisodeFilterExpression(const QString &articleTitl
|
||||
if (m_dataPtr->episodeFilter.isEmpty())
|
||||
return true;
|
||||
|
||||
const QRegularExpression filterRegex {cachedRegex("(^\\d{1,4})x(.*;$)")};
|
||||
const QRegularExpression filterRegex {cachedRegex(u"(^\\d{1,4})x(.*;$)"_qs)};
|
||||
const QRegularExpressionMatch matcher {filterRegex.match(m_dataPtr->episodeFilter)};
|
||||
if (!matcher.hasMatch())
|
||||
return false;
|
||||
|
||||
const QString season {matcher.captured(1)};
|
||||
const QStringList episodes {matcher.captured(2).split(';')};
|
||||
const QStringList episodes {matcher.captured(2).split(u';')};
|
||||
const int seasonOurs {season.toInt()};
|
||||
|
||||
for (QString episode : episodes)
|
||||
@@ -301,13 +301,13 @@ bool AutoDownloadRule::matchesEpisodeFilterExpression(const QString &articleTitl
|
||||
continue;
|
||||
|
||||
// We need to trim leading zeroes, but if it's all zeros then we want episode zero.
|
||||
while ((episode.size() > 1) && episode.startsWith('0'))
|
||||
while ((episode.size() > 1) && episode.startsWith(u'0'))
|
||||
episode = episode.right(episode.size() - 1);
|
||||
|
||||
if (episode.indexOf('-') != -1)
|
||||
if (episode.indexOf(u'-') != -1)
|
||||
{ // Range detected
|
||||
const QString partialPattern1 {"\\bs0?(\\d{1,4})[ -_\\.]?e(0?\\d{1,4})(?:\\D|\\b)"};
|
||||
const QString partialPattern2 {"\\b(\\d{1,4})x(0?\\d{1,4})(?:\\D|\\b)"};
|
||||
const QString partialPattern1 {u"\\bs0?(\\d{1,4})[ -_\\.]?e(0?\\d{1,4})(?:\\D|\\b)"_qs};
|
||||
const QString partialPattern2 {u"\\b(\\d{1,4})x(0?\\d{1,4})(?:\\D|\\b)"_qs};
|
||||
|
||||
// Extract partial match from article and compare as digits
|
||||
QRegularExpressionMatch matcher = cachedRegex(partialPattern1).match(articleTitle);
|
||||
@@ -324,7 +324,7 @@ bool AutoDownloadRule::matchesEpisodeFilterExpression(const QString &articleTitl
|
||||
const int seasonTheirs {matcher.captured(1).toInt()};
|
||||
const int episodeTheirs {matcher.captured(2).toInt()};
|
||||
|
||||
if (episode.endsWith('-'))
|
||||
if (episode.endsWith(u'-'))
|
||||
{ // Infinite range
|
||||
const int episodeOurs {QStringView(episode).left(episode.size() - 1).toInt()};
|
||||
if (((seasonTheirs == seasonOurs) && (episodeTheirs >= episodeOurs)) || (seasonTheirs > seasonOurs))
|
||||
@@ -332,7 +332,7 @@ bool AutoDownloadRule::matchesEpisodeFilterExpression(const QString &articleTitl
|
||||
}
|
||||
else
|
||||
{ // Normal range
|
||||
const QStringList range {episode.split('-')};
|
||||
const QStringList range {episode.split(u'-')};
|
||||
Q_ASSERT(range.size() == 2);
|
||||
if (range.first().toInt() > range.last().toInt())
|
||||
continue; // Ignore this subrule completely
|
||||
@@ -372,15 +372,15 @@ bool AutoDownloadRule::matchesSmartEpisodeFilter(const QString &articleTitle) co
|
||||
return false;
|
||||
|
||||
// Now see if we've downloaded this particular repack/proper combination
|
||||
const bool isRepack = articleTitle.contains("REPACK", Qt::CaseInsensitive);
|
||||
const bool isProper = articleTitle.contains("PROPER", Qt::CaseInsensitive);
|
||||
const bool isRepack = articleTitle.contains(u"REPACK", Qt::CaseInsensitive);
|
||||
const bool isProper = articleTitle.contains(u"PROPER", Qt::CaseInsensitive);
|
||||
|
||||
if (!isRepack && !isProper)
|
||||
return false;
|
||||
|
||||
const QString fullEpisodeStr = QString::fromLatin1("%1%2%3").arg(episodeStr,
|
||||
isRepack ? "-REPACK" : "",
|
||||
isProper ? "-PROPER" : "");
|
||||
const QString fullEpisodeStr = u"%1%2%3"_qs.arg(episodeStr,
|
||||
isRepack ? u"-REPACK" : u"",
|
||||
isProper ? u"-PROPER" : u"");
|
||||
const bool previouslyMatchedFull = m_dataPtr->previouslyMatchedEpisodes.contains(fullEpisodeStr);
|
||||
if (previouslyMatchedFull)
|
||||
return false;
|
||||
@@ -544,35 +544,35 @@ AutoDownloadRule AutoDownloadRule::fromJsonObject(const QJsonObject &jsonObj, co
|
||||
|
||||
QVariantHash AutoDownloadRule::toLegacyDict() const
|
||||
{
|
||||
return {{"name", name()},
|
||||
{"must_contain", mustContain()},
|
||||
{"must_not_contain", mustNotContain()},
|
||||
{"save_path", savePath().toString()},
|
||||
{"affected_feeds", feedURLs()},
|
||||
{"enabled", isEnabled()},
|
||||
{"category_assigned", assignedCategory()},
|
||||
{"use_regex", useRegex()},
|
||||
{"add_paused", toAddPausedLegacy(addPaused())},
|
||||
{"episode_filter", episodeFilter()},
|
||||
{"last_match", lastMatch()},
|
||||
{"ignore_days", ignoreDays()}};
|
||||
return {{u"name"_qs, name()},
|
||||
{u"must_contain"_qs, mustContain()},
|
||||
{u"must_not_contain"_qs, mustNotContain()},
|
||||
{u"save_path"_qs, savePath().toString()},
|
||||
{u"affected_feeds"_qs, feedURLs()},
|
||||
{u"enabled"_qs, isEnabled()},
|
||||
{u"category_assigned"_qs, assignedCategory()},
|
||||
{u"use_regex"_qs, useRegex()},
|
||||
{u"add_paused"_qs, toAddPausedLegacy(addPaused())},
|
||||
{u"episode_filter"_qs, episodeFilter()},
|
||||
{u"last_match"_qs, lastMatch()},
|
||||
{u"ignore_days"_qs, ignoreDays()}};
|
||||
}
|
||||
|
||||
AutoDownloadRule AutoDownloadRule::fromLegacyDict(const QVariantHash &dict)
|
||||
{
|
||||
AutoDownloadRule rule(dict.value("name").toString());
|
||||
AutoDownloadRule rule(dict.value(u"name"_qs).toString());
|
||||
|
||||
rule.setUseRegex(dict.value("use_regex", false).toBool());
|
||||
rule.setMustContain(dict.value("must_contain").toString());
|
||||
rule.setMustNotContain(dict.value("must_not_contain").toString());
|
||||
rule.setEpisodeFilter(dict.value("episode_filter").toString());
|
||||
rule.setFeedURLs(dict.value("affected_feeds").toStringList());
|
||||
rule.setEnabled(dict.value("enabled", false).toBool());
|
||||
rule.setSavePath(Path(dict.value("save_path").toString()));
|
||||
rule.setCategory(dict.value("category_assigned").toString());
|
||||
rule.setAddPaused(addPausedLegacyToOptionalBool(dict.value("add_paused").toInt()));
|
||||
rule.setLastMatch(dict.value("last_match").toDateTime());
|
||||
rule.setIgnoreDays(dict.value("ignore_days").toInt());
|
||||
rule.setUseRegex(dict.value(u"use_regex"_qs, false).toBool());
|
||||
rule.setMustContain(dict.value(u"must_contain"_qs).toString());
|
||||
rule.setMustNotContain(dict.value(u"must_not_contain"_qs).toString());
|
||||
rule.setEpisodeFilter(dict.value(u"episode_filter"_qs).toString());
|
||||
rule.setFeedURLs(dict.value(u"affected_feeds"_qs).toStringList());
|
||||
rule.setEnabled(dict.value(u"enabled"_qs, false).toBool());
|
||||
rule.setSavePath(Path(dict.value(u"save_path"_qs).toString()));
|
||||
rule.setCategory(dict.value(u"category_assigned"_qs).toString());
|
||||
rule.setAddPaused(addPausedLegacyToOptionalBool(dict.value(u"add_paused"_qs).toInt()));
|
||||
rule.setLastMatch(dict.value(u"last_match"_qs).toDateTime());
|
||||
rule.setIgnoreDays(dict.value(u"ignore_days"_qs).toInt());
|
||||
|
||||
return rule;
|
||||
}
|
||||
@@ -584,7 +584,7 @@ void AutoDownloadRule::setMustContain(const QString &tokens)
|
||||
if (m_dataPtr->useRegex)
|
||||
m_dataPtr->mustContain = QStringList() << tokens;
|
||||
else
|
||||
m_dataPtr->mustContain = tokens.split('|');
|
||||
m_dataPtr->mustContain = tokens.split(u'|');
|
||||
|
||||
// Check for single empty string - if so, no condition
|
||||
if ((m_dataPtr->mustContain.size() == 1) && m_dataPtr->mustContain[0].isEmpty())
|
||||
@@ -598,7 +598,7 @@ void AutoDownloadRule::setMustNotContain(const QString &tokens)
|
||||
if (m_dataPtr->useRegex)
|
||||
m_dataPtr->mustNotContain = QStringList() << tokens;
|
||||
else
|
||||
m_dataPtr->mustNotContain = tokens.split('|');
|
||||
m_dataPtr->mustNotContain = tokens.split(u'|');
|
||||
|
||||
// Check for single empty string - if so, no condition
|
||||
if ((m_dataPtr->mustNotContain.size() == 1) && m_dataPtr->mustNotContain[0].isEmpty())
|
||||
@@ -697,12 +697,12 @@ int AutoDownloadRule::ignoreDays() const
|
||||
|
||||
QString AutoDownloadRule::mustContain() const
|
||||
{
|
||||
return m_dataPtr->mustContain.join('|');
|
||||
return m_dataPtr->mustContain.join(u'|');
|
||||
}
|
||||
|
||||
QString AutoDownloadRule::mustNotContain() const
|
||||
{
|
||||
return m_dataPtr->mustNotContain.join('|');
|
||||
return m_dataPtr->mustNotContain.join(u'|');
|
||||
}
|
||||
|
||||
bool AutoDownloadRule::useSmartFilter() const
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include <QSharedDataPointer>
|
||||
#include <QVariant>
|
||||
|
||||
#include "base/global.h"
|
||||
#include "base/bittorrent/torrentcontentlayout.h"
|
||||
#include "base/pathfwd.h"
|
||||
|
||||
@@ -48,7 +49,7 @@ namespace RSS
|
||||
class AutoDownloadRule
|
||||
{
|
||||
public:
|
||||
explicit AutoDownloadRule(const QString &name = "");
|
||||
explicit AutoDownloadRule(const QString &name = u""_qs);
|
||||
AutoDownloadRule(const AutoDownloadRule &other);
|
||||
~AutoDownloadRule();
|
||||
|
||||
@@ -95,7 +96,7 @@ namespace RSS
|
||||
bool operator!=(const AutoDownloadRule &other) const;
|
||||
|
||||
QJsonObject toJsonObject() const;
|
||||
static AutoDownloadRule fromJsonObject(const QJsonObject &jsonObj, const QString &name = "");
|
||||
static AutoDownloadRule fromJsonObject(const QJsonObject &jsonObj, const QString &name = u""_qs);
|
||||
|
||||
QVariantHash toLegacyDict() const;
|
||||
static AutoDownloadRule fromLegacyDict(const QVariantHash &dict);
|
||||
|
||||
@@ -324,7 +324,7 @@ void Feed::loadArticles(const QByteArray &data)
|
||||
void Feed::loadArticlesLegacy()
|
||||
{
|
||||
const SettingsPtr qBTRSSFeeds = Profile::instance()->applicationSettings(QStringLiteral("qBittorrent-rss-feeds"));
|
||||
const QVariantHash allOldItems = qBTRSSFeeds->value("old_items").toHash();
|
||||
const QVariantHash allOldItems = qBTRSSFeeds->value(u"old_items"_qs).toHash();
|
||||
|
||||
for (const QVariant &var : asConst(allOldItems.value(m_url).toList()))
|
||||
{
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <QList>
|
||||
|
||||
#include "base/global.h"
|
||||
#include "rss_item.h"
|
||||
|
||||
namespace RSS
|
||||
@@ -44,7 +46,7 @@ namespace RSS
|
||||
|
||||
friend class Session;
|
||||
|
||||
explicit Folder(const QString &path = "");
|
||||
explicit Folder(const QString &path = u""_qs);
|
||||
~Folder() override;
|
||||
|
||||
public:
|
||||
|
||||
@@ -71,7 +71,7 @@ Session::Session()
|
||||
connect(m_workingThread, &QThread::finished, m_confFileStorage, &AsyncFileStorage::deleteLater);
|
||||
connect(m_confFileStorage, &AsyncFileStorage::failed, [](const Path &fileName, const QString &errorString)
|
||||
{
|
||||
LogMsg(tr("Couldn't save RSS Session configuration in %1. Error: %2")
|
||||
LogMsg(tr("Couldn't save RSS session configuration. File: \"%1\". Error: \"%2\"")
|
||||
.arg(fileName.toString(), errorString), Log::WARNING);
|
||||
});
|
||||
|
||||
@@ -80,11 +80,11 @@ Session::Session()
|
||||
connect(m_workingThread, &QThread::finished, m_dataFileStorage, &AsyncFileStorage::deleteLater);
|
||||
connect(m_dataFileStorage, &AsyncFileStorage::failed, [](const Path &fileName, const QString &errorString)
|
||||
{
|
||||
LogMsg(tr("Couldn't save RSS Session data in %1. Error: %2")
|
||||
LogMsg(tr("Couldn't save RSS session data. File: \"%1\". Error: \"%2\"")
|
||||
.arg(fileName.toString(), errorString), Log::WARNING);
|
||||
});
|
||||
|
||||
m_itemsByPath.insert("", new Folder); // root folder
|
||||
m_itemsByPath.insert(u""_qs, new Folder); // root folder
|
||||
|
||||
m_workingThread->start();
|
||||
load();
|
||||
@@ -100,22 +100,22 @@ Session::Session()
|
||||
// (at least on Windows, QSettings is case-insensitive and it can get
|
||||
// confused when asked about settings that differ only in their case)
|
||||
auto settingsStorage = SettingsStorage::instance();
|
||||
settingsStorage->removeValue("Rss/streamList");
|
||||
settingsStorage->removeValue("Rss/streamAlias");
|
||||
settingsStorage->removeValue("Rss/open_folders");
|
||||
settingsStorage->removeValue("Rss/qt5/splitter_h");
|
||||
settingsStorage->removeValue("Rss/qt5/splitterMain");
|
||||
settingsStorage->removeValue("Rss/hosts_cookies");
|
||||
settingsStorage->removeValue("RSS/streamList");
|
||||
settingsStorage->removeValue("RSS/streamAlias");
|
||||
settingsStorage->removeValue("RSS/open_folders");
|
||||
settingsStorage->removeValue("RSS/qt5/splitter_h");
|
||||
settingsStorage->removeValue("RSS/qt5/splitterMain");
|
||||
settingsStorage->removeValue("RSS/hosts_cookies");
|
||||
settingsStorage->removeValue("Rss/Session/EnableProcessing");
|
||||
settingsStorage->removeValue("Rss/Session/RefreshInterval");
|
||||
settingsStorage->removeValue("Rss/Session/MaxArticlesPerFeed");
|
||||
settingsStorage->removeValue("Rss/AutoDownloader/EnableProcessing");
|
||||
settingsStorage->removeValue(u"Rss/streamList"_qs);
|
||||
settingsStorage->removeValue(u"Rss/streamAlias"_qs);
|
||||
settingsStorage->removeValue(u"Rss/open_folders"_qs);
|
||||
settingsStorage->removeValue(u"Rss/qt5/splitter_h"_qs);
|
||||
settingsStorage->removeValue(u"Rss/qt5/splitterMain"_qs);
|
||||
settingsStorage->removeValue(u"Rss/hosts_cookies"_qs);
|
||||
settingsStorage->removeValue(u"RSS/streamList"_qs);
|
||||
settingsStorage->removeValue(u"RSS/streamAlias"_qs);
|
||||
settingsStorage->removeValue(u"RSS/open_folders"_qs);
|
||||
settingsStorage->removeValue(u"RSS/qt5/splitter_h"_qs);
|
||||
settingsStorage->removeValue(u"RSS/qt5/splitterMain"_qs);
|
||||
settingsStorage->removeValue(u"RSS/hosts_cookies"_qs);
|
||||
settingsStorage->removeValue(u"Rss/Session/EnableProcessing"_qs);
|
||||
settingsStorage->removeValue(u"Rss/Session/RefreshInterval"_qs);
|
||||
settingsStorage->removeValue(u"Rss/Session/MaxArticlesPerFeed"_qs);
|
||||
settingsStorage->removeValue(u"Rss/AutoDownloader/EnableProcessing"_qs);
|
||||
}
|
||||
|
||||
Session::~Session()
|
||||
@@ -126,7 +126,7 @@ Session::~Session()
|
||||
m_workingThread->wait();
|
||||
|
||||
//store();
|
||||
delete m_itemsByPath[""]; // deleting root folder
|
||||
delete m_itemsByPath[u""_qs]; // deleting root folder
|
||||
|
||||
qDebug() << "RSS Session deleted.";
|
||||
}
|
||||
@@ -240,9 +240,8 @@ void Session::load()
|
||||
|
||||
if (!itemsFile.open(QFile::ReadOnly))
|
||||
{
|
||||
Logger::instance()->addMessage(
|
||||
QString("Couldn't read RSS Session data from %1. Error: %2")
|
||||
.arg(itemsFile.fileName(), itemsFile.errorString()), Log::WARNING);
|
||||
LogMsg(tr("Couldn't read RSS session data. File: \"%1\". Error: \"%2\"")
|
||||
.arg(itemsFile.fileName(), itemsFile.errorString()), Log::WARNING);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -250,17 +249,15 @@ void Session::load()
|
||||
const QJsonDocument jsonDoc = QJsonDocument::fromJson(itemsFile.readAll(), &jsonError);
|
||||
if (jsonError.error != QJsonParseError::NoError)
|
||||
{
|
||||
Logger::instance()->addMessage(
|
||||
QString("Couldn't parse RSS Session data from %1. Error: %2")
|
||||
.arg(itemsFile.fileName(), jsonError.errorString()), Log::WARNING);
|
||||
LogMsg(tr("Couldn't parse RSS session data. File: \"%1\". Error: \"%2\"")
|
||||
.arg(itemsFile.fileName(), jsonError.errorString()), Log::WARNING);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!jsonDoc.isObject())
|
||||
{
|
||||
Logger::instance()->addMessage(
|
||||
QString("Couldn't load RSS Session data from %1. Invalid data format.")
|
||||
.arg(itemsFile.fileName()), Log::WARNING);
|
||||
LogMsg(tr("Couldn't load RSS session data. File: \"%1\". Error: Invalid data format.")
|
||||
.arg(itemsFile.fileName()), Log::WARNING);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -285,29 +282,29 @@ void Session::loadFolder(const QJsonObject &jsonObj, Folder *folder)
|
||||
else if (val.isObject())
|
||||
{
|
||||
const QJsonObject valObj {val.toObject()};
|
||||
if (valObj.contains("url"))
|
||||
if (valObj.contains(u"url"))
|
||||
{
|
||||
if (!valObj["url"].isString())
|
||||
if (!valObj[u"url"].isString())
|
||||
{
|
||||
LogMsg(tr("Couldn't load RSS Feed '%1'. URL is required.")
|
||||
.arg(QString("%1\\%2").arg(folder->path(), key)), Log::WARNING);
|
||||
LogMsg(tr("Couldn't load RSS feed. Feed: \"%1\". Reason: URL is required.")
|
||||
.arg(u"%1\\%2"_qs.arg(folder->path(), key)), Log::WARNING);
|
||||
continue;
|
||||
}
|
||||
|
||||
QUuid uid;
|
||||
if (valObj.contains("uid"))
|
||||
if (valObj.contains(u"uid"))
|
||||
{
|
||||
uid = QUuid {valObj["uid"].toString()};
|
||||
uid = QUuid {valObj[u"uid"].toString()};
|
||||
if (uid.isNull())
|
||||
{
|
||||
LogMsg(tr("Couldn't load RSS Feed '%1'. UID is invalid.")
|
||||
.arg(QString("%1\\%2").arg(folder->path(), key)), Log::WARNING);
|
||||
LogMsg(tr("Couldn't load RSS feed. Feed: \"%1\". Reason: UID is invalid.")
|
||||
.arg(u"%1\\%2"_qs.arg(folder->path(), key)), Log::WARNING);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (m_feedsByUID.contains(uid))
|
||||
{
|
||||
LogMsg(tr("Duplicate RSS Feed UID: %1. Configuration seems to be corrupted.")
|
||||
LogMsg(tr("Duplicate RSS feed found. UID: \"%1\". Error: Configuration seems to be corrupted.")
|
||||
.arg(uid.toString()), Log::WARNING);
|
||||
continue;
|
||||
}
|
||||
@@ -319,7 +316,7 @@ void Session::loadFolder(const QJsonObject &jsonObj, Folder *folder)
|
||||
updated = true;
|
||||
}
|
||||
|
||||
addFeedToFolder(uid, valObj["url"].toString(), key, folder);
|
||||
addFeedToFolder(uid, valObj[u"url"].toString(), key, folder);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -328,7 +325,7 @@ void Session::loadFolder(const QJsonObject &jsonObj, Folder *folder)
|
||||
}
|
||||
else
|
||||
{
|
||||
LogMsg(tr("Couldn't load RSS Item '%1'. Invalid data format.")
|
||||
LogMsg(tr("Couldn't load RSS item. Item: \"%1\". Invalid data format.")
|
||||
.arg(QString::fromLatin1("%1\\%2").arg(folder->path(), key)), Log::WARNING);
|
||||
}
|
||||
}
|
||||
@@ -339,11 +336,11 @@ void Session::loadFolder(const QJsonObject &jsonObj, Folder *folder)
|
||||
|
||||
void Session::loadLegacy()
|
||||
{
|
||||
const auto legacyFeedPaths = SettingsStorage::instance()->loadValue<QStringList>("Rss/streamList");
|
||||
const auto feedAliases = SettingsStorage::instance()->loadValue<QStringList>("Rss/streamAlias");
|
||||
const auto legacyFeedPaths = SettingsStorage::instance()->loadValue<QStringList>(u"Rss/streamList"_qs);
|
||||
const auto feedAliases = SettingsStorage::instance()->loadValue<QStringList>(u"Rss/streamAlias"_qs);
|
||||
if (legacyFeedPaths.size() != feedAliases.size())
|
||||
{
|
||||
Logger::instance()->addMessage("Corrupted RSS list, not loading it.", Log::WARNING);
|
||||
LogMsg(tr("Corrupted RSS list, not loading it."), Log::WARNING);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -458,7 +455,7 @@ AsyncFileStorage *Session::dataFileStorage() const
|
||||
|
||||
Folder *Session::rootFolder() const
|
||||
{
|
||||
return static_cast<Folder *>(m_itemsByPath.value(""));
|
||||
return static_cast<Folder *>(m_itemsByPath.value(u""_qs));
|
||||
}
|
||||
|
||||
QList<Feed *> Session::feeds() const
|
||||
|
||||
Reference in New Issue
Block a user