mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-31 20:58:07 -06:00
Use QString literals
This patch covers src/gui and some leftovers from previous commit.
This commit is contained in:
@@ -42,6 +42,7 @@
|
||||
#include <QDir>
|
||||
#endif
|
||||
|
||||
#include "base/global.h"
|
||||
#include "base/logger.h"
|
||||
#include "base/utils/bytearray.h"
|
||||
|
||||
@@ -52,7 +53,7 @@ namespace
|
||||
bool testPythonInstallation(const QString &exeName, PythonInfo &info)
|
||||
{
|
||||
QProcess proc;
|
||||
proc.start(exeName, {"--version"}, QIODevice::ReadOnly);
|
||||
proc.start(exeName, {u"--version"_qs}, QIODevice::ReadOnly);
|
||||
if (proc.waitForFinished() && (proc.exitCode() == QProcess::NormalExit))
|
||||
{
|
||||
QByteArray procOutput = proc.readAllStandardOutput();
|
||||
@@ -69,8 +70,8 @@ namespace
|
||||
|
||||
// User reports: `python --version` -> "Python 3.6.6+"
|
||||
// So trim off unrelated characters
|
||||
const QString versionStr = outputSplit[1];
|
||||
const int idx = versionStr.indexOf(QRegularExpression("[^\\.\\d]"));
|
||||
const auto versionStr = QString::fromLocal8Bit(outputSplit[1]);
|
||||
const int idx = versionStr.indexOf(QRegularExpression(u"[^\\.\\d]"_qs));
|
||||
|
||||
try
|
||||
{
|
||||
@@ -274,10 +275,10 @@ PythonInfo Utils::ForeignApps::pythonInfo()
|
||||
static PythonInfo pyInfo;
|
||||
if (!pyInfo.isValid())
|
||||
{
|
||||
if (testPythonInstallation("python3", pyInfo))
|
||||
if (testPythonInstallation(u"python3"_qs, pyInfo))
|
||||
return pyInfo;
|
||||
|
||||
if (testPythonInstallation("python", pyInfo))
|
||||
if (testPythonInstallation(u"python"_qs, pyInfo))
|
||||
return pyInfo;
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
|
||||
@@ -265,7 +265,7 @@ QString Utils::Misc::friendlyUnit(const qint64 bytes, const bool isSpeed)
|
||||
if (!result)
|
||||
return QCoreApplication::translate("misc", "Unknown", "Unknown (size)");
|
||||
return Utils::String::fromDouble(result->value, friendlyUnitPrecision(result->unit))
|
||||
+ QString::fromUtf8(C_NON_BREAKING_SPACE)
|
||||
+ C_NON_BREAKING_SPACE
|
||||
+ unitString(result->unit, isSpeed);
|
||||
}
|
||||
|
||||
@@ -354,9 +354,9 @@ bool Utils::Misc::isPreviewable(const Path &filePath)
|
||||
QString Utils::Misc::userFriendlyDuration(const qlonglong seconds, const qlonglong maxCap)
|
||||
{
|
||||
if (seconds < 0)
|
||||
return QString::fromUtf8(C_INFINITY);
|
||||
return C_INFINITY;
|
||||
if ((maxCap >= 0) && (seconds >= maxCap))
|
||||
return QString::fromUtf8(C_INFINITY);
|
||||
return C_INFINITY;
|
||||
|
||||
if (seconds == 0)
|
||||
return u"0"_qs;
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace Utils
|
||||
|
||||
QString subnetToString(const Subnet &subnet)
|
||||
{
|
||||
return subnet.first.toString() + '/' + QString::number(subnet.second);
|
||||
return subnet.first.toString() + u'/' + QString::number(subnet.second);
|
||||
}
|
||||
|
||||
QHostAddress canonicalIPv6Addr(const QHostAddress &addr)
|
||||
|
||||
Reference in New Issue
Block a user