Use QString literals

The plan is to define `QT_NO_CAST_FROM_ASCII` eventually.
PR #16561.
This commit is contained in:
Chocobo1
2022-03-04 13:25:22 +08:00
committed by GitHub
parent 2c8447853b
commit ab64ee872b
23 changed files with 104 additions and 108 deletions

View File

@@ -114,7 +114,7 @@ BitTorrent::BencodeResumeDataStorage::BencodeResumeDataStorage(const Path &path,
m_registeredTorrents.append(TorrentID::fromString(rxMatch.captured(1)));
}
loadQueue(m_resumeDataPath / Path("queue"));
loadQueue(m_resumeDataPath / Path(u"queue"_qs));
qDebug() << "Registered torrents count: " << m_registeredTorrents.size();
@@ -403,7 +403,7 @@ void BitTorrent::BencodeResumeDataStorage::Worker::storeQueue(const QVector<Torr
for (const BitTorrent::TorrentID &torrentID : queue)
data += (torrentID.toString().toLatin1() + '\n');
const Path filepath = m_resumeDataDir / Path("queue");
const Path filepath = m_resumeDataDir / Path(u"queue"_qs);
const nonstd::expected<void, QString> result = Utils::IO::saveToFile(filepath, data);
if (!result)
{

View File

@@ -108,7 +108,7 @@
using namespace BitTorrent;
const Path CATEGORIES_FILE_NAME {"categories.json"};
const Path CATEGORIES_FILE_NAME {u"categories.json"_qs};
namespace
{
@@ -457,7 +457,7 @@ Session::Session(QObject *parent)
, m_storedTags(BITTORRENT_SESSION_KEY("Tags"))
, m_maxRatioAction(BITTORRENT_SESSION_KEY("MaxRatioAction"), Pause)
, m_savePath(BITTORRENT_SESSION_KEY("DefaultSavePath"), specialFolderLocation(SpecialFolder::Downloads))
, m_downloadPath(BITTORRENT_SESSION_KEY("TempPath"), (savePath() / Path("temp")))
, m_downloadPath(BITTORRENT_SESSION_KEY("TempPath"), (savePath() / Path(u"temp"_qs)))
, m_isDownloadPathEnabled(BITTORRENT_SESSION_KEY("TempPathEnabled"), false)
, m_isSubcategoriesEnabled(BITTORRENT_SESSION_KEY("SubcategoriesEnabled"), false)
, m_useCategoryPathsInManualMode(BITTORRENT_SESSION_KEY("UseCategoryPathsInManualMode"), false)
@@ -2556,7 +2556,7 @@ void Session::setSavePath(const Path &path)
void Session::setDownloadPath(const Path &path)
{
const Path newPath = (path.isAbsolute() ? path : (savePath() / Path("temp") / path));
const Path newPath = (path.isAbsolute() ? path : (savePath() / Path(u"temp"_qs) / path));
if (newPath == m_downloadPath)
return;
@@ -4451,7 +4451,7 @@ void Session::startUpTorrents()
{
qDebug("Initializing torrents resume data storage...");
const Path dbPath = specialFolderLocation(SpecialFolder::Data) / Path("torrents.db");
const Path dbPath = specialFolderLocation(SpecialFolder::Data) / Path(u"torrents.db"_qs);
const bool dbStorageExists = dbPath.exists();
ResumeDataStorage *startupStorage = nullptr;
@@ -4461,13 +4461,13 @@ void Session::startUpTorrents()
if (!dbStorageExists)
{
const Path dataPath = specialFolderLocation(SpecialFolder::Data) / Path("BT_backup");
const Path dataPath = specialFolderLocation(SpecialFolder::Data) / Path(u"BT_backup"_qs);
startupStorage = new BencodeResumeDataStorage(dataPath, this);
}
}
else
{
const Path dataPath = specialFolderLocation(SpecialFolder::Data) / Path("BT_backup");
const Path dataPath = specialFolderLocation(SpecialFolder::Data) / Path(u"BT_backup"_qs);
m_resumeDataStorage = new BencodeResumeDataStorage(dataPath, this);
if (dbStorageExists)

View File

@@ -324,8 +324,8 @@ TorrentImpl::TorrentImpl(Session *session, lt::session *nativeSession
// Remove .unwanted directory if empty
const Path newPath = spath / newRelPath;
qDebug() << "Attempting to remove \".unwanted\" folder at " << (newPath / Path(".unwanted")).toString();
Utils::Fs::rmdir(newPath / Path(".unwanted"));
qDebug() << "Attempting to remove \".unwanted\" folder at " << (newPath / Path(u".unwanted"_qs)).toString();
Utils::Fs::rmdir(newPath / Path(u".unwanted"_qs));
}
}
// == END UPGRADE CODE ==