mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-22 08:27:24 -06:00
Use QString literals
It covers src/webui and enables `QT_NO_CAST_FROM_ASCII`.
This commit is contained in:
@@ -3170,7 +3170,7 @@ void Session::setOSMemoryPriority(const OSMemoryPriority priority)
|
||||
void Session::applyOSMemoryPriority() const
|
||||
{
|
||||
using SETPROCESSINFORMATION = BOOL (WINAPI *)(HANDLE, PROCESS_INFORMATION_CLASS, LPVOID, DWORD);
|
||||
const auto setProcessInformation = Utils::Misc::loadWinAPI<SETPROCESSINFORMATION>("Kernel32.dll", "SetProcessInformation");
|
||||
const auto setProcessInformation = Utils::Misc::loadWinAPI<SETPROCESSINFORMATION>(u"Kernel32.dll"_qs, "SetProcessInformation");
|
||||
if (!setProcessInformation) // only available on Windows >= 8
|
||||
return;
|
||||
|
||||
|
||||
@@ -186,7 +186,7 @@ namespace
|
||||
bool found = false;
|
||||
while (!found && !versions.empty())
|
||||
{
|
||||
const QString version = versions.takeLast() + "\\InstallPath";
|
||||
const QString version = versions.takeLast() + u"\\InstallPath";
|
||||
LPWSTR lpSubkey = new WCHAR[version.size() + 1];
|
||||
version.toWCharArray(lpSubkey);
|
||||
lpSubkey[version.size()] = 0;
|
||||
@@ -205,15 +205,15 @@ namespace
|
||||
{
|
||||
const QDir baseDir {path};
|
||||
|
||||
if (baseDir.exists("python3.exe"))
|
||||
if (baseDir.exists(u"python3.exe"_qs))
|
||||
{
|
||||
found = true;
|
||||
path = baseDir.filePath("python3.exe");
|
||||
path = baseDir.filePath(u"python3.exe"_qs);
|
||||
}
|
||||
else if (baseDir.exists("python.exe"))
|
||||
else if (baseDir.exists(u"python.exe"_qs))
|
||||
{
|
||||
found = true;
|
||||
path = baseDir.filePath("python.exe");
|
||||
path = baseDir.filePath(u"python.exe"_qs);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -243,14 +243,14 @@ namespace
|
||||
return path;
|
||||
|
||||
// Fallback: Detect python from default locations
|
||||
const QFileInfoList dirs = QDir("C:/").entryInfoList({"Python*"}, QDir::Dirs, (QDir::Name | QDir::Reversed));
|
||||
const QFileInfoList dirs = QDir(u"C:/"_qs).entryInfoList({u"Python*"_qs}, QDir::Dirs, (QDir::Name | QDir::Reversed));
|
||||
for (const QFileInfo &info : dirs)
|
||||
{
|
||||
const QString py3Path {info.absolutePath() + "/python3.exe"};
|
||||
const QString py3Path {info.absolutePath() + u"/python3.exe"};
|
||||
if (QFile::exists(py3Path))
|
||||
return py3Path;
|
||||
|
||||
const QString pyPath {info.absolutePath() + "/python.exe"};
|
||||
const QString pyPath {info.absolutePath() + u"/python.exe"};
|
||||
if (QFile::exists(pyPath))
|
||||
return pyPath;
|
||||
}
|
||||
|
||||
@@ -93,8 +93,8 @@ namespace Utils::Misc
|
||||
T loadWinAPI(const QString &source, const char *funcName)
|
||||
{
|
||||
QString path = windowsSystemPath();
|
||||
if (!path.endsWith('\\'))
|
||||
path += '\\';
|
||||
if (!path.endsWith(u'\\'))
|
||||
path += u'\\';
|
||||
|
||||
path += source;
|
||||
|
||||
|
||||
@@ -43,7 +43,8 @@
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include "misc.h"
|
||||
#include "base/global.h"
|
||||
#include "base/utils/misc.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
@@ -55,7 +56,7 @@ namespace
|
||||
using result_type = uint32_t;
|
||||
|
||||
RandomLayer()
|
||||
: m_rtlGenRandom {Utils::Misc::loadWinAPI<PRTLGENRANDOM>("Advapi32.dll", "SystemFunction036")}
|
||||
: m_rtlGenRandom {Utils::Misc::loadWinAPI<PRTLGENRANDOM>(u"Advapi32.dll"_qs, "SystemFunction036")}
|
||||
{
|
||||
if (!m_rtlGenRandom)
|
||||
qFatal("Failed to load RtlGenRandom()");
|
||||
|
||||
Reference in New Issue
Block a user