Remove usage of QTextStream

Other classes already provide rich methods so avoid another
layer of QTextStream which slow things down (slightly).

PR #17180.
This commit is contained in:
Chocobo1
2022-06-09 11:18:41 +08:00
committed by GitHub
parent ca07540675
commit eddeda7bab
6 changed files with 80 additions and 82 deletions

View File

@@ -41,7 +41,6 @@
#include <QJsonObject>
#include <QJsonValue>
#include <QSet>
#include <QTextStream>
#include <QThread>
#include <QTimer>
#include <QVariant>
@@ -522,9 +521,11 @@ void TorrentFilesWatcher::Worker::processFolder(const Path &path, const Path &wa
QFile file {filePath.data()};
if (file.open(QIODevice::ReadOnly | QIODevice::Text))
{
QTextStream str {&file};
while (!str.atEnd())
emit magnetFound(BitTorrent::MagnetUri(str.readLine()), addTorrentParams);
while (!file.atEnd())
{
const auto line = QString::fromLatin1(file.readLine()).trimmed();
emit magnetFound(BitTorrent::MagnetUri(line), addTorrentParams);
}
file.close();
Utils::Fs::removeFile(filePath);