Merge pull request #15181 from glassez/qt5

Raise minimum Qt version to 5.15.2
This commit is contained in:
Vladimir Golovnev
2021-07-23 06:22:57 +03:00
committed by GitHub
38 changed files with 120 additions and 146 deletions

View File

@@ -32,18 +32,18 @@
using namespace BitTorrent;
PeerAddress PeerAddress::parse(const QString &address)
PeerAddress PeerAddress::parse(const QStringView address)
{
QVector<QStringRef> ipPort;
QList<QStringView> ipPort;
if (address.startsWith('[') && address.contains("]:"))
if (address.startsWith(u'[') && address.contains(QLatin1String("]:")))
{ // IPv6
ipPort = address.splitRef("]:");
ipPort = address.split(QString::fromLatin1("]:"));
ipPort[0] = ipPort[0].mid(1); // chop '['
}
else if (address.contains(':'))
else if (address.contains(u':'))
{ // IPv4
ipPort = address.splitRef(':');
ipPort = address.split(u':');
}
else
{

View File

@@ -39,7 +39,7 @@ namespace BitTorrent
QHostAddress ip;
ushort port = 0;
static PeerAddress parse(const QString &address);
static PeerAddress parse(QStringView address);
QString toString() const;
};

View File

@@ -1590,7 +1590,7 @@ void Session::populateAdditionalTrackers()
m_additionalTrackerList.clear();
const QString trackers = additionalTrackers();
for (QStringRef tracker : asConst(trackers.splitRef('\n')))
for (QStringView tracker : asConst(QStringView(trackers).split(u'\n')))
{
tracker = tracker.trimmed();
if (!tracker.isEmpty())

View File

@@ -1868,9 +1868,9 @@ void TorrentImpl::handleFileRenamedAlert(const lt::file_renamed_alert *p)
if (m_oldPath[p->index].isEmpty())
m_oldPath.remove(p->index);
QVector<QStringRef> oldPathParts = oldFilePath.splitRef('/', Qt::SkipEmptyParts);
QList<QStringView> oldPathParts = QStringView(oldFilePath).split('/', Qt::SkipEmptyParts);
oldPathParts.removeLast(); // drop file name part
QVector<QStringRef> newPathParts = newFilePath.splitRef('/', Qt::SkipEmptyParts);
QList<QStringView> newPathParts = QStringView(newFilePath).split('/', Qt::SkipEmptyParts);
newPathParts.removeLast(); // drop file name part
#if defined(Q_OS_WIN)
@@ -1889,7 +1889,7 @@ void TorrentImpl::handleFileRenamedAlert(const lt::file_renamed_alert *p)
for (int i = (oldPathParts.size() - 1); i >= pathIdx; --i)
{
QDir().rmdir(savePath() + Utils::String::join(oldPathParts, QLatin1String("/")));
QDir().rmdir(savePath() + Utils::String::join(oldPathParts, QString::fromLatin1("/")));
oldPathParts.removeLast();
}

View File

@@ -61,7 +61,7 @@ namespace
{
if (QDir::isAbsolutePath(filePath)) continue;
const auto filePathElements = filePath.splitRef('/');
const auto filePathElements = QStringView(filePath).split(u'/');
// if at least one file has no root folder, no common root folder exists
if (filePathElements.count() <= 1) return {};