Rename literal operator

Qt 6.4 introduced `QString operator""_s()` and the previous `""_qs` is
deprecated since Qt 6.8.
This commit is contained in:
Chocobo1 2023-06-18 02:02:02 +08:00
parent f6b58f36e2
commit e6d85a468b
No known key found for this signature in database
GPG key ID: 210D9C873253A68C
141 changed files with 3610 additions and 3604 deletions

View file

@ -108,12 +108,12 @@ namespace
{ {
#define SETTINGS_KEY(name) u"Application/" name #define SETTINGS_KEY(name) u"Application/" name
#define FILELOGGER_SETTINGS_KEY(name) (SETTINGS_KEY(u"FileLogger/") name) #define FILELOGGER_SETTINGS_KEY(name) (SETTINGS_KEY(u"FileLogger/") name)
#define NOTIFICATIONS_SETTINGS_KEY(name) (SETTINGS_KEY(u"GUI/Notifications/"_qs) name) #define NOTIFICATIONS_SETTINGS_KEY(name) (SETTINGS_KEY(u"GUI/Notifications/"_s) name)
const QString LOG_FOLDER = u"logs"_qs; const QString LOG_FOLDER = u"logs"_s;
const QChar PARAMS_SEPARATOR = u'|'; const QChar PARAMS_SEPARATOR = u'|';
const Path DEFAULT_PORTABLE_MODE_PROFILE_DIR {u"profile"_qs}; const Path DEFAULT_PORTABLE_MODE_PROFILE_DIR {u"profile"_s};
const int MIN_FILELOG_SIZE = 1024; // 1KiB const int MIN_FILELOG_SIZE = 1024; // 1KiB
const int MAX_FILELOG_SIZE = 1000 * 1024 * 1024; // 1000MiB const int MAX_FILELOG_SIZE = 1000 * 1024 * 1024; // 1000MiB
@ -140,22 +140,22 @@ namespace
result.append(u"@savePath=" + addTorrentParams.savePath.data()); result.append(u"@savePath=" + addTorrentParams.savePath.data());
if (addTorrentParams.addPaused.has_value()) if (addTorrentParams.addPaused.has_value())
result.append(*addTorrentParams.addPaused ? u"@addPaused=1"_qs : u"@addPaused=0"_qs); result.append(*addTorrentParams.addPaused ? u"@addPaused=1"_s : u"@addPaused=0"_s);
if (addTorrentParams.skipChecking) if (addTorrentParams.skipChecking)
result.append(u"@skipChecking"_qs); result.append(u"@skipChecking"_s);
if (!addTorrentParams.category.isEmpty()) if (!addTorrentParams.category.isEmpty())
result.append(u"@category=" + addTorrentParams.category); result.append(u"@category=" + addTorrentParams.category);
if (addTorrentParams.sequential) if (addTorrentParams.sequential)
result.append(u"@sequential"_qs); result.append(u"@sequential"_s);
if (addTorrentParams.firstLastPiecePriority) if (addTorrentParams.firstLastPiecePriority)
result.append(u"@firstLastPiecePriority"_qs); result.append(u"@firstLastPiecePriority"_s);
if (params.skipDialog.has_value()) if (params.skipDialog.has_value())
result.append(*params.skipDialog ? u"@skipDialog=1"_qs : u"@skipDialog=0"_qs); result.append(*params.skipDialog ? u"@skipDialog=1"_s : u"@skipDialog=0"_s);
result += params.torrentSources; result += params.torrentSources;
@ -225,29 +225,29 @@ namespace
Application::Application(int &argc, char **argv) Application::Application(int &argc, char **argv)
: BaseApplication(argc, argv) : BaseApplication(argc, argv)
, m_commandLineArgs(parseCommandLine(Application::arguments())) , m_commandLineArgs(parseCommandLine(Application::arguments()))
, m_storeFileLoggerEnabled(FILELOGGER_SETTINGS_KEY(u"Enabled"_qs)) , m_storeFileLoggerEnabled(FILELOGGER_SETTINGS_KEY(u"Enabled"_s))
, m_storeFileLoggerBackup(FILELOGGER_SETTINGS_KEY(u"Backup"_qs)) , m_storeFileLoggerBackup(FILELOGGER_SETTINGS_KEY(u"Backup"_s))
, m_storeFileLoggerDeleteOld(FILELOGGER_SETTINGS_KEY(u"DeleteOld"_qs)) , m_storeFileLoggerDeleteOld(FILELOGGER_SETTINGS_KEY(u"DeleteOld"_s))
, m_storeFileLoggerMaxSize(FILELOGGER_SETTINGS_KEY(u"MaxSizeBytes"_qs)) , m_storeFileLoggerMaxSize(FILELOGGER_SETTINGS_KEY(u"MaxSizeBytes"_s))
, m_storeFileLoggerAge(FILELOGGER_SETTINGS_KEY(u"Age"_qs)) , m_storeFileLoggerAge(FILELOGGER_SETTINGS_KEY(u"Age"_s))
, m_storeFileLoggerAgeType(FILELOGGER_SETTINGS_KEY(u"AgeType"_qs)) , m_storeFileLoggerAgeType(FILELOGGER_SETTINGS_KEY(u"AgeType"_s))
, m_storeFileLoggerPath(FILELOGGER_SETTINGS_KEY(u"Path"_qs)) , m_storeFileLoggerPath(FILELOGGER_SETTINGS_KEY(u"Path"_s))
, m_storeMemoryWorkingSetLimit(SETTINGS_KEY(u"MemoryWorkingSetLimit"_qs)) , m_storeMemoryWorkingSetLimit(SETTINGS_KEY(u"MemoryWorkingSetLimit"_s))
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
, m_processMemoryPriority(SETTINGS_KEY(u"ProcessMemoryPriority"_qs)) , m_processMemoryPriority(SETTINGS_KEY(u"ProcessMemoryPriority"_s))
#endif #endif
#ifndef DISABLE_GUI #ifndef DISABLE_GUI
, m_startUpWindowState(u"GUI/StartUpWindowState"_qs) , m_startUpWindowState(u"GUI/StartUpWindowState"_s)
, m_storeNotificationTorrentAdded(NOTIFICATIONS_SETTINGS_KEY(u"TorrentAdded"_qs)) , m_storeNotificationTorrentAdded(NOTIFICATIONS_SETTINGS_KEY(u"TorrentAdded"_s))
#endif #endif
{ {
qRegisterMetaType<Log::Msg>("Log::Msg"); qRegisterMetaType<Log::Msg>("Log::Msg");
qRegisterMetaType<Log::Peer>("Log::Peer"); qRegisterMetaType<Log::Peer>("Log::Peer");
setApplicationName(u"qBittorrent"_qs); setApplicationName(u"qBittorrent"_s);
setOrganizationDomain(u"qbittorrent.org"_qs); setOrganizationDomain(u"qbittorrent.org"_s);
#if !defined(DISABLE_GUI) #if !defined(DISABLE_GUI)
setDesktopFileName(u"org.qbittorrent.qBittorrent"_qs); setDesktopFileName(u"org.qbittorrent.qBittorrent"_s);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
setAttribute(Qt::AA_UseHighDpiPixmaps, true); // opt-in to the high DPI pixmap support setAttribute(Qt::AA_UseHighDpiPixmaps, true); // opt-in to the high DPI pixmap support
#endif #endif
@ -275,7 +275,7 @@ Application::Application(int &argc, char **argv)
if (!firstTimeUser) if (!firstTimeUser)
{ {
if (!upgrade()) if (!upgrade())
throw RuntimeError(u"Failed migration of old settings"_qs); // Not translatable. Translation isn't configured yet. throw RuntimeError(u"Failed migration of old settings"_s); // Not translatable. Translation isn't configured yet.
handleChangedDefaults(DefaultPreferencesMode::Legacy); handleChangedDefaults(DefaultPreferencesMode::Legacy);
} }
else else
@ -296,7 +296,7 @@ Application::Application(int &argc, char **argv)
{ {
LogMsg(tr("Running in portable mode. Auto detected profile folder at: %1").arg(profileDir.toString())); LogMsg(tr("Running in portable mode. Auto detected profile folder at: %1").arg(profileDir.toString()));
if (m_commandLineArgs.relativeFastresumePaths) if (m_commandLineArgs.relativeFastresumePaths)
LogMsg(tr("Redundant command line flag detected: \"%1\". Portable mode implies relative fastresume.").arg(u"--relative-fastresume"_qs), Log::WARNING); // to avoid translating the `--relative-fastresume` string LogMsg(tr("Redundant command line flag detected: \"%1\". Portable mode implies relative fastresume.").arg(u"--relative-fastresume"_s), Log::WARNING); // to avoid translating the `--relative-fastresume` string
} }
else else
{ {
@ -311,7 +311,7 @@ Application::Application(int &argc, char **argv)
if (m_commandLineArgs.torrentingPort > 0) // it will be -1 when user did not set any value if (m_commandLineArgs.torrentingPort > 0) // it will be -1 when user did not set any value
{ {
SettingValue<int> port {u"BitTorrent/Session/Port"_qs}; SettingValue<int> port {u"BitTorrent/Session/Port"_s};
port = m_commandLineArgs.torrentingPort; port = m_commandLineArgs.torrentingPort;
} }
} }
@ -523,13 +523,13 @@ void Application::runExternalProgram(const QString &programTemplate, const BitTo
str.replace(i, 2, torrent->contentPath().toString()); str.replace(i, 2, torrent->contentPath().toString());
break; break;
case u'G': case u'G':
str.replace(i, 2, torrent->tags().join(u","_qs)); str.replace(i, 2, torrent->tags().join(u","_s));
break; break;
case u'I': case u'I':
str.replace(i, 2, (torrent->infoHash().v1().isValid() ? torrent->infoHash().v1().toString() : u"-"_qs)); str.replace(i, 2, (torrent->infoHash().v1().isValid() ? torrent->infoHash().v1().toString() : u"-"_s));
break; break;
case u'J': case u'J':
str.replace(i, 2, (torrent->infoHash().v2().isValid() ? torrent->infoHash().v2().toString() : u"-"_qs)); str.replace(i, 2, (torrent->infoHash().v2().isValid() ? torrent->infoHash().v2().toString() : u"-"_s));
break; break;
case u'K': case u'K':
str.replace(i, 2, torrent->id().toString()); str.replace(i, 2, torrent->id().toString());
@ -792,7 +792,7 @@ try
#ifndef Q_OS_MACOS #ifndef Q_OS_MACOS
auto *desktopIntegrationMenu = new QMenu; auto *desktopIntegrationMenu = new QMenu;
auto *actionExit = new QAction(tr("E&xit"), desktopIntegrationMenu); auto *actionExit = new QAction(tr("E&xit"), desktopIntegrationMenu);
actionExit->setIcon(UIThemeManager::instance()->getIcon(u"application-exit"_qs)); actionExit->setIcon(UIThemeManager::instance()->getIcon(u"application-exit"_s));
actionExit->setMenuRole(QAction::QuitRole); actionExit->setMenuRole(QAction::QuitRole);
actionExit->setShortcut(Qt::CTRL | Qt::Key_Q); actionExit->setShortcut(Qt::CTRL | Qt::Key_Q);
connect(actionExit, &QAction::triggered, this, [] connect(actionExit, &QAction::triggered, this, []
@ -904,16 +904,16 @@ try
const Preferences *pref = Preferences::instance(); const Preferences *pref = Preferences::instance();
const auto scheme = pref->isWebUiHttpsEnabled() ? u"https"_qs : u"http"_qs; const auto scheme = pref->isWebUiHttpsEnabled() ? u"https"_s : u"http"_s;
const auto url = u"%1://localhost:%2\n"_qs.arg(scheme, QString::number(pref->getWebUiPort())); const auto url = u"%1://localhost:%2\n"_s.arg(scheme, QString::number(pref->getWebUiPort()));
const QString mesg = u"\n******** %1 ********\n"_qs.arg(tr("Information")) const QString mesg = u"\n******** %1 ********\n"_s.arg(tr("Information"))
+ tr("To control qBittorrent, access the WebUI at: %1").arg(url); + tr("To control qBittorrent, access the WebUI at: %1").arg(url);
printf("%s\n", qUtf8Printable(mesg)); printf("%s\n", qUtf8Printable(mesg));
if (pref->getWebUIPassword() == QByteArrayLiteral("ARQ77eY1NUZaQsuDHbIMCA==:0WMRkYTUWVT9wVvdDtHAjU9b3b7uB8NR1Gur2hmQCvCDpm39Q+PsJRJPaCU51dEiz+dTzh8qbPsL8WkFljQYFQ==")) if (pref->getWebUIPassword() == QByteArrayLiteral("ARQ77eY1NUZaQsuDHbIMCA==:0WMRkYTUWVT9wVvdDtHAjU9b3b7uB8NR1Gur2hmQCvCDpm39Q+PsJRJPaCU51dEiz+dTzh8qbPsL8WkFljQYFQ=="))
{ {
const QString warning = tr("The Web UI administrator username is: %1").arg(pref->getWebUiUsername()) + u'\n' const QString warning = tr("The Web UI administrator username is: %1").arg(pref->getWebUiUsername()) + u'\n'
+ tr("The Web UI administrator password has not been changed from the default: %1").arg(u"adminadmin"_qs) + u'\n' + tr("The Web UI administrator password has not been changed from the default: %1").arg(u"adminadmin"_s) + u'\n'
+ tr("This is a security risk, please change your password in program preferences.") + u'\n'; + tr("This is a security risk, please change your password in program preferences.") + u'\n';
printf("%s", qUtf8Printable(warning)); printf("%s", qUtf8Printable(warning));
} }
@ -1165,12 +1165,12 @@ void Application::setProcessMemoryPriority(const MemoryPriority priority)
void Application::applyMemoryPriority() const void Application::applyMemoryPriority() const
{ {
using SETPROCESSINFORMATION = BOOL (WINAPI *)(HANDLE, PROCESS_INFORMATION_CLASS, LPVOID, DWORD); using SETPROCESSINFORMATION = BOOL (WINAPI *)(HANDLE, PROCESS_INFORMATION_CLASS, LPVOID, DWORD);
const auto setProcessInformation = Utils::Misc::loadWinAPI<SETPROCESSINFORMATION>(u"Kernel32.dll"_qs, "SetProcessInformation"); const auto setProcessInformation = Utils::Misc::loadWinAPI<SETPROCESSINFORMATION>(u"Kernel32.dll"_s, "SetProcessInformation");
if (!setProcessInformation) // only available on Windows >= 8 if (!setProcessInformation) // only available on Windows >= 8
return; return;
using SETTHREADINFORMATION = BOOL (WINAPI *)(HANDLE, THREAD_INFORMATION_CLASS, LPVOID, DWORD); using SETTHREADINFORMATION = BOOL (WINAPI *)(HANDLE, THREAD_INFORMATION_CLASS, LPVOID, DWORD);
const auto setThreadInformation = Utils::Misc::loadWinAPI<SETTHREADINFORMATION>(u"Kernel32.dll"_qs, "SetThreadInformation"); const auto setThreadInformation = Utils::Misc::loadWinAPI<SETTHREADINFORMATION>(u"Kernel32.dll"_s, "SetThreadInformation");
if (!setThreadInformation) // only available on Windows >= 8 if (!setThreadInformation) // only available on Windows >= 8
return; return;

View file

@ -152,16 +152,16 @@ namespace
{ {
QStringList parts = arg.split(u'='); QStringList parts = arg.split(u'=');
if (parts.size() == 2) if (parts.size() == 2)
return Utils::String::unquote(parts[1], u"'\""_qs); return Utils::String::unquote(parts[1], u"'\""_s);
throw CommandLineParameterError(QCoreApplication::translate("CMD Options", "Parameter '%1' must follow syntax '%1=%2'", throw CommandLineParameterError(QCoreApplication::translate("CMD Options", "Parameter '%1' must follow syntax '%1=%2'",
"e.g. Parameter '--webui-port' must follow syntax '--webui-port=value'") "e.g. Parameter '--webui-port' must follow syntax '--webui-port=value'")
.arg(fullParameter(), u"<value>"_qs)); .arg(fullParameter(), u"<value>"_s));
} }
QString value(const QProcessEnvironment &env, const QString &defaultValue = {}) const QString value(const QProcessEnvironment &env, const QString &defaultValue = {}) const
{ {
QString val = env.value(envVarName()); QString val = env.value(envVarName());
return val.isEmpty() ? defaultValue : Utils::String::unquote(val, u"'\""_qs); return val.isEmpty() ? defaultValue : Utils::String::unquote(val, u"'\""_s);
} }
QString usage(const QString &valueName) const QString usage(const QString &valueName) const
@ -206,7 +206,7 @@ namespace
{ {
throw CommandLineParameterError(QCoreApplication::translate("CMD Options", "Parameter '%1' must follow syntax '%1=%2'", throw CommandLineParameterError(QCoreApplication::translate("CMD Options", "Parameter '%1' must follow syntax '%1=%2'",
"e.g. Parameter '--webui-port' must follow syntax '--webui-port=<value>'") "e.g. Parameter '--webui-port' must follow syntax '--webui-port=<value>'")
.arg(fullParameter(), u"<integer value>"_qs)); .arg(fullParameter(), u"<integer value>"_s));
} }
return res; return res;
} }
@ -279,12 +279,12 @@ namespace
throw CommandLineParameterError(QCoreApplication::translate("CMD Options", "Parameter '%1' must follow syntax '%1=%2'", throw CommandLineParameterError(QCoreApplication::translate("CMD Options", "Parameter '%1' must follow syntax '%1=%2'",
"e.g. Parameter '--add-paused' must follow syntax " "e.g. Parameter '--add-paused' must follow syntax "
"'--add-paused=<true|false>'") "'--add-paused=<true|false>'")
.arg(fullParameter(), u"<true|false>"_qs)); .arg(fullParameter(), u"<true|false>"_s));
} }
std::optional<bool> value(const QProcessEnvironment &env) const std::optional<bool> value(const QProcessEnvironment &env) const
{ {
const QString val = env.value(envVarName(), u"-1"_qs); const QString val = env.value(envVarName(), u"-1"_s);
if (val.isEmpty()) if (val.isEmpty())
{ {
@ -304,7 +304,7 @@ namespace
} }
qDebug() << QCoreApplication::translate("CMD Options", "Expected %1 in environment variable '%2', but got '%3'") qDebug() << QCoreApplication::translate("CMD Options", "Expected %1 in environment variable '%2', but got '%3'")
.arg(u"true|false"_qs, envVarName(), val); .arg(u"true|false"_s, envVarName(), val);
return std::nullopt; return std::nullopt;
} }
@ -390,7 +390,7 @@ QBtCommandLineParameters parseCommandLine(const QStringList &args)
result.webUiPort = WEBUI_PORT_OPTION.value(arg); result.webUiPort = WEBUI_PORT_OPTION.value(arg);
if ((result.webUiPort < 1) || (result.webUiPort > 65535)) if ((result.webUiPort < 1) || (result.webUiPort > 65535))
throw CommandLineParameterError(QCoreApplication::translate("CMD Options", "%1 must specify a valid port (1 to 65535).") throw CommandLineParameterError(QCoreApplication::translate("CMD Options", "%1 must specify a valid port (1 to 65535).")
.arg(u"--webui-port"_qs)); .arg(u"--webui-port"_s));
} }
else if (arg == TORRENTING_PORT_OPTION) else if (arg == TORRENTING_PORT_OPTION)
{ {
@ -398,7 +398,7 @@ QBtCommandLineParameters parseCommandLine(const QStringList &args)
if ((result.torrentingPort < 1) || (result.torrentingPort > 65535)) if ((result.torrentingPort < 1) || (result.torrentingPort > 65535))
{ {
throw CommandLineParameterError(QCoreApplication::translate("CMD Options", "%1 must specify a valid port (1 to 65535).") throw CommandLineParameterError(QCoreApplication::translate("CMD Options", "%1 must specify a valid port (1 to 65535).")
.arg(u"--torrenting-port"_qs)); .arg(u"--torrenting-port"_s));
} }
} }
#ifndef DISABLE_GUI #ifndef DISABLE_GUI

View file

@ -78,7 +78,7 @@ void FileLogger::changePath(const Path &newPath)
closeLogFile(); closeLogFile();
m_path = newPath / Path(u"qbittorrent.log"_qs); m_path = newPath / Path(u"qbittorrent.log"_s);
m_logFile.setFileName(m_path.data()); m_logFile.setFileName(m_path.data());
Utils::Fs::mkpath(newPath); Utils::Fs::mkpath(newPath);
@ -89,7 +89,7 @@ void FileLogger::deleteOld(const int age, const FileLogAgeType ageType)
{ {
const QDateTime date = QDateTime::currentDateTime(); const QDateTime date = QDateTime::currentDateTime();
const QDir dir {m_path.parentPath().data()}; const QDir dir {m_path.parentPath().data()};
const QFileInfoList fileList = dir.entryInfoList(QStringList(u"qbittorrent.log.bak*"_qs) const QFileInfoList fileList = dir.entryInfoList(QStringList(u"qbittorrent.log.bak*"_s)
, (QDir::Files | QDir::Writable), (QDir::Time | QDir::Reversed)); , (QDir::Files | QDir::Writable), (QDir::Time | QDir::Reversed));
for (const QFileInfo &file : fileList) for (const QFileInfo &file : fileList)

View file

@ -127,7 +127,7 @@ int main(int argc, char *argv[])
if (envValue.isEmpty()) if (envValue.isEmpty())
qputenv(envName, Application::applicationDirPath().toLocal8Bit()); qputenv(envName, Application::applicationDirPath().toLocal8Bit());
else else
qputenv(envName, u"%1;%2"_qs.arg(envValue, Application::applicationDirPath()).toLocal8Bit()); qputenv(envName, u"%1;%2"_s.arg(envValue, Application::applicationDirPath()).toLocal8Bit());
#endif #endif
const QBtCommandLineParameters params = app->commandLineArgs(); const QBtCommandLineParameters params = app->commandLineArgs();
@ -146,7 +146,7 @@ int main(int argc, char *argv[])
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
throw CommandLineParameterError(QCoreApplication::translate("Main", "%1 must be the single command line parameter.") throw CommandLineParameterError(QCoreApplication::translate("Main", "%1 must be the single command line parameter.")
.arg(u"-v (or --version)"_qs)); .arg(u"-v (or --version)"_s));
} }
#endif #endif
if (params.showHelp) if (params.showHelp)
@ -157,7 +157,7 @@ int main(int argc, char *argv[])
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
throw CommandLineParameterError(QCoreApplication::translate("Main", "%1 must be the single command line parameter.") throw CommandLineParameterError(QCoreApplication::translate("Main", "%1 must be the single command line parameter.")
.arg(u"-h (or --help)"_qs)); .arg(u"-h (or --help)"_s));
} }
const bool firstTimeUser = !Preferences::instance()->getAcceptedLegal(); const bool firstTimeUser = !Preferences::instance()->getAcceptedLegal();
@ -189,7 +189,7 @@ int main(int argc, char *argv[])
if (params.shouldDaemonize) if (params.shouldDaemonize)
{ {
throw CommandLineParameterError(QCoreApplication::translate("Main", "You cannot use %1: qBittorrent is already running for this user.") throw CommandLineParameterError(QCoreApplication::translate("Main", "You cannot use %1: qBittorrent is already running for this user.")
.arg(u"-d (or --daemon)"_qs)); .arg(u"-d (or --daemon)"_s));
} }
#endif #endif
@ -276,11 +276,11 @@ int main(int argc, char *argv[])
#if !defined(DISABLE_GUI) #if !defined(DISABLE_GUI)
void showSplashScreen() void showSplashScreen()
{ {
QPixmap splashImg(u":/icons/splash.png"_qs); QPixmap splashImg(u":/icons/splash.png"_s);
QPainter painter(&splashImg); QPainter painter(&splashImg);
const auto version = QStringLiteral(QBT_VERSION); const auto version = QStringLiteral(QBT_VERSION);
painter.setPen(QPen(Qt::white)); painter.setPen(QPen(Qt::white));
painter.setFont(QFont(u"Arial"_qs, 22, QFont::Black)); painter.setFont(QFont(u"Arial"_s, 22, QFont::Black));
painter.drawText(224 - painter.fontMetrics().horizontalAdvance(version), 270, version); painter.drawText(224 - painter.fontMetrics().horizontalAdvance(version), 270, version);
QSplashScreen *splash = new QSplashScreen(splashImg); QSplashScreen *splash = new QSplashScreen(splashImg);
splash->show(); splash->show();
@ -317,10 +317,10 @@ bool userAgreesWithLegalNotice()
Q_ASSERT(!pref->getAcceptedLegal()); Q_ASSERT(!pref->getAcceptedLegal());
#ifdef DISABLE_GUI #ifdef DISABLE_GUI
const QString eula = u"\n*** %1 ***\n"_qs.arg(QCoreApplication::translate("Main", "Legal Notice")) const QString eula = u"\n*** %1 ***\n"_s.arg(QCoreApplication::translate("Main", "Legal Notice"))
+ QCoreApplication::translate("Main", "qBittorrent is a file sharing program. When you run a torrent, its data will be made available to others by means of upload. Any content you share is your sole responsibility.") + u"\n\n" + QCoreApplication::translate("Main", "qBittorrent is a file sharing program. When you run a torrent, its data will be made available to others by means of upload. Any content you share is your sole responsibility.") + u"\n\n"
+ QCoreApplication::translate("Main", "No further notices will be issued.") + u"\n\n" + QCoreApplication::translate("Main", "No further notices will be issued.") + u"\n\n"
+ QCoreApplication::translate("Main", "Press %1 key to accept and continue...").arg(u"'y'"_qs) + u'\n'; + QCoreApplication::translate("Main", "Press %1 key to accept and continue...").arg(u"'y'"_s) + u'\n';
printf("%s", qUtf8Printable(eula)); printf("%s", qUtf8Printable(eula));
const char ret = getchar(); // Read pressed key const char ret = getchar(); // Read pressed key

View file

@ -46,7 +46,7 @@
namespace namespace
{ {
const int MIGRATION_VERSION = 6; const int MIGRATION_VERSION = 6;
const QString MIGRATION_VERSION_KEY = u"Meta/MigrationVersion"_qs; const QString MIGRATION_VERSION_KEY = u"Meta/MigrationVersion"_s;
void exportWebUIHttpsFiles() void exportWebUIHttpsFiles()
{ {
@ -75,18 +75,18 @@ namespace
}; };
const Path configPath = specialFolderLocation(SpecialFolder::Config); const Path configPath = specialFolderLocation(SpecialFolder::Config);
migrate(u"Preferences/WebUI/HTTPS/Certificate"_qs migrate(u"Preferences/WebUI/HTTPS/Certificate"_s
, u"Preferences/WebUI/HTTPS/CertificatePath"_qs , u"Preferences/WebUI/HTTPS/CertificatePath"_s
, (configPath / Path(u"WebUICertificate.crt"_qs))); , (configPath / Path(u"WebUICertificate.crt"_s)));
migrate(u"Preferences/WebUI/HTTPS/Key"_qs migrate(u"Preferences/WebUI/HTTPS/Key"_s
, u"Preferences/WebUI/HTTPS/KeyPath"_qs , u"Preferences/WebUI/HTTPS/KeyPath"_s
, (configPath / Path(u"WebUIPrivateKey.pem"_qs))); , (configPath / Path(u"WebUIPrivateKey.pem"_s)));
} }
void upgradeTorrentContentLayout() void upgradeTorrentContentLayout()
{ {
const QString oldKey = u"BitTorrent/Session/CreateTorrentSubfolder"_qs; const QString oldKey = u"BitTorrent/Session/CreateTorrentSubfolder"_s;
const QString newKey = u"BitTorrent/Session/TorrentContentLayout"_qs; const QString newKey = u"BitTorrent/Session/TorrentContentLayout"_s;
SettingsStorage *settingsStorage {SettingsStorage::instance()}; SettingsStorage *settingsStorage {SettingsStorage::instance()};
const auto oldData {settingsStorage->loadValue<QVariant>(oldKey)}; const auto oldData {settingsStorage->loadValue<QVariant>(oldKey)};
@ -105,8 +105,8 @@ namespace
void upgradeListenPortSettings() void upgradeListenPortSettings()
{ {
const auto oldKey = u"BitTorrent/Session/UseRandomPort"_qs; const auto oldKey = u"BitTorrent/Session/UseRandomPort"_s;
const auto newKey = u"Preferences/Connection/PortRangeMin"_qs; const auto newKey = u"Preferences/Connection/PortRangeMin"_s;
auto *settingsStorage = SettingsStorage::instance(); auto *settingsStorage = SettingsStorage::instance();
if (settingsStorage->hasKey(oldKey)) if (settingsStorage->hasKey(oldKey))
@ -121,7 +121,7 @@ namespace
void upgradeSchedulerDaysSettings() void upgradeSchedulerDaysSettings()
{ {
auto *settingsStorage = SettingsStorage::instance(); auto *settingsStorage = SettingsStorage::instance();
const auto key = u"Preferences/Scheduler/days"_qs; const auto key = u"Preferences/Scheduler/days"_s;
const auto value = settingsStorage->loadValue<QString>(key); const auto value = settingsStorage->loadValue<QString>(key);
bool ok = false; bool ok = false;
@ -173,7 +173,7 @@ namespace
void upgradeDNSServiceSettings() void upgradeDNSServiceSettings()
{ {
auto *settingsStorage = SettingsStorage::instance(); auto *settingsStorage = SettingsStorage::instance();
const auto key = u"Preferences/DynDNS/Service"_qs; const auto key = u"Preferences/DynDNS/Service"_s;
const auto value = settingsStorage->loadValue<QString>(key); const auto value = settingsStorage->loadValue<QString>(key);
bool ok = false; bool ok = false;
@ -204,7 +204,7 @@ namespace
void upgradeTrayIconStyleSettings() void upgradeTrayIconStyleSettings()
{ {
auto *settingsStorage = SettingsStorage::instance(); auto *settingsStorage = SettingsStorage::instance();
const auto key = u"Preferences/Advanced/TrayIconStyle"_qs; const auto key = u"Preferences/Advanced/TrayIconStyle"_s;
const auto value = settingsStorage->loadValue<QString>(key); const auto value = settingsStorage->loadValue<QString>(key);
bool ok = false; bool ok = false;
@ -242,80 +242,80 @@ namespace
const KeyMapping mappings[] = const KeyMapping mappings[] =
{ {
{u"AddNewTorrentDialog/Enabled"_qs, u"Preferences/Downloads/NewAdditionDialog"_qs}, {u"AddNewTorrentDialog/Enabled"_s, u"Preferences/Downloads/NewAdditionDialog"_s},
{u"AddNewTorrentDialog/Expanded"_qs, u"AddNewTorrentDialog/expanded"_qs}, {u"AddNewTorrentDialog/Expanded"_s, u"AddNewTorrentDialog/expanded"_s},
{u"AddNewTorrentDialog/Position"_qs, u"AddNewTorrentDialog/y"_qs}, {u"AddNewTorrentDialog/Position"_s, u"AddNewTorrentDialog/y"_s},
{u"AddNewTorrentDialog/SavePathHistory"_qs, u"TorrentAdditionDlg/save_path_history"_qs}, {u"AddNewTorrentDialog/SavePathHistory"_s, u"TorrentAdditionDlg/save_path_history"_s},
{u"AddNewTorrentDialog/TopLevel"_qs, u"Preferences/Downloads/NewAdditionDialogFront"_qs}, {u"AddNewTorrentDialog/TopLevel"_s, u"Preferences/Downloads/NewAdditionDialogFront"_s},
{u"AddNewTorrentDialog/TreeHeaderState"_qs, u"AddNewTorrentDialog/qt5/treeHeaderState"_qs}, {u"AddNewTorrentDialog/TreeHeaderState"_s, u"AddNewTorrentDialog/qt5/treeHeaderState"_s},
{u"AddNewTorrentDialog/Width"_qs, u"AddNewTorrentDialog/width"_qs}, {u"AddNewTorrentDialog/Width"_s, u"AddNewTorrentDialog/width"_s},
{u"BitTorrent/Session/AddExtensionToIncompleteFiles"_qs, u"Preferences/Downloads/UseIncompleteExtension"_qs}, {u"BitTorrent/Session/AddExtensionToIncompleteFiles"_s, u"Preferences/Downloads/UseIncompleteExtension"_s},
{u"BitTorrent/Session/AdditionalTrackers"_qs, u"Preferences/Bittorrent/TrackersList"_qs}, {u"BitTorrent/Session/AdditionalTrackers"_s, u"Preferences/Bittorrent/TrackersList"_s},
{u"BitTorrent/Session/AddTorrentPaused"_qs, u"Preferences/Downloads/StartInPause"_qs}, {u"BitTorrent/Session/AddTorrentPaused"_s, u"Preferences/Downloads/StartInPause"_s},
{u"BitTorrent/Session/AddTrackersEnabled"_qs, u"Preferences/Bittorrent/AddTrackers"_qs}, {u"BitTorrent/Session/AddTrackersEnabled"_s, u"Preferences/Bittorrent/AddTrackers"_s},
{u"BitTorrent/Session/AlternativeGlobalDLSpeedLimit"_qs, u"Preferences/Connection/GlobalDLLimitAlt"_qs}, {u"BitTorrent/Session/AlternativeGlobalDLSpeedLimit"_s, u"Preferences/Connection/GlobalDLLimitAlt"_s},
{u"BitTorrent/Session/AlternativeGlobalUPSpeedLimit"_qs, u"Preferences/Connection/GlobalUPLimitAlt"_qs}, {u"BitTorrent/Session/AlternativeGlobalUPSpeedLimit"_s, u"Preferences/Connection/GlobalUPLimitAlt"_s},
{u"BitTorrent/Session/AnnounceIP"_qs, u"Preferences/Connection/InetAddress"_qs}, {u"BitTorrent/Session/AnnounceIP"_s, u"Preferences/Connection/InetAddress"_s},
{u"BitTorrent/Session/AnnounceToAllTrackers"_qs, u"Preferences/Advanced/AnnounceToAllTrackers"_qs}, {u"BitTorrent/Session/AnnounceToAllTrackers"_s, u"Preferences/Advanced/AnnounceToAllTrackers"_s},
{u"BitTorrent/Session/AnonymousModeEnabled"_qs, u"Preferences/Advanced/AnonymousMode"_qs}, {u"BitTorrent/Session/AnonymousModeEnabled"_s, u"Preferences/Advanced/AnonymousMode"_s},
{u"BitTorrent/Session/BandwidthSchedulerEnabled"_qs, u"Preferences/Scheduler/Enabled"_qs}, {u"BitTorrent/Session/BandwidthSchedulerEnabled"_s, u"Preferences/Scheduler/Enabled"_s},
{u"BitTorrent/Session/DefaultSavePath"_qs, u"Preferences/Downloads/SavePath"_qs}, {u"BitTorrent/Session/DefaultSavePath"_s, u"Preferences/Downloads/SavePath"_s},
{u"BitTorrent/Session/DHTEnabled"_qs, u"Preferences/Bittorrent/DHT"_qs}, {u"BitTorrent/Session/DHTEnabled"_s, u"Preferences/Bittorrent/DHT"_s},
{u"BitTorrent/Session/DiskCacheSize"_qs, u"Preferences/Downloads/DiskWriteCacheSize"_qs}, {u"BitTorrent/Session/DiskCacheSize"_s, u"Preferences/Downloads/DiskWriteCacheSize"_s},
{u"BitTorrent/Session/DiskCacheTTL"_qs, u"Preferences/Downloads/DiskWriteCacheTTL"_qs}, {u"BitTorrent/Session/DiskCacheTTL"_s, u"Preferences/Downloads/DiskWriteCacheTTL"_s},
{u"BitTorrent/Session/Encryption"_qs, u"Preferences/Bittorrent/Encryption"_qs}, {u"BitTorrent/Session/Encryption"_s, u"Preferences/Bittorrent/Encryption"_s},
{u"BitTorrent/Session/FinishedTorrentExportDirectory"_qs, u"Preferences/Downloads/FinishedTorrentExportDir"_qs}, {u"BitTorrent/Session/FinishedTorrentExportDirectory"_s, u"Preferences/Downloads/FinishedTorrentExportDir"_s},
{u"BitTorrent/Session/ForceProxy"_qs, u"Preferences/Connection/ProxyForce"_qs}, {u"BitTorrent/Session/ForceProxy"_s, u"Preferences/Connection/ProxyForce"_s},
{u"BitTorrent/Session/GlobalDLSpeedLimit"_qs, u"Preferences/Connection/GlobalDLLimit"_qs}, {u"BitTorrent/Session/GlobalDLSpeedLimit"_s, u"Preferences/Connection/GlobalDLLimit"_s},
{u"BitTorrent/Session/GlobalMaxRatio"_qs, u"Preferences/Bittorrent/MaxRatio"_qs}, {u"BitTorrent/Session/GlobalMaxRatio"_s, u"Preferences/Bittorrent/MaxRatio"_s},
{u"BitTorrent/Session/GlobalUPSpeedLimit"_qs, u"Preferences/Connection/GlobalUPLimit"_qs}, {u"BitTorrent/Session/GlobalUPSpeedLimit"_s, u"Preferences/Connection/GlobalUPLimit"_s},
{u"BitTorrent/Session/IgnoreLimitsOnLAN"_qs, u"Preferences/Advanced/IgnoreLimitsLAN"_qs}, {u"BitTorrent/Session/IgnoreLimitsOnLAN"_s, u"Preferences/Advanced/IgnoreLimitsLAN"_s},
{u"BitTorrent/Session/IgnoreSlowTorrentsForQueueing"_qs, u"Preferences/Queueing/IgnoreSlowTorrents"_qs}, {u"BitTorrent/Session/IgnoreSlowTorrentsForQueueing"_s, u"Preferences/Queueing/IgnoreSlowTorrents"_s},
{u"BitTorrent/Session/IncludeOverheadInLimits"_qs, u"Preferences/Advanced/IncludeOverhead"_qs}, {u"BitTorrent/Session/IncludeOverheadInLimits"_s, u"Preferences/Advanced/IncludeOverhead"_s},
{u"BitTorrent/Session/Interface"_qs, u"Preferences/Connection/Interface"_qs}, {u"BitTorrent/Session/Interface"_s, u"Preferences/Connection/Interface"_s},
{u"BitTorrent/Session/InterfaceAddress"_qs, u"Preferences/Connection/InterfaceAddress"_qs}, {u"BitTorrent/Session/InterfaceAddress"_s, u"Preferences/Connection/InterfaceAddress"_s},
{u"BitTorrent/Session/InterfaceName"_qs, u"Preferences/Connection/InterfaceName"_qs}, {u"BitTorrent/Session/InterfaceName"_s, u"Preferences/Connection/InterfaceName"_s},
{u"BitTorrent/Session/IPFilter"_qs, u"Preferences/IPFilter/File"_qs}, {u"BitTorrent/Session/IPFilter"_s, u"Preferences/IPFilter/File"_s},
{u"BitTorrent/Session/IPFilteringEnabled"_qs, u"Preferences/IPFilter/Enabled"_qs}, {u"BitTorrent/Session/IPFilteringEnabled"_s, u"Preferences/IPFilter/Enabled"_s},
{u"BitTorrent/Session/LSDEnabled"_qs, u"Preferences/Bittorrent/LSD"_qs}, {u"BitTorrent/Session/LSDEnabled"_s, u"Preferences/Bittorrent/LSD"_s},
{u"BitTorrent/Session/MaxActiveDownloads"_qs, u"Preferences/Queueing/MaxActiveDownloads"_qs}, {u"BitTorrent/Session/MaxActiveDownloads"_s, u"Preferences/Queueing/MaxActiveDownloads"_s},
{u"BitTorrent/Session/MaxActiveTorrents"_qs, u"Preferences/Queueing/MaxActiveTorrents"_qs}, {u"BitTorrent/Session/MaxActiveTorrents"_s, u"Preferences/Queueing/MaxActiveTorrents"_s},
{u"BitTorrent/Session/MaxActiveUploads"_qs, u"Preferences/Queueing/MaxActiveUploads"_qs}, {u"BitTorrent/Session/MaxActiveUploads"_s, u"Preferences/Queueing/MaxActiveUploads"_s},
{u"BitTorrent/Session/MaxConnections"_qs, u"Preferences/Bittorrent/MaxConnecs"_qs}, {u"BitTorrent/Session/MaxConnections"_s, u"Preferences/Bittorrent/MaxConnecs"_s},
{u"BitTorrent/Session/MaxConnectionsPerTorrent"_qs, u"Preferences/Bittorrent/MaxConnecsPerTorrent"_qs}, {u"BitTorrent/Session/MaxConnectionsPerTorrent"_s, u"Preferences/Bittorrent/MaxConnecsPerTorrent"_s},
{u"BitTorrent/Session/MaxHalfOpenConnections"_qs, u"Preferences/Connection/MaxHalfOpenConnec"_qs}, {u"BitTorrent/Session/MaxHalfOpenConnections"_s, u"Preferences/Connection/MaxHalfOpenConnec"_s},
{u"BitTorrent/Session/MaxRatioAction"_qs, u"Preferences/Bittorrent/MaxRatioAction"_qs}, {u"BitTorrent/Session/MaxRatioAction"_s, u"Preferences/Bittorrent/MaxRatioAction"_s},
{u"BitTorrent/Session/MaxUploads"_qs, u"Preferences/Bittorrent/MaxUploads"_qs}, {u"BitTorrent/Session/MaxUploads"_s, u"Preferences/Bittorrent/MaxUploads"_s},
{u"BitTorrent/Session/MaxUploadsPerTorrent"_qs, u"Preferences/Bittorrent/MaxUploadsPerTorrent"_qs}, {u"BitTorrent/Session/MaxUploadsPerTorrent"_s, u"Preferences/Bittorrent/MaxUploadsPerTorrent"_s},
{u"BitTorrent/Session/OutgoingPortsMax"_qs, u"Preferences/Advanced/OutgoingPortsMax"_qs}, {u"BitTorrent/Session/OutgoingPortsMax"_s, u"Preferences/Advanced/OutgoingPortsMax"_s},
{u"BitTorrent/Session/OutgoingPortsMin"_qs, u"Preferences/Advanced/OutgoingPortsMin"_qs}, {u"BitTorrent/Session/OutgoingPortsMin"_s, u"Preferences/Advanced/OutgoingPortsMin"_s},
{u"BitTorrent/Session/PeXEnabled"_qs, u"Preferences/Bittorrent/PeX"_qs}, {u"BitTorrent/Session/PeXEnabled"_s, u"Preferences/Bittorrent/PeX"_s},
{u"BitTorrent/Session/Port"_qs, u"Preferences/Connection/PortRangeMin"_qs}, {u"BitTorrent/Session/Port"_s, u"Preferences/Connection/PortRangeMin"_s},
{u"BitTorrent/Session/Preallocation"_qs, u"Preferences/Downloads/PreAllocation"_qs}, {u"BitTorrent/Session/Preallocation"_s, u"Preferences/Downloads/PreAllocation"_s},
{u"BitTorrent/Session/ProxyPeerConnections"_qs, u"Preferences/Connection/ProxyPeerConnections"_qs}, {u"BitTorrent/Session/ProxyPeerConnections"_s, u"Preferences/Connection/ProxyPeerConnections"_s},
{u"BitTorrent/Session/QueueingSystemEnabled"_qs, u"Preferences/Queueing/QueueingEnabled"_qs}, {u"BitTorrent/Session/QueueingSystemEnabled"_s, u"Preferences/Queueing/QueueingEnabled"_s},
{u"BitTorrent/Session/RefreshInterval"_qs, u"Preferences/General/RefreshInterval"_qs}, {u"BitTorrent/Session/RefreshInterval"_s, u"Preferences/General/RefreshInterval"_s},
{u"BitTorrent/Session/SaveResumeDataInterval"_qs, u"Preferences/Downloads/SaveResumeDataInterval"_qs}, {u"BitTorrent/Session/SaveResumeDataInterval"_s, u"Preferences/Downloads/SaveResumeDataInterval"_s},
{u"BitTorrent/Session/SuperSeedingEnabled"_qs, u"Preferences/Advanced/SuperSeeding"_qs}, {u"BitTorrent/Session/SuperSeedingEnabled"_s, u"Preferences/Advanced/SuperSeeding"_s},
{u"BitTorrent/Session/TempPath"_qs, u"Preferences/Downloads/TempPath"_qs}, {u"BitTorrent/Session/TempPath"_s, u"Preferences/Downloads/TempPath"_s},
{u"BitTorrent/Session/TempPathEnabled"_qs, u"Preferences/Downloads/TempPathEnabled"_qs}, {u"BitTorrent/Session/TempPathEnabled"_s, u"Preferences/Downloads/TempPathEnabled"_s},
{u"BitTorrent/Session/TorrentExportDirectory"_qs, u"Preferences/Downloads/TorrentExportDir"_qs}, {u"BitTorrent/Session/TorrentExportDirectory"_s, u"Preferences/Downloads/TorrentExportDir"_s},
{u"BitTorrent/Session/TrackerFilteringEnabled"_qs, u"Preferences/IPFilter/FilterTracker"_qs}, {u"BitTorrent/Session/TrackerFilteringEnabled"_s, u"Preferences/IPFilter/FilterTracker"_s},
{u"BitTorrent/Session/UseAlternativeGlobalSpeedLimit"_qs, u"Preferences/Connection/alt_speeds_on"_qs}, {u"BitTorrent/Session/UseAlternativeGlobalSpeedLimit"_s, u"Preferences/Connection/alt_speeds_on"_s},
{u"BitTorrent/Session/UseOSCache"_qs, u"Preferences/Advanced/osCache"_qs}, {u"BitTorrent/Session/UseOSCache"_s, u"Preferences/Advanced/osCache"_s},
{u"BitTorrent/Session/UseRandomPort"_qs, u"Preferences/General/UseRandomPort"_qs}, {u"BitTorrent/Session/UseRandomPort"_s, u"Preferences/General/UseRandomPort"_s},
{u"BitTorrent/Session/uTPEnabled"_qs, u"Preferences/Bittorrent/uTP"_qs}, {u"BitTorrent/Session/uTPEnabled"_s, u"Preferences/Bittorrent/uTP"_s},
{u"BitTorrent/Session/uTPRateLimited"_qs, u"Preferences/Bittorrent/uTP_rate_limited"_qs}, {u"BitTorrent/Session/uTPRateLimited"_s, u"Preferences/Bittorrent/uTP_rate_limited"_s},
{u"BitTorrent/TrackerEnabled"_qs, u"Preferences/Advanced/trackerEnabled"_qs}, {u"BitTorrent/TrackerEnabled"_s, u"Preferences/Advanced/trackerEnabled"_s},
{u"Network/PortForwardingEnabled"_qs, u"Preferences/Connection/UPnP"_qs}, {u"Network/PortForwardingEnabled"_s, u"Preferences/Connection/UPnP"_s},
{u"Network/Proxy/Authentication"_qs, u"Preferences/Connection/Proxy/Authentication"_qs}, {u"Network/Proxy/Authentication"_s, u"Preferences/Connection/Proxy/Authentication"_s},
{u"Network/Proxy/IP"_qs, u"Preferences/Connection/Proxy/IP"_qs}, {u"Network/Proxy/IP"_s, u"Preferences/Connection/Proxy/IP"_s},
{u"Network/Proxy/OnlyForTorrents"_qs, u"Preferences/Connection/ProxyOnlyForTorrents"_qs}, {u"Network/Proxy/OnlyForTorrents"_s, u"Preferences/Connection/ProxyOnlyForTorrents"_s},
{u"Network/Proxy/Password"_qs, u"Preferences/Connection/Proxy/Password"_qs}, {u"Network/Proxy/Password"_s, u"Preferences/Connection/Proxy/Password"_s},
{u"Network/Proxy/Port"_qs, u"Preferences/Connection/Proxy/Port"_qs}, {u"Network/Proxy/Port"_s, u"Preferences/Connection/Proxy/Port"_s},
{u"Network/Proxy/Type"_qs, u"Preferences/Connection/ProxyType"_qs}, {u"Network/Proxy/Type"_s, u"Preferences/Connection/ProxyType"_s},
{u"Network/Proxy/Username"_qs, u"Preferences/Connection/Proxy/Username"_qs}, {u"Network/Proxy/Username"_s, u"Preferences/Connection/Proxy/Username"_s},
{u"State/BannedIPs"_qs, u"Preferences/IPFilter/BannedIPs"_qs} {u"State/BannedIPs"_s, u"Preferences/IPFilter/BannedIPs"_s}
}; };
auto *settingsStorage = SettingsStorage::instance(); auto *settingsStorage = SettingsStorage::instance();
@ -333,7 +333,7 @@ namespace
void migrateProxySettingsEnum() void migrateProxySettingsEnum()
{ {
auto *settingsStorage = SettingsStorage::instance(); auto *settingsStorage = SettingsStorage::instance();
const auto key = u"Network/Proxy/Type"_qs; const auto key = u"Network/Proxy/Type"_s;
const auto value = settingsStorage->loadValue<QString>(key); const auto value = settingsStorage->loadValue<QString>(key);
bool ok = false; bool ok = false;
@ -344,7 +344,7 @@ namespace
switch (number) switch (number)
{ {
case 0: case 0:
settingsStorage->storeValue(key, u"None"_qs); settingsStorage->storeValue(key, u"None"_s);
break; break;
case 1: case 1:
settingsStorage->storeValue(key, Net::ProxyType::HTTP); settingsStorage->storeValue(key, Net::ProxyType::HTTP);
@ -353,10 +353,10 @@ namespace
settingsStorage->storeValue(key, Net::ProxyType::SOCKS5); settingsStorage->storeValue(key, Net::ProxyType::SOCKS5);
break; break;
case 3: case 3:
settingsStorage->storeValue(key, u"HTTP_PW"_qs); settingsStorage->storeValue(key, u"HTTP_PW"_s);
break; break;
case 4: case 4:
settingsStorage->storeValue(key, u"SOCKS5_PW"_qs); settingsStorage->storeValue(key, u"SOCKS5_PW"_s);
break; break;
case 5: case 5:
settingsStorage->storeValue(key, Net::ProxyType::SOCKS4); settingsStorage->storeValue(key, Net::ProxyType::SOCKS4);
@ -373,49 +373,49 @@ namespace
void migrateProxySettings() void migrateProxySettings()
{ {
auto *settingsStorage = SettingsStorage::instance(); auto *settingsStorage = SettingsStorage::instance();
const auto proxyType = settingsStorage->loadValue<QString>(u"Network/Proxy/Type"_qs, u"None"_qs); const auto proxyType = settingsStorage->loadValue<QString>(u"Network/Proxy/Type"_s, u"None"_s);
const auto onlyForTorrents = settingsStorage->loadValue<bool>(u"Network/Proxy/OnlyForTorrents"_qs) const auto onlyForTorrents = settingsStorage->loadValue<bool>(u"Network/Proxy/OnlyForTorrents"_s)
|| (proxyType == u"SOCKS4"); || (proxyType == u"SOCKS4");
if (proxyType == u"None") if (proxyType == u"None")
{ {
settingsStorage->storeValue(u"Network/Proxy/Type"_qs, Net::ProxyType::HTTP); settingsStorage->storeValue(u"Network/Proxy/Type"_s, Net::ProxyType::HTTP);
settingsStorage->storeValue(u"Network/Proxy/Profiles/BitTorrent"_qs, false); settingsStorage->storeValue(u"Network/Proxy/Profiles/BitTorrent"_s, false);
settingsStorage->storeValue(u"Network/Proxy/Profiles/RSS"_qs, false); settingsStorage->storeValue(u"Network/Proxy/Profiles/RSS"_s, false);
settingsStorage->storeValue(u"Network/Proxy/Profiles/Misc"_qs, false); settingsStorage->storeValue(u"Network/Proxy/Profiles/Misc"_s, false);
} }
else else
{ {
settingsStorage->storeValue(u"Network/Proxy/Profiles/BitTorrent"_qs, true); settingsStorage->storeValue(u"Network/Proxy/Profiles/BitTorrent"_s, true);
settingsStorage->storeValue(u"Network/Proxy/Profiles/RSS"_qs, !onlyForTorrents); settingsStorage->storeValue(u"Network/Proxy/Profiles/RSS"_s, !onlyForTorrents);
settingsStorage->storeValue(u"Network/Proxy/Profiles/Misc"_qs, !onlyForTorrents); settingsStorage->storeValue(u"Network/Proxy/Profiles/Misc"_s, !onlyForTorrents);
if (proxyType == u"HTTP_PW"_qs) if (proxyType == u"HTTP_PW"_s)
{ {
settingsStorage->storeValue(u"Network/Proxy/Type"_qs, Net::ProxyType::HTTP); settingsStorage->storeValue(u"Network/Proxy/Type"_s, Net::ProxyType::HTTP);
settingsStorage->storeValue(u"Network/Proxy/AuthEnabled"_qs, true); settingsStorage->storeValue(u"Network/Proxy/AuthEnabled"_s, true);
} }
else if (proxyType == u"SOCKS5_PW"_qs) else if (proxyType == u"SOCKS5_PW"_s)
{ {
settingsStorage->storeValue(u"Network/Proxy/Type"_qs, Net::ProxyType::SOCKS5); settingsStorage->storeValue(u"Network/Proxy/Type"_s, Net::ProxyType::SOCKS5);
settingsStorage->storeValue(u"Network/Proxy/AuthEnabled"_qs, true); settingsStorage->storeValue(u"Network/Proxy/AuthEnabled"_s, true);
} }
} }
settingsStorage->removeValue(u"Network/Proxy/OnlyForTorrents"_qs); settingsStorage->removeValue(u"Network/Proxy/OnlyForTorrents"_s);
const auto proxyHostnameLookup = settingsStorage->loadValue<bool>(u"BitTorrent/Session/ProxyHostnameLookup"_qs); const auto proxyHostnameLookup = settingsStorage->loadValue<bool>(u"BitTorrent/Session/ProxyHostnameLookup"_s);
settingsStorage->storeValue(u"Network/Proxy/HostnameLookupEnabled"_qs, proxyHostnameLookup); settingsStorage->storeValue(u"Network/Proxy/HostnameLookupEnabled"_s, proxyHostnameLookup);
settingsStorage->removeValue(u"BitTorrent/Session/ProxyHostnameLookup"_qs); settingsStorage->removeValue(u"BitTorrent/Session/ProxyHostnameLookup"_s);
} }
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
void migrateMemoryPrioritySettings() void migrateMemoryPrioritySettings()
{ {
auto *settingsStorage = SettingsStorage::instance(); auto *settingsStorage = SettingsStorage::instance();
const QString oldKey = u"BitTorrent/OSMemoryPriority"_qs; const QString oldKey = u"BitTorrent/OSMemoryPriority"_s;
const QString newKey = u"Application/ProcessMemoryPriority"_qs; const QString newKey = u"Application/ProcessMemoryPriority"_s;
if (settingsStorage->hasKey(oldKey)) if (settingsStorage->hasKey(oldKey))
{ {
@ -428,24 +428,24 @@ namespace
void migrateStartupWindowState() void migrateStartupWindowState()
{ {
auto *settingsStorage = SettingsStorage::instance(); auto *settingsStorage = SettingsStorage::instance();
if (settingsStorage->hasKey(u"Preferences/General/StartMinimized"_qs)) if (settingsStorage->hasKey(u"Preferences/General/StartMinimized"_s))
{ {
const auto startMinimized = settingsStorage->loadValue<bool>(u"Preferences/General/StartMinimized"_qs); const auto startMinimized = settingsStorage->loadValue<bool>(u"Preferences/General/StartMinimized"_s);
const auto minimizeToTray = settingsStorage->loadValue<bool>(u"Preferences/General/MinimizeToTray"_qs); const auto minimizeToTray = settingsStorage->loadValue<bool>(u"Preferences/General/MinimizeToTray"_s);
const QString windowState = startMinimized ? (minimizeToTray ? u"Hidden"_qs : u"Minimized"_qs) : u"Normal"_qs; const QString windowState = startMinimized ? (minimizeToTray ? u"Hidden"_s : u"Minimized"_s) : u"Normal"_s;
settingsStorage->storeValue(u"GUI/StartUpWindowState"_qs, windowState); settingsStorage->storeValue(u"GUI/StartUpWindowState"_s, windowState);
} }
} }
void migrateChineseLocale() void migrateChineseLocale()
{ {
auto *settingsStorage = SettingsStorage::instance(); auto *settingsStorage = SettingsStorage::instance();
const auto key = u"Preferences/General/Locale"_qs; const auto key = u"Preferences/General/Locale"_s;
if (settingsStorage->hasKey(key)) if (settingsStorage->hasKey(key))
{ {
const auto locale = settingsStorage->loadValue<QString>(key); const auto locale = settingsStorage->loadValue<QString>(key);
if (locale.compare(u"zh"_qs, Qt::CaseInsensitive) == 0) if (locale.compare(u"zh"_s, Qt::CaseInsensitive) == 0)
settingsStorage->storeValue(key, u"zh_CN"_qs); settingsStorage->storeValue(key, u"zh_CN"_s);
} }
} }
} }
@ -508,7 +508,7 @@ void handleChangedDefaults(const DefaultPreferencesMode mode)
const DefaultValue changedDefaults[] = const DefaultValue changedDefaults[] =
{ {
{u"BitTorrent/Session/QueueingSystemEnabled"_qs, true, false} {u"BitTorrent/Session/QueueingSystemEnabled"_s, true, false}
}; };
auto *settingsStorage = SettingsStorage::instance(); auto *settingsStorage = SettingsStorage::instance();

View file

@ -37,7 +37,7 @@
AsyncFileStorage::AsyncFileStorage(const Path &storageFolderPath, QObject *parent) AsyncFileStorage::AsyncFileStorage(const Path &storageFolderPath, QObject *parent)
: QObject(parent) : QObject(parent)
, m_storageDir(storageFolderPath) , m_storageDir(storageFolderPath)
, m_lockFile((m_storageDir / Path(u"storage.lock"_qs)).data()) , m_lockFile((m_storageDir / Path(u"storage.lock"_s)).data())
{ {
Q_ASSERT(m_storageDir.isAbsolute()); Q_ASSERT(m_storageDir.isAbsolute());

View file

@ -36,21 +36,21 @@
#include "base/utils/string.h" #include "base/utils/string.h"
const QString PARAM_CATEGORY = u"category"_qs; const QString PARAM_CATEGORY = u"category"_s;
const QString PARAM_TAGS = u"tags"_qs; const QString PARAM_TAGS = u"tags"_s;
const QString PARAM_SAVEPATH = u"save_path"_qs; const QString PARAM_SAVEPATH = u"save_path"_s;
const QString PARAM_USEDOWNLOADPATH = u"use_download_path"_qs; const QString PARAM_USEDOWNLOADPATH = u"use_download_path"_s;
const QString PARAM_DOWNLOADPATH = u"download_path"_qs; const QString PARAM_DOWNLOADPATH = u"download_path"_s;
const QString PARAM_OPERATINGMODE = u"operating_mode"_qs; const QString PARAM_OPERATINGMODE = u"operating_mode"_s;
const QString PARAM_QUEUETOP = u"add_to_top_of_queue"_qs; const QString PARAM_QUEUETOP = u"add_to_top_of_queue"_s;
const QString PARAM_STOPPED = u"stopped"_qs; const QString PARAM_STOPPED = u"stopped"_s;
const QString PARAM_SKIPCHECKING = u"skip_checking"_qs; const QString PARAM_SKIPCHECKING = u"skip_checking"_s;
const QString PARAM_CONTENTLAYOUT = u"content_layout"_qs; const QString PARAM_CONTENTLAYOUT = u"content_layout"_s;
const QString PARAM_AUTOTMM = u"use_auto_tmm"_qs; const QString PARAM_AUTOTMM = u"use_auto_tmm"_s;
const QString PARAM_UPLOADLIMIT = u"upload_limit"_qs; const QString PARAM_UPLOADLIMIT = u"upload_limit"_s;
const QString PARAM_DOWNLOADLIMIT = u"download_limit"_qs; const QString PARAM_DOWNLOADLIMIT = u"download_limit"_s;
const QString PARAM_SEEDINGTIMELIMIT = u"seeding_time_limit"_qs; const QString PARAM_SEEDINGTIMELIMIT = u"seeding_time_limit"_s;
const QString PARAM_RATIOLIMIT = u"ratio_limit"_qs; const QString PARAM_RATIOLIMIT = u"ratio_limit"_s;
namespace namespace
{ {

View file

@ -103,8 +103,8 @@ BitTorrent::BencodeResumeDataStorage::BencodeResumeDataStorage(const Path &path,
.arg(path.toString())); .arg(path.toString()));
} }
const QRegularExpression filenamePattern {u"^([A-Fa-f0-9]{40})\\.fastresume$"_qs}; const QRegularExpression filenamePattern {u"^([A-Fa-f0-9]{40})\\.fastresume$"_s};
const QStringList filenames = QDir(path.data()).entryList(QStringList(u"*.fastresume"_qs), QDir::Files, QDir::Unsorted); const QStringList filenames = QDir(path.data()).entryList(QStringList(u"*.fastresume"_s), QDir::Files, QDir::Unsorted);
m_registeredTorrents.reserve(filenames.size()); m_registeredTorrents.reserve(filenames.size());
for (const QString &filename : filenames) for (const QString &filename : filenames)
@ -114,7 +114,7 @@ BitTorrent::BencodeResumeDataStorage::BencodeResumeDataStorage(const Path &path,
m_registeredTorrents.append(TorrentID::fromString(rxMatch.captured(1))); m_registeredTorrents.append(TorrentID::fromString(rxMatch.captured(1)));
} }
loadQueue(path / Path(u"queue"_qs)); loadQueue(path / Path(u"queue"_s));
qDebug() << "Registered torrents count: " << m_registeredTorrents.size(); qDebug() << "Registered torrents count: " << m_registeredTorrents.size();
@ -176,7 +176,7 @@ void BitTorrent::BencodeResumeDataStorage::loadQueue(const Path &queueFilename)
return; return;
} }
const QRegularExpression hashPattern {u"^([A-Fa-f0-9]{40})$"_qs}; const QRegularExpression hashPattern {u"^([A-Fa-f0-9]{40})$"_s};
int start = 0; int start = 0;
while (true) while (true)
{ {
@ -370,7 +370,7 @@ void BitTorrent::BencodeResumeDataStorage::Worker::store(const TorrentID &id, co
metadataDict.insert(dataDict.extract("created by")); metadataDict.insert(dataDict.extract("created by"));
metadataDict.insert(dataDict.extract("comment")); metadataDict.insert(dataDict.extract("comment"));
const Path torrentFilepath = m_resumeDataDir / Path(u"%1.torrent"_qs.arg(id.toString())); const Path torrentFilepath = m_resumeDataDir / Path(u"%1.torrent"_s.arg(id.toString()));
const nonstd::expected<void, QString> result = Utils::IO::saveToFile(torrentFilepath, metadata); const nonstd::expected<void, QString> result = Utils::IO::saveToFile(torrentFilepath, metadata);
if (!result) if (!result)
{ {
@ -396,7 +396,7 @@ void BitTorrent::BencodeResumeDataStorage::Worker::store(const TorrentID &id, co
data["qBt-downloadPath"] = Profile::instance()->toPortablePath(resumeData.downloadPath).data().toStdString(); data["qBt-downloadPath"] = Profile::instance()->toPortablePath(resumeData.downloadPath).data().toStdString();
} }
const Path resumeFilepath = m_resumeDataDir / Path(u"%1.fastresume"_qs.arg(id.toString())); const Path resumeFilepath = m_resumeDataDir / Path(u"%1.fastresume"_s.arg(id.toString()));
const nonstd::expected<void, QString> result = Utils::IO::saveToFile(resumeFilepath, data); const nonstd::expected<void, QString> result = Utils::IO::saveToFile(resumeFilepath, data);
if (!result) if (!result)
{ {
@ -407,10 +407,10 @@ void BitTorrent::BencodeResumeDataStorage::Worker::store(const TorrentID &id, co
void BitTorrent::BencodeResumeDataStorage::Worker::remove(const TorrentID &id) const void BitTorrent::BencodeResumeDataStorage::Worker::remove(const TorrentID &id) const
{ {
const Path resumeFilename {u"%1.fastresume"_qs.arg(id.toString())}; const Path resumeFilename {u"%1.fastresume"_s.arg(id.toString())};
Utils::Fs::removeFile(m_resumeDataDir / resumeFilename); Utils::Fs::removeFile(m_resumeDataDir / resumeFilename);
const Path torrentFilename {u"%1.torrent"_qs.arg(id.toString())}; const Path torrentFilename {u"%1.torrent"_s.arg(id.toString())};
Utils::Fs::removeFile(m_resumeDataDir / torrentFilename); Utils::Fs::removeFile(m_resumeDataDir / torrentFilename);
} }
@ -421,7 +421,7 @@ void BitTorrent::BencodeResumeDataStorage::Worker::storeQueue(const QVector<Torr
for (const BitTorrent::TorrentID &torrentID : queue) for (const BitTorrent::TorrentID &torrentID : queue)
data += (torrentID.toString().toLatin1() + '\n'); data += (torrentID.toString().toLatin1() + '\n');
const Path filepath = m_resumeDataDir / Path(u"queue"_qs); const Path filepath = m_resumeDataDir / Path(u"queue"_s);
const nonstd::expected<void, QString> result = Utils::IO::saveToFile(filepath, data); const nonstd::expected<void, QString> result = Utils::IO::saveToFile(filepath, data);
if (!result) if (!result)
{ {

View file

@ -33,8 +33,8 @@
#include "base/global.h" #include "base/global.h"
const QString OPTION_SAVEPATH = u"save_path"_qs; const QString OPTION_SAVEPATH = u"save_path"_s;
const QString OPTION_DOWNLOADPATH = u"download_path"_qs; const QString OPTION_DOWNLOADPATH = u"download_path"_s;
BitTorrent::CategoryOptions BitTorrent::CategoryOptions::fromJSON(const QJsonObject &jsonObj) BitTorrent::CategoryOptions BitTorrent::CategoryOptions::fromJSON(const QJsonObject &jsonObj)
{ {

View file

@ -32,4 +32,4 @@
#include "base/global.h" #include "base/global.h"
inline const QString QB_EXT = u".!qB"_qs; inline const QString QB_EXT = u".!qB"_s;

View file

@ -63,14 +63,14 @@
namespace namespace
{ {
const QString DB_CONNECTION_NAME = u"ResumeDataStorage"_qs; const QString DB_CONNECTION_NAME = u"ResumeDataStorage"_s;
const int DB_VERSION = 4; const int DB_VERSION = 4;
const QString DB_TABLE_META = u"meta"_qs; const QString DB_TABLE_META = u"meta"_s;
const QString DB_TABLE_TORRENTS = u"torrents"_qs; const QString DB_TABLE_TORRENTS = u"torrents"_s;
const QString META_VERSION = u"version"_qs; const QString META_VERSION = u"version"_s;
using namespace BitTorrent; using namespace BitTorrent;
@ -158,7 +158,7 @@ namespace
QString makeCreateTableStatement(const QString &tableName, const QStringList &items) QString makeCreateTableStatement(const QString &tableName, const QStringList &items)
{ {
return u"CREATE TABLE %1 (%2)"_qs.arg(quoted(tableName), items.join(u',')); return u"CREATE TABLE %1 (%2)"_s.arg(quoted(tableName), items.join(u','));
} }
std::pair<QString, QString> joinColumns(const QVector<Column> &columns) std::pair<QString, QString> joinColumns(const QVector<Column> &columns)
@ -189,27 +189,27 @@ namespace
QString makeInsertStatement(const QString &tableName, const QVector<Column> &columns) QString makeInsertStatement(const QString &tableName, const QVector<Column> &columns)
{ {
const auto [names, values] = joinColumns(columns); const auto [names, values] = joinColumns(columns);
return u"INSERT INTO %1 (%2) VALUES (%3)"_qs return u"INSERT INTO %1 (%2) VALUES (%3)"_s
.arg(quoted(tableName), names, values); .arg(quoted(tableName), names, values);
} }
QString makeUpdateStatement(const QString &tableName, const QVector<Column> &columns) QString makeUpdateStatement(const QString &tableName, const QVector<Column> &columns)
{ {
const auto [names, values] = joinColumns(columns); const auto [names, values] = joinColumns(columns);
return u"UPDATE %1 SET (%2) = (%3)"_qs return u"UPDATE %1 SET (%2) = (%3)"_s
.arg(quoted(tableName), names, values); .arg(quoted(tableName), names, values);
} }
QString makeOnConflictUpdateStatement(const Column &constraint, const QVector<Column> &columns) QString makeOnConflictUpdateStatement(const Column &constraint, const QVector<Column> &columns)
{ {
const auto [names, values] = joinColumns(columns); const auto [names, values] = joinColumns(columns);
return u" ON CONFLICT (%1) DO UPDATE SET (%2) = (%3)"_qs return u" ON CONFLICT (%1) DO UPDATE SET (%2) = (%3)"_s
.arg(quoted(constraint.name), names, values); .arg(quoted(constraint.name), names, values);
} }
QString makeColumnDefinition(const Column &column, const char *definition) QString makeColumnDefinition(const Column &column, const char *definition)
{ {
return u"%1 %2"_qs.arg(quoted(column.name), QString::fromLatin1(definition)); return u"%1 %2"_s.arg(quoted(column.name), QString::fromLatin1(definition));
} }
LoadTorrentParams parseQueryResultRow(const QSqlQuery &query) LoadTorrentParams parseQueryResultRow(const QSqlQuery &query)
@ -292,7 +292,7 @@ namespace BitTorrent
private: private:
void addJob(std::unique_ptr<Job> job); void addJob(std::unique_ptr<Job> job);
const QString m_connectionName = u"ResumeDataStorageWorker"_qs; const QString m_connectionName = u"ResumeDataStorageWorker"_s;
const Path m_path; const Path m_path;
QReadWriteLock &m_dbLock; QReadWriteLock &m_dbLock;
@ -308,7 +308,7 @@ BitTorrent::DBResumeDataStorage::DBResumeDataStorage(const Path &dbPath, QObject
{ {
const bool needCreateDB = !dbPath.exists(); const bool needCreateDB = !dbPath.exists();
auto db = QSqlDatabase::addDatabase(u"QSQLITE"_qs, DB_CONNECTION_NAME); auto db = QSqlDatabase::addDatabase(u"QSQLITE"_s, DB_CONNECTION_NAME);
db.setDatabaseName(dbPath.data()); db.setDatabaseName(dbPath.data());
if (!db.open()) if (!db.open())
throw RuntimeError(db.lastError().text()); throw RuntimeError(db.lastError().text());
@ -337,7 +337,7 @@ BitTorrent::DBResumeDataStorage::~DBResumeDataStorage()
QVector<BitTorrent::TorrentID> BitTorrent::DBResumeDataStorage::registeredTorrents() const QVector<BitTorrent::TorrentID> BitTorrent::DBResumeDataStorage::registeredTorrents() const
{ {
const auto selectTorrentIDStatement = u"SELECT %1 FROM %2 ORDER BY %3;"_qs const auto selectTorrentIDStatement = u"SELECT %1 FROM %2 ORDER BY %3;"_s
.arg(quoted(DB_COLUMN_TORRENT_ID.name), quoted(DB_TABLE_TORRENTS), quoted(DB_COLUMN_QUEUE_POSITION.name)); .arg(quoted(DB_COLUMN_TORRENT_ID.name), quoted(DB_TABLE_TORRENTS), quoted(DB_COLUMN_QUEUE_POSITION.name));
auto db = QSqlDatabase::database(DB_CONNECTION_NAME); auto db = QSqlDatabase::database(DB_CONNECTION_NAME);
@ -356,7 +356,7 @@ QVector<BitTorrent::TorrentID> BitTorrent::DBResumeDataStorage::registeredTorren
BitTorrent::LoadResumeDataResult BitTorrent::DBResumeDataStorage::load(const TorrentID &id) const BitTorrent::LoadResumeDataResult BitTorrent::DBResumeDataStorage::load(const TorrentID &id) const
{ {
const QString selectTorrentStatement = u"SELECT * FROM %1 WHERE %2 = %3;"_qs const QString selectTorrentStatement = u"SELECT * FROM %1 WHERE %2 = %3;"_s
.arg(quoted(DB_TABLE_TORRENTS), quoted(DB_COLUMN_TORRENT_ID.name), DB_COLUMN_TORRENT_ID.placeholder); .arg(quoted(DB_TABLE_TORRENTS), quoted(DB_COLUMN_TORRENT_ID.name), DB_COLUMN_TORRENT_ID.placeholder);
auto db = QSqlDatabase::database(DB_CONNECTION_NAME); auto db = QSqlDatabase::database(DB_CONNECTION_NAME);
@ -399,17 +399,17 @@ void BitTorrent::DBResumeDataStorage::storeQueue(const QVector<TorrentID> &queue
void BitTorrent::DBResumeDataStorage::doLoadAll() const void BitTorrent::DBResumeDataStorage::doLoadAll() const
{ {
const QString connectionName = u"ResumeDataStorageLoadAll"_qs; const QString connectionName = u"ResumeDataStorageLoadAll"_s;
{ {
auto db = QSqlDatabase::addDatabase(u"QSQLITE"_qs, connectionName); auto db = QSqlDatabase::addDatabase(u"QSQLITE"_s, connectionName);
db.setDatabaseName(path().data()); db.setDatabaseName(path().data());
if (!db.open()) if (!db.open())
throw RuntimeError(db.lastError().text()); throw RuntimeError(db.lastError().text());
QSqlQuery query {db}; QSqlQuery query {db};
const auto selectTorrentIDStatement = u"SELECT %1 FROM %2 ORDER BY %3;"_qs const auto selectTorrentIDStatement = u"SELECT %1 FROM %2 ORDER BY %3;"_s
.arg(quoted(DB_COLUMN_TORRENT_ID.name), quoted(DB_TABLE_TORRENTS), quoted(DB_COLUMN_QUEUE_POSITION.name)); .arg(quoted(DB_COLUMN_TORRENT_ID.name), quoted(DB_TABLE_TORRENTS), quoted(DB_COLUMN_QUEUE_POSITION.name));
const QReadLocker locker {&m_dbLock}; const QReadLocker locker {&m_dbLock};
@ -424,7 +424,7 @@ void BitTorrent::DBResumeDataStorage::doLoadAll() const
emit const_cast<DBResumeDataStorage *>(this)->loadStarted(registeredTorrents); emit const_cast<DBResumeDataStorage *>(this)->loadStarted(registeredTorrents);
const auto selectStatement = u"SELECT * FROM %1 ORDER BY %2;"_qs.arg(quoted(DB_TABLE_TORRENTS), quoted(DB_COLUMN_QUEUE_POSITION.name)); const auto selectStatement = u"SELECT * FROM %1 ORDER BY %2;"_s.arg(quoted(DB_TABLE_TORRENTS), quoted(DB_COLUMN_QUEUE_POSITION.name));
if (!query.exec(selectStatement)) if (!query.exec(selectStatement))
throw RuntimeError(query.lastError().text()); throw RuntimeError(query.lastError().text());
@ -442,7 +442,7 @@ void BitTorrent::DBResumeDataStorage::doLoadAll() const
int BitTorrent::DBResumeDataStorage::currentDBVersion() const int BitTorrent::DBResumeDataStorage::currentDBVersion() const
{ {
const auto selectDBVersionStatement = u"SELECT %1 FROM %2 WHERE %3 = %4;"_qs const auto selectDBVersionStatement = u"SELECT %1 FROM %2 WHERE %3 = %4;"_s
.arg(quoted(DB_COLUMN_VALUE.name), quoted(DB_TABLE_META), quoted(DB_COLUMN_NAME.name), DB_COLUMN_NAME.placeholder); .arg(quoted(DB_COLUMN_VALUE.name), quoted(DB_TABLE_META), quoted(DB_COLUMN_NAME.name), DB_COLUMN_NAME.placeholder);
auto db = QSqlDatabase::database(DB_CONNECTION_NAME); auto db = QSqlDatabase::database(DB_CONNECTION_NAME);
@ -533,8 +533,8 @@ void BitTorrent::DBResumeDataStorage::createDB() const
if (!query.exec(createTableTorrentsQuery)) if (!query.exec(createTableTorrentsQuery))
throw RuntimeError(query.lastError().text()); throw RuntimeError(query.lastError().text());
const QString torrentsQueuePositionIndexName = u"%1_%2_INDEX"_qs.arg(DB_TABLE_TORRENTS, DB_COLUMN_QUEUE_POSITION.name); const QString torrentsQueuePositionIndexName = u"%1_%2_INDEX"_s.arg(DB_TABLE_TORRENTS, DB_COLUMN_QUEUE_POSITION.name);
const QString createTorrentsQueuePositionIndexQuery = u"CREATE INDEX %1 ON %2 (%3)"_qs const QString createTorrentsQueuePositionIndexQuery = u"CREATE INDEX %1 ON %2 (%3)"_s
.arg(quoted(torrentsQueuePositionIndexName), quoted(DB_TABLE_TORRENTS), quoted(DB_COLUMN_QUEUE_POSITION.name)); .arg(quoted(torrentsQueuePositionIndexName), quoted(DB_TABLE_TORRENTS), quoted(DB_COLUMN_QUEUE_POSITION.name));
if (!query.exec(createTorrentsQueuePositionIndexQuery)) if (!query.exec(createTorrentsQueuePositionIndexQuery))
throw RuntimeError(query.lastError().text()); throw RuntimeError(query.lastError().text());
@ -567,11 +567,11 @@ void BitTorrent::DBResumeDataStorage::updateDB(const int fromVersion) const
{ {
if (fromVersion == 1) if (fromVersion == 1)
{ {
const auto testQuery = u"SELECT COUNT(%1) FROM %2;"_qs const auto testQuery = u"SELECT COUNT(%1) FROM %2;"_s
.arg(quoted(DB_COLUMN_DOWNLOAD_PATH.name), quoted(DB_TABLE_TORRENTS)); .arg(quoted(DB_COLUMN_DOWNLOAD_PATH.name), quoted(DB_TABLE_TORRENTS));
if (!query.exec(testQuery)) if (!query.exec(testQuery))
{ {
const auto alterTableTorrentsQuery = u"ALTER TABLE %1 ADD %2"_qs const auto alterTableTorrentsQuery = u"ALTER TABLE %1 ADD %2"_s
.arg(quoted(DB_TABLE_TORRENTS), makeColumnDefinition(DB_COLUMN_DOWNLOAD_PATH, "TEXT")); .arg(quoted(DB_TABLE_TORRENTS), makeColumnDefinition(DB_COLUMN_DOWNLOAD_PATH, "TEXT"));
if (!query.exec(alterTableTorrentsQuery)) if (!query.exec(alterTableTorrentsQuery))
throw RuntimeError(query.lastError().text()); throw RuntimeError(query.lastError().text());
@ -580,11 +580,11 @@ void BitTorrent::DBResumeDataStorage::updateDB(const int fromVersion) const
if (fromVersion <= 2) if (fromVersion <= 2)
{ {
const auto testQuery = u"SELECT COUNT(%1) FROM %2;"_qs const auto testQuery = u"SELECT COUNT(%1) FROM %2;"_s
.arg(quoted(DB_COLUMN_STOP_CONDITION.name), quoted(DB_TABLE_TORRENTS)); .arg(quoted(DB_COLUMN_STOP_CONDITION.name), quoted(DB_TABLE_TORRENTS));
if (!query.exec(testQuery)) if (!query.exec(testQuery))
{ {
const auto alterTableTorrentsQuery = u"ALTER TABLE %1 ADD %2"_qs const auto alterTableTorrentsQuery = u"ALTER TABLE %1 ADD %2"_s
.arg(quoted(DB_TABLE_TORRENTS), makeColumnDefinition(DB_COLUMN_STOP_CONDITION, "TEXT NOT NULL DEFAULT `None`")); .arg(quoted(DB_TABLE_TORRENTS), makeColumnDefinition(DB_COLUMN_STOP_CONDITION, "TEXT NOT NULL DEFAULT `None`"));
if (!query.exec(alterTableTorrentsQuery)) if (!query.exec(alterTableTorrentsQuery))
throw RuntimeError(query.lastError().text()); throw RuntimeError(query.lastError().text());
@ -593,8 +593,8 @@ void BitTorrent::DBResumeDataStorage::updateDB(const int fromVersion) const
if (fromVersion <= 3) if (fromVersion <= 3)
{ {
const QString torrentsQueuePositionIndexName = u"%1_%2_INDEX"_qs.arg(DB_TABLE_TORRENTS, DB_COLUMN_QUEUE_POSITION.name); const QString torrentsQueuePositionIndexName = u"%1_%2_INDEX"_s.arg(DB_TABLE_TORRENTS, DB_COLUMN_QUEUE_POSITION.name);
const QString createTorrentsQueuePositionIndexQuery = u"CREATE INDEX IF NOT EXISTS %1 ON %2 (%3)"_qs const QString createTorrentsQueuePositionIndexQuery = u"CREATE INDEX IF NOT EXISTS %1 ON %2 (%3)"_s
.arg(quoted(torrentsQueuePositionIndexName), quoted(DB_TABLE_TORRENTS), quoted(DB_COLUMN_QUEUE_POSITION.name)); .arg(quoted(torrentsQueuePositionIndexName), quoted(DB_TABLE_TORRENTS), quoted(DB_COLUMN_QUEUE_POSITION.name));
if (!query.exec(createTorrentsQueuePositionIndexQuery)) if (!query.exec(createTorrentsQueuePositionIndexQuery))
throw RuntimeError(query.lastError().text()); throw RuntimeError(query.lastError().text());
@ -625,14 +625,14 @@ void BitTorrent::DBResumeDataStorage::enableWALMode() const
auto db = QSqlDatabase::database(DB_CONNECTION_NAME); auto db = QSqlDatabase::database(DB_CONNECTION_NAME);
QSqlQuery query {db}; QSqlQuery query {db};
if (!query.exec(u"PRAGMA journal_mode = WAL;"_qs)) if (!query.exec(u"PRAGMA journal_mode = WAL;"_s))
throw RuntimeError(query.lastError().text()); throw RuntimeError(query.lastError().text());
if (!query.next()) if (!query.next())
throw RuntimeError(tr("Couldn't obtain query result.")); throw RuntimeError(tr("Couldn't obtain query result."));
const QString result = query.value(0).toString(); const QString result = query.value(0).toString();
if (result.compare(u"WAL"_qs, Qt::CaseInsensitive) != 0) if (result.compare(u"WAL"_s, Qt::CaseInsensitive) != 0)
throw RuntimeError(tr("WAL mode is probably unsupported due to filesystem limitations.")); throw RuntimeError(tr("WAL mode is probably unsupported due to filesystem limitations."));
} }
@ -645,7 +645,7 @@ BitTorrent::DBResumeDataStorage::Worker::Worker(const Path &dbPath, QReadWriteLo
void BitTorrent::DBResumeDataStorage::Worker::run() void BitTorrent::DBResumeDataStorage::Worker::run()
{ {
{ {
auto db = QSqlDatabase::addDatabase(u"QSQLITE"_qs, m_connectionName); auto db = QSqlDatabase::addDatabase(u"QSQLITE"_s, m_connectionName);
db.setDatabaseName(m_path.data()); db.setDatabaseName(m_path.data());
if (!db.open()) if (!db.open())
throw RuntimeError(db.lastError().text()); throw RuntimeError(db.lastError().text());
@ -830,7 +830,7 @@ namespace
query.bindValue(DB_COLUMN_NAME.placeholder, m_resumeData.name); query.bindValue(DB_COLUMN_NAME.placeholder, m_resumeData.name);
query.bindValue(DB_COLUMN_CATEGORY.placeholder, m_resumeData.category); query.bindValue(DB_COLUMN_CATEGORY.placeholder, m_resumeData.category);
query.bindValue(DB_COLUMN_TAGS.placeholder, (m_resumeData.tags.isEmpty() query.bindValue(DB_COLUMN_TAGS.placeholder, (m_resumeData.tags.isEmpty()
? QVariant(QVariant::String) : m_resumeData.tags.join(u","_qs))); ? QVariant(QVariant::String) : m_resumeData.tags.join(u","_s)));
query.bindValue(DB_COLUMN_CONTENT_LAYOUT.placeholder, Utils::String::fromEnum(m_resumeData.contentLayout)); query.bindValue(DB_COLUMN_CONTENT_LAYOUT.placeholder, Utils::String::fromEnum(m_resumeData.contentLayout));
query.bindValue(DB_COLUMN_RATIO_LIMIT.placeholder, static_cast<int>(m_resumeData.ratioLimit * 1000)); query.bindValue(DB_COLUMN_RATIO_LIMIT.placeholder, static_cast<int>(m_resumeData.ratioLimit * 1000));
query.bindValue(DB_COLUMN_SEEDING_TIME_LIMIT.placeholder, m_resumeData.seedingTimeLimit); query.bindValue(DB_COLUMN_SEEDING_TIME_LIMIT.placeholder, m_resumeData.seedingTimeLimit);
@ -867,7 +867,7 @@ namespace
void RemoveJob::perform(QSqlDatabase db) void RemoveJob::perform(QSqlDatabase db)
{ {
const auto deleteTorrentStatement = u"DELETE FROM %1 WHERE %2 = %3;"_qs const auto deleteTorrentStatement = u"DELETE FROM %1 WHERE %2 = %3;"_s
.arg(quoted(DB_TABLE_TORRENTS), quoted(DB_COLUMN_TORRENT_ID.name), DB_COLUMN_TORRENT_ID.placeholder); .arg(quoted(DB_TABLE_TORRENTS), quoted(DB_COLUMN_TORRENT_ID.name), DB_COLUMN_TORRENT_ID.placeholder);
QSqlQuery query {db}; QSqlQuery query {db};
@ -895,7 +895,7 @@ namespace
void StoreQueueJob::perform(QSqlDatabase db) void StoreQueueJob::perform(QSqlDatabase db)
{ {
const auto updateQueuePosStatement = u"UPDATE %1 SET %2 = %3 WHERE %4 = %5;"_qs const auto updateQueuePosStatement = u"UPDATE %1 SET %2 = %3 WHERE %4 = %5;"_s
.arg(quoted(DB_TABLE_TORRENTS), quoted(DB_COLUMN_QUEUE_POSITION.name), DB_COLUMN_QUEUE_POSITION.placeholder .arg(quoted(DB_TABLE_TORRENTS), quoted(DB_COLUMN_QUEUE_POSITION.name), DB_COLUMN_QUEUE_POSITION.placeholder
, quoted(DB_COLUMN_TORRENT_ID.name), DB_COLUMN_TORRENT_ID.placeholder); , quoted(DB_COLUMN_TORRENT_ID.name), DB_COLUMN_TORRENT_ID.placeholder);

View file

@ -617,17 +617,17 @@ void FilterParserThread::run()
{ {
qDebug("Processing filter file"); qDebug("Processing filter file");
int ruleCount = 0; int ruleCount = 0;
if (m_filePath.hasExtension(u".p2p"_qs)) if (m_filePath.hasExtension(u".p2p"_s))
{ {
// PeerGuardian p2p file // PeerGuardian p2p file
ruleCount = parseP2PFilterFile(); ruleCount = parseP2PFilterFile();
} }
else if (m_filePath.hasExtension(u".p2b"_qs)) else if (m_filePath.hasExtension(u".p2b"_s))
{ {
// PeerGuardian p2b file // PeerGuardian p2b file
ruleCount = parseP2BFilterFile(); ruleCount = parseP2BFilterFile();
} }
else if (m_filePath.hasExtension(u".dat"_qs)) else if (m_filePath.hasExtension(u".dat"_s))
{ {
// eMule DAT format // eMule DAT format
ruleCount = parseDATFilterFile(); ruleCount = parseDATFilterFile();

View file

@ -53,9 +53,9 @@ namespace
const int V1_BASE32_SIZE = SHA1Hash::length() * 1.6; const int V1_BASE32_SIZE = SHA1Hash::length() * 1.6;
return ((((string.size() == V1_HEX_SIZE)) return ((((string.size() == V1_HEX_SIZE))
&& !string.contains(QRegularExpression(u"[^0-9A-Fa-f]"_qs))) && !string.contains(QRegularExpression(u"[^0-9A-Fa-f]"_s)))
|| ((string.size() == V1_BASE32_SIZE) || ((string.size() == V1_BASE32_SIZE)
&& !string.contains(QRegularExpression(u"[^2-7A-Za-z]"_qs)))); && !string.contains(QRegularExpression(u"[^2-7A-Za-z]"_s))));
} }
bool isV2Hash(const QString &string) bool isV2Hash(const QString &string)
@ -66,7 +66,7 @@ namespace
const int V2_HEX_SIZE = SHA256Hash::length() * 2; const int V2_HEX_SIZE = SHA256Hash::length() * 2;
return (string.size() == V2_HEX_SIZE) return (string.size() == V2_HEX_SIZE)
&& !string.contains(QRegularExpression(u"[^0-9A-Fa-f]"_qs)); && !string.contains(QRegularExpression(u"[^0-9A-Fa-f]"_s));
} }
} }

View file

@ -262,8 +262,8 @@ QString PeerInfo::connectionType() const
return C_UTP; return C_UTP;
return (m_nativeInfo.connection_type == lt::peer_info::standard_bittorrent) return (m_nativeInfo.connection_type == lt::peer_info::standard_bittorrent)
? u"BT"_qs ? u"BT"_s
: u"Web"_qs; : u"Web"_s;
} }
qreal PeerInfo::calcRelevance(const QBitArray &allPieces) const qreal PeerInfo::calcRelevance(const QBitArray &allPieces) const
@ -287,7 +287,7 @@ void PeerInfo::determineFlags()
const auto updateFlags = [this](const QChar specifier, const QString &explanation) const auto updateFlags = [this](const QChar specifier, const QString &explanation)
{ {
m_flags += (specifier + u' '); m_flags += (specifier + u' ');
m_flagsDescription += u"%1 = %2\n"_qs.arg(specifier, explanation); m_flagsDescription += u"%1 = %2\n"_s.arg(specifier, explanation);
}; };
if (isInteresting()) if (isInteresting())

View file

@ -34,7 +34,7 @@
PortForwarderImpl::PortForwarderImpl(BitTorrent::SessionImpl *provider, QObject *parent) PortForwarderImpl::PortForwarderImpl(BitTorrent::SessionImpl *provider, QObject *parent)
: Net::PortForwarder(parent) : Net::PortForwarder(parent)
, m_storeActive {u"Network/PortForwardingEnabled"_qs, true} , m_storeActive {u"Network/PortForwardingEnabled"_s, true}
, m_provider {provider} , m_provider {provider}
{ {
if (isEnabled()) if (isEnabled())

View file

@ -115,7 +115,7 @@
using namespace std::chrono_literals; using namespace std::chrono_literals;
using namespace BitTorrent; using namespace BitTorrent;
const Path CATEGORIES_FILE_NAME {u"categories.json"_qs}; const Path CATEGORIES_FILE_NAME {u"categories.json"_s};
const int MAX_PROCESSING_RESUMEDATA_COUNT = 50; const int MAX_PROCESSING_RESUMEDATA_COUNT = 50;
const int STATISTICS_SAVE_INTERVAL = std::chrono::milliseconds(15min).count(); const int STATISTICS_SAVE_INTERVAL = std::chrono::milliseconds(15min).count();
@ -213,33 +213,33 @@ namespace
{ {
#ifdef QBT_USES_LIBTORRENT2 #ifdef QBT_USES_LIBTORRENT2
case lt::socket_type_t::http: case lt::socket_type_t::http:
return u"HTTP"_qs; return u"HTTP"_s;
case lt::socket_type_t::http_ssl: case lt::socket_type_t::http_ssl:
return u"HTTP_SSL"_qs; return u"HTTP_SSL"_s;
#endif #endif
case lt::socket_type_t::i2p: case lt::socket_type_t::i2p:
return u"I2P"_qs; return u"I2P"_s;
case lt::socket_type_t::socks5: case lt::socket_type_t::socks5:
return u"SOCKS5"_qs; return u"SOCKS5"_s;
#ifdef QBT_USES_LIBTORRENT2 #ifdef QBT_USES_LIBTORRENT2
case lt::socket_type_t::socks5_ssl: case lt::socket_type_t::socks5_ssl:
return u"SOCKS5_SSL"_qs; return u"SOCKS5_SSL"_s;
#endif #endif
case lt::socket_type_t::tcp: case lt::socket_type_t::tcp:
return u"TCP"_qs; return u"TCP"_s;
case lt::socket_type_t::tcp_ssl: case lt::socket_type_t::tcp_ssl:
return u"TCP_SSL"_qs; return u"TCP_SSL"_s;
#ifdef QBT_USES_LIBTORRENT2 #ifdef QBT_USES_LIBTORRENT2
case lt::socket_type_t::utp: case lt::socket_type_t::utp:
return u"UTP"_qs; return u"UTP"_s;
#else #else
case lt::socket_type_t::udp: case lt::socket_type_t::udp:
return u"UDP"_qs; return u"UDP"_s;
#endif #endif
case lt::socket_type_t::utp_ssl: case lt::socket_type_t::utp_ssl:
return u"UTP_SSL"_qs; return u"UTP_SSL"_s;
} }
return u"INVALID"_qs; return u"INVALID"_s;
} }
QString toString(const lt::address &address) QString toString(const lt::address &address)
@ -378,7 +378,7 @@ Session *Session::instance()
bool Session::isValidCategoryName(const QString &name) bool Session::isValidCategoryName(const QString &name)
{ {
const QRegularExpression re {uR"(^([^\\\/]|[^\\\/]([^\\\/]|\/(?=[^\/]))*[^\\\/])$)"_qs}; const QRegularExpression re {uR"(^([^\\\/]|[^\\\/]([^\\\/]|\/(?=[^\/]))*[^\\\/])$)"_s};
return (name.isEmpty() || (name.indexOf(re) == 0)); return (name.isEmpty() || (name.indexOf(re) == 0));
} }
@ -406,131 +406,131 @@ QStringList Session::expandCategory(const QString &category)
SessionImpl::SessionImpl(QObject *parent) SessionImpl::SessionImpl(QObject *parent)
: Session(parent) : Session(parent)
, m_isDHTEnabled(BITTORRENT_SESSION_KEY(u"DHTEnabled"_qs), true) , m_isDHTEnabled(BITTORRENT_SESSION_KEY(u"DHTEnabled"_s), true)
, m_isLSDEnabled(BITTORRENT_SESSION_KEY(u"LSDEnabled"_qs), true) , m_isLSDEnabled(BITTORRENT_SESSION_KEY(u"LSDEnabled"_s), true)
, m_isPeXEnabled(BITTORRENT_SESSION_KEY(u"PeXEnabled"_qs), true) , m_isPeXEnabled(BITTORRENT_SESSION_KEY(u"PeXEnabled"_s), true)
, m_isIPFilteringEnabled(BITTORRENT_SESSION_KEY(u"IPFilteringEnabled"_qs), false) , m_isIPFilteringEnabled(BITTORRENT_SESSION_KEY(u"IPFilteringEnabled"_s), false)
, m_isTrackerFilteringEnabled(BITTORRENT_SESSION_KEY(u"TrackerFilteringEnabled"_qs), false) , m_isTrackerFilteringEnabled(BITTORRENT_SESSION_KEY(u"TrackerFilteringEnabled"_s), false)
, m_IPFilterFile(BITTORRENT_SESSION_KEY(u"IPFilter"_qs)) , m_IPFilterFile(BITTORRENT_SESSION_KEY(u"IPFilter"_s))
, m_announceToAllTrackers(BITTORRENT_SESSION_KEY(u"AnnounceToAllTrackers"_qs), false) , m_announceToAllTrackers(BITTORRENT_SESSION_KEY(u"AnnounceToAllTrackers"_s), false)
, m_announceToAllTiers(BITTORRENT_SESSION_KEY(u"AnnounceToAllTiers"_qs), true) , m_announceToAllTiers(BITTORRENT_SESSION_KEY(u"AnnounceToAllTiers"_s), true)
, m_asyncIOThreads(BITTORRENT_SESSION_KEY(u"AsyncIOThreadsCount"_qs), 10) , m_asyncIOThreads(BITTORRENT_SESSION_KEY(u"AsyncIOThreadsCount"_s), 10)
, m_hashingThreads(BITTORRENT_SESSION_KEY(u"HashingThreadsCount"_qs), 1) , m_hashingThreads(BITTORRENT_SESSION_KEY(u"HashingThreadsCount"_s), 1)
, m_filePoolSize(BITTORRENT_SESSION_KEY(u"FilePoolSize"_qs), 500) , m_filePoolSize(BITTORRENT_SESSION_KEY(u"FilePoolSize"_s), 500)
, m_checkingMemUsage(BITTORRENT_SESSION_KEY(u"CheckingMemUsageSize"_qs), 32) , m_checkingMemUsage(BITTORRENT_SESSION_KEY(u"CheckingMemUsageSize"_s), 32)
, m_diskCacheSize(BITTORRENT_SESSION_KEY(u"DiskCacheSize"_qs), -1) , m_diskCacheSize(BITTORRENT_SESSION_KEY(u"DiskCacheSize"_s), -1)
, m_diskCacheTTL(BITTORRENT_SESSION_KEY(u"DiskCacheTTL"_qs), 60) , m_diskCacheTTL(BITTORRENT_SESSION_KEY(u"DiskCacheTTL"_s), 60)
, m_diskQueueSize(BITTORRENT_SESSION_KEY(u"DiskQueueSize"_qs), (1024 * 1024)) , m_diskQueueSize(BITTORRENT_SESSION_KEY(u"DiskQueueSize"_s), (1024 * 1024))
, m_diskIOType(BITTORRENT_SESSION_KEY(u"DiskIOType"_qs), DiskIOType::Default) , m_diskIOType(BITTORRENT_SESSION_KEY(u"DiskIOType"_s), DiskIOType::Default)
, m_diskIOReadMode(BITTORRENT_SESSION_KEY(u"DiskIOReadMode"_qs), DiskIOReadMode::EnableOSCache) , m_diskIOReadMode(BITTORRENT_SESSION_KEY(u"DiskIOReadMode"_s), DiskIOReadMode::EnableOSCache)
, m_diskIOWriteMode(BITTORRENT_SESSION_KEY(u"DiskIOWriteMode"_qs), DiskIOWriteMode::EnableOSCache) , m_diskIOWriteMode(BITTORRENT_SESSION_KEY(u"DiskIOWriteMode"_s), DiskIOWriteMode::EnableOSCache)
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
, m_coalesceReadWriteEnabled(BITTORRENT_SESSION_KEY(u"CoalesceReadWrite"_qs), true) , m_coalesceReadWriteEnabled(BITTORRENT_SESSION_KEY(u"CoalesceReadWrite"_s), true)
#else #else
, m_coalesceReadWriteEnabled(BITTORRENT_SESSION_KEY(u"CoalesceReadWrite"_qs), false) , m_coalesceReadWriteEnabled(BITTORRENT_SESSION_KEY(u"CoalesceReadWrite"_s), false)
#endif #endif
, m_usePieceExtentAffinity(BITTORRENT_SESSION_KEY(u"PieceExtentAffinity"_qs), false) , m_usePieceExtentAffinity(BITTORRENT_SESSION_KEY(u"PieceExtentAffinity"_s), false)
, m_isSuggestMode(BITTORRENT_SESSION_KEY(u"SuggestMode"_qs), false) , m_isSuggestMode(BITTORRENT_SESSION_KEY(u"SuggestMode"_s), false)
, m_sendBufferWatermark(BITTORRENT_SESSION_KEY(u"SendBufferWatermark"_qs), 500) , m_sendBufferWatermark(BITTORRENT_SESSION_KEY(u"SendBufferWatermark"_s), 500)
, m_sendBufferLowWatermark(BITTORRENT_SESSION_KEY(u"SendBufferLowWatermark"_qs), 10) , m_sendBufferLowWatermark(BITTORRENT_SESSION_KEY(u"SendBufferLowWatermark"_s), 10)
, m_sendBufferWatermarkFactor(BITTORRENT_SESSION_KEY(u"SendBufferWatermarkFactor"_qs), 50) , m_sendBufferWatermarkFactor(BITTORRENT_SESSION_KEY(u"SendBufferWatermarkFactor"_s), 50)
, m_connectionSpeed(BITTORRENT_SESSION_KEY(u"ConnectionSpeed"_qs), 30) , m_connectionSpeed(BITTORRENT_SESSION_KEY(u"ConnectionSpeed"_s), 30)
, m_socketSendBufferSize(BITTORRENT_SESSION_KEY(u"SocketSendBufferSize"_qs), 0) , m_socketSendBufferSize(BITTORRENT_SESSION_KEY(u"SocketSendBufferSize"_s), 0)
, m_socketReceiveBufferSize(BITTORRENT_SESSION_KEY(u"SocketReceiveBufferSize"_qs), 0) , m_socketReceiveBufferSize(BITTORRENT_SESSION_KEY(u"SocketReceiveBufferSize"_s), 0)
, m_socketBacklogSize(BITTORRENT_SESSION_KEY(u"SocketBacklogSize"_qs), 30) , m_socketBacklogSize(BITTORRENT_SESSION_KEY(u"SocketBacklogSize"_s), 30)
, m_isAnonymousModeEnabled(BITTORRENT_SESSION_KEY(u"AnonymousModeEnabled"_qs), false) , m_isAnonymousModeEnabled(BITTORRENT_SESSION_KEY(u"AnonymousModeEnabled"_s), false)
, m_isQueueingEnabled(BITTORRENT_SESSION_KEY(u"QueueingSystemEnabled"_qs), false) , m_isQueueingEnabled(BITTORRENT_SESSION_KEY(u"QueueingSystemEnabled"_s), false)
, m_maxActiveDownloads(BITTORRENT_SESSION_KEY(u"MaxActiveDownloads"_qs), 3, lowerLimited(-1)) , m_maxActiveDownloads(BITTORRENT_SESSION_KEY(u"MaxActiveDownloads"_s), 3, lowerLimited(-1))
, m_maxActiveUploads(BITTORRENT_SESSION_KEY(u"MaxActiveUploads"_qs), 3, lowerLimited(-1)) , m_maxActiveUploads(BITTORRENT_SESSION_KEY(u"MaxActiveUploads"_s), 3, lowerLimited(-1))
, m_maxActiveTorrents(BITTORRENT_SESSION_KEY(u"MaxActiveTorrents"_qs), 5, lowerLimited(-1)) , m_maxActiveTorrents(BITTORRENT_SESSION_KEY(u"MaxActiveTorrents"_s), 5, lowerLimited(-1))
, m_ignoreSlowTorrentsForQueueing(BITTORRENT_SESSION_KEY(u"IgnoreSlowTorrentsForQueueing"_qs), false) , m_ignoreSlowTorrentsForQueueing(BITTORRENT_SESSION_KEY(u"IgnoreSlowTorrentsForQueueing"_s), false)
, m_downloadRateForSlowTorrents(BITTORRENT_SESSION_KEY(u"SlowTorrentsDownloadRate"_qs), 2) , m_downloadRateForSlowTorrents(BITTORRENT_SESSION_KEY(u"SlowTorrentsDownloadRate"_s), 2)
, m_uploadRateForSlowTorrents(BITTORRENT_SESSION_KEY(u"SlowTorrentsUploadRate"_qs), 2) , m_uploadRateForSlowTorrents(BITTORRENT_SESSION_KEY(u"SlowTorrentsUploadRate"_s), 2)
, m_slowTorrentsInactivityTimer(BITTORRENT_SESSION_KEY(u"SlowTorrentsInactivityTimer"_qs), 60) , m_slowTorrentsInactivityTimer(BITTORRENT_SESSION_KEY(u"SlowTorrentsInactivityTimer"_s), 60)
, m_outgoingPortsMin(BITTORRENT_SESSION_KEY(u"OutgoingPortsMin"_qs), 0) , m_outgoingPortsMin(BITTORRENT_SESSION_KEY(u"OutgoingPortsMin"_s), 0)
, m_outgoingPortsMax(BITTORRENT_SESSION_KEY(u"OutgoingPortsMax"_qs), 0) , m_outgoingPortsMax(BITTORRENT_SESSION_KEY(u"OutgoingPortsMax"_s), 0)
, m_UPnPLeaseDuration(BITTORRENT_SESSION_KEY(u"UPnPLeaseDuration"_qs), 0) , m_UPnPLeaseDuration(BITTORRENT_SESSION_KEY(u"UPnPLeaseDuration"_s), 0)
, m_peerToS(BITTORRENT_SESSION_KEY(u"PeerToS"_qs), 0x04) , m_peerToS(BITTORRENT_SESSION_KEY(u"PeerToS"_s), 0x04)
, m_ignoreLimitsOnLAN(BITTORRENT_SESSION_KEY(u"IgnoreLimitsOnLAN"_qs), false) , m_ignoreLimitsOnLAN(BITTORRENT_SESSION_KEY(u"IgnoreLimitsOnLAN"_s), false)
, m_includeOverheadInLimits(BITTORRENT_SESSION_KEY(u"IncludeOverheadInLimits"_qs), false) , m_includeOverheadInLimits(BITTORRENT_SESSION_KEY(u"IncludeOverheadInLimits"_s), false)
, m_announceIP(BITTORRENT_SESSION_KEY(u"AnnounceIP"_qs)) , m_announceIP(BITTORRENT_SESSION_KEY(u"AnnounceIP"_s))
, m_maxConcurrentHTTPAnnounces(BITTORRENT_SESSION_KEY(u"MaxConcurrentHTTPAnnounces"_qs), 50) , m_maxConcurrentHTTPAnnounces(BITTORRENT_SESSION_KEY(u"MaxConcurrentHTTPAnnounces"_s), 50)
, m_isReannounceWhenAddressChangedEnabled(BITTORRENT_SESSION_KEY(u"ReannounceWhenAddressChanged"_qs), false) , m_isReannounceWhenAddressChangedEnabled(BITTORRENT_SESSION_KEY(u"ReannounceWhenAddressChanged"_s), false)
, m_stopTrackerTimeout(BITTORRENT_SESSION_KEY(u"StopTrackerTimeout"_qs), 5) , m_stopTrackerTimeout(BITTORRENT_SESSION_KEY(u"StopTrackerTimeout"_s), 5)
, m_maxConnections(BITTORRENT_SESSION_KEY(u"MaxConnections"_qs), 500, lowerLimited(0, -1)) , m_maxConnections(BITTORRENT_SESSION_KEY(u"MaxConnections"_s), 500, lowerLimited(0, -1))
, m_maxUploads(BITTORRENT_SESSION_KEY(u"MaxUploads"_qs), 20, lowerLimited(0, -1)) , m_maxUploads(BITTORRENT_SESSION_KEY(u"MaxUploads"_s), 20, lowerLimited(0, -1))
, m_maxConnectionsPerTorrent(BITTORRENT_SESSION_KEY(u"MaxConnectionsPerTorrent"_qs), 100, lowerLimited(0, -1)) , m_maxConnectionsPerTorrent(BITTORRENT_SESSION_KEY(u"MaxConnectionsPerTorrent"_s), 100, lowerLimited(0, -1))
, m_maxUploadsPerTorrent(BITTORRENT_SESSION_KEY(u"MaxUploadsPerTorrent"_qs), 4, lowerLimited(0, -1)) , m_maxUploadsPerTorrent(BITTORRENT_SESSION_KEY(u"MaxUploadsPerTorrent"_s), 4, lowerLimited(0, -1))
, m_btProtocol(BITTORRENT_SESSION_KEY(u"BTProtocol"_qs), BTProtocol::Both , m_btProtocol(BITTORRENT_SESSION_KEY(u"BTProtocol"_s), BTProtocol::Both
, clampValue(BTProtocol::Both, BTProtocol::UTP)) , clampValue(BTProtocol::Both, BTProtocol::UTP))
, m_isUTPRateLimited(BITTORRENT_SESSION_KEY(u"uTPRateLimited"_qs), true) , m_isUTPRateLimited(BITTORRENT_SESSION_KEY(u"uTPRateLimited"_s), true)
, m_utpMixedMode(BITTORRENT_SESSION_KEY(u"uTPMixedMode"_qs), MixedModeAlgorithm::TCP , m_utpMixedMode(BITTORRENT_SESSION_KEY(u"uTPMixedMode"_s), MixedModeAlgorithm::TCP
, clampValue(MixedModeAlgorithm::TCP, MixedModeAlgorithm::Proportional)) , clampValue(MixedModeAlgorithm::TCP, MixedModeAlgorithm::Proportional))
, m_IDNSupportEnabled(BITTORRENT_SESSION_KEY(u"IDNSupportEnabled"_qs), false) , m_IDNSupportEnabled(BITTORRENT_SESSION_KEY(u"IDNSupportEnabled"_s), false)
, m_multiConnectionsPerIpEnabled(BITTORRENT_SESSION_KEY(u"MultiConnectionsPerIp"_qs), false) , m_multiConnectionsPerIpEnabled(BITTORRENT_SESSION_KEY(u"MultiConnectionsPerIp"_s), false)
, m_validateHTTPSTrackerCertificate(BITTORRENT_SESSION_KEY(u"ValidateHTTPSTrackerCertificate"_qs), true) , m_validateHTTPSTrackerCertificate(BITTORRENT_SESSION_KEY(u"ValidateHTTPSTrackerCertificate"_s), true)
, m_SSRFMitigationEnabled(BITTORRENT_SESSION_KEY(u"SSRFMitigation"_qs), true) , m_SSRFMitigationEnabled(BITTORRENT_SESSION_KEY(u"SSRFMitigation"_s), true)
, m_blockPeersOnPrivilegedPorts(BITTORRENT_SESSION_KEY(u"BlockPeersOnPrivilegedPorts"_qs), false) , m_blockPeersOnPrivilegedPorts(BITTORRENT_SESSION_KEY(u"BlockPeersOnPrivilegedPorts"_s), false)
, m_isAddTrackersEnabled(BITTORRENT_SESSION_KEY(u"AddTrackersEnabled"_qs), false) , m_isAddTrackersEnabled(BITTORRENT_SESSION_KEY(u"AddTrackersEnabled"_s), false)
, m_additionalTrackers(BITTORRENT_SESSION_KEY(u"AdditionalTrackers"_qs)) , m_additionalTrackers(BITTORRENT_SESSION_KEY(u"AdditionalTrackers"_s))
, m_globalMaxRatio(BITTORRENT_SESSION_KEY(u"GlobalMaxRatio"_qs), -1, [](qreal r) { return r < 0 ? -1. : r;}) , m_globalMaxRatio(BITTORRENT_SESSION_KEY(u"GlobalMaxRatio"_s), -1, [](qreal r) { return r < 0 ? -1. : r;})
, m_globalMaxSeedingMinutes(BITTORRENT_SESSION_KEY(u"GlobalMaxSeedingMinutes"_qs), -1, lowerLimited(-1)) , m_globalMaxSeedingMinutes(BITTORRENT_SESSION_KEY(u"GlobalMaxSeedingMinutes"_s), -1, lowerLimited(-1))
, m_isAddTorrentToQueueTop(BITTORRENT_SESSION_KEY(u"AddTorrentToTopOfQueue"_qs), false) , m_isAddTorrentToQueueTop(BITTORRENT_SESSION_KEY(u"AddTorrentToTopOfQueue"_s), false)
, m_isAddTorrentPaused(BITTORRENT_SESSION_KEY(u"AddTorrentPaused"_qs), false) , m_isAddTorrentPaused(BITTORRENT_SESSION_KEY(u"AddTorrentPaused"_s), false)
, m_torrentStopCondition(BITTORRENT_SESSION_KEY(u"TorrentStopCondition"_qs), Torrent::StopCondition::None) , m_torrentStopCondition(BITTORRENT_SESSION_KEY(u"TorrentStopCondition"_s), Torrent::StopCondition::None)
, m_torrentContentLayout(BITTORRENT_SESSION_KEY(u"TorrentContentLayout"_qs), TorrentContentLayout::Original) , m_torrentContentLayout(BITTORRENT_SESSION_KEY(u"TorrentContentLayout"_s), TorrentContentLayout::Original)
, m_isAppendExtensionEnabled(BITTORRENT_SESSION_KEY(u"AddExtensionToIncompleteFiles"_qs), false) , m_isAppendExtensionEnabled(BITTORRENT_SESSION_KEY(u"AddExtensionToIncompleteFiles"_s), false)
, m_refreshInterval(BITTORRENT_SESSION_KEY(u"RefreshInterval"_qs), 1500) , m_refreshInterval(BITTORRENT_SESSION_KEY(u"RefreshInterval"_s), 1500)
, m_isPreallocationEnabled(BITTORRENT_SESSION_KEY(u"Preallocation"_qs), false) , m_isPreallocationEnabled(BITTORRENT_SESSION_KEY(u"Preallocation"_s), false)
, m_torrentExportDirectory(BITTORRENT_SESSION_KEY(u"TorrentExportDirectory"_qs)) , m_torrentExportDirectory(BITTORRENT_SESSION_KEY(u"TorrentExportDirectory"_s))
, m_finishedTorrentExportDirectory(BITTORRENT_SESSION_KEY(u"FinishedTorrentExportDirectory"_qs)) , m_finishedTorrentExportDirectory(BITTORRENT_SESSION_KEY(u"FinishedTorrentExportDirectory"_s))
, m_globalDownloadSpeedLimit(BITTORRENT_SESSION_KEY(u"GlobalDLSpeedLimit"_qs), 0, lowerLimited(0)) , m_globalDownloadSpeedLimit(BITTORRENT_SESSION_KEY(u"GlobalDLSpeedLimit"_s), 0, lowerLimited(0))
, m_globalUploadSpeedLimit(BITTORRENT_SESSION_KEY(u"GlobalUPSpeedLimit"_qs), 0, lowerLimited(0)) , m_globalUploadSpeedLimit(BITTORRENT_SESSION_KEY(u"GlobalUPSpeedLimit"_s), 0, lowerLimited(0))
, m_altGlobalDownloadSpeedLimit(BITTORRENT_SESSION_KEY(u"AlternativeGlobalDLSpeedLimit"_qs), 10, lowerLimited(0)) , m_altGlobalDownloadSpeedLimit(BITTORRENT_SESSION_KEY(u"AlternativeGlobalDLSpeedLimit"_s), 10, lowerLimited(0))
, m_altGlobalUploadSpeedLimit(BITTORRENT_SESSION_KEY(u"AlternativeGlobalUPSpeedLimit"_qs), 10, lowerLimited(0)) , m_altGlobalUploadSpeedLimit(BITTORRENT_SESSION_KEY(u"AlternativeGlobalUPSpeedLimit"_s), 10, lowerLimited(0))
, m_isAltGlobalSpeedLimitEnabled(BITTORRENT_SESSION_KEY(u"UseAlternativeGlobalSpeedLimit"_qs), false) , m_isAltGlobalSpeedLimitEnabled(BITTORRENT_SESSION_KEY(u"UseAlternativeGlobalSpeedLimit"_s), false)
, m_isBandwidthSchedulerEnabled(BITTORRENT_SESSION_KEY(u"BandwidthSchedulerEnabled"_qs), false) , m_isBandwidthSchedulerEnabled(BITTORRENT_SESSION_KEY(u"BandwidthSchedulerEnabled"_s), false)
, m_isPerformanceWarningEnabled(BITTORRENT_SESSION_KEY(u"PerformanceWarning"_qs), false) , m_isPerformanceWarningEnabled(BITTORRENT_SESSION_KEY(u"PerformanceWarning"_s), false)
, m_saveResumeDataInterval(BITTORRENT_SESSION_KEY(u"SaveResumeDataInterval"_qs), 60) , m_saveResumeDataInterval(BITTORRENT_SESSION_KEY(u"SaveResumeDataInterval"_s), 60)
, m_port(BITTORRENT_SESSION_KEY(u"Port"_qs), -1) , m_port(BITTORRENT_SESSION_KEY(u"Port"_s), -1)
, m_networkInterface(BITTORRENT_SESSION_KEY(u"Interface"_qs)) , m_networkInterface(BITTORRENT_SESSION_KEY(u"Interface"_s))
, m_networkInterfaceName(BITTORRENT_SESSION_KEY(u"InterfaceName"_qs)) , m_networkInterfaceName(BITTORRENT_SESSION_KEY(u"InterfaceName"_s))
, m_networkInterfaceAddress(BITTORRENT_SESSION_KEY(u"InterfaceAddress"_qs)) , m_networkInterfaceAddress(BITTORRENT_SESSION_KEY(u"InterfaceAddress"_s))
, m_encryption(BITTORRENT_SESSION_KEY(u"Encryption"_qs), 0) , m_encryption(BITTORRENT_SESSION_KEY(u"Encryption"_s), 0)
, m_maxActiveCheckingTorrents(BITTORRENT_SESSION_KEY(u"MaxActiveCheckingTorrents"_qs), 1) , m_maxActiveCheckingTorrents(BITTORRENT_SESSION_KEY(u"MaxActiveCheckingTorrents"_s), 1)
, m_isProxyPeerConnectionsEnabled(BITTORRENT_SESSION_KEY(u"ProxyPeerConnections"_qs), false) , m_isProxyPeerConnectionsEnabled(BITTORRENT_SESSION_KEY(u"ProxyPeerConnections"_s), false)
, m_chokingAlgorithm(BITTORRENT_SESSION_KEY(u"ChokingAlgorithm"_qs), ChokingAlgorithm::FixedSlots , m_chokingAlgorithm(BITTORRENT_SESSION_KEY(u"ChokingAlgorithm"_s), ChokingAlgorithm::FixedSlots
, clampValue(ChokingAlgorithm::FixedSlots, ChokingAlgorithm::RateBased)) , clampValue(ChokingAlgorithm::FixedSlots, ChokingAlgorithm::RateBased))
, m_seedChokingAlgorithm(BITTORRENT_SESSION_KEY(u"SeedChokingAlgorithm"_qs), SeedChokingAlgorithm::FastestUpload , m_seedChokingAlgorithm(BITTORRENT_SESSION_KEY(u"SeedChokingAlgorithm"_s), SeedChokingAlgorithm::FastestUpload
, clampValue(SeedChokingAlgorithm::RoundRobin, SeedChokingAlgorithm::AntiLeech)) , clampValue(SeedChokingAlgorithm::RoundRobin, SeedChokingAlgorithm::AntiLeech))
, m_storedTags(BITTORRENT_SESSION_KEY(u"Tags"_qs)) , m_storedTags(BITTORRENT_SESSION_KEY(u"Tags"_s))
, m_maxRatioAction(BITTORRENT_SESSION_KEY(u"MaxRatioAction"_qs), Pause) , m_maxRatioAction(BITTORRENT_SESSION_KEY(u"MaxRatioAction"_s), Pause)
, m_savePath(BITTORRENT_SESSION_KEY(u"DefaultSavePath"_qs), specialFolderLocation(SpecialFolder::Downloads)) , m_savePath(BITTORRENT_SESSION_KEY(u"DefaultSavePath"_s), specialFolderLocation(SpecialFolder::Downloads))
, m_downloadPath(BITTORRENT_SESSION_KEY(u"TempPath"_qs), (savePath() / Path(u"temp"_qs))) , m_downloadPath(BITTORRENT_SESSION_KEY(u"TempPath"_s), (savePath() / Path(u"temp"_s)))
, m_isDownloadPathEnabled(BITTORRENT_SESSION_KEY(u"TempPathEnabled"_qs), false) , m_isDownloadPathEnabled(BITTORRENT_SESSION_KEY(u"TempPathEnabled"_s), false)
, m_isSubcategoriesEnabled(BITTORRENT_SESSION_KEY(u"SubcategoriesEnabled"_qs), false) , m_isSubcategoriesEnabled(BITTORRENT_SESSION_KEY(u"SubcategoriesEnabled"_s), false)
, m_useCategoryPathsInManualMode(BITTORRENT_SESSION_KEY(u"UseCategoryPathsInManualMode"_qs), false) , m_useCategoryPathsInManualMode(BITTORRENT_SESSION_KEY(u"UseCategoryPathsInManualMode"_s), false)
, m_isAutoTMMDisabledByDefault(BITTORRENT_SESSION_KEY(u"DisableAutoTMMByDefault"_qs), true) , m_isAutoTMMDisabledByDefault(BITTORRENT_SESSION_KEY(u"DisableAutoTMMByDefault"_s), true)
, m_isDisableAutoTMMWhenCategoryChanged(BITTORRENT_SESSION_KEY(u"DisableAutoTMMTriggers/CategoryChanged"_qs), false) , m_isDisableAutoTMMWhenCategoryChanged(BITTORRENT_SESSION_KEY(u"DisableAutoTMMTriggers/CategoryChanged"_s), false)
, m_isDisableAutoTMMWhenDefaultSavePathChanged(BITTORRENT_SESSION_KEY(u"DisableAutoTMMTriggers/DefaultSavePathChanged"_qs), true) , m_isDisableAutoTMMWhenDefaultSavePathChanged(BITTORRENT_SESSION_KEY(u"DisableAutoTMMTriggers/DefaultSavePathChanged"_s), true)
, m_isDisableAutoTMMWhenCategorySavePathChanged(BITTORRENT_SESSION_KEY(u"DisableAutoTMMTriggers/CategorySavePathChanged"_qs), true) , m_isDisableAutoTMMWhenCategorySavePathChanged(BITTORRENT_SESSION_KEY(u"DisableAutoTMMTriggers/CategorySavePathChanged"_s), true)
, m_isTrackerEnabled(BITTORRENT_KEY(u"TrackerEnabled"_qs), false) , m_isTrackerEnabled(BITTORRENT_KEY(u"TrackerEnabled"_s), false)
, m_peerTurnover(BITTORRENT_SESSION_KEY(u"PeerTurnover"_qs), 4) , m_peerTurnover(BITTORRENT_SESSION_KEY(u"PeerTurnover"_s), 4)
, m_peerTurnoverCutoff(BITTORRENT_SESSION_KEY(u"PeerTurnoverCutOff"_qs), 90) , m_peerTurnoverCutoff(BITTORRENT_SESSION_KEY(u"PeerTurnoverCutOff"_s), 90)
, m_peerTurnoverInterval(BITTORRENT_SESSION_KEY(u"PeerTurnoverInterval"_qs), 300) , m_peerTurnoverInterval(BITTORRENT_SESSION_KEY(u"PeerTurnoverInterval"_s), 300)
, m_requestQueueSize(BITTORRENT_SESSION_KEY(u"RequestQueueSize"_qs), 500) , m_requestQueueSize(BITTORRENT_SESSION_KEY(u"RequestQueueSize"_s), 500)
, m_isExcludedFileNamesEnabled(BITTORRENT_KEY(u"ExcludedFileNamesEnabled"_qs), false) , m_isExcludedFileNamesEnabled(BITTORRENT_KEY(u"ExcludedFileNamesEnabled"_s), false)
, m_excludedFileNames(BITTORRENT_SESSION_KEY(u"ExcludedFileNames"_qs)) , m_excludedFileNames(BITTORRENT_SESSION_KEY(u"ExcludedFileNames"_s))
, m_bannedIPs(u"State/BannedIPs"_qs, QStringList(), Algorithm::sorted<QStringList>) , m_bannedIPs(u"State/BannedIPs"_s, QStringList(), Algorithm::sorted<QStringList>)
, m_resumeDataStorageType(BITTORRENT_SESSION_KEY(u"ResumeDataStorageType"_qs), ResumeDataStorageType::Legacy) , m_resumeDataStorageType(BITTORRENT_SESSION_KEY(u"ResumeDataStorageType"_s), ResumeDataStorageType::Legacy)
, m_isI2PEnabled {BITTORRENT_SESSION_KEY(u"I2P/Enabled"_qs), false} , m_isI2PEnabled {BITTORRENT_SESSION_KEY(u"I2P/Enabled"_s), false}
, m_I2PAddress {BITTORRENT_SESSION_KEY(u"I2P/Address"_qs), u"127.0.0.1"_qs} , m_I2PAddress {BITTORRENT_SESSION_KEY(u"I2P/Address"_s), u"127.0.0.1"_s}
, m_I2PPort {BITTORRENT_SESSION_KEY(u"I2P/Port"_qs), 7656} , m_I2PPort {BITTORRENT_SESSION_KEY(u"I2P/Port"_s), 7656}
, m_I2PMixedMode {BITTORRENT_SESSION_KEY(u"I2P/MixedMode"_qs), false} , m_I2PMixedMode {BITTORRENT_SESSION_KEY(u"I2P/MixedMode"_s), false}
, m_I2PInboundQuantity {BITTORRENT_SESSION_KEY(u"I2P/InboundQuantity"_qs), 3} , m_I2PInboundQuantity {BITTORRENT_SESSION_KEY(u"I2P/InboundQuantity"_s), 3}
, m_I2POutboundQuantity {BITTORRENT_SESSION_KEY(u"I2P/OutboundQuantity"_qs), 3} , m_I2POutboundQuantity {BITTORRENT_SESSION_KEY(u"I2P/OutboundQuantity"_s), 3}
, m_I2PInboundLength {BITTORRENT_SESSION_KEY(u"I2P/InboundLength"_qs), 3} , m_I2PInboundLength {BITTORRENT_SESSION_KEY(u"I2P/InboundLength"_s), 3}
, m_I2POutboundLength {BITTORRENT_SESSION_KEY(u"I2P/OutboundLength"_qs), 3} , m_I2POutboundLength {BITTORRENT_SESSION_KEY(u"I2P/OutboundLength"_s), 3}
, m_seedingLimitTimer {new QTimer(this)} , m_seedingLimitTimer {new QTimer(this)}
, m_resumeDataTimer {new QTimer(this)} , m_resumeDataTimer {new QTimer(this)}
, m_ioThread {new QThread} , m_ioThread {new QThread}
@ -879,7 +879,7 @@ bool SessionImpl::removeCategory(const QString &name)
for (TorrentImpl *const torrent : asConst(m_torrents)) for (TorrentImpl *const torrent : asConst(m_torrents))
{ {
if (torrent->belongsToCategory(name)) if (torrent->belongsToCategory(name))
torrent->setCategory(u""_qs); torrent->setCategory(u""_s);
} }
// remove stored category and its subcategories if exist // remove stored category and its subcategories if exist
@ -1156,7 +1156,7 @@ void SessionImpl::prepareStartup()
{ {
qDebug("Initializing torrents resume data storage..."); qDebug("Initializing torrents resume data storage...");
const Path dbPath = specialFolderLocation(SpecialFolder::Data) / Path(u"torrents.db"_qs); const Path dbPath = specialFolderLocation(SpecialFolder::Data) / Path(u"torrents.db"_s);
const bool dbStorageExists = dbPath.exists(); const bool dbStorageExists = dbPath.exists();
auto *context = new ResumeSessionContext(this); auto *context = new ResumeSessionContext(this);
@ -1168,13 +1168,13 @@ void SessionImpl::prepareStartup()
if (!dbStorageExists) if (!dbStorageExists)
{ {
const Path dataPath = specialFolderLocation(SpecialFolder::Data) / Path(u"BT_backup"_qs); const Path dataPath = specialFolderLocation(SpecialFolder::Data) / Path(u"BT_backup"_s);
context->startupStorage = new BencodeResumeDataStorage(dataPath, this); context->startupStorage = new BencodeResumeDataStorage(dataPath, this);
} }
} }
else else
{ {
const Path dataPath = specialFolderLocation(SpecialFolder::Data) / Path(u"BT_backup"_qs); const Path dataPath = specialFolderLocation(SpecialFolder::Data) / Path(u"BT_backup"_s);
m_resumeDataStorage = new BencodeResumeDataStorage(dataPath, this); m_resumeDataStorage = new BencodeResumeDataStorage(dataPath, this);
if (dbStorageExists) if (dbStorageExists)
@ -2068,7 +2068,7 @@ void SessionImpl::configurePeerClasses()
void SessionImpl::enableTracker(const bool enable) void SessionImpl::enableTracker(const bool enable)
{ {
const QString profile = u"embeddedTracker"_qs; const QString profile = u"embeddedTracker"_s;
auto *portForwarder = Net::PortForwarder::instance(); auto *portForwarder = Net::PortForwarder::instance();
if (enable) if (enable)
@ -2146,23 +2146,23 @@ void SessionImpl::processShareLimits()
if (m_maxRatioAction == Remove) if (m_maxRatioAction == Remove)
{ {
LogMsg(u"%1 %2 %3"_qs.arg(description, tr("Removed torrent."), torrentName)); LogMsg(u"%1 %2 %3"_s.arg(description, tr("Removed torrent."), torrentName));
deleteTorrent(torrent->id()); deleteTorrent(torrent->id());
} }
else if (m_maxRatioAction == DeleteFiles) else if (m_maxRatioAction == DeleteFiles)
{ {
LogMsg(u"%1 %2 %3"_qs.arg(description, tr("Removed torrent and deleted its content."), torrentName)); LogMsg(u"%1 %2 %3"_s.arg(description, tr("Removed torrent and deleted its content."), torrentName));
deleteTorrent(torrent->id(), DeleteTorrentAndFiles); deleteTorrent(torrent->id(), DeleteTorrentAndFiles);
} }
else if ((m_maxRatioAction == Pause) && !torrent->isPaused()) else if ((m_maxRatioAction == Pause) && !torrent->isPaused())
{ {
torrent->pause(); torrent->pause();
LogMsg(u"%1 %2 %3"_qs.arg(description, tr("Torrent paused."), torrentName)); LogMsg(u"%1 %2 %3"_s.arg(description, tr("Torrent paused."), torrentName));
} }
else if ((m_maxRatioAction == EnableSuperSeeding) && !torrent->isPaused() && !torrent->superSeeding()) else if ((m_maxRatioAction == EnableSuperSeeding) && !torrent->isPaused() && !torrent->superSeeding())
{ {
torrent->setSuperSeeding(true); torrent->setSuperSeeding(true);
LogMsg(u"%1 %2 %3"_qs.arg(description, tr("Super seeding enabled."), torrentName)); LogMsg(u"%1 %2 %3"_s.arg(description, tr("Super seeding enabled."), torrentName));
} }
continue; continue;
@ -2189,23 +2189,23 @@ void SessionImpl::processShareLimits()
if (m_maxRatioAction == Remove) if (m_maxRatioAction == Remove)
{ {
LogMsg(u"%1 %2 %3"_qs.arg(description, tr("Removed torrent."), torrentName)); LogMsg(u"%1 %2 %3"_s.arg(description, tr("Removed torrent."), torrentName));
deleteTorrent(torrent->id()); deleteTorrent(torrent->id());
} }
else if (m_maxRatioAction == DeleteFiles) else if (m_maxRatioAction == DeleteFiles)
{ {
LogMsg(u"%1 %2 %3"_qs.arg(description, tr("Removed torrent and deleted its content."), torrentName)); LogMsg(u"%1 %2 %3"_s.arg(description, tr("Removed torrent and deleted its content."), torrentName));
deleteTorrent(torrent->id(), DeleteTorrentAndFiles); deleteTorrent(torrent->id(), DeleteTorrentAndFiles);
} }
else if ((m_maxRatioAction == Pause) && !torrent->isPaused()) else if ((m_maxRatioAction == Pause) && !torrent->isPaused())
{ {
torrent->pause(); torrent->pause();
LogMsg(u"%1 %2 %3"_qs.arg(description, tr("Torrent paused."), torrentName)); LogMsg(u"%1 %2 %3"_s.arg(description, tr("Torrent paused."), torrentName));
} }
else if ((m_maxRatioAction == EnableSuperSeeding) && !torrent->isPaused() && !torrent->superSeeding()) else if ((m_maxRatioAction == EnableSuperSeeding) && !torrent->isPaused() && !torrent->superSeeding())
{ {
torrent->setSuperSeeding(true); torrent->setSuperSeeding(true);
LogMsg(u"%1 %2 %3"_qs.arg(description, tr("Super seeding enabled."), torrentName)); LogMsg(u"%1 %2 %3"_s.arg(description, tr("Super seeding enabled."), torrentName));
} }
} }
} }
@ -2615,7 +2615,7 @@ LoadTorrentParams SessionImpl::initLoadTorrentParams(const AddTorrentParams &add
const QString category = addTorrentParams.category; const QString category = addTorrentParams.category;
if (!category.isEmpty() && !m_categories.contains(category) && !addCategory(category)) if (!category.isEmpty() && !m_categories.contains(category) && !addCategory(category))
loadTorrentParams.category = u""_qs; loadTorrentParams.category = u""_s;
else else
loadTorrentParams.category = category; loadTorrentParams.category = category;
@ -3013,13 +3013,13 @@ void SessionImpl::exportTorrentFile(const Torrent *torrent, const Path &folderPa
return; return;
const QString validName = Utils::Fs::toValidFileName(torrent->name()); const QString validName = Utils::Fs::toValidFileName(torrent->name());
QString torrentExportFilename = u"%1.torrent"_qs.arg(validName); QString torrentExportFilename = u"%1.torrent"_s.arg(validName);
Path newTorrentPath = folderPath / Path(torrentExportFilename); Path newTorrentPath = folderPath / Path(torrentExportFilename);
int counter = 0; int counter = 0;
while (newTorrentPath.exists()) while (newTorrentPath.exists())
{ {
// Append number to torrent name to make it unique // Append number to torrent name to make it unique
torrentExportFilename = u"%1 %2.torrent"_qs.arg(validName).arg(++counter); torrentExportFilename = u"%1 %2.torrent"_s.arg(validName).arg(++counter);
newTorrentPath = folderPath / Path(torrentExportFilename); newTorrentPath = folderPath / Path(torrentExportFilename);
} }
@ -3154,7 +3154,7 @@ void SessionImpl::setSavePath(const Path &path)
void SessionImpl::setDownloadPath(const Path &path) void SessionImpl::setDownloadPath(const Path &path)
{ {
const Path newPath = (path.isAbsolute() ? path : (savePath() / Path(u"temp"_qs) / path)); const Path newPath = (path.isAbsolute() ? path : (savePath() / Path(u"temp"_s) / path));
if (newPath == m_downloadPath) if (newPath == m_downloadPath)
return; return;
@ -3230,13 +3230,13 @@ QStringList SessionImpl::getListeningIPs() const
if (ifaceName.isEmpty()) if (ifaceName.isEmpty())
{ {
if (ifaceAddr.isEmpty()) if (ifaceAddr.isEmpty())
return {u"0.0.0.0"_qs, u"::"_qs}; // Indicates all interfaces + all addresses (aka default) return {u"0.0.0.0"_s, u"::"_s}; // Indicates all interfaces + all addresses (aka default)
if (allIPv4) if (allIPv4)
return {u"0.0.0.0"_qs}; return {u"0.0.0.0"_s};
if (allIPv6) if (allIPv6)
return {u"::"_qs}; return {u"::"_s};
} }
const auto checkAndAddIP = [allIPv4, allIPv6, &IPs](const QHostAddress &addr, const QHostAddress &match) const auto checkAndAddIP = [allIPv4, allIPv6, &IPs](const QHostAddress &addr, const QHostAddress &match)
@ -4920,7 +4920,7 @@ void SessionImpl::handleTorrentFinished(TorrentImpl *const torrent)
// Check whether it contains .torrent files // Check whether it contains .torrent files
for (const Path &torrentRelpath : asConst(torrent->filePaths())) for (const Path &torrentRelpath : asConst(torrent->filePaths()))
{ {
if (torrentRelpath.hasExtension(u".torrent"_qs)) if (torrentRelpath.hasExtension(u".torrent"_s))
{ {
emit recursiveTorrentDownloadPossible(torrent); emit recursiveTorrentDownloadPossible(torrent);
break; break;
@ -5084,7 +5084,7 @@ void SessionImpl::storeCategories() const
void SessionImpl::upgradeCategories() void SessionImpl::upgradeCategories()
{ {
const auto legacyCategories = SettingValue<QVariantMap>(u"BitTorrent/Session/Categories"_qs).get(); const auto legacyCategories = SettingValue<QVariantMap>(u"BitTorrent/Session/Categories"_s).get();
for (auto it = legacyCategories.cbegin(); it != legacyCategories.cend(); ++it) for (auto it = legacyCategories.cbegin(); it != legacyCategories.cend(); ++it)
{ {
const QString &categoryName = it.key(); const QString &categoryName = it.key();
@ -5214,7 +5214,7 @@ void SessionImpl::recursiveTorrentDownload(const TorrentID &id)
for (const Path &torrentRelpath : asConst(torrent->filePaths())) for (const Path &torrentRelpath : asConst(torrent->filePaths()))
{ {
if (torrentRelpath.hasExtension(u".torrent"_qs)) if (torrentRelpath.hasExtension(u".torrent"_s))
{ {
const Path torrentFullpath = torrent->savePath() / torrentRelpath; const Path torrentFullpath = torrent->savePath() / torrentRelpath;
@ -5723,7 +5723,7 @@ void SessionImpl::handlePeerBlockedAlert(const lt::peer_blocked_alert *p)
reason = tr("filtered port (%1)", "this peer was blocked. Reason: filtered port (8899).").arg(QString::number(p->endpoint.port())); reason = tr("filtered port (%1)", "this peer was blocked. Reason: filtered port (8899).").arg(QString::number(p->endpoint.port()));
break; break;
case lt::peer_blocked_alert::i2p_mixed: case lt::peer_blocked_alert::i2p_mixed:
reason = tr("%1 mixed mode restrictions", "this peer was blocked. Reason: I2P mixed mode restrictions.").arg(u"I2P"_qs); // don't translate I2P reason = tr("%1 mixed mode restrictions", "this peer was blocked. Reason: I2P mixed mode restrictions.").arg(u"I2P"_s); // don't translate I2P
break; break;
case lt::peer_blocked_alert::privileged_ports: case lt::peer_blocked_alert::privileged_ports:
reason = tr("privileged port (%1)", "this peer was blocked. Reason: privileged port (80).").arg(QString::number(p->endpoint.port())); reason = tr("privileged port (%1)", "this peer was blocked. Reason: privileged port (80).").arg(QString::number(p->endpoint.port()));
@ -5732,7 +5732,7 @@ void SessionImpl::handlePeerBlockedAlert(const lt::peer_blocked_alert *p)
reason = tr("%1 is disabled", "this peer was blocked. Reason: uTP is disabled.").arg(C_UTP); // don't translate μTP reason = tr("%1 is disabled", "this peer was blocked. Reason: uTP is disabled.").arg(C_UTP); // don't translate μTP
break; break;
case lt::peer_blocked_alert::tcp_disabled: case lt::peer_blocked_alert::tcp_disabled:
reason = tr("%1 is disabled", "this peer was blocked. Reason: TCP is disabled.").arg(u"TCP"_qs); // don't translate TCP reason = tr("%1 is disabled", "this peer was blocked. Reason: TCP is disabled.").arg(u"TCP"_s); // don't translate TCP
break; break;
} }
@ -5983,7 +5983,7 @@ void SessionImpl::handleSocks5Alert(const lt::socks5_alert *p) const
if (p->error) if (p->error)
{ {
const auto addr = p->ip.address(); const auto addr = p->ip.address();
const QString endpoint = (addr.is_v6() ? u"[%1]:%2"_qs : u"%1:%2"_qs) const QString endpoint = (addr.is_v6() ? u"[%1]:%2"_s : u"%1:%2"_s)
.arg(QString::fromStdString(addr.to_string()), QString::number(p->ip.port())); .arg(QString::fromStdString(addr.to_string()), QString::number(p->ip.port()));
LogMsg(tr("SOCKS5 proxy error. Address: %1. Message: \"%2\".") LogMsg(tr("SOCKS5 proxy error. Address: %1. Message: \"%2\".")
.arg(endpoint, QString::fromLocal8Bit(p->error.message().c_str())) .arg(endpoint, QString::fromLocal8Bit(p->error.message().c_str()))
@ -6108,10 +6108,10 @@ void SessionImpl::saveStatistics() const
return; return;
const QVariantHash stats { const QVariantHash stats {
{u"AlltimeDL"_qs, m_status.allTimeDownload}, {u"AlltimeDL"_s, m_status.allTimeDownload},
{u"AlltimeUL"_qs, m_status.allTimeUpload}}; {u"AlltimeUL"_s, m_status.allTimeUpload}};
std::unique_ptr<QSettings> settings = Profile::instance()->applicationSettings(u"qBittorrent-data"_qs); std::unique_ptr<QSettings> settings = Profile::instance()->applicationSettings(u"qBittorrent-data"_s);
settings->setValue(u"Stats/AllStats"_qs, stats); settings->setValue(u"Stats/AllStats"_s, stats);
m_statisticsLastUpdateTimer.start(); m_statisticsLastUpdateTimer.start();
m_isStatisticsDirty = false; m_isStatisticsDirty = false;
@ -6119,9 +6119,9 @@ void SessionImpl::saveStatistics() const
void SessionImpl::loadStatistics() void SessionImpl::loadStatistics()
{ {
const std::unique_ptr<QSettings> settings = Profile::instance()->applicationSettings(u"qBittorrent-data"_qs); const std::unique_ptr<QSettings> settings = Profile::instance()->applicationSettings(u"qBittorrent-data"_s);
const QVariantHash value = settings->value(u"Stats/AllStats"_qs).toHash(); const QVariantHash value = settings->value(u"Stats/AllStats"_s).toHash();
m_previouslyDownloaded = value[u"AlltimeDL"_qs].toLongLong(); m_previouslyDownloaded = value[u"AlltimeDL"_s].toLongLong();
m_previouslyUploaded = value[u"AlltimeUL"_qs].toLongLong(); m_previouslyUploaded = value[u"AlltimeUL"_s].toLongLong();
} }

View file

@ -330,8 +330,8 @@ TorrentImpl::TorrentImpl(SessionImpl *session, lt::session *nativeSession
// Remove .unwanted directory if empty // Remove .unwanted directory if empty
const Path newPath = spath / newRelPath; const Path newPath = spath / newRelPath;
qDebug() << "Attempting to remove \".unwanted\" folder at " << (newPath / Path(u".unwanted"_qs)).toString(); qDebug() << "Attempting to remove \".unwanted\" folder at " << (newPath / Path(u".unwanted"_s)).toString();
Utils::Fs::rmdir(newPath / Path(u".unwanted"_qs)); Utils::Fs::rmdir(newPath / Path(u".unwanted"_s));
} }
} }
// == END UPGRADE CODE == // == END UPGRADE CODE ==
@ -2143,7 +2143,7 @@ void TorrentImpl::handleMetadataReceivedAlert(const lt::metadata_received_alert
void TorrentImpl::handlePerformanceAlert(const lt::performance_alert *p) const void TorrentImpl::handlePerformanceAlert(const lt::performance_alert *p) const
{ {
LogMsg((tr("Performance alert: %1. More info: %2").arg(QString::fromStdString(p->message()), u"https://libtorrent.org/reference-Alerts.html#enum-performance-warning-t"_qs)) LogMsg((tr("Performance alert: %1. More info: %2").arg(QString::fromStdString(p->message()), u"https://libtorrent.org/reference-Alerts.html#enum-performance-warning-t"_s))
, Log::INFO); , Log::INFO);
} }
@ -2480,7 +2480,7 @@ void TorrentImpl::flushCache() const
QString TorrentImpl::createMagnetURI() const QString TorrentImpl::createMagnetURI() const
{ {
QString ret = u"magnet:?"_qs; QString ret = u"magnet:?"_s;
const SHA1Hash infoHash1 = infoHash().v1(); const SHA1Hash infoHash1 = infoHash().v1();
if (infoHash1.isValid()) if (infoHash1.isValid())

View file

@ -53,23 +53,23 @@ namespace
// constants // constants
const int PEER_ID_SIZE = 20; const int PEER_ID_SIZE = 20;
const QString ANNOUNCE_REQUEST_PATH = u"/announce"_qs; const QString ANNOUNCE_REQUEST_PATH = u"/announce"_s;
const QString ANNOUNCE_REQUEST_COMPACT = u"compact"_qs; const QString ANNOUNCE_REQUEST_COMPACT = u"compact"_s;
const QString ANNOUNCE_REQUEST_INFO_HASH = u"info_hash"_qs; const QString ANNOUNCE_REQUEST_INFO_HASH = u"info_hash"_s;
const QString ANNOUNCE_REQUEST_IP = u"ip"_qs; const QString ANNOUNCE_REQUEST_IP = u"ip"_s;
const QString ANNOUNCE_REQUEST_LEFT = u"left"_qs; const QString ANNOUNCE_REQUEST_LEFT = u"left"_s;
const QString ANNOUNCE_REQUEST_NO_PEER_ID = u"no_peer_id"_qs; const QString ANNOUNCE_REQUEST_NO_PEER_ID = u"no_peer_id"_s;
const QString ANNOUNCE_REQUEST_NUM_WANT = u"numwant"_qs; const QString ANNOUNCE_REQUEST_NUM_WANT = u"numwant"_s;
const QString ANNOUNCE_REQUEST_PEER_ID = u"peer_id"_qs; const QString ANNOUNCE_REQUEST_PEER_ID = u"peer_id"_s;
const QString ANNOUNCE_REQUEST_PORT = u"port"_qs; const QString ANNOUNCE_REQUEST_PORT = u"port"_s;
const QString ANNOUNCE_REQUEST_EVENT = u"event"_qs; const QString ANNOUNCE_REQUEST_EVENT = u"event"_s;
const QString ANNOUNCE_REQUEST_EVENT_COMPLETED = u"completed"_qs; const QString ANNOUNCE_REQUEST_EVENT_COMPLETED = u"completed"_s;
const QString ANNOUNCE_REQUEST_EVENT_EMPTY = u"empty"_qs; const QString ANNOUNCE_REQUEST_EVENT_EMPTY = u"empty"_s;
const QString ANNOUNCE_REQUEST_EVENT_STARTED = u"started"_qs; const QString ANNOUNCE_REQUEST_EVENT_STARTED = u"started"_s;
const QString ANNOUNCE_REQUEST_EVENT_STOPPED = u"stopped"_qs; const QString ANNOUNCE_REQUEST_EVENT_STOPPED = u"stopped"_s;
const QString ANNOUNCE_REQUEST_EVENT_PAUSED = u"paused"_qs; const QString ANNOUNCE_REQUEST_EVENT_PAUSED = u"paused"_s;
const char ANNOUNCE_RESPONSE_COMPLETE[] = "complete"; const char ANNOUNCE_RESPONSE_COMPLETE[] = "complete";
const char ANNOUNCE_RESPONSE_EXTERNAL_IP[] = "external ip"; const char ANNOUNCE_RESPONSE_EXTERNAL_IP[] = "external ip";
@ -297,32 +297,32 @@ void Tracker::processAnnounceRequest()
// 1. info_hash // 1. info_hash
const auto infoHashIter = queryParams.find(ANNOUNCE_REQUEST_INFO_HASH); const auto infoHashIter = queryParams.find(ANNOUNCE_REQUEST_INFO_HASH);
if (infoHashIter == queryParams.end()) if (infoHashIter == queryParams.end())
throw TrackerError(u"Missing \"info_hash\" parameter"_qs); throw TrackerError(u"Missing \"info_hash\" parameter"_s);
const auto torrentID = TorrentID::fromString(QString::fromLatin1(infoHashIter->toHex())); const auto torrentID = TorrentID::fromString(QString::fromLatin1(infoHashIter->toHex()));
if (!torrentID.isValid()) if (!torrentID.isValid())
throw TrackerError(u"Invalid \"info_hash\" parameter"_qs); throw TrackerError(u"Invalid \"info_hash\" parameter"_s);
announceReq.torrentID = torrentID; announceReq.torrentID = torrentID;
// 2. peer_id // 2. peer_id
const auto peerIdIter = queryParams.find(ANNOUNCE_REQUEST_PEER_ID); const auto peerIdIter = queryParams.find(ANNOUNCE_REQUEST_PEER_ID);
if (peerIdIter == queryParams.end()) if (peerIdIter == queryParams.end())
throw TrackerError(u"Missing \"peer_id\" parameter"_qs); throw TrackerError(u"Missing \"peer_id\" parameter"_s);
if (peerIdIter->size() > PEER_ID_SIZE) if (peerIdIter->size() > PEER_ID_SIZE)
throw TrackerError(u"Invalid \"peer_id\" parameter"_qs); throw TrackerError(u"Invalid \"peer_id\" parameter"_s);
announceReq.peer.peerId = *peerIdIter; announceReq.peer.peerId = *peerIdIter;
// 3. port // 3. port
const auto portIter = queryParams.find(ANNOUNCE_REQUEST_PORT); const auto portIter = queryParams.find(ANNOUNCE_REQUEST_PORT);
if (portIter == queryParams.end()) if (portIter == queryParams.end())
throw TrackerError(u"Missing \"port\" parameter"_qs); throw TrackerError(u"Missing \"port\" parameter"_s);
const ushort portNum = portIter->toUShort(); const ushort portNum = portIter->toUShort();
if (portNum == 0) if (portNum == 0)
throw TrackerError(u"Invalid \"port\" parameter"_qs); throw TrackerError(u"Invalid \"port\" parameter"_s);
announceReq.peer.port = portNum; announceReq.peer.port = portNum;
@ -332,7 +332,7 @@ void Tracker::processAnnounceRequest()
{ {
const int num = numWantIter->toInt(); const int num = numWantIter->toInt();
if (num < 0) if (num < 0)
throw TrackerError(u"Invalid \"numwant\" parameter"_qs); throw TrackerError(u"Invalid \"numwant\" parameter"_s);
announceReq.numwant = num; announceReq.numwant = num;
} }
@ -377,7 +377,7 @@ void Tracker::processAnnounceRequest()
} }
else else
{ {
throw TrackerError(u"Invalid \"event\" parameter"_qs); throw TrackerError(u"Invalid \"event\" parameter"_s);
} }
prepareAnnounceResponse(announceReq); prepareAnnounceResponse(announceReq);

View file

@ -1,6 +1,6 @@
/* /*
* Bittorrent Client using Qt and libtorrent. * Bittorrent Client using Qt and libtorrent.
* Copyright (C) 2016 Mike Tzou * Copyright (C) 2016-2023 Mike Tzou (Chocobo1)
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -48,12 +48,18 @@ constexpr typename std::add_const_t<T> asConst(T &&t) noexcept { return std::for
template <typename T> template <typename T>
void asConst(const T &&) = delete; void asConst(const T &&) = delete;
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) #if (QT_VERSION < QT_VERSION_CHECK(6, 4, 0))
// https://doc.qt.io/qt-6/qstring.html#operator-22-22_qs // https://doc.qt.io/qt-6/qstring.html#operator-22-22_s
inline QString operator"" _qs(const char16_t *str, const std::size_t size) inline QString operator"" _s(const char16_t *str, const std::size_t size)
{ {
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
return QString::fromRawData(reinterpret_cast<const QChar *>(str), static_cast<int>(size)); return QString::fromRawData(reinterpret_cast<const QChar *>(str), static_cast<int>(size));
#else
return operator""_qs(str, size);
#endif
} }
#else
using namespace Qt::Literals::StringLiterals;
#endif #endif
inline const QString TORRENT_FILE_EXTENSION = u".torrent"_qs; inline const QString TORRENT_FILE_EXTENSION = u".torrent"_s;

View file

@ -82,8 +82,8 @@ void Connection::read()
LogMsg(tr("Http request size exceeds limitation, closing socket. Limit: %1, IP: %2") LogMsg(tr("Http request size exceeds limitation, closing socket. Limit: %1, IP: %2")
.arg(bufferLimit).arg(m_socket->peerAddress().toString()), Log::WARNING); .arg(bufferLimit).arg(m_socket->peerAddress().toString()), Log::WARNING);
Response resp(413, u"Payload Too Large"_qs); Response resp(413, u"Payload Too Large"_s);
resp.headers[HEADER_CONNECTION] = u"close"_qs; resp.headers[HEADER_CONNECTION] = u"close"_s;
sendResponse(resp); sendResponse(resp);
m_socket->close(); m_socket->close();
@ -96,8 +96,8 @@ void Connection::read()
LogMsg(tr("Bad Http request, closing socket. IP: %1") LogMsg(tr("Bad Http request, closing socket. IP: %1")
.arg(m_socket->peerAddress().toString()), Log::WARNING); .arg(m_socket->peerAddress().toString()), Log::WARNING);
Response resp(400, u"Bad Request"_qs); Response resp(400, u"Bad Request"_s);
resp.headers[HEADER_CONNECTION] = u"close"_qs; resp.headers[HEADER_CONNECTION] = u"close"_s;
sendResponse(resp); sendResponse(resp);
m_socket->close(); m_socket->close();
@ -110,10 +110,10 @@ void Connection::read()
Response resp = m_requestHandler->processRequest(result.request, env); Response resp = m_requestHandler->processRequest(result.request, env);
if (acceptsGzipEncoding(result.request.headers[u"accept-encoding"_qs])) if (acceptsGzipEncoding(result.request.headers[u"accept-encoding"_s]))
resp.headers[HEADER_CONTENT_ENCODING] = u"gzip"_qs; resp.headers[HEADER_CONTENT_ENCODING] = u"gzip"_s;
resp.headers[HEADER_CONNECTION] = u"keep-alive"_qs; resp.headers[HEADER_CONNECTION] = u"keep-alive"_s;
sendResponse(resp); sendResponse(resp);
m_receivedData = m_receivedData.mid(result.frameSize); m_receivedData = m_receivedData.mid(result.frameSize);
@ -176,11 +176,11 @@ bool Connection::acceptsGzipEncoding(QString codings)
if (list.isEmpty()) if (list.isEmpty())
return false; return false;
const bool canGzip = isCodingAvailable(list, u"gzip"_qs); const bool canGzip = isCodingAvailable(list, u"gzip"_s);
if (canGzip) if (canGzip)
return true; return true;
const bool canAny = isCodingAvailable(list, u"*"_qs); const bool canAny = isCodingAvailable(list, u"*"_s);
if (canAny) if (canAny)
return true; return true;

View file

@ -48,41 +48,41 @@ QString HTTPError::statusText() const
} }
BadRequestHTTPError::BadRequestHTTPError(const QString &message) BadRequestHTTPError::BadRequestHTTPError(const QString &message)
: HTTPError(400, u"Bad Request"_qs, message) : HTTPError(400, u"Bad Request"_s, message)
{ {
} }
UnauthorizedHTTPError::UnauthorizedHTTPError(const QString &message) UnauthorizedHTTPError::UnauthorizedHTTPError(const QString &message)
: HTTPError(401, u"Unauthorized"_qs, message) : HTTPError(401, u"Unauthorized"_s, message)
{ {
} }
ForbiddenHTTPError::ForbiddenHTTPError(const QString &message) ForbiddenHTTPError::ForbiddenHTTPError(const QString &message)
: HTTPError(403, u"Forbidden"_qs, message) : HTTPError(403, u"Forbidden"_s, message)
{ {
} }
NotFoundHTTPError::NotFoundHTTPError(const QString &message) NotFoundHTTPError::NotFoundHTTPError(const QString &message)
: HTTPError(404, u"Not Found"_qs, message) : HTTPError(404, u"Not Found"_s, message)
{ {
} }
MethodNotAllowedHTTPError::MethodNotAllowedHTTPError(const QString &message) MethodNotAllowedHTTPError::MethodNotAllowedHTTPError(const QString &message)
: HTTPError(405, u"Method Not Allowed"_qs, message) : HTTPError(405, u"Method Not Allowed"_s, message)
{ {
} }
ConflictHTTPError::ConflictHTTPError(const QString &message) ConflictHTTPError::ConflictHTTPError(const QString &message)
: HTTPError(409, u"Conflict"_qs, message) : HTTPError(409, u"Conflict"_s, message)
{ {
} }
UnsupportedMediaTypeHTTPError::UnsupportedMediaTypeHTTPError(const QString &message) UnsupportedMediaTypeHTTPError::UnsupportedMediaTypeHTTPError(const QString &message)
: HTTPError(415, u"Unsupported Media Type"_qs, message) : HTTPError(415, u"Unsupported Media Type"_s, message)
{ {
} }
InternalServerErrorHTTPError::InternalServerErrorHTTPError(const QString &message) InternalServerErrorHTTPError::InternalServerErrorHTTPError(const QString &message)
: HTTPError(500, u"Internal Server Error"_qs, message) : HTTPError(500, u"Internal Server Error"_s, message)
{ {
} }

View file

@ -189,7 +189,7 @@ bool RequestParser::parseRequestLine(const QString &line)
{ {
// [rfc7230] 3.1.1. Request Line // [rfc7230] 3.1.1. Request Line
const QRegularExpression re(u"^([A-Z]+)\\s+(\\S+)\\s+HTTP\\/(\\d\\.\\d)$"_qs); const QRegularExpression re(u"^([A-Z]+)\\s+(\\S+)\\s+HTTP\\/(\\d\\.\\d)$"_s);
const QRegularExpressionMatch match = re.match(line); const QRegularExpressionMatch match = re.match(line);
if (!match.hasMatch()) if (!match.hasMatch())
@ -264,7 +264,7 @@ bool RequestParser::parsePostMessage(const QByteArray &data)
// [rfc2046] 5.1.1. Common Syntax // [rfc2046] 5.1.1. Common Syntax
// find boundary delimiter // find boundary delimiter
const QString boundaryFieldName = u"boundary="_qs; const QString boundaryFieldName = u"boundary="_s;
const int idx = contentType.indexOf(boundaryFieldName); const int idx = contentType.indexOf(boundaryFieldName);
if (idx < 0) if (idx < 0)
{ {
@ -343,8 +343,8 @@ bool RequestParser::parseFormData(const QByteArray &data)
} }
// pick data // pick data
const QString filename = u"filename"_qs; const QString filename = u"filename"_s;
const QString name = u"name"_qs; const QString name = u"name"_s;
if (headersMap.contains(filename)) if (headersMap.contains(filename))
{ {

View file

@ -38,7 +38,7 @@ namespace Http
class ResponseBuilder class ResponseBuilder
{ {
public: public:
void status(uint code = 200, const QString &text = u"OK"_qs); void status(uint code = 200, const QString &text = u"OK"_s);
void setHeader(const Header &header); void setHeader(const Header &header);
void print(const QString &text, const QString &type = CONTENT_TYPE_HTML); void print(const QString &text, const QString &type = CONTENT_TYPE_HTML);
void print(const QByteArray &data, const QString &type = CONTENT_TYPE_HTML); void print(const QByteArray &data, const QString &type = CONTENT_TYPE_HTML);

View file

@ -74,7 +74,7 @@ QString Http::httpDate()
// [RFC 7231] 7.1.1.1. Date/Time Formats // [RFC 7231] 7.1.1.1. Date/Time Formats
// example: "Sun, 06 Nov 1994 08:49:37 GMT" // example: "Sun, 06 Nov 1994 08:49:37 GMT"
return QLocale::c().toString(QDateTime::currentDateTimeUtc(), u"ddd, dd MMM yyyy HH:mm:ss"_qs) return QLocale::c().toString(QDateTime::currentDateTimeUtc(), u"ddd, dd MMM yyyy HH:mm:ss"_s)
.append(u" GMT"); .append(u" GMT");
} }
@ -106,5 +106,5 @@ void Http::compressContent(Response &response)
return; return;
response.content = compressedData; response.content = compressedData;
response.headers[HEADER_CONTENT_ENCODING] = u"gzip"_qs; response.headers[HEADER_CONTENT_ENCODING] = u"gzip"_s;
} }

View file

@ -55,28 +55,28 @@ namespace
QList<QSslCipher> safeCipherList() QList<QSslCipher> safeCipherList()
{ {
const QStringList badCiphers {u"idea"_qs, u"rc4"_qs}; const QStringList badCiphers {u"idea"_s, u"rc4"_s};
// Contains Ciphersuites that use RSA for the Key Exchange but they don't mention it in their name // Contains Ciphersuites that use RSA for the Key Exchange but they don't mention it in their name
const QStringList badRSAShorthandSuites { const QStringList badRSAShorthandSuites {
u"AES256-GCM-SHA384"_qs, u"AES128-GCM-SHA256"_qs, u"AES256-SHA256"_qs, u"AES256-GCM-SHA384"_s, u"AES128-GCM-SHA256"_s, u"AES256-SHA256"_s,
u"AES128-SHA256"_qs, u"AES256-SHA"_qs, u"AES128-SHA"_qs}; u"AES128-SHA256"_s, u"AES256-SHA"_s, u"AES128-SHA"_s};
// Contains Ciphersuites that use AES CBC mode but they don't mention it in their name // Contains Ciphersuites that use AES CBC mode but they don't mention it in their name
const QStringList badAESShorthandSuites { const QStringList badAESShorthandSuites {
u"ECDHE-ECDSA-AES256-SHA384"_qs, u"ECDHE-RSA-AES256-SHA384"_qs, u"DHE-RSA-AES256-SHA256"_qs, u"ECDHE-ECDSA-AES256-SHA384"_s, u"ECDHE-RSA-AES256-SHA384"_s, u"DHE-RSA-AES256-SHA256"_s,
u"ECDHE-ECDSA-AES128-SHA256"_qs, u"ECDHE-RSA-AES128-SHA256"_qs, u"DHE-RSA-AES128-SHA256"_qs, u"ECDHE-ECDSA-AES128-SHA256"_s, u"ECDHE-RSA-AES128-SHA256"_s, u"DHE-RSA-AES128-SHA256"_s,
u"ECDHE-ECDSA-AES256-SHA"_qs, u"ECDHE-RSA-AES256-SHA"_qs, u"DHE-RSA-AES256-SHA"_qs, u"ECDHE-ECDSA-AES256-SHA"_s, u"ECDHE-RSA-AES256-SHA"_s, u"DHE-RSA-AES256-SHA"_s,
u"ECDHE-ECDSA-AES128-SHA"_qs, u"ECDHE-RSA-AES128-SHA"_qs, u"DHE-RSA-AES128-SHA"_qs}; u"ECDHE-ECDSA-AES128-SHA"_s, u"ECDHE-RSA-AES128-SHA"_s, u"DHE-RSA-AES128-SHA"_s};
const QList<QSslCipher> allCiphers {QSslConfiguration::supportedCiphers()}; const QList<QSslCipher> allCiphers {QSslConfiguration::supportedCiphers()};
QList<QSslCipher> safeCiphers; QList<QSslCipher> safeCiphers;
std::copy_if(allCiphers.cbegin(), allCiphers.cend(), std::back_inserter(safeCiphers), std::copy_if(allCiphers.cbegin(), allCiphers.cend(), std::back_inserter(safeCiphers),
[&badCiphers, &badRSAShorthandSuites, &badAESShorthandSuites](const QSslCipher &cipher) [&badCiphers, &badRSAShorthandSuites, &badAESShorthandSuites](const QSslCipher &cipher)
{ {
const QString name = cipher.name(); const QString name = cipher.name();
if (name.contains(u"-cbc-"_qs, Qt::CaseInsensitive) // AES CBC mode is considered vulnerable to BEAST attack if (name.contains(u"-cbc-"_s, Qt::CaseInsensitive) // AES CBC mode is considered vulnerable to BEAST attack
|| name.startsWith(u"adh-"_qs, Qt::CaseInsensitive) // Key Exchange: Diffie-Hellman, doesn't support Perfect Forward Secrecy || name.startsWith(u"adh-"_s, Qt::CaseInsensitive) // Key Exchange: Diffie-Hellman, doesn't support Perfect Forward Secrecy
|| name.startsWith(u"aecdh-"_qs, Qt::CaseInsensitive) // Key Exchange: Elliptic Curve Diffie-Hellman, doesn't support Perfect Forward Secrecy || name.startsWith(u"aecdh-"_s, Qt::CaseInsensitive) // Key Exchange: Elliptic Curve Diffie-Hellman, doesn't support Perfect Forward Secrecy
|| name.startsWith(u"psk-"_qs, Qt::CaseInsensitive) // Key Exchange: Pre-Shared Key, doesn't support Perfect Forward Secrecy || name.startsWith(u"psk-"_s, Qt::CaseInsensitive) // Key Exchange: Pre-Shared Key, doesn't support Perfect Forward Secrecy
|| name.startsWith(u"rsa-"_qs, Qt::CaseInsensitive) // Key Exchange: Rivest Shamir Adleman (RSA), doesn't support Perfect Forward Secrecy || name.startsWith(u"rsa-"_s, Qt::CaseInsensitive) // Key Exchange: Rivest Shamir Adleman (RSA), doesn't support Perfect Forward Secrecy
|| badRSAShorthandSuites.contains(name, Qt::CaseInsensitive) || badRSAShorthandSuites.contains(name, Qt::CaseInsensitive)
|| badAESShorthandSuites.contains(name, Qt::CaseInsensitive)) || badAESShorthandSuites.contains(name, Qt::CaseInsensitive))
{ {

View file

@ -37,42 +37,42 @@
namespace Http namespace Http
{ {
inline const QString METHOD_GET = u"GET"_qs; inline const QString METHOD_GET = u"GET"_s;
inline const QString METHOD_POST = u"POST"_qs; inline const QString METHOD_POST = u"POST"_s;
inline const QString HEADER_CACHE_CONTROL = u"cache-control"_qs; inline const QString HEADER_CACHE_CONTROL = u"cache-control"_s;
inline const QString HEADER_CONNECTION = u"connection"_qs; inline const QString HEADER_CONNECTION = u"connection"_s;
inline const QString HEADER_CONTENT_DISPOSITION = u"content-disposition"_qs; inline const QString HEADER_CONTENT_DISPOSITION = u"content-disposition"_s;
inline const QString HEADER_CONTENT_ENCODING = u"content-encoding"_qs; inline const QString HEADER_CONTENT_ENCODING = u"content-encoding"_s;
inline const QString HEADER_CONTENT_LENGTH = u"content-length"_qs; inline const QString HEADER_CONTENT_LENGTH = u"content-length"_s;
inline const QString HEADER_CONTENT_SECURITY_POLICY = u"content-security-policy"_qs; inline const QString HEADER_CONTENT_SECURITY_POLICY = u"content-security-policy"_s;
inline const QString HEADER_CONTENT_TYPE = u"content-type"_qs; inline const QString HEADER_CONTENT_TYPE = u"content-type"_s;
inline const QString HEADER_CROSS_ORIGIN_OPENER_POLICY = u"cross-origin-opener-policy"_qs; inline const QString HEADER_CROSS_ORIGIN_OPENER_POLICY = u"cross-origin-opener-policy"_s;
inline const QString HEADER_DATE = u"date"_qs; inline const QString HEADER_DATE = u"date"_s;
inline const QString HEADER_HOST = u"host"_qs; inline const QString HEADER_HOST = u"host"_s;
inline const QString HEADER_ORIGIN = u"origin"_qs; inline const QString HEADER_ORIGIN = u"origin"_s;
inline const QString HEADER_REFERER = u"referer"_qs; inline const QString HEADER_REFERER = u"referer"_s;
inline const QString HEADER_REFERRER_POLICY = u"referrer-policy"_qs; inline const QString HEADER_REFERRER_POLICY = u"referrer-policy"_s;
inline const QString HEADER_SET_COOKIE = u"set-cookie"_qs; inline const QString HEADER_SET_COOKIE = u"set-cookie"_s;
inline const QString HEADER_X_CONTENT_TYPE_OPTIONS = u"x-content-type-options"_qs; inline const QString HEADER_X_CONTENT_TYPE_OPTIONS = u"x-content-type-options"_s;
inline const QString HEADER_X_FORWARDED_FOR = u"x-forwarded-for"_qs; inline const QString HEADER_X_FORWARDED_FOR = u"x-forwarded-for"_s;
inline const QString HEADER_X_FORWARDED_HOST = u"x-forwarded-host"_qs; inline const QString HEADER_X_FORWARDED_HOST = u"x-forwarded-host"_s;
inline const QString HEADER_X_FRAME_OPTIONS = u"x-frame-options"_qs; inline const QString HEADER_X_FRAME_OPTIONS = u"x-frame-options"_s;
inline const QString HEADER_X_XSS_PROTECTION = u"x-xss-protection"_qs; inline const QString HEADER_X_XSS_PROTECTION = u"x-xss-protection"_s;
inline const QString HEADER_REQUEST_METHOD_GET = u"GET"_qs; inline const QString HEADER_REQUEST_METHOD_GET = u"GET"_s;
inline const QString HEADER_REQUEST_METHOD_HEAD = u"HEAD"_qs; inline const QString HEADER_REQUEST_METHOD_HEAD = u"HEAD"_s;
inline const QString HEADER_REQUEST_METHOD_POST = u"POST"_qs; inline const QString HEADER_REQUEST_METHOD_POST = u"POST"_s;
inline const QString CONTENT_TYPE_HTML = u"text/html"_qs; inline const QString CONTENT_TYPE_HTML = u"text/html"_s;
inline const QString CONTENT_TYPE_CSS = u"text/css"_qs; inline const QString CONTENT_TYPE_CSS = u"text/css"_s;
inline const QString CONTENT_TYPE_TXT = u"text/plain; charset=UTF-8"_qs; inline const QString CONTENT_TYPE_TXT = u"text/plain; charset=UTF-8"_s;
inline const QString CONTENT_TYPE_JS = u"application/javascript"_qs; inline const QString CONTENT_TYPE_JS = u"application/javascript"_s;
inline const QString CONTENT_TYPE_JSON = u"application/json"_qs; inline const QString CONTENT_TYPE_JSON = u"application/json"_s;
inline const QString CONTENT_TYPE_GIF = u"image/gif"_qs; inline const QString CONTENT_TYPE_GIF = u"image/gif"_s;
inline const QString CONTENT_TYPE_PNG = u"image/png"_qs; inline const QString CONTENT_TYPE_PNG = u"image/png"_s;
inline const QString CONTENT_TYPE_FORM_ENCODED = u"application/x-www-form-urlencoded"_qs; inline const QString CONTENT_TYPE_FORM_ENCODED = u"application/x-www-form-urlencoded"_s;
inline const QString CONTENT_TYPE_FORM_DATA = u"multipart/form-data"_qs; inline const QString CONTENT_TYPE_FORM_DATA = u"multipart/form-data"_s;
// portability: "\r\n" doesn't guarantee mapping to the correct symbol // portability: "\r\n" doesn't guarantee mapping to the correct symbol
inline const char CRLF[] = {0x0D, 0x0A, '\0'}; inline const char CRLF[] = {0x0D, 0x0A, '\0'};
@ -124,7 +124,7 @@ namespace Http
HeaderMap headers; HeaderMap headers;
QByteArray content; QByteArray content;
Response(uint code = 200, const QString &text = u"OK"_qs) Response(uint code = 200, const QString &text = u"OK"_s)
: status {code, text} : status {code, text}
{ {
} }

View file

@ -78,7 +78,7 @@ void DNSUpdater::checkPublicIP()
Q_ASSERT(m_state == OK); Q_ASSERT(m_state == OK);
DownloadManager::instance()->download( DownloadManager::instance()->download(
DownloadRequest(u"http://checkip.dyndns.org"_qs).userAgent(QStringLiteral("qBittorrent/" QBT_VERSION_2)) DownloadRequest(u"http://checkip.dyndns.org"_s).userAgent(QStringLiteral("qBittorrent/" QBT_VERSION_2))
, Preferences::instance()->useProxyForGeneralPurposes(), this, &DNSUpdater::ipRequestFinished); , Preferences::instance()->useProxyForGeneralPurposes(), this, &DNSUpdater::ipRequestFinished);
m_lastIPCheckTime = QDateTime::currentDateTime(); m_lastIPCheckTime = QDateTime::currentDateTime();
@ -93,7 +93,7 @@ void DNSUpdater::ipRequestFinished(const DownloadResult &result)
} }
// Parse response // Parse response
const QRegularExpressionMatch ipRegexMatch = QRegularExpression(u"Current IP Address:\\s+([^<]+)</body>"_qs).match(QString::fromUtf8(result.data)); const QRegularExpressionMatch ipRegexMatch = QRegularExpression(u"Current IP Address:\\s+([^<]+)</body>"_s).match(QString::fromUtf8(result.data));
if (ipRegexMatch.hasMatch()) if (ipRegexMatch.hasMatch())
{ {
QString ipStr = ipRegexMatch.captured(1); QString ipStr = ipRegexMatch.captured(1);
@ -134,9 +134,9 @@ QString DNSUpdater::getUpdateUrl() const
{ {
QUrl url; QUrl url;
#ifdef QT_NO_OPENSSL #ifdef QT_NO_OPENSSL
url.setScheme(u"http"_qs); url.setScheme(u"http"_s);
#else #else
url.setScheme(u"https"_qs); url.setScheme(u"https"_s);
#endif #endif
url.setUserName(m_username); url.setUserName(m_username);
url.setPassword(m_password); url.setPassword(m_password);
@ -146,21 +146,21 @@ QString DNSUpdater::getUpdateUrl() const
switch (m_service) switch (m_service)
{ {
case DNS::Service::DynDNS: case DNS::Service::DynDNS:
url.setHost(u"members.dyndns.org"_qs); url.setHost(u"members.dyndns.org"_s);
break; break;
case DNS::Service::NoIP: case DNS::Service::NoIP:
url.setHost(u"dynupdate.no-ip.com"_qs); url.setHost(u"dynupdate.no-ip.com"_s);
break; break;
default: default:
qWarning() << "Unrecognized Dynamic DNS service!"; qWarning() << "Unrecognized Dynamic DNS service!";
Q_ASSERT(false); Q_ASSERT(false);
break; break;
} }
url.setPath(u"/nic/update"_qs); url.setPath(u"/nic/update"_s);
QUrlQuery urlQuery(url); QUrlQuery urlQuery(url);
urlQuery.addQueryItem(u"hostname"_qs, m_domain); urlQuery.addQueryItem(u"hostname"_s, m_domain);
urlQuery.addQueryItem(u"myip"_qs, m_lastIP.toString()); urlQuery.addQueryItem(u"myip"_s, m_lastIP.toString());
url.setQuery(urlQuery); url.setQuery(urlQuery);
Q_ASSERT(url.isValid()); Q_ASSERT(url.isValid());
@ -223,7 +223,7 @@ void DNSUpdater::processIPUpdateReply(const QString &reply)
if (code == u"!donator") if (code == u"!donator")
{ {
LogMsg(tr("Dynamic DNS error: %1 was returned by the service, please submit a bug report at https://bugs.qbittorrent.org.").arg(u"!donator"_qs), LogMsg(tr("Dynamic DNS error: %1 was returned by the service, please submit a bug report at https://bugs.qbittorrent.org.").arg(u"!donator"_s),
Log::CRITICAL); Log::CRITICAL);
m_state = FATAL; m_state = FATAL;
return; return;
@ -250,7 +250,7 @@ void DNSUpdater::updateCredentials()
if (m_domain != pref->getDynDomainName()) if (m_domain != pref->getDynDomainName())
{ {
m_domain = pref->getDynDomainName(); m_domain = pref->getDynDomainName();
const QRegularExpressionMatch domainRegexMatch = QRegularExpression(u"^(?:(?!\\d|-)[a-zA-Z0-9\\-]{1,63}\\.)+[a-zA-Z]{2,}$"_qs).match(m_domain); const QRegularExpressionMatch domainRegexMatch = QRegularExpression(u"^(?:(?!\\d|-)[a-zA-Z0-9\\-]{1,63}\\.)+[a-zA-Z]{2,}$"_s).match(m_domain);
if (!domainRegexMatch.hasMatch()) if (!domainRegexMatch.hasMatch())
{ {
LogMsg(tr("Dynamic DNS error: supplied domain name is invalid."), Log::CRITICAL); LogMsg(tr("Dynamic DNS error: supplied domain name is invalid."), Log::CRITICAL);
@ -301,9 +301,9 @@ QUrl DNSUpdater::getRegistrationUrl(const DNS::Service service)
switch (service) switch (service)
{ {
case DNS::Service::DynDNS: case DNS::Service::DynDNS:
return {u"https://account.dyn.com/entrance/"_qs}; return {u"https://account.dyn.com/entrance/"_s};
case DNS::Service::NoIP: case DNS::Service::NoIP:
return {u"https://www.noip.com/remote-access"_qs}; return {u"https://www.noip.com/remote-access"_s};
default: default:
Q_ASSERT(false); Q_ASSERT(false);
break; break;

View file

@ -190,7 +190,7 @@ QString GeoIPDatabase::lookup(const QHostAddress &hostAddr) const
const QVariant val = readDataField(tmp); const QVariant val = readDataField(tmp);
if (val.userType() == QMetaType::QVariantHash) if (val.userType() == QMetaType::QVariantHash)
{ {
country = val.toHash()[u"country"_qs].toHash()[u"iso_code"_qs].toString(); country = val.toHash()[u"country"_s].toHash()[u"iso_code"_s].toString();
m_countries[id] = country; m_countries[id] = country;
} }
} }
@ -233,26 +233,26 @@ bool GeoIPDatabase::parseMetadata(const QVariantHash &metadata, QString &error)
qDebug() << "Parsing MaxMindDB metadata..."; qDebug() << "Parsing MaxMindDB metadata...";
CHECK_METADATA_REQ(u"binary_format_major_version"_qs, UShort); CHECK_METADATA_REQ(u"binary_format_major_version"_s, UShort);
CHECK_METADATA_REQ(u"binary_format_minor_version"_qs, UShort); CHECK_METADATA_REQ(u"binary_format_minor_version"_s, UShort);
const uint versionMajor = metadata.value(u"binary_format_major_version"_qs).toUInt(); const uint versionMajor = metadata.value(u"binary_format_major_version"_s).toUInt();
const uint versionMinor = metadata.value(u"binary_format_minor_version"_qs).toUInt(); const uint versionMinor = metadata.value(u"binary_format_minor_version"_s).toUInt();
if (versionMajor != 2) if (versionMajor != 2)
{ {
error = tr("Unsupported database version: %1.%2").arg(versionMajor).arg(versionMinor); error = tr("Unsupported database version: %1.%2").arg(versionMajor).arg(versionMinor);
return false; return false;
} }
CHECK_METADATA_REQ(u"ip_version"_qs, UShort); CHECK_METADATA_REQ(u"ip_version"_s, UShort);
m_ipVersion = metadata.value(u"ip_version"_qs).value<quint16>(); m_ipVersion = metadata.value(u"ip_version"_s).value<quint16>();
if (m_ipVersion != 6) if (m_ipVersion != 6)
{ {
error = tr("Unsupported IP version: %1").arg(m_ipVersion); error = tr("Unsupported IP version: %1").arg(m_ipVersion);
return false; return false;
} }
CHECK_METADATA_REQ(u"record_size"_qs, UShort); CHECK_METADATA_REQ(u"record_size"_s, UShort);
m_recordSize = metadata.value(u"record_size"_qs).value<quint16>(); m_recordSize = metadata.value(u"record_size"_s).value<quint16>();
if (m_recordSize != 24) if (m_recordSize != 24)
{ {
error = tr("Unsupported record size: %1").arg(m_recordSize); error = tr("Unsupported record size: %1").arg(m_recordSize);
@ -261,18 +261,18 @@ bool GeoIPDatabase::parseMetadata(const QVariantHash &metadata, QString &error)
m_nodeSize = m_recordSize / 4; m_nodeSize = m_recordSize / 4;
m_recordBytes = m_nodeSize / 2; m_recordBytes = m_nodeSize / 2;
CHECK_METADATA_REQ(u"node_count"_qs, UInt); CHECK_METADATA_REQ(u"node_count"_s, UInt);
m_nodeCount = metadata.value(u"node_count"_qs).value<quint32>(); m_nodeCount = metadata.value(u"node_count"_s).value<quint32>();
m_indexSize = m_nodeCount * m_nodeSize; m_indexSize = m_nodeCount * m_nodeSize;
CHECK_METADATA_REQ(u"database_type"_qs, QString); CHECK_METADATA_REQ(u"database_type"_s, QString);
m_dbType = metadata.value(u"database_type"_qs).toString(); m_dbType = metadata.value(u"database_type"_s).toString();
CHECK_METADATA_REQ(u"build_epoch"_qs, ULongLong); CHECK_METADATA_REQ(u"build_epoch"_s, ULongLong);
m_buildEpoch = QDateTime::fromSecsSinceEpoch(metadata.value(u"build_epoch"_qs).toULongLong()); m_buildEpoch = QDateTime::fromSecsSinceEpoch(metadata.value(u"build_epoch"_s).toULongLong());
CHECK_METADATA_OPT(u"languages"_qs, QVariantList); CHECK_METADATA_OPT(u"languages"_s, QVariantList);
CHECK_METADATA_OPT(u"description"_qs, QVariantHash); CHECK_METADATA_OPT(u"description"_s, QVariantHash);
return true; return true;
} }

View file

@ -43,9 +43,9 @@
#include "downloadmanager.h" #include "downloadmanager.h"
#include "geoipdatabase.h" #include "geoipdatabase.h"
const QString DATABASE_URL = u"https://download.db-ip.com/free/dbip-country-lite-%1.mmdb.gz"_qs; const QString DATABASE_URL = u"https://download.db-ip.com/free/dbip-country-lite-%1.mmdb.gz"_s;
const QString GEODB_FOLDER = u"GeoDB"_qs; const QString GEODB_FOLDER = u"GeoDB"_s;
const QString GEODB_FILENAME = u"dbip-country-lite.mmdb"_qs; const QString GEODB_FILENAME = u"dbip-country-lite.mmdb"_s;
using namespace Net; using namespace Net;
@ -150,255 +150,255 @@ QString GeoIPManager::CountryName(const QString &countryISOCode)
// http://www.iso.org/iso/home/standards/country_codes/country_names_and_code_elements_txt-temp.htm // http://www.iso.org/iso/home/standards/country_codes/country_names_and_code_elements_txt-temp.htm
// Officially assigned // Officially assigned
{u"AD"_qs, tr("Andorra")}, {u"AD"_s, tr("Andorra")},
{u"AE"_qs, tr("United Arab Emirates")}, {u"AE"_s, tr("United Arab Emirates")},
{u"AF"_qs, tr("Afghanistan")}, {u"AF"_s, tr("Afghanistan")},
{u"AG"_qs, tr("Antigua and Barbuda")}, {u"AG"_s, tr("Antigua and Barbuda")},
{u"AI"_qs, tr("Anguilla")}, {u"AI"_s, tr("Anguilla")},
{u"AL"_qs, tr("Albania")}, {u"AL"_s, tr("Albania")},
{u"AM"_qs, tr("Armenia")}, {u"AM"_s, tr("Armenia")},
{u"AO"_qs, tr("Angola")}, {u"AO"_s, tr("Angola")},
{u"AQ"_qs, tr("Antarctica")}, {u"AQ"_s, tr("Antarctica")},
{u"AR"_qs, tr("Argentina")}, {u"AR"_s, tr("Argentina")},
{u"AS"_qs, tr("American Samoa")}, {u"AS"_s, tr("American Samoa")},
{u"AT"_qs, tr("Austria")}, {u"AT"_s, tr("Austria")},
{u"AU"_qs, tr("Australia")}, {u"AU"_s, tr("Australia")},
{u"AW"_qs, tr("Aruba")}, {u"AW"_s, tr("Aruba")},
{u"AX"_qs, tr("Aland Islands")}, {u"AX"_s, tr("Aland Islands")},
{u"AZ"_qs, tr("Azerbaijan")}, {u"AZ"_s, tr("Azerbaijan")},
{u"BA"_qs, tr("Bosnia and Herzegovina")}, {u"BA"_s, tr("Bosnia and Herzegovina")},
{u"BB"_qs, tr("Barbados")}, {u"BB"_s, tr("Barbados")},
{u"BD"_qs, tr("Bangladesh")}, {u"BD"_s, tr("Bangladesh")},
{u"BE"_qs, tr("Belgium")}, {u"BE"_s, tr("Belgium")},
{u"BF"_qs, tr("Burkina Faso")}, {u"BF"_s, tr("Burkina Faso")},
{u"BG"_qs, tr("Bulgaria")}, {u"BG"_s, tr("Bulgaria")},
{u"BH"_qs, tr("Bahrain")}, {u"BH"_s, tr("Bahrain")},
{u"BI"_qs, tr("Burundi")}, {u"BI"_s, tr("Burundi")},
{u"BJ"_qs, tr("Benin")}, {u"BJ"_s, tr("Benin")},
{u"BL"_qs, tr("Saint Barthelemy")}, {u"BL"_s, tr("Saint Barthelemy")},
{u"BM"_qs, tr("Bermuda")}, {u"BM"_s, tr("Bermuda")},
{u"BN"_qs, tr("Brunei Darussalam")}, {u"BN"_s, tr("Brunei Darussalam")},
{u"BO"_qs, tr("Bolivia, Plurinational State of")}, {u"BO"_s, tr("Bolivia, Plurinational State of")},
{u"BQ"_qs, tr("Bonaire, Sint Eustatius and Saba")}, {u"BQ"_s, tr("Bonaire, Sint Eustatius and Saba")},
{u"BR"_qs, tr("Brazil")}, {u"BR"_s, tr("Brazil")},
{u"BS"_qs, tr("Bahamas")}, {u"BS"_s, tr("Bahamas")},
{u"BT"_qs, tr("Bhutan")}, {u"BT"_s, tr("Bhutan")},
{u"BV"_qs, tr("Bouvet Island")}, {u"BV"_s, tr("Bouvet Island")},
{u"BW"_qs, tr("Botswana")}, {u"BW"_s, tr("Botswana")},
{u"BY"_qs, tr("Belarus")}, {u"BY"_s, tr("Belarus")},
{u"BZ"_qs, tr("Belize")}, {u"BZ"_s, tr("Belize")},
{u"CA"_qs, tr("Canada")}, {u"CA"_s, tr("Canada")},
{u"CC"_qs, tr("Cocos (Keeling) Islands")}, {u"CC"_s, tr("Cocos (Keeling) Islands")},
{u"CD"_qs, tr("Congo, The Democratic Republic of the")}, {u"CD"_s, tr("Congo, The Democratic Republic of the")},
{u"CF"_qs, tr("Central African Republic")}, {u"CF"_s, tr("Central African Republic")},
{u"CG"_qs, tr("Congo")}, {u"CG"_s, tr("Congo")},
{u"CH"_qs, tr("Switzerland")}, {u"CH"_s, tr("Switzerland")},
{u"CI"_qs, tr("Cote d'Ivoire")}, {u"CI"_s, tr("Cote d'Ivoire")},
{u"CK"_qs, tr("Cook Islands")}, {u"CK"_s, tr("Cook Islands")},
{u"CL"_qs, tr("Chile")}, {u"CL"_s, tr("Chile")},
{u"CM"_qs, tr("Cameroon")}, {u"CM"_s, tr("Cameroon")},
{u"CN"_qs, tr("China")}, {u"CN"_s, tr("China")},
{u"CO"_qs, tr("Colombia")}, {u"CO"_s, tr("Colombia")},
{u"CR"_qs, tr("Costa Rica")}, {u"CR"_s, tr("Costa Rica")},
{u"CU"_qs, tr("Cuba")}, {u"CU"_s, tr("Cuba")},
{u"CV"_qs, tr("Cape Verde")}, {u"CV"_s, tr("Cape Verde")},
{u"CW"_qs, tr("Curacao")}, {u"CW"_s, tr("Curacao")},
{u"CX"_qs, tr("Christmas Island")}, {u"CX"_s, tr("Christmas Island")},
{u"CY"_qs, tr("Cyprus")}, {u"CY"_s, tr("Cyprus")},
{u"CZ"_qs, tr("Czech Republic")}, {u"CZ"_s, tr("Czech Republic")},
{u"DE"_qs, tr("Germany")}, {u"DE"_s, tr("Germany")},
{u"DJ"_qs, tr("Djibouti")}, {u"DJ"_s, tr("Djibouti")},
{u"DK"_qs, tr("Denmark")}, {u"DK"_s, tr("Denmark")},
{u"DM"_qs, tr("Dominica")}, {u"DM"_s, tr("Dominica")},
{u"DO"_qs, tr("Dominican Republic")}, {u"DO"_s, tr("Dominican Republic")},
{u"DZ"_qs, tr("Algeria")}, {u"DZ"_s, tr("Algeria")},
{u"EC"_qs, tr("Ecuador")}, {u"EC"_s, tr("Ecuador")},
{u"EE"_qs, tr("Estonia")}, {u"EE"_s, tr("Estonia")},
{u"EG"_qs, tr("Egypt")}, {u"EG"_s, tr("Egypt")},
{u"EH"_qs, tr("Western Sahara")}, {u"EH"_s, tr("Western Sahara")},
{u"ER"_qs, tr("Eritrea")}, {u"ER"_s, tr("Eritrea")},
{u"ES"_qs, tr("Spain")}, {u"ES"_s, tr("Spain")},
{u"ET"_qs, tr("Ethiopia")}, {u"ET"_s, tr("Ethiopia")},
{u"FI"_qs, tr("Finland")}, {u"FI"_s, tr("Finland")},
{u"FJ"_qs, tr("Fiji")}, {u"FJ"_s, tr("Fiji")},
{u"FK"_qs, tr("Falkland Islands (Malvinas)")}, {u"FK"_s, tr("Falkland Islands (Malvinas)")},
{u"FM"_qs, tr("Micronesia, Federated States of")}, {u"FM"_s, tr("Micronesia, Federated States of")},
{u"FO"_qs, tr("Faroe Islands")}, {u"FO"_s, tr("Faroe Islands")},
{u"FR"_qs, tr("France")}, {u"FR"_s, tr("France")},
{u"GA"_qs, tr("Gabon")}, {u"GA"_s, tr("Gabon")},
{u"GB"_qs, tr("United Kingdom")}, {u"GB"_s, tr("United Kingdom")},
{u"GD"_qs, tr("Grenada")}, {u"GD"_s, tr("Grenada")},
{u"GE"_qs, tr("Georgia")}, {u"GE"_s, tr("Georgia")},
{u"GF"_qs, tr("French Guiana")}, {u"GF"_s, tr("French Guiana")},
{u"GG"_qs, tr("Guernsey")}, {u"GG"_s, tr("Guernsey")},
{u"GH"_qs, tr("Ghana")}, {u"GH"_s, tr("Ghana")},
{u"GI"_qs, tr("Gibraltar")}, {u"GI"_s, tr("Gibraltar")},
{u"GL"_qs, tr("Greenland")}, {u"GL"_s, tr("Greenland")},
{u"GM"_qs, tr("Gambia")}, {u"GM"_s, tr("Gambia")},
{u"GN"_qs, tr("Guinea")}, {u"GN"_s, tr("Guinea")},
{u"GP"_qs, tr("Guadeloupe")}, {u"GP"_s, tr("Guadeloupe")},
{u"GQ"_qs, tr("Equatorial Guinea")}, {u"GQ"_s, tr("Equatorial Guinea")},
{u"GR"_qs, tr("Greece")}, {u"GR"_s, tr("Greece")},
{u"GS"_qs, tr("South Georgia and the South Sandwich Islands")}, {u"GS"_s, tr("South Georgia and the South Sandwich Islands")},
{u"GT"_qs, tr("Guatemala")}, {u"GT"_s, tr("Guatemala")},
{u"GU"_qs, tr("Guam")}, {u"GU"_s, tr("Guam")},
{u"GW"_qs, tr("Guinea-Bissau")}, {u"GW"_s, tr("Guinea-Bissau")},
{u"GY"_qs, tr("Guyana")}, {u"GY"_s, tr("Guyana")},
{u"HK"_qs, tr("Hong Kong")}, {u"HK"_s, tr("Hong Kong")},
{u"HM"_qs, tr("Heard Island and McDonald Islands")}, {u"HM"_s, tr("Heard Island and McDonald Islands")},
{u"HN"_qs, tr("Honduras")}, {u"HN"_s, tr("Honduras")},
{u"HR"_qs, tr("Croatia")}, {u"HR"_s, tr("Croatia")},
{u"HT"_qs, tr("Haiti")}, {u"HT"_s, tr("Haiti")},
{u"HU"_qs, tr("Hungary")}, {u"HU"_s, tr("Hungary")},
{u"ID"_qs, tr("Indonesia")}, {u"ID"_s, tr("Indonesia")},
{u"IE"_qs, tr("Ireland")}, {u"IE"_s, tr("Ireland")},
{u"IL"_qs, tr("Israel")}, {u"IL"_s, tr("Israel")},
{u"IM"_qs, tr("Isle of Man")}, {u"IM"_s, tr("Isle of Man")},
{u"IN"_qs, tr("India")}, {u"IN"_s, tr("India")},
{u"IO"_qs, tr("British Indian Ocean Territory")}, {u"IO"_s, tr("British Indian Ocean Territory")},
{u"IQ"_qs, tr("Iraq")}, {u"IQ"_s, tr("Iraq")},
{u"IR"_qs, tr("Iran, Islamic Republic of")}, {u"IR"_s, tr("Iran, Islamic Republic of")},
{u"IS"_qs, tr("Iceland")}, {u"IS"_s, tr("Iceland")},
{u"IT"_qs, tr("Italy")}, {u"IT"_s, tr("Italy")},
{u"JE"_qs, tr("Jersey")}, {u"JE"_s, tr("Jersey")},
{u"JM"_qs, tr("Jamaica")}, {u"JM"_s, tr("Jamaica")},
{u"JO"_qs, tr("Jordan")}, {u"JO"_s, tr("Jordan")},
{u"JP"_qs, tr("Japan")}, {u"JP"_s, tr("Japan")},
{u"KE"_qs, tr("Kenya")}, {u"KE"_s, tr("Kenya")},
{u"KG"_qs, tr("Kyrgyzstan")}, {u"KG"_s, tr("Kyrgyzstan")},
{u"KH"_qs, tr("Cambodia")}, {u"KH"_s, tr("Cambodia")},
{u"KI"_qs, tr("Kiribati")}, {u"KI"_s, tr("Kiribati")},
{u"KM"_qs, tr("Comoros")}, {u"KM"_s, tr("Comoros")},
{u"KN"_qs, tr("Saint Kitts and Nevis")}, {u"KN"_s, tr("Saint Kitts and Nevis")},
{u"KP"_qs, tr("Korea, Democratic People's Republic of")}, {u"KP"_s, tr("Korea, Democratic People's Republic of")},
{u"KR"_qs, tr("Korea, Republic of")}, {u"KR"_s, tr("Korea, Republic of")},
{u"KW"_qs, tr("Kuwait")}, {u"KW"_s, tr("Kuwait")},
{u"KY"_qs, tr("Cayman Islands")}, {u"KY"_s, tr("Cayman Islands")},
{u"KZ"_qs, tr("Kazakhstan")}, {u"KZ"_s, tr("Kazakhstan")},
{u"LA"_qs, tr("Lao People's Democratic Republic")}, {u"LA"_s, tr("Lao People's Democratic Republic")},
{u"LB"_qs, tr("Lebanon")}, {u"LB"_s, tr("Lebanon")},
{u"LC"_qs, tr("Saint Lucia")}, {u"LC"_s, tr("Saint Lucia")},
{u"LI"_qs, tr("Liechtenstein")}, {u"LI"_s, tr("Liechtenstein")},
{u"LK"_qs, tr("Sri Lanka")}, {u"LK"_s, tr("Sri Lanka")},
{u"LR"_qs, tr("Liberia")}, {u"LR"_s, tr("Liberia")},
{u"LS"_qs, tr("Lesotho")}, {u"LS"_s, tr("Lesotho")},
{u"LT"_qs, tr("Lithuania")}, {u"LT"_s, tr("Lithuania")},
{u"LU"_qs, tr("Luxembourg")}, {u"LU"_s, tr("Luxembourg")},
{u"LV"_qs, tr("Latvia")}, {u"LV"_s, tr("Latvia")},
{u"LY"_qs, tr("Libya")}, {u"LY"_s, tr("Libya")},
{u"MA"_qs, tr("Morocco")}, {u"MA"_s, tr("Morocco")},
{u"MC"_qs, tr("Monaco")}, {u"MC"_s, tr("Monaco")},
{u"MD"_qs, tr("Moldova, Republic of")}, {u"MD"_s, tr("Moldova, Republic of")},
{u"ME"_qs, tr("Montenegro")}, {u"ME"_s, tr("Montenegro")},
{u"MF"_qs, tr("Saint Martin (French part)")}, {u"MF"_s, tr("Saint Martin (French part)")},
{u"MG"_qs, tr("Madagascar")}, {u"MG"_s, tr("Madagascar")},
{u"MH"_qs, tr("Marshall Islands")}, {u"MH"_s, tr("Marshall Islands")},
{u"MK"_qs, tr("Macedonia, The Former Yugoslav Republic of")}, {u"MK"_s, tr("Macedonia, The Former Yugoslav Republic of")},
{u"ML"_qs, tr("Mali")}, {u"ML"_s, tr("Mali")},
{u"MM"_qs, tr("Myanmar")}, {u"MM"_s, tr("Myanmar")},
{u"MN"_qs, tr("Mongolia")}, {u"MN"_s, tr("Mongolia")},
{u"MO"_qs, tr("Macao")}, {u"MO"_s, tr("Macao")},
{u"MP"_qs, tr("Northern Mariana Islands")}, {u"MP"_s, tr("Northern Mariana Islands")},
{u"MQ"_qs, tr("Martinique")}, {u"MQ"_s, tr("Martinique")},
{u"MR"_qs, tr("Mauritania")}, {u"MR"_s, tr("Mauritania")},
{u"MS"_qs, tr("Montserrat")}, {u"MS"_s, tr("Montserrat")},
{u"MT"_qs, tr("Malta")}, {u"MT"_s, tr("Malta")},
{u"MU"_qs, tr("Mauritius")}, {u"MU"_s, tr("Mauritius")},
{u"MV"_qs, tr("Maldives")}, {u"MV"_s, tr("Maldives")},
{u"MW"_qs, tr("Malawi")}, {u"MW"_s, tr("Malawi")},
{u"MX"_qs, tr("Mexico")}, {u"MX"_s, tr("Mexico")},
{u"MY"_qs, tr("Malaysia")}, {u"MY"_s, tr("Malaysia")},
{u"MZ"_qs, tr("Mozambique")}, {u"MZ"_s, tr("Mozambique")},
{u"NA"_qs, tr("Namibia")}, {u"NA"_s, tr("Namibia")},
{u"NC"_qs, tr("New Caledonia")}, {u"NC"_s, tr("New Caledonia")},
{u"NE"_qs, tr("Niger")}, {u"NE"_s, tr("Niger")},
{u"NF"_qs, tr("Norfolk Island")}, {u"NF"_s, tr("Norfolk Island")},
{u"NG"_qs, tr("Nigeria")}, {u"NG"_s, tr("Nigeria")},
{u"NI"_qs, tr("Nicaragua")}, {u"NI"_s, tr("Nicaragua")},
{u"NL"_qs, tr("Netherlands")}, {u"NL"_s, tr("Netherlands")},
{u"NO"_qs, tr("Norway")}, {u"NO"_s, tr("Norway")},
{u"NP"_qs, tr("Nepal")}, {u"NP"_s, tr("Nepal")},
{u"NR"_qs, tr("Nauru")}, {u"NR"_s, tr("Nauru")},
{u"NU"_qs, tr("Niue")}, {u"NU"_s, tr("Niue")},
{u"NZ"_qs, tr("New Zealand")}, {u"NZ"_s, tr("New Zealand")},
{u"OM"_qs, tr("Oman")}, {u"OM"_s, tr("Oman")},
{u"PA"_qs, tr("Panama")}, {u"PA"_s, tr("Panama")},
{u"PE"_qs, tr("Peru")}, {u"PE"_s, tr("Peru")},
{u"PF"_qs, tr("French Polynesia")}, {u"PF"_s, tr("French Polynesia")},
{u"PG"_qs, tr("Papua New Guinea")}, {u"PG"_s, tr("Papua New Guinea")},
{u"PH"_qs, tr("Philippines")}, {u"PH"_s, tr("Philippines")},
{u"PK"_qs, tr("Pakistan")}, {u"PK"_s, tr("Pakistan")},
{u"PL"_qs, tr("Poland")}, {u"PL"_s, tr("Poland")},
{u"PM"_qs, tr("Saint Pierre and Miquelon")}, {u"PM"_s, tr("Saint Pierre and Miquelon")},
{u"PN"_qs, tr("Pitcairn")}, {u"PN"_s, tr("Pitcairn")},
{u"PR"_qs, tr("Puerto Rico")}, {u"PR"_s, tr("Puerto Rico")},
{u"PS"_qs, tr("Palestine, State of")}, {u"PS"_s, tr("Palestine, State of")},
{u"PT"_qs, tr("Portugal")}, {u"PT"_s, tr("Portugal")},
{u"PW"_qs, tr("Palau")}, {u"PW"_s, tr("Palau")},
{u"PY"_qs, tr("Paraguay")}, {u"PY"_s, tr("Paraguay")},
{u"QA"_qs, tr("Qatar")}, {u"QA"_s, tr("Qatar")},
{u"RE"_qs, tr("Reunion")}, {u"RE"_s, tr("Reunion")},
{u"RO"_qs, tr("Romania")}, {u"RO"_s, tr("Romania")},
{u"RS"_qs, tr("Serbia")}, {u"RS"_s, tr("Serbia")},
{u"RU"_qs, tr("Russian Federation")}, {u"RU"_s, tr("Russian Federation")},
{u"RW"_qs, tr("Rwanda")}, {u"RW"_s, tr("Rwanda")},
{u"SA"_qs, tr("Saudi Arabia")}, {u"SA"_s, tr("Saudi Arabia")},
{u"SB"_qs, tr("Solomon Islands")}, {u"SB"_s, tr("Solomon Islands")},
{u"SC"_qs, tr("Seychelles")}, {u"SC"_s, tr("Seychelles")},
{u"SD"_qs, tr("Sudan")}, {u"SD"_s, tr("Sudan")},
{u"SE"_qs, tr("Sweden")}, {u"SE"_s, tr("Sweden")},
{u"SG"_qs, tr("Singapore")}, {u"SG"_s, tr("Singapore")},
{u"SH"_qs, tr("Saint Helena, Ascension and Tristan da Cunha")}, {u"SH"_s, tr("Saint Helena, Ascension and Tristan da Cunha")},
{u"SI"_qs, tr("Slovenia")}, {u"SI"_s, tr("Slovenia")},
{u"SJ"_qs, tr("Svalbard and Jan Mayen")}, {u"SJ"_s, tr("Svalbard and Jan Mayen")},
{u"SK"_qs, tr("Slovakia")}, {u"SK"_s, tr("Slovakia")},
{u"SL"_qs, tr("Sierra Leone")}, {u"SL"_s, tr("Sierra Leone")},
{u"SM"_qs, tr("San Marino")}, {u"SM"_s, tr("San Marino")},
{u"SN"_qs, tr("Senegal")}, {u"SN"_s, tr("Senegal")},
{u"SO"_qs, tr("Somalia")}, {u"SO"_s, tr("Somalia")},
{u"SR"_qs, tr("Suriname")}, {u"SR"_s, tr("Suriname")},
{u"SS"_qs, tr("South Sudan")}, {u"SS"_s, tr("South Sudan")},
{u"ST"_qs, tr("Sao Tome and Principe")}, {u"ST"_s, tr("Sao Tome and Principe")},
{u"SV"_qs, tr("El Salvador")}, {u"SV"_s, tr("El Salvador")},
{u"SX"_qs, tr("Sint Maarten (Dutch part)")}, {u"SX"_s, tr("Sint Maarten (Dutch part)")},
{u"SY"_qs, tr("Syrian Arab Republic")}, {u"SY"_s, tr("Syrian Arab Republic")},
{u"SZ"_qs, tr("Swaziland")}, {u"SZ"_s, tr("Swaziland")},
{u"TC"_qs, tr("Turks and Caicos Islands")}, {u"TC"_s, tr("Turks and Caicos Islands")},
{u"TD"_qs, tr("Chad")}, {u"TD"_s, tr("Chad")},
{u"TF"_qs, tr("French Southern Territories")}, {u"TF"_s, tr("French Southern Territories")},
{u"TG"_qs, tr("Togo")}, {u"TG"_s, tr("Togo")},
{u"TH"_qs, tr("Thailand")}, {u"TH"_s, tr("Thailand")},
{u"TJ"_qs, tr("Tajikistan")}, {u"TJ"_s, tr("Tajikistan")},
{u"TK"_qs, tr("Tokelau")}, {u"TK"_s, tr("Tokelau")},
{u"TL"_qs, tr("Timor-Leste")}, {u"TL"_s, tr("Timor-Leste")},
{u"TM"_qs, tr("Turkmenistan")}, {u"TM"_s, tr("Turkmenistan")},
{u"TN"_qs, tr("Tunisia")}, {u"TN"_s, tr("Tunisia")},
{u"TO"_qs, tr("Tonga")}, {u"TO"_s, tr("Tonga")},
{u"TR"_qs, tr("Turkey")}, {u"TR"_s, tr("Turkey")},
{u"TT"_qs, tr("Trinidad and Tobago")}, {u"TT"_s, tr("Trinidad and Tobago")},
{u"TV"_qs, tr("Tuvalu")}, {u"TV"_s, tr("Tuvalu")},
{u"TW"_qs, tr("Taiwan")}, {u"TW"_s, tr("Taiwan")},
{u"TZ"_qs, tr("Tanzania, United Republic of")}, {u"TZ"_s, tr("Tanzania, United Republic of")},
{u"UA"_qs, tr("Ukraine")}, {u"UA"_s, tr("Ukraine")},
{u"UG"_qs, tr("Uganda")}, {u"UG"_s, tr("Uganda")},
{u"UM"_qs, tr("United States Minor Outlying Islands")}, {u"UM"_s, tr("United States Minor Outlying Islands")},
{u"US"_qs, tr("United States")}, {u"US"_s, tr("United States")},
{u"UY"_qs, tr("Uruguay")}, {u"UY"_s, tr("Uruguay")},
{u"UZ"_qs, tr("Uzbekistan")}, {u"UZ"_s, tr("Uzbekistan")},
{u"VA"_qs, tr("Holy See (Vatican City State)")}, {u"VA"_s, tr("Holy See (Vatican City State)")},
{u"VC"_qs, tr("Saint Vincent and the Grenadines")}, {u"VC"_s, tr("Saint Vincent and the Grenadines")},
{u"VE"_qs, tr("Venezuela, Bolivarian Republic of")}, {u"VE"_s, tr("Venezuela, Bolivarian Republic of")},
{u"VG"_qs, tr("Virgin Islands, British")}, {u"VG"_s, tr("Virgin Islands, British")},
{u"VI"_qs, tr("Virgin Islands, U.S.")}, {u"VI"_s, tr("Virgin Islands, U.S.")},
{u"VN"_qs, tr("Vietnam")}, {u"VN"_s, tr("Vietnam")},
{u"VU"_qs, tr("Vanuatu")}, {u"VU"_s, tr("Vanuatu")},
{u"WF"_qs, tr("Wallis and Futuna")}, {u"WF"_s, tr("Wallis and Futuna")},
{u"WS"_qs, tr("Samoa")}, {u"WS"_s, tr("Samoa")},
{u"YE"_qs, tr("Yemen")}, {u"YE"_s, tr("Yemen")},
{u"YT"_qs, tr("Mayotte")}, {u"YT"_s, tr("Mayotte")},
{u"ZA"_qs, tr("South Africa")}, {u"ZA"_s, tr("South Africa")},
{u"ZM"_qs, tr("Zambia")}, {u"ZM"_s, tr("Zambia")},
{u"ZW"_qs, tr("Zimbabwe")}, {u"ZW"_s, tr("Zimbabwe")},
{{}, tr("N/A")} {{}, tr("N/A")}
}; };

View file

@ -52,18 +52,18 @@ ProxyConfigurationManager *ProxyConfigurationManager::m_instance = nullptr;
ProxyConfigurationManager::ProxyConfigurationManager(QObject *parent) ProxyConfigurationManager::ProxyConfigurationManager(QObject *parent)
: QObject(parent) : QObject(parent)
, m_storeProxyType {SETTINGS_KEY(u"Type"_qs)} , m_storeProxyType {SETTINGS_KEY(u"Type"_s)}
, m_storeProxyIP {SETTINGS_KEY(u"IP"_qs)} , m_storeProxyIP {SETTINGS_KEY(u"IP"_s)}
, m_storeProxyPort {SETTINGS_KEY(u"Port"_qs)} , m_storeProxyPort {SETTINGS_KEY(u"Port"_s)}
, m_storeProxyAuthEnabled {SETTINGS_KEY(u"AuthEnabled"_qs)} , m_storeProxyAuthEnabled {SETTINGS_KEY(u"AuthEnabled"_s)}
, m_storeProxyUsername {SETTINGS_KEY(u"Username"_qs)} , m_storeProxyUsername {SETTINGS_KEY(u"Username"_s)}
, m_storeProxyPassword {SETTINGS_KEY(u"Password"_qs)} , m_storeProxyPassword {SETTINGS_KEY(u"Password"_s)}
, m_storeProxyHostnameLookupEnabled {SETTINGS_KEY(u"HostnameLookupEnabled"_qs)} , m_storeProxyHostnameLookupEnabled {SETTINGS_KEY(u"HostnameLookupEnabled"_s)}
{ {
m_config.type = m_storeProxyType.get(ProxyType::HTTP); m_config.type = m_storeProxyType.get(ProxyType::HTTP);
if ((m_config.type < ProxyType::HTTP) || (m_config.type > ProxyType::SOCKS4)) if ((m_config.type < ProxyType::HTTP) || (m_config.type > ProxyType::SOCKS4))
m_config.type = ProxyType::HTTP; m_config.type = ProxyType::HTTP;
m_config.ip = m_storeProxyIP.get(u"0.0.0.0"_qs); m_config.ip = m_storeProxyIP.get(u"0.0.0.0"_s);
m_config.port = m_storeProxyPort.get(8080); m_config.port = m_storeProxyPort.get(8080);
m_config.authEnabled = m_storeProxyAuthEnabled; m_config.authEnabled = m_storeProxyAuthEnabled;
m_config.username = m_storeProxyUsername; m_config.username = m_storeProxyUsername;

View file

@ -48,7 +48,7 @@ namespace Net
struct ProxyConfiguration struct ProxyConfiguration
{ {
ProxyType type = ProxyType::HTTP; ProxyType type = ProxyType::HTTP;
QString ip = u"0.0.0.0"_qs; QString ip = u"0.0.0.0"_s;
ushort port = 8080; ushort port = 8080;
bool authEnabled = false; bool authEnabled = false;
QString username; QString username;

View file

@ -85,7 +85,7 @@ namespace
{ {
QString hostname = QHostInfo::localHostName(); QString hostname = QHostInfo::localHostName();
if (hostname.isEmpty()) if (hostname.isEmpty())
hostname = u"localhost"_qs; hostname = u"localhost"_s;
return hostname.toLocal8Bit(); return hostname.toLocal8Bit();
} }
@ -138,16 +138,16 @@ void Smtp::sendMail(const QString &from, const QString &to, const QString &subje
{ {
const Preferences *const pref = Preferences::instance(); const Preferences *const pref = Preferences::instance();
m_message = "Date: " + getCurrentDateTime().toLatin1() + "\r\n" m_message = "Date: " + getCurrentDateTime().toLatin1() + "\r\n"
+ encodeMimeHeader(u"From"_qs, u"qBittorrent <%1>"_qs.arg(from)) + encodeMimeHeader(u"From"_s, u"qBittorrent <%1>"_s.arg(from))
+ encodeMimeHeader(u"Subject"_qs, subject) + encodeMimeHeader(u"Subject"_s, subject)
+ encodeMimeHeader(u"To"_qs, to) + encodeMimeHeader(u"To"_s, to)
+ "MIME-Version: 1.0\r\n" + "MIME-Version: 1.0\r\n"
+ "Content-Type: text/plain; charset=UTF-8\r\n" + "Content-Type: text/plain; charset=UTF-8\r\n"
+ "Content-Transfer-Encoding: base64\r\n" + "Content-Transfer-Encoding: base64\r\n"
+ "\r\n"; + "\r\n";
// Encode the body in base64 // Encode the body in base64
QString crlfBody = body; QString crlfBody = body;
const QByteArray b = crlfBody.replace(u"\n"_qs, u"\r\n"_qs).toUtf8().toBase64(); const QByteArray b = crlfBody.replace(u"\n"_s, u"\r\n"_s).toUtf8().toBase64();
const int ct = b.length(); const int ct = b.length();
for (int i = 0; i < ct; i += 78) for (int i = 0; i < ct; i += 78)
m_message += b.mid(i, 78); m_message += b.mid(i, 78);
@ -424,7 +424,7 @@ void Smtp::parseEhloResponse(const QByteArray &code, const bool continued, const
if (m_state != EhloDone) return; if (m_state != EhloDone) return;
if (m_extensions.contains(u"STARTTLS"_qs) && m_useSsl) if (m_extensions.contains(u"STARTTLS"_s) && m_useSsl)
{ {
qDebug() << "STARTTLS"; qDebug() << "STARTTLS";
startTLS(); startTLS();
@ -438,7 +438,7 @@ void Smtp::parseEhloResponse(const QByteArray &code, const bool continued, const
void Smtp::authenticate() void Smtp::authenticate()
{ {
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
if (!m_extensions.contains(u"AUTH"_qs) || if (!m_extensions.contains(u"AUTH"_s) ||
m_username.isEmpty() || m_password.isEmpty()) m_username.isEmpty() || m_password.isEmpty())
{ {
// Skip authentication // Skip authentication
@ -453,7 +453,7 @@ void Smtp::authenticate()
// AUTH extension is supported, check which // AUTH extension is supported, check which
// authentication modes are supported by // authentication modes are supported by
// the server // the server
const QStringList auth = m_extensions[u"AUTH"_qs].toUpper().split(u' ', Qt::SkipEmptyParts); const QStringList auth = m_extensions[u"AUTH"_s].toUpper().split(u' ', Qt::SkipEmptyParts);
if (auth.contains(u"CRAM-MD5")) if (auth.contains(u"CRAM-MD5"))
{ {
qDebug() << "Using CRAM-MD5 authentication..."; qDebug() << "Using CRAM-MD5 authentication...";

View file

@ -63,7 +63,7 @@ namespace
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
bool hasDriveLetter(const QStringView path) bool hasDriveLetter(const QStringView path)
{ {
const QRegularExpression driveLetterRegex {u"^[A-Za-z]:/"_qs}; const QRegularExpression driveLetterRegex {u"^[A-Za-z]:/"_s};
return driveLetterRegex.match(path).hasMatch(); return driveLetterRegex.match(path).hasMatch();
} }
#endif #endif
@ -93,12 +93,12 @@ bool Path::isValid() const
view = view.mid(3); view = view.mid(3);
// \\37 is using base-8 number system // \\37 is using base-8 number system
const QRegularExpression regex {u"[\\0-\\37:?\"*<>|]"_qs}; const QRegularExpression regex {u"[\\0-\\37:?\"*<>|]"_s};
return !regex.match(view).hasMatch(); return !regex.match(view).hasMatch();
#elif defined(Q_OS_MACOS) #elif defined(Q_OS_MACOS)
const QRegularExpression regex {u"[\\0:]"_qs}; const QRegularExpression regex {u"[\\0:]"_s};
#else #else
const QRegularExpression regex {u"\\0"_qs}; const QRegularExpression regex {u"\\0"_s};
#endif #endif
return !m_pathStr.contains(regex); return !m_pathStr.contains(regex);
} }
@ -138,7 +138,7 @@ Path Path::rootItem() const
return *this; return *this;
if (slashIndex == 0) // *nix absolute path if (slashIndex == 0) // *nix absolute path
return createUnchecked(u"/"_qs); return createUnchecked(u"/"_s);
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
// should be `c:/` instead of `c:` // should be `c:/` instead of `c:`
@ -157,7 +157,7 @@ Path Path::parentPath() const
return {}; return {};
if (slashIndex == 0) // *nix absolute path if (slashIndex == 0) // *nix absolute path
return (m_pathStr.size() == 1) ? Path() : createUnchecked(u"/"_qs); return (m_pathStr.size() == 1) ? Path() : createUnchecked(u"/"_s);
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
// should be `c:/` instead of `c:` // should be `c:/` instead of `c:`

File diff suppressed because it is too large Load diff

View file

@ -92,7 +92,7 @@ Path Private::DefaultProfile::dataLocation() const
// On Linux keep using the legacy directory ~/.local/share/data/ if it exists // On Linux keep using the legacy directory ~/.local/share/data/ if it exists
const Path genericDataPath {QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)}; const Path genericDataPath {QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)};
const Path profilePath {profileName()}; const Path profilePath {profileName()};
const Path legacyDir = genericDataPath / Path(u"data"_qs) / profilePath; const Path legacyDir = genericDataPath / Path(u"data"_s) / profilePath;
const Path dataDir = genericDataPath / profilePath; const Path dataDir = genericDataPath / profilePath;
@ -131,10 +131,10 @@ Private::CustomProfile::CustomProfile(const Path &rootPath, const QString &confi
: Profile {configurationName} : Profile {configurationName}
, m_rootPath {rootPath} , m_rootPath {rootPath}
, m_basePath {m_rootPath / Path(profileName())} , m_basePath {m_rootPath / Path(profileName())}
, m_cacheLocation {m_basePath / Path(u"cache"_qs)} , m_cacheLocation {m_basePath / Path(u"cache"_s)}
, m_configLocation {m_basePath / Path(u"config"_qs)} , m_configLocation {m_basePath / Path(u"config"_s)}
, m_dataLocation {m_basePath / Path(u"data"_qs)} , m_dataLocation {m_basePath / Path(u"data"_s)}
, m_downloadLocation {m_basePath / Path(u"downloads"_qs)} , m_downloadLocation {m_basePath / Path(u"downloads"_s)}
{ {
} }
@ -172,9 +172,9 @@ std::unique_ptr<QSettings> Private::CustomProfile::applicationSettings(const QSt
{ {
// here we force QSettings::IniFormat format always because we need it to be portable across platforms // here we force QSettings::IniFormat format always because we need it to be portable across platforms
#if defined(Q_OS_WIN) || defined(Q_OS_MACOS) #if defined(Q_OS_WIN) || defined(Q_OS_MACOS)
const auto CONF_FILE_EXTENSION = u".ini"_qs; const auto CONF_FILE_EXTENSION = u".ini"_s;
#else #else
const auto CONF_FILE_EXTENSION = u".conf"_qs; const auto CONF_FILE_EXTENSION = u".conf"_s;
#endif #endif
const Path settingsFilePath = configLocation() / Path(name + CONF_FILE_EXTENSION); const Path settingsFilePath = configLocation() / Path(name + CONF_FILE_EXTENSION);
return std::make_unique<QSettings>(settingsFilePath.data(), QSettings::IniFormat); return std::make_unique<QSettings>(settingsFilePath.data(), QSettings::IniFormat);

View file

@ -37,14 +37,14 @@
using namespace RSS; using namespace RSS;
const QString Article::KeyId = u"id"_qs; const QString Article::KeyId = u"id"_s;
const QString Article::KeyDate = u"date"_qs; const QString Article::KeyDate = u"date"_s;
const QString Article::KeyTitle = u"title"_qs; const QString Article::KeyTitle = u"title"_s;
const QString Article::KeyAuthor = u"author"_qs; const QString Article::KeyAuthor = u"author"_s;
const QString Article::KeyDescription = u"description"_qs; const QString Article::KeyDescription = u"description"_s;
const QString Article::KeyTorrentURL = u"torrentURL"_qs; const QString Article::KeyTorrentURL = u"torrentURL"_s;
const QString Article::KeyLink = u"link"_qs; const QString Article::KeyLink = u"link"_s;
const QString Article::KeyIsRead = u"isRead"_qs; const QString Article::KeyIsRead = u"isRead"_s;
Article::Article(Feed *feed, const QVariantHash &varHash) Article::Article(Feed *feed, const QVariantHash &varHash)
: QObject(feed) : QObject(feed)

View file

@ -61,8 +61,8 @@ struct ProcessingJob
QVariantHash articleData; QVariantHash articleData;
}; };
const QString CONF_FOLDER_NAME = u"rss"_qs; const QString CONF_FOLDER_NAME = u"rss"_s;
const QString RULES_FILE_NAME = u"download_rules.json"_qs; const QString RULES_FILE_NAME = u"download_rules.json"_s;
namespace namespace
{ {
@ -97,13 +97,13 @@ QPointer<AutoDownloader> AutoDownloader::m_instance = nullptr;
QString computeSmartFilterRegex(const QStringList &filters) QString computeSmartFilterRegex(const QStringList &filters)
{ {
return u"(?:_|\\b)(?:%1)(?:_|\\b)"_qs.arg(filters.join(u")|(?:")); return u"(?:_|\\b)(?:%1)(?:_|\\b)"_s.arg(filters.join(u")|(?:"));
} }
AutoDownloader::AutoDownloader() AutoDownloader::AutoDownloader()
: m_storeProcessingEnabled(u"RSS/AutoDownloader/EnableProcessing"_qs, false) : m_storeProcessingEnabled(u"RSS/AutoDownloader/EnableProcessing"_s, false)
, m_storeSmartEpisodeFilter(u"RSS/AutoDownloader/SmartEpisodeFilter"_qs) , m_storeSmartEpisodeFilter(u"RSS/AutoDownloader/SmartEpisodeFilter"_s)
, m_storeDownloadRepacks(u"RSS/AutoDownloader/DownloadRepacks"_qs) , m_storeDownloadRepacks(u"RSS/AutoDownloader/DownloadRepacks"_s)
, m_processingTimer(new QTimer(this)) , m_processingTimer(new QTimer(this))
, m_ioThread(new QThread) , m_ioThread(new QThread)
{ {
@ -175,7 +175,7 @@ bool AutoDownloader::hasRule(const QString &ruleName) const
AutoDownloadRule AutoDownloader::ruleByName(const QString &ruleName) const AutoDownloadRule AutoDownloader::ruleByName(const QString &ruleName) const
{ {
const auto index = m_rulesByName.value(ruleName, -1); const auto index = m_rulesByName.value(ruleName, -1);
return m_rules.value(index, AutoDownloadRule(u"Unknown Rule"_qs)); return m_rules.value(index, AutoDownloadRule(u"Unknown Rule"_s));
} }
QList<AutoDownloadRule> AutoDownloader::rules() const QList<AutoDownloadRule> AutoDownloader::rules() const
@ -312,10 +312,10 @@ QStringList AutoDownloader::smartEpisodeFilters() const
{ {
const QStringList defaultFilters = const QStringList defaultFilters =
{ {
u"s(\\d+)e(\\d+)"_qs, // Format 1: s01e01 u"s(\\d+)e(\\d+)"_s, // Format 1: s01e01
u"(\\d+)x(\\d+)"_qs, // Format 2: 01x01 u"(\\d+)x(\\d+)"_s, // Format 2: 01x01
u"(\\d{4}[.\\-]\\d{1,2}[.\\-]\\d{1,2})"_qs, // Format 3: 2017.01.01 u"(\\d{4}[.\\-]\\d{1,2}[.\\-]\\d{1,2})"_s, // Format 3: 2017.01.01
u"(\\d{1,2}[.\\-]\\d{1,2}[.\\-]\\d{4})"_qs // Format 4: 01.01.2017 u"(\\d{1,2}[.\\-]\\d{1,2}[.\\-]\\d{4})"_s // Format 4: 01.01.2017
}; };
return defaultFilters; return defaultFilters;
} }
@ -529,8 +529,8 @@ void AutoDownloader::loadRules(const QByteArray &data)
void AutoDownloader::loadRulesLegacy() void AutoDownloader::loadRulesLegacy()
{ {
const std::unique_ptr<QSettings> settings = Profile::instance()->applicationSettings(u"qBittorrent-rss"_qs); const std::unique_ptr<QSettings> settings = Profile::instance()->applicationSettings(u"qBittorrent-rss"_s);
const QVariantHash rules = settings->value(u"download_rules"_qs).toHash(); const QVariantHash rules = settings->value(u"download_rules"_s).toHash();
for (const QVariant &ruleVar : rules) for (const QVariant &ruleVar : rules)
{ {
const auto rule = AutoDownloadRule::fromLegacyDict(ruleVar.toHash()); const auto rule = AutoDownloadRule::fromLegacyDict(ruleVar.toHash());

View file

@ -101,25 +101,25 @@ namespace
} }
} }
const QString S_NAME = u"name"_qs; const QString S_NAME = u"name"_s;
const QString S_ENABLED = u"enabled"_qs; const QString S_ENABLED = u"enabled"_s;
const QString S_PRIORITY = u"priority"_qs; const QString S_PRIORITY = u"priority"_s;
const QString S_USE_REGEX = u"useRegex"_qs; const QString S_USE_REGEX = u"useRegex"_s;
const QString S_MUST_CONTAIN = u"mustContain"_qs; const QString S_MUST_CONTAIN = u"mustContain"_s;
const QString S_MUST_NOT_CONTAIN = u"mustNotContain"_qs; const QString S_MUST_NOT_CONTAIN = u"mustNotContain"_s;
const QString S_EPISODE_FILTER = u"episodeFilter"_qs; const QString S_EPISODE_FILTER = u"episodeFilter"_s;
const QString S_AFFECTED_FEEDS = u"affectedFeeds"_qs; const QString S_AFFECTED_FEEDS = u"affectedFeeds"_s;
const QString S_LAST_MATCH = u"lastMatch"_qs; const QString S_LAST_MATCH = u"lastMatch"_s;
const QString S_IGNORE_DAYS = u"ignoreDays"_qs; const QString S_IGNORE_DAYS = u"ignoreDays"_s;
const QString S_SMART_FILTER = u"smartFilter"_qs; const QString S_SMART_FILTER = u"smartFilter"_s;
const QString S_PREVIOUSLY_MATCHED = u"previouslyMatchedEpisodes"_qs; const QString S_PREVIOUSLY_MATCHED = u"previouslyMatchedEpisodes"_s;
const QString S_SAVE_PATH = u"savePath"_qs; const QString S_SAVE_PATH = u"savePath"_s;
const QString S_ASSIGNED_CATEGORY = u"assignedCategory"_qs; const QString S_ASSIGNED_CATEGORY = u"assignedCategory"_s;
const QString S_ADD_PAUSED = u"addPaused"_qs; const QString S_ADD_PAUSED = u"addPaused"_s;
const QString S_CONTENT_LAYOUT = u"torrentContentLayout"_qs; const QString S_CONTENT_LAYOUT = u"torrentContentLayout"_s;
const QString S_TORRENT_PARAMS = u"torrentParams"_qs; const QString S_TORRENT_PARAMS = u"torrentParams"_s;
namespace RSS namespace RSS
{ {
@ -230,7 +230,7 @@ QRegularExpression AutoDownloadRule::cachedRegex(const QString &expression, cons
bool AutoDownloadRule::matchesExpression(const QString &articleTitle, const QString &expression) const bool AutoDownloadRule::matchesExpression(const QString &articleTitle, const QString &expression) const
{ {
const QRegularExpression whitespace {u"\\s+"_qs}; const QRegularExpression whitespace {u"\\s+"_s};
if (expression.isEmpty()) if (expression.isEmpty())
{ {
@ -293,7 +293,7 @@ bool AutoDownloadRule::matchesEpisodeFilterExpression(const QString &articleTitl
if (m_dataPtr->episodeFilter.isEmpty()) if (m_dataPtr->episodeFilter.isEmpty())
return true; return true;
const QRegularExpression filterRegex {cachedRegex(u"(^\\d{1,4})x(.*;$)"_qs)}; const QRegularExpression filterRegex {cachedRegex(u"(^\\d{1,4})x(.*;$)"_s)};
const QRegularExpressionMatch matcher {filterRegex.match(m_dataPtr->episodeFilter)}; const QRegularExpressionMatch matcher {filterRegex.match(m_dataPtr->episodeFilter)};
if (!matcher.hasMatch()) if (!matcher.hasMatch())
return false; return false;
@ -313,8 +313,8 @@ bool AutoDownloadRule::matchesEpisodeFilterExpression(const QString &articleTitl
if (episode.indexOf(u'-') != -1) if (episode.indexOf(u'-') != -1)
{ // Range detected { // Range detected
const QString partialPattern1 {u"\\bs0?(\\d{1,4})[ -_\\.]?e(0?\\d{1,4})(?:\\D|\\b)"_qs}; const QString partialPattern1 {u"\\bs0?(\\d{1,4})[ -_\\.]?e(0?\\d{1,4})(?:\\D|\\b)"_s};
const QString partialPattern2 {u"\\b(\\d{1,4})x(0?\\d{1,4})(?:\\D|\\b)"_qs}; const QString partialPattern2 {u"\\b(\\d{1,4})x(0?\\d{1,4})(?:\\D|\\b)"_s};
// Extract partial match from article and compare as digits // Extract partial match from article and compare as digits
QRegularExpressionMatch matcher = cachedRegex(partialPattern1).match(articleTitle); QRegularExpressionMatch matcher = cachedRegex(partialPattern1).match(articleTitle);
@ -353,7 +353,7 @@ bool AutoDownloadRule::matchesEpisodeFilterExpression(const QString &articleTitl
} }
else else
{ // Single number { // Single number
const QString expStr {u"\\b(?:s0?%1[ -_\\.]?e0?%2|%1x0?%2)(?:\\D|\\b)"_qs.arg(season, episode)}; const QString expStr {u"\\b(?:s0?%1[ -_\\.]?e0?%2|%1x0?%2)(?:\\D|\\b)"_s.arg(season, episode)};
if (cachedRegex(expStr).match(articleTitle).hasMatch()) if (cachedRegex(expStr).match(articleTitle).hasMatch())
return true; return true;
} }
@ -385,7 +385,7 @@ bool AutoDownloadRule::matchesSmartEpisodeFilter(const QString &articleTitle) co
if (!isRepack && !isProper) if (!isRepack && !isProper)
return false; return false;
const QString fullEpisodeStr = u"%1%2%3"_qs.arg(episodeStr, const QString fullEpisodeStr = u"%1%2%3"_s.arg(episodeStr,
isRepack ? u"-REPACK" : u"", isRepack ? u"-REPACK" : u"",
isProper ? u"-PROPER" : u""); isProper ? u"-PROPER" : u"");
const bool previouslyMatchedFull = m_dataPtr->previouslyMatchedEpisodes.contains(fullEpisodeStr); const bool previouslyMatchedFull = m_dataPtr->previouslyMatchedEpisodes.contains(fullEpisodeStr);
@ -565,39 +565,39 @@ QVariantHash AutoDownloadRule::toLegacyDict() const
{ {
const BitTorrent::AddTorrentParams &addTorrentParams = m_dataPtr->addTorrentParams; const BitTorrent::AddTorrentParams &addTorrentParams = m_dataPtr->addTorrentParams;
return {{u"name"_qs, name()}, return {{u"name"_s, name()},
{u"must_contain"_qs, mustContain()}, {u"must_contain"_s, mustContain()},
{u"must_not_contain"_qs, mustNotContain()}, {u"must_not_contain"_s, mustNotContain()},
{u"save_path"_qs, addTorrentParams.savePath.toString()}, {u"save_path"_s, addTorrentParams.savePath.toString()},
{u"affected_feeds"_qs, feedURLs()}, {u"affected_feeds"_s, feedURLs()},
{u"enabled"_qs, isEnabled()}, {u"enabled"_s, isEnabled()},
{u"category_assigned"_qs, addTorrentParams.category}, {u"category_assigned"_s, addTorrentParams.category},
{u"use_regex"_qs, useRegex()}, {u"use_regex"_s, useRegex()},
{u"add_paused"_qs, toAddPausedLegacy(addTorrentParams.addPaused)}, {u"add_paused"_s, toAddPausedLegacy(addTorrentParams.addPaused)},
{u"episode_filter"_qs, episodeFilter()}, {u"episode_filter"_s, episodeFilter()},
{u"last_match"_qs, lastMatch()}, {u"last_match"_s, lastMatch()},
{u"ignore_days"_qs, ignoreDays()}}; {u"ignore_days"_s, ignoreDays()}};
} }
AutoDownloadRule AutoDownloadRule::fromLegacyDict(const QVariantHash &dict) AutoDownloadRule AutoDownloadRule::fromLegacyDict(const QVariantHash &dict)
{ {
BitTorrent::AddTorrentParams addTorrentParams; BitTorrent::AddTorrentParams addTorrentParams;
addTorrentParams.savePath = Path(dict.value(u"save_path"_qs).toString()); addTorrentParams.savePath = Path(dict.value(u"save_path"_s).toString());
addTorrentParams.category = dict.value(u"category_assigned"_qs).toString(); addTorrentParams.category = dict.value(u"category_assigned"_s).toString();
addTorrentParams.addPaused = addPausedLegacyToOptionalBool(dict.value(u"add_paused"_qs).toInt()); addTorrentParams.addPaused = addPausedLegacyToOptionalBool(dict.value(u"add_paused"_s).toInt());
if (!addTorrentParams.savePath.isEmpty()) if (!addTorrentParams.savePath.isEmpty())
addTorrentParams.useAutoTMM = false; addTorrentParams.useAutoTMM = false;
AutoDownloadRule rule {dict.value(u"name"_qs).toString()}; AutoDownloadRule rule {dict.value(u"name"_s).toString()};
rule.setUseRegex(dict.value(u"use_regex"_qs, false).toBool()); rule.setUseRegex(dict.value(u"use_regex"_s, false).toBool());
rule.setMustContain(dict.value(u"must_contain"_qs).toString()); rule.setMustContain(dict.value(u"must_contain"_s).toString());
rule.setMustNotContain(dict.value(u"must_not_contain"_qs).toString()); rule.setMustNotContain(dict.value(u"must_not_contain"_s).toString());
rule.setEpisodeFilter(dict.value(u"episode_filter"_qs).toString()); rule.setEpisodeFilter(dict.value(u"episode_filter"_s).toString());
rule.setFeedURLs(dict.value(u"affected_feeds"_qs).toStringList()); rule.setFeedURLs(dict.value(u"affected_feeds"_s).toStringList());
rule.setEnabled(dict.value(u"enabled"_qs, false).toBool()); rule.setEnabled(dict.value(u"enabled"_s, false).toBool());
rule.setLastMatch(dict.value(u"last_match"_qs).toDateTime()); rule.setLastMatch(dict.value(u"last_match"_s).toDateTime());
rule.setIgnoreDays(dict.value(u"ignore_days"_qs).toInt()); rule.setIgnoreDays(dict.value(u"ignore_days"_s).toInt());
rule.setAddTorrentParams(addTorrentParams); rule.setAddTorrentParams(addTorrentParams);
return rule; return rule;

View file

@ -53,13 +53,13 @@
#include "rss_parser.h" #include "rss_parser.h"
#include "rss_session.h" #include "rss_session.h"
const QString KEY_UID = u"uid"_qs; const QString KEY_UID = u"uid"_s;
const QString KEY_URL = u"url"_qs; const QString KEY_URL = u"url"_s;
const QString KEY_TITLE = u"title"_qs; const QString KEY_TITLE = u"title"_s;
const QString KEY_LASTBUILDDATE = u"lastBuildDate"_qs; const QString KEY_LASTBUILDDATE = u"lastBuildDate"_s;
const QString KEY_ISLOADING = u"isLoading"_qs; const QString KEY_ISLOADING = u"isLoading"_s;
const QString KEY_HASERROR = u"hasError"_qs; const QString KEY_HASERROR = u"hasError"_s;
const QString KEY_ARTICLES = u"articles"_qs; const QString KEY_ARTICLES = u"articles"_s;
using namespace RSS; using namespace RSS;
@ -73,7 +73,7 @@ Feed::Feed(const QUuid &uid, const QString &url, const QString &path, Session *s
m_dataFileName = Path(uidHex + u".json"); m_dataFileName = Path(uidHex + u".json");
// Move to new file naming scheme (since v4.1.2) // Move to new file naming scheme (since v4.1.2)
const QString legacyFilename = Utils::Fs::toValidFileName(m_url, u"_"_qs) + u".json"; const QString legacyFilename = Utils::Fs::toValidFileName(m_url, u"_"_s) + u".json";
const Path storageDir = m_session->dataFileStorage()->storageDir(); const Path storageDir = m_session->dataFileStorage()->storageDir();
const Path dataFilePath = storageDir / m_dataFileName; const Path dataFilePath = storageDir / m_dataFileName;
if (!dataFilePath.exists()) if (!dataFilePath.exists())
@ -376,7 +376,7 @@ void Feed::downloadIcon()
// Download the RSS Feed icon // Download the RSS Feed icon
// XXX: This works for most sites but it is not perfect // XXX: This works for most sites but it is not perfect
const QUrl url(m_url); const QUrl url(m_url);
const auto iconUrl = u"%1://%2/favicon.ico"_qs.arg(url.scheme(), url.host()); const auto iconUrl = u"%1://%2/favicon.ico"_s.arg(url.scheme(), url.host());
Net::DownloadManager::instance()->download( Net::DownloadManager::instance()->download(
Net::DownloadRequest(iconUrl).saveToFile(true).destFileName(m_iconPath) Net::DownloadRequest(iconUrl).saveToFile(true).destFileName(m_iconPath)
, Preferences::instance()->useProxyForRSS(), this, &Feed::handleIconDownloadFinished); , Preferences::instance()->useProxyForRSS(), this, &Feed::handleIconDownloadFinished);

View file

@ -67,7 +67,7 @@ QString Item::name() const
bool Item::isValidPath(const QString &path) bool Item::isValidPath(const QString &path)
{ {
const QRegularExpression re( const QRegularExpression re(
uR"(\A[^\%1]+(\%1[^\%1]+)*\z)"_qs.arg(Item::PathSeparator) uR"(\A[^\%1]+(\%1[^\%1]+)*\z)"_s.arg(Item::PathSeparator)
, QRegularExpression::DontCaptureOption); , QRegularExpression::DontCaptureOption);
if (path.isEmpty() || !re.match(path).hasMatch()) if (path.isEmpty() || !re.match(path).hasMatch())

View file

@ -56,303 +56,303 @@ namespace
// http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent // http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent
static const QHash<QString, QString> HTMLEntities static const QHash<QString, QString> HTMLEntities
{ {
{u"nbsp"_qs, u"&#160;"_qs}, // no-break space = non-breaking space, U+00A0 ISOnum {u"nbsp"_s, u"&#160;"_s}, // no-break space = non-breaking space, U+00A0 ISOnum
{u"iexcl"_qs, u"&#161;"_qs}, // inverted exclamation mark, U+00A1 ISOnum {u"iexcl"_s, u"&#161;"_s}, // inverted exclamation mark, U+00A1 ISOnum
{u"cent"_qs, u"&#162;"_qs}, // cent sign, U+00A2 ISOnum {u"cent"_s, u"&#162;"_s}, // cent sign, U+00A2 ISOnum
{u"pound"_qs, u"&#163;"_qs}, // pound sign, U+00A3 ISOnum {u"pound"_s, u"&#163;"_s}, // pound sign, U+00A3 ISOnum
{u"curren"_qs, u"&#164;"_qs}, // currency sign, U+00A4 ISOnum {u"curren"_s, u"&#164;"_s}, // currency sign, U+00A4 ISOnum
{u"yen"_qs, u"&#165;"_qs}, // yen sign = yuan sign, U+00A5 ISOnum {u"yen"_s, u"&#165;"_s}, // yen sign = yuan sign, U+00A5 ISOnum
{u"brvbar"_qs, u"&#166;"_qs}, // broken bar = broken vertical bar, U+00A6 ISOnum {u"brvbar"_s, u"&#166;"_s}, // broken bar = broken vertical bar, U+00A6 ISOnum
{u"sect"_qs, u"&#167;"_qs}, // section sign, U+00A7 ISOnum {u"sect"_s, u"&#167;"_s}, // section sign, U+00A7 ISOnum
{u"uml"_qs, u"&#168;"_qs}, // diaeresis = spacing diaeresis, U+00A8 ISOdia {u"uml"_s, u"&#168;"_s}, // diaeresis = spacing diaeresis, U+00A8 ISOdia
{u"copy"_qs, u"&#169;"_qs}, // copyright sign, U+00A9 ISOnum {u"copy"_s, u"&#169;"_s}, // copyright sign, U+00A9 ISOnum
{u"ordf"_qs, u"&#170;"_qs}, // feminine ordinal indicator, U+00AA ISOnum {u"ordf"_s, u"&#170;"_s}, // feminine ordinal indicator, U+00AA ISOnum
{u"laquo"_qs, u"&#171;"_qs}, // left-pointing double angle quotation mark = left pointing guillemet, U+00AB ISOnum {u"laquo"_s, u"&#171;"_s}, // left-pointing double angle quotation mark = left pointing guillemet, U+00AB ISOnum
{u"not"_qs, u"&#172;"_qs}, // not sign = angled dash, U+00AC ISOnum {u"not"_s, u"&#172;"_s}, // not sign = angled dash, U+00AC ISOnum
{u"shy"_qs, u"&#173;"_qs}, // soft hyphen = discretionary hyphen, U+00AD ISOnum {u"shy"_s, u"&#173;"_s}, // soft hyphen = discretionary hyphen, U+00AD ISOnum
{u"reg"_qs, u"&#174;"_qs}, // registered sign = registered trade mark sign, U+00AE ISOnum {u"reg"_s, u"&#174;"_s}, // registered sign = registered trade mark sign, U+00AE ISOnum
{u"macr"_qs, u"&#175;"_qs}, // macron = spacing macron = overline = APL overbar, U+00AF ISOdia {u"macr"_s, u"&#175;"_s}, // macron = spacing macron = overline = APL overbar, U+00AF ISOdia
{u"deg"_qs, u"&#176;"_qs}, // degree sign, U+00B0 ISOnum {u"deg"_s, u"&#176;"_s}, // degree sign, U+00B0 ISOnum
{u"plusmn"_qs, u"&#177;"_qs}, // plus-minus sign = plus-or-minus sign, U+00B1 ISOnum {u"plusmn"_s, u"&#177;"_s}, // plus-minus sign = plus-or-minus sign, U+00B1 ISOnum
{u"sup2"_qs, u"&#178;"_qs}, // superscript two = superscript digit two = squared, U+00B2 ISOnum {u"sup2"_s, u"&#178;"_s}, // superscript two = superscript digit two = squared, U+00B2 ISOnum
{u"sup3"_qs, u"&#179;"_qs}, // superscript three = superscript digit three = cubed, U+00B3 ISOnum {u"sup3"_s, u"&#179;"_s}, // superscript three = superscript digit three = cubed, U+00B3 ISOnum
{u"acute"_qs, u"&#180;"_qs}, // acute accent = spacing acute, U+00B4 ISOdia {u"acute"_s, u"&#180;"_s}, // acute accent = spacing acute, U+00B4 ISOdia
{u"micro"_qs, u"&#181;"_qs}, // micro sign, U+00B5 ISOnum {u"micro"_s, u"&#181;"_s}, // micro sign, U+00B5 ISOnum
{u"para"_qs, u"&#182;"_qs}, // pilcrow sign = paragraph sign, U+00B6 ISOnum {u"para"_s, u"&#182;"_s}, // pilcrow sign = paragraph sign, U+00B6 ISOnum
{u"middot"_qs, u"&#183;"_qs}, // middle dot = Georgian comma = Greek middle dot, U+00B7 ISOnum {u"middot"_s, u"&#183;"_s}, // middle dot = Georgian comma = Greek middle dot, U+00B7 ISOnum
{u"cedil"_qs, u"&#184;"_qs}, // cedilla = spacing cedilla, U+00B8 ISOdia {u"cedil"_s, u"&#184;"_s}, // cedilla = spacing cedilla, U+00B8 ISOdia
{u"sup1"_qs, u"&#185;"_qs}, // superscript one = superscript digit one, U+00B9 ISOnum {u"sup1"_s, u"&#185;"_s}, // superscript one = superscript digit one, U+00B9 ISOnum
{u"ordm"_qs, u"&#186;"_qs}, // masculine ordinal indicator, U+00BA ISOnum {u"ordm"_s, u"&#186;"_s}, // masculine ordinal indicator, U+00BA ISOnum
{u"raquo"_qs, u"&#187;"_qs}, // right-pointing double angle quotation mark = right pointing guillemet, U+00BB ISOnum {u"raquo"_s, u"&#187;"_s}, // right-pointing double angle quotation mark = right pointing guillemet, U+00BB ISOnum
{u"frac14"_qs, u"&#188;"_qs}, // vulgar fraction one quarter = fraction one quarter, U+00BC ISOnum {u"frac14"_s, u"&#188;"_s}, // vulgar fraction one quarter = fraction one quarter, U+00BC ISOnum
{u"frac12"_qs, u"&#189;"_qs}, // vulgar fraction one half = fraction one half, U+00BD ISOnum {u"frac12"_s, u"&#189;"_s}, // vulgar fraction one half = fraction one half, U+00BD ISOnum
{u"frac34"_qs, u"&#190;"_qs}, // vulgar fraction three quarters = fraction three quarters, U+00BE ISOnum {u"frac34"_s, u"&#190;"_s}, // vulgar fraction three quarters = fraction three quarters, U+00BE ISOnum
{u"iquest"_qs, u"&#191;"_qs}, // inverted question mark = turned question mark, U+00BF ISOnum {u"iquest"_s, u"&#191;"_s}, // inverted question mark = turned question mark, U+00BF ISOnum
{u"Agrave"_qs, u"&#192;"_qs}, // latin capital letter A with grave = latin capital letter A grave, U+00C0 ISOlat1 {u"Agrave"_s, u"&#192;"_s}, // latin capital letter A with grave = latin capital letter A grave, U+00C0 ISOlat1
{u"Aacute"_qs, u"&#193;"_qs}, // latin capital letter A with acute, U+00C1 ISOlat1 {u"Aacute"_s, u"&#193;"_s}, // latin capital letter A with acute, U+00C1 ISOlat1
{u"Acirc"_qs, u"&#194;"_qs}, // latin capital letter A with circumflex, U+00C2 ISOlat1 {u"Acirc"_s, u"&#194;"_s}, // latin capital letter A with circumflex, U+00C2 ISOlat1
{u"Atilde"_qs, u"&#195;"_qs}, // latin capital letter A with tilde, U+00C3 ISOlat1 {u"Atilde"_s, u"&#195;"_s}, // latin capital letter A with tilde, U+00C3 ISOlat1
{u"Auml"_qs, u"&#196;"_qs}, // latin capital letter A with diaeresis, U+00C4 ISOlat1 {u"Auml"_s, u"&#196;"_s}, // latin capital letter A with diaeresis, U+00C4 ISOlat1
{u"Aring"_qs, u"&#197;"_qs}, // latin capital letter A with ring above = latin capital letter A ring, U+00C5 ISOlat1 {u"Aring"_s, u"&#197;"_s}, // latin capital letter A with ring above = latin capital letter A ring, U+00C5 ISOlat1
{u"AElig"_qs, u"&#198;"_qs}, // latin capital letter AE = latin capital ligature AE, U+00C6 ISOlat1 {u"AElig"_s, u"&#198;"_s}, // latin capital letter AE = latin capital ligature AE, U+00C6 ISOlat1
{u"Ccedil"_qs, u"&#199;"_qs}, // latin capital letter C with cedilla, U+00C7 ISOlat1 {u"Ccedil"_s, u"&#199;"_s}, // latin capital letter C with cedilla, U+00C7 ISOlat1
{u"Egrave"_qs, u"&#200;"_qs}, // latin capital letter E with grave, U+00C8 ISOlat1 {u"Egrave"_s, u"&#200;"_s}, // latin capital letter E with grave, U+00C8 ISOlat1
{u"Eacute"_qs, u"&#201;"_qs}, // latin capital letter E with acute, U+00C9 ISOlat1 {u"Eacute"_s, u"&#201;"_s}, // latin capital letter E with acute, U+00C9 ISOlat1
{u"Ecirc"_qs, u"&#202;"_qs}, // latin capital letter E with circumflex, U+00CA ISOlat1 {u"Ecirc"_s, u"&#202;"_s}, // latin capital letter E with circumflex, U+00CA ISOlat1
{u"Euml"_qs, u"&#203;"_qs}, // latin capital letter E with diaeresis, U+00CB ISOlat1 {u"Euml"_s, u"&#203;"_s}, // latin capital letter E with diaeresis, U+00CB ISOlat1
{u"Igrave"_qs, u"&#204;"_qs}, // latin capital letter I with grave, U+00CC ISOlat1 {u"Igrave"_s, u"&#204;"_s}, // latin capital letter I with grave, U+00CC ISOlat1
{u"Iacute"_qs, u"&#205;"_qs}, // latin capital letter I with acute, U+00CD ISOlat1 {u"Iacute"_s, u"&#205;"_s}, // latin capital letter I with acute, U+00CD ISOlat1
{u"Icirc"_qs, u"&#206;"_qs}, // latin capital letter I with circumflex, U+00CE ISOlat1 {u"Icirc"_s, u"&#206;"_s}, // latin capital letter I with circumflex, U+00CE ISOlat1
{u"Iuml"_qs, u"&#207;"_qs}, // latin capital letter I with diaeresis, U+00CF ISOlat1 {u"Iuml"_s, u"&#207;"_s}, // latin capital letter I with diaeresis, U+00CF ISOlat1
{u"ETH"_qs, u"&#208;"_qs}, // latin capital letter ETH, U+00D0 ISOlat1 {u"ETH"_s, u"&#208;"_s}, // latin capital letter ETH, U+00D0 ISOlat1
{u"Ntilde"_qs, u"&#209;"_qs}, // latin capital letter N with tilde, U+00D1 ISOlat1 {u"Ntilde"_s, u"&#209;"_s}, // latin capital letter N with tilde, U+00D1 ISOlat1
{u"Ograve"_qs, u"&#210;"_qs}, // latin capital letter O with grave, U+00D2 ISOlat1 {u"Ograve"_s, u"&#210;"_s}, // latin capital letter O with grave, U+00D2 ISOlat1
{u"Oacute"_qs, u"&#211;"_qs}, // latin capital letter O with acute, U+00D3 ISOlat1 {u"Oacute"_s, u"&#211;"_s}, // latin capital letter O with acute, U+00D3 ISOlat1
{u"Ocirc"_qs, u"&#212;"_qs}, // latin capital letter O with circumflex, U+00D4 ISOlat1 {u"Ocirc"_s, u"&#212;"_s}, // latin capital letter O with circumflex, U+00D4 ISOlat1
{u"Otilde"_qs, u"&#213;"_qs}, // latin capital letter O with tilde, U+00D5 ISOlat1 {u"Otilde"_s, u"&#213;"_s}, // latin capital letter O with tilde, U+00D5 ISOlat1
{u"Ouml"_qs, u"&#214;"_qs}, // latin capital letter O with diaeresis, U+00D6 ISOlat1 {u"Ouml"_s, u"&#214;"_s}, // latin capital letter O with diaeresis, U+00D6 ISOlat1
{u"times"_qs, u"&#215;"_qs}, // multiplication sign, U+00D7 ISOnum {u"times"_s, u"&#215;"_s}, // multiplication sign, U+00D7 ISOnum
{u"Oslash"_qs, u"&#216;"_qs}, // latin capital letter O with stroke = latin capital letter O slash, U+00D8 ISOlat1 {u"Oslash"_s, u"&#216;"_s}, // latin capital letter O with stroke = latin capital letter O slash, U+00D8 ISOlat1
{u"Ugrave"_qs, u"&#217;"_qs}, // latin capital letter U with grave, U+00D9 ISOlat1 {u"Ugrave"_s, u"&#217;"_s}, // latin capital letter U with grave, U+00D9 ISOlat1
{u"Uacute"_qs, u"&#218;"_qs}, // latin capital letter U with acute, U+00DA ISOlat1 {u"Uacute"_s, u"&#218;"_s}, // latin capital letter U with acute, U+00DA ISOlat1
{u"Ucirc"_qs, u"&#219;"_qs}, // latin capital letter U with circumflex, U+00DB ISOlat1 {u"Ucirc"_s, u"&#219;"_s}, // latin capital letter U with circumflex, U+00DB ISOlat1
{u"Uuml"_qs, u"&#220;"_qs}, // latin capital letter U with diaeresis, U+00DC ISOlat1 {u"Uuml"_s, u"&#220;"_s}, // latin capital letter U with diaeresis, U+00DC ISOlat1
{u"Yacute"_qs, u"&#221;"_qs}, // latin capital letter Y with acute, U+00DD ISOlat1 {u"Yacute"_s, u"&#221;"_s}, // latin capital letter Y with acute, U+00DD ISOlat1
{u"THORN"_qs, u"&#222;"_qs}, // latin capital letter THORN, U+00DE ISOlat1 {u"THORN"_s, u"&#222;"_s}, // latin capital letter THORN, U+00DE ISOlat1
{u"szlig"_qs, u"&#223;"_qs}, // latin small letter sharp s = ess-zed, U+00DF ISOlat1 {u"szlig"_s, u"&#223;"_s}, // latin small letter sharp s = ess-zed, U+00DF ISOlat1
{u"agrave"_qs, u"&#224;"_qs}, // latin small letter a with grave = latin small letter a grave, U+00E0 ISOlat1 {u"agrave"_s, u"&#224;"_s}, // latin small letter a with grave = latin small letter a grave, U+00E0 ISOlat1
{u"aacute"_qs, u"&#225;"_qs}, // latin small letter a with acute, U+00E1 ISOlat1 {u"aacute"_s, u"&#225;"_s}, // latin small letter a with acute, U+00E1 ISOlat1
{u"acirc"_qs, u"&#226;"_qs}, // latin small letter a with circumflex, U+00E2 ISOlat1 {u"acirc"_s, u"&#226;"_s}, // latin small letter a with circumflex, U+00E2 ISOlat1
{u"atilde"_qs, u"&#227;"_qs}, // latin small letter a with tilde, U+00E3 ISOlat1 {u"atilde"_s, u"&#227;"_s}, // latin small letter a with tilde, U+00E3 ISOlat1
{u"auml"_qs, u"&#228;"_qs}, // latin small letter a with diaeresis, U+00E4 ISOlat1 {u"auml"_s, u"&#228;"_s}, // latin small letter a with diaeresis, U+00E4 ISOlat1
{u"aring"_qs, u"&#229;"_qs}, // latin small letter a with ring above = latin small letter a ring, U+00E5 ISOlat1 {u"aring"_s, u"&#229;"_s}, // latin small letter a with ring above = latin small letter a ring, U+00E5 ISOlat1
{u"aelig"_qs, u"&#230;"_qs}, // latin small letter ae = latin small ligature ae, U+00E6 ISOlat1 {u"aelig"_s, u"&#230;"_s}, // latin small letter ae = latin small ligature ae, U+00E6 ISOlat1
{u"ccedil"_qs, u"&#231;"_qs}, // latin small letter c with cedilla, U+00E7 ISOlat1 {u"ccedil"_s, u"&#231;"_s}, // latin small letter c with cedilla, U+00E7 ISOlat1
{u"egrave"_qs, u"&#232;"_qs}, // latin small letter e with grave, U+00E8 ISOlat1 {u"egrave"_s, u"&#232;"_s}, // latin small letter e with grave, U+00E8 ISOlat1
{u"eacute"_qs, u"&#233;"_qs}, // latin small letter e with acute, U+00E9 ISOlat1 {u"eacute"_s, u"&#233;"_s}, // latin small letter e with acute, U+00E9 ISOlat1
{u"ecirc"_qs, u"&#234;"_qs}, // latin small letter e with circumflex, U+00EA ISOlat1 {u"ecirc"_s, u"&#234;"_s}, // latin small letter e with circumflex, U+00EA ISOlat1
{u"euml"_qs, u"&#235;"_qs}, // latin small letter e with diaeresis, U+00EB ISOlat1 {u"euml"_s, u"&#235;"_s}, // latin small letter e with diaeresis, U+00EB ISOlat1
{u"igrave"_qs, u"&#236;"_qs}, // latin small letter i with grave, U+00EC ISOlat1 {u"igrave"_s, u"&#236;"_s}, // latin small letter i with grave, U+00EC ISOlat1
{u"iacute"_qs, u"&#237;"_qs}, // latin small letter i with acute, U+00ED ISOlat1 {u"iacute"_s, u"&#237;"_s}, // latin small letter i with acute, U+00ED ISOlat1
{u"icirc"_qs, u"&#238;"_qs}, // latin small letter i with circumflex, U+00EE ISOlat1 {u"icirc"_s, u"&#238;"_s}, // latin small letter i with circumflex, U+00EE ISOlat1
{u"iuml"_qs, u"&#239;"_qs}, // latin small letter i with diaeresis, U+00EF ISOlat1 {u"iuml"_s, u"&#239;"_s}, // latin small letter i with diaeresis, U+00EF ISOlat1
{u"eth"_qs, u"&#240;"_qs}, // latin small letter eth, U+00F0 ISOlat1 {u"eth"_s, u"&#240;"_s}, // latin small letter eth, U+00F0 ISOlat1
{u"ntilde"_qs, u"&#241;"_qs}, // latin small letter n with tilde, U+00F1 ISOlat1 {u"ntilde"_s, u"&#241;"_s}, // latin small letter n with tilde, U+00F1 ISOlat1
{u"ograve"_qs, u"&#242;"_qs}, // latin small letter o with grave, U+00F2 ISOlat1 {u"ograve"_s, u"&#242;"_s}, // latin small letter o with grave, U+00F2 ISOlat1
{u"oacute"_qs, u"&#243;"_qs}, // latin small letter o with acute, U+00F3 ISOlat1 {u"oacute"_s, u"&#243;"_s}, // latin small letter o with acute, U+00F3 ISOlat1
{u"ocirc"_qs, u"&#244;"_qs}, // latin small letter o with circumflex, U+00F4 ISOlat1 {u"ocirc"_s, u"&#244;"_s}, // latin small letter o with circumflex, U+00F4 ISOlat1
{u"otilde"_qs, u"&#245;"_qs}, // latin small letter o with tilde, U+00F5 ISOlat1 {u"otilde"_s, u"&#245;"_s}, // latin small letter o with tilde, U+00F5 ISOlat1
{u"ouml"_qs, u"&#246;"_qs}, // latin small letter o with diaeresis, U+00F6 ISOlat1 {u"ouml"_s, u"&#246;"_s}, // latin small letter o with diaeresis, U+00F6 ISOlat1
{u"divide"_qs, u"&#247;"_qs}, // division sign, U+00F7 ISOnum {u"divide"_s, u"&#247;"_s}, // division sign, U+00F7 ISOnum
{u"oslash"_qs, u"&#248;"_qs}, // latin small letter o with stroke, = latin small letter o slash, U+00F8 ISOlat1 {u"oslash"_s, u"&#248;"_s}, // latin small letter o with stroke, = latin small letter o slash, U+00F8 ISOlat1
{u"ugrave"_qs, u"&#249;"_qs}, // latin small letter u with grave, U+00F9 ISOlat1 {u"ugrave"_s, u"&#249;"_s}, // latin small letter u with grave, U+00F9 ISOlat1
{u"uacute"_qs, u"&#250;"_qs}, // latin small letter u with acute, U+00FA ISOlat1 {u"uacute"_s, u"&#250;"_s}, // latin small letter u with acute, U+00FA ISOlat1
{u"ucirc"_qs, u"&#251;"_qs}, // latin small letter u with circumflex, U+00FB ISOlat1 {u"ucirc"_s, u"&#251;"_s}, // latin small letter u with circumflex, U+00FB ISOlat1
{u"uuml"_qs, u"&#252;"_qs}, // latin small letter u with diaeresis, U+00FC ISOlat1 {u"uuml"_s, u"&#252;"_s}, // latin small letter u with diaeresis, U+00FC ISOlat1
{u"yacute"_qs, u"&#253;"_qs}, // latin small letter y with acute, U+00FD ISOlat1 {u"yacute"_s, u"&#253;"_s}, // latin small letter y with acute, U+00FD ISOlat1
{u"thorn"_qs, u"&#254;"_qs}, // latin small letter thorn, U+00FE ISOlat1 {u"thorn"_s, u"&#254;"_s}, // latin small letter thorn, U+00FE ISOlat1
{u"yuml"_qs, u"&#255;"_qs}, // latin small letter y with diaeresis, U+00FF ISOlat1 {u"yuml"_s, u"&#255;"_s}, // latin small letter y with diaeresis, U+00FF ISOlat1
// Latin Extended-A // Latin Extended-A
{u"OElig"_qs, u"&#338;"_qs}, // latin capital ligature OE, U+0152 ISOlat2 {u"OElig"_s, u"&#338;"_s}, // latin capital ligature OE, U+0152 ISOlat2
{u"oelig"_qs, u"&#339;"_qs}, // latin small ligature oe, U+0153 ISOlat2 {u"oelig"_s, u"&#339;"_s}, // latin small ligature oe, U+0153 ISOlat2
// ligature is a misnomer, this is a separate character in some languages // ligature is a misnomer, this is a separate character in some languages
{u"Scaron"_qs, u"&#352;"_qs}, // latin capital letter S with caron, U+0160 ISOlat2 {u"Scaron"_s, u"&#352;"_s}, // latin capital letter S with caron, U+0160 ISOlat2
{u"scaron"_qs, u"&#353;"_qs}, // latin small letter s with caron, U+0161 ISOlat2 {u"scaron"_s, u"&#353;"_s}, // latin small letter s with caron, U+0161 ISOlat2
{u"Yuml"_qs, u"&#376;"_qs}, // latin capital letter Y with diaeresis, U+0178 ISOlat2 {u"Yuml"_s, u"&#376;"_s}, // latin capital letter Y with diaeresis, U+0178 ISOlat2
// Spacing Modifier Letters // Spacing Modifier Letters
{u"circ"_qs, u"&#710;"_qs}, // modifier letter circumflex accent, U+02C6 ISOpub {u"circ"_s, u"&#710;"_s}, // modifier letter circumflex accent, U+02C6 ISOpub
{u"tilde"_qs, u"&#732;"_qs}, // small tilde, U+02DC ISOdia {u"tilde"_s, u"&#732;"_s}, // small tilde, U+02DC ISOdia
// General Punctuation // General Punctuation
{u"ensp"_qs, u"&#8194;"_qs}, // en space, U+2002 ISOpub {u"ensp"_s, u"&#8194;"_s}, // en space, U+2002 ISOpub
{u"emsp"_qs, u"&#8195;"_qs}, // em space, U+2003 ISOpub {u"emsp"_s, u"&#8195;"_s}, // em space, U+2003 ISOpub
{u"thinsp"_qs, u"&#8201;"_qs}, // thin space, U+2009 ISOpub {u"thinsp"_s, u"&#8201;"_s}, // thin space, U+2009 ISOpub
{u"zwnj"_qs, u"&#8204;"_qs}, // zero width non-joiner, U+200C NEW RFC 2070 {u"zwnj"_s, u"&#8204;"_s}, // zero width non-joiner, U+200C NEW RFC 2070
{u"zwj"_qs, u"&#8205;"_qs}, // zero width joiner, U+200D NEW RFC 2070 {u"zwj"_s, u"&#8205;"_s}, // zero width joiner, U+200D NEW RFC 2070
{u"lrm"_qs, u"&#8206;"_qs}, // left-to-right mark, U+200E NEW RFC 2070 {u"lrm"_s, u"&#8206;"_s}, // left-to-right mark, U+200E NEW RFC 2070
{u"rlm"_qs, u"&#8207;"_qs}, // right-to-left mark, U+200F NEW RFC 2070 {u"rlm"_s, u"&#8207;"_s}, // right-to-left mark, U+200F NEW RFC 2070
{u"ndash"_qs, u"&#8211;"_qs}, // en dash, U+2013 ISOpub {u"ndash"_s, u"&#8211;"_s}, // en dash, U+2013 ISOpub
{u"mdash"_qs, u"&#8212;"_qs}, // em dash, U+2014 ISOpub {u"mdash"_s, u"&#8212;"_s}, // em dash, U+2014 ISOpub
{u"lsquo"_qs, u"&#8216;"_qs}, // left single quotation mark, U+2018 ISOnum {u"lsquo"_s, u"&#8216;"_s}, // left single quotation mark, U+2018 ISOnum
{u"rsquo"_qs, u"&#8217;"_qs}, // right single quotation mark, U+2019 ISOnum {u"rsquo"_s, u"&#8217;"_s}, // right single quotation mark, U+2019 ISOnum
{u"sbquo"_qs, u"&#8218;"_qs}, // single low-9 quotation mark, U+201A NEW {u"sbquo"_s, u"&#8218;"_s}, // single low-9 quotation mark, U+201A NEW
{u"ldquo"_qs, u"&#8220;"_qs}, // left double quotation mark, U+201C ISOnum {u"ldquo"_s, u"&#8220;"_s}, // left double quotation mark, U+201C ISOnum
{u"rdquo"_qs, u"&#8221;"_qs}, // right double quotation mark, U+201D ISOnum {u"rdquo"_s, u"&#8221;"_s}, // right double quotation mark, U+201D ISOnum
{u"bdquo"_qs, u"&#8222;"_qs}, // double low-9 quotation mark, U+201E NEW {u"bdquo"_s, u"&#8222;"_s}, // double low-9 quotation mark, U+201E NEW
{u"dagger"_qs, u"&#8224;"_qs}, // dagger, U+2020 ISOpub {u"dagger"_s, u"&#8224;"_s}, // dagger, U+2020 ISOpub
{u"Dagger"_qs, u"&#8225;"_qs}, // double dagger, U+2021 ISOpub {u"Dagger"_s, u"&#8225;"_s}, // double dagger, U+2021 ISOpub
{u"permil"_qs, u"&#8240;"_qs}, // per mille sign, U+2030 ISOtech {u"permil"_s, u"&#8240;"_s}, // per mille sign, U+2030 ISOtech
{u"lsaquo"_qs, u"&#8249;"_qs}, // single left-pointing angle quotation mark, U+2039 ISO proposed {u"lsaquo"_s, u"&#8249;"_s}, // single left-pointing angle quotation mark, U+2039 ISO proposed
// lsaquo is proposed but not yet ISO standardized // lsaquo is proposed but not yet ISO standardized
{u"rsaquo"_qs, u"&#8250;"_qs}, // single right-pointing angle quotation mark, U+203A ISO proposed {u"rsaquo"_s, u"&#8250;"_s}, // single right-pointing angle quotation mark, U+203A ISO proposed
// rsaquo is proposed but not yet ISO standardized // rsaquo is proposed but not yet ISO standardized
// Currency Symbols // Currency Symbols
{u"euro"_qs, u"&#8364;"_qs}, // euro sign, U+20AC NEW {u"euro"_s, u"&#8364;"_s}, // euro sign, U+20AC NEW
// Latin Extended-B // Latin Extended-B
{u"fnof"_qs, u"&#402;"_qs}, // latin small letter f with hook = function = florin, U+0192 ISOtech {u"fnof"_s, u"&#402;"_s}, // latin small letter f with hook = function = florin, U+0192 ISOtech
// Greek // Greek
{u"Alpha"_qs, u"&#913;"_qs}, // greek capital letter alpha, U+0391 {u"Alpha"_s, u"&#913;"_s}, // greek capital letter alpha, U+0391
{u"Beta"_qs, u"&#914;"_qs}, // greek capital letter beta, U+0392 {u"Beta"_s, u"&#914;"_s}, // greek capital letter beta, U+0392
{u"Gamma"_qs, u"&#915;"_qs}, // greek capital letter gamma, U+0393 ISOgrk3 {u"Gamma"_s, u"&#915;"_s}, // greek capital letter gamma, U+0393 ISOgrk3
{u"Delta"_qs, u"&#916;"_qs}, // greek capital letter delta, U+0394 ISOgrk3 {u"Delta"_s, u"&#916;"_s}, // greek capital letter delta, U+0394 ISOgrk3
{u"Epsilon"_qs, u"&#917;"_qs}, // greek capital letter epsilon, U+0395 {u"Epsilon"_s, u"&#917;"_s}, // greek capital letter epsilon, U+0395
{u"Zeta"_qs, u"&#918;"_qs}, // greek capital letter zeta, U+0396 {u"Zeta"_s, u"&#918;"_s}, // greek capital letter zeta, U+0396
{u"Eta"_qs, u"&#919;"_qs}, // greek capital letter eta, U+0397 {u"Eta"_s, u"&#919;"_s}, // greek capital letter eta, U+0397
{u"Theta"_qs, u"&#920;"_qs}, // greek capital letter theta, U+0398 ISOgrk3 {u"Theta"_s, u"&#920;"_s}, // greek capital letter theta, U+0398 ISOgrk3
{u"Iota"_qs, u"&#921;"_qs}, // greek capital letter iota, U+0399 {u"Iota"_s, u"&#921;"_s}, // greek capital letter iota, U+0399
{u"Kappa"_qs, u"&#922;"_qs}, // greek capital letter kappa, U+039A {u"Kappa"_s, u"&#922;"_s}, // greek capital letter kappa, U+039A
{u"Lambda"_qs, u"&#923;"_qs}, // greek capital letter lamda, U+039B ISOgrk3 {u"Lambda"_s, u"&#923;"_s}, // greek capital letter lamda, U+039B ISOgrk3
{u"Mu"_qs, u"&#924;"_qs}, // greek capital letter mu, U+039C {u"Mu"_s, u"&#924;"_s}, // greek capital letter mu, U+039C
{u"Nu"_qs, u"&#925;"_qs}, // greek capital letter nu, U+039D {u"Nu"_s, u"&#925;"_s}, // greek capital letter nu, U+039D
{u"Xi"_qs, u"&#926;"_qs}, // greek capital letter xi, U+039E ISOgrk3 {u"Xi"_s, u"&#926;"_s}, // greek capital letter xi, U+039E ISOgrk3
{u"Omicron"_qs, u"&#927;"_qs}, // greek capital letter omicron, U+039F {u"Omicron"_s, u"&#927;"_s}, // greek capital letter omicron, U+039F
{u"Pi"_qs, u"&#928;"_qs}, // greek capital letter pi, U+03A0 ISOgrk3 {u"Pi"_s, u"&#928;"_s}, // greek capital letter pi, U+03A0 ISOgrk3
{u"Rho"_qs, u"&#929;"_qs}, // greek capital letter rho, U+03A1 {u"Rho"_s, u"&#929;"_s}, // greek capital letter rho, U+03A1
{u"Sigma"_qs, u"&#931;"_qs}, // greek capital letter sigma, U+03A3 ISOgrk3 {u"Sigma"_s, u"&#931;"_s}, // greek capital letter sigma, U+03A3 ISOgrk3
{u"Tau"_qs, u"&#932;"_qs}, // greek capital letter tau, U+03A4 {u"Tau"_s, u"&#932;"_s}, // greek capital letter tau, U+03A4
{u"Upsilon"_qs, u"&#933;"_qs}, // greek capital letter upsilon, U+03A5 ISOgrk3 {u"Upsilon"_s, u"&#933;"_s}, // greek capital letter upsilon, U+03A5 ISOgrk3
{u"Phi"_qs, u"&#934;"_qs}, // greek capital letter phi, U+03A6 ISOgrk3 {u"Phi"_s, u"&#934;"_s}, // greek capital letter phi, U+03A6 ISOgrk3
{u"Chi"_qs, u"&#935;"_qs}, // greek capital letter chi, U+03A7 {u"Chi"_s, u"&#935;"_s}, // greek capital letter chi, U+03A7
{u"Psi"_qs, u"&#936;"_qs}, // greek capital letter psi, U+03A8 ISOgrk3 {u"Psi"_s, u"&#936;"_s}, // greek capital letter psi, U+03A8 ISOgrk3
{u"Omega"_qs, u"&#937;"_qs}, // greek capital letter omega, U+03A9 ISOgrk3 {u"Omega"_s, u"&#937;"_s}, // greek capital letter omega, U+03A9 ISOgrk3
{u"alpha"_qs, u"&#945;"_qs}, // greek small letter alpha, U+03B1 ISOgrk3 {u"alpha"_s, u"&#945;"_s}, // greek small letter alpha, U+03B1 ISOgrk3
{u"beta"_qs, u"&#946;"_qs}, // greek small letter beta, U+03B2 ISOgrk3 {u"beta"_s, u"&#946;"_s}, // greek small letter beta, U+03B2 ISOgrk3
{u"gamma"_qs, u"&#947;"_qs}, // greek small letter gamma, U+03B3 ISOgrk3 {u"gamma"_s, u"&#947;"_s}, // greek small letter gamma, U+03B3 ISOgrk3
{u"delta"_qs, u"&#948;"_qs}, // greek small letter delta, U+03B4 ISOgrk3 {u"delta"_s, u"&#948;"_s}, // greek small letter delta, U+03B4 ISOgrk3
{u"epsilon"_qs, u"&#949;"_qs}, // greek small letter epsilon, U+03B5 ISOgrk3 {u"epsilon"_s, u"&#949;"_s}, // greek small letter epsilon, U+03B5 ISOgrk3
{u"zeta"_qs, u"&#950;"_qs}, // greek small letter zeta, U+03B6 ISOgrk3 {u"zeta"_s, u"&#950;"_s}, // greek small letter zeta, U+03B6 ISOgrk3
{u"eta"_qs, u"&#951;"_qs}, // greek small letter eta, U+03B7 ISOgrk3 {u"eta"_s, u"&#951;"_s}, // greek small letter eta, U+03B7 ISOgrk3
{u"theta"_qs, u"&#952;"_qs}, // greek small letter theta, U+03B8 ISOgrk3 {u"theta"_s, u"&#952;"_s}, // greek small letter theta, U+03B8 ISOgrk3
{u"iota"_qs, u"&#953;"_qs}, // greek small letter iota, U+03B9 ISOgrk3 {u"iota"_s, u"&#953;"_s}, // greek small letter iota, U+03B9 ISOgrk3
{u"kappa"_qs, u"&#954;"_qs}, // greek small letter kappa, U+03BA ISOgrk3 {u"kappa"_s, u"&#954;"_s}, // greek small letter kappa, U+03BA ISOgrk3
{u"lambda"_qs, u"&#955;"_qs}, // greek small letter lamda, U+03BB ISOgrk3 {u"lambda"_s, u"&#955;"_s}, // greek small letter lamda, U+03BB ISOgrk3
{u"mu"_qs, u"&#956;"_qs}, // greek small letter mu, U+03BC ISOgrk3 {u"mu"_s, u"&#956;"_s}, // greek small letter mu, U+03BC ISOgrk3
{u"nu"_qs, u"&#957;"_qs}, // greek small letter nu, U+03BD ISOgrk3 {u"nu"_s, u"&#957;"_s}, // greek small letter nu, U+03BD ISOgrk3
{u"xi"_qs, u"&#958;"_qs}, // greek small letter xi, U+03BE ISOgrk3 {u"xi"_s, u"&#958;"_s}, // greek small letter xi, U+03BE ISOgrk3
{u"omicron"_qs, u"&#959;"_qs}, // greek small letter omicron, U+03BF NEW {u"omicron"_s, u"&#959;"_s}, // greek small letter omicron, U+03BF NEW
{u"pi"_qs, u"&#960;"_qs}, // greek small letter pi, U+03C0 ISOgrk3 {u"pi"_s, u"&#960;"_s}, // greek small letter pi, U+03C0 ISOgrk3
{u"rho"_qs, u"&#961;"_qs}, // greek small letter rho, U+03C1 ISOgrk3 {u"rho"_s, u"&#961;"_s}, // greek small letter rho, U+03C1 ISOgrk3
{u"sigmaf"_qs, u"&#962;"_qs}, // greek small letter final sigma, U+03C2 ISOgrk3 {u"sigmaf"_s, u"&#962;"_s}, // greek small letter final sigma, U+03C2 ISOgrk3
{u"sigma"_qs, u"&#963;"_qs}, // greek small letter sigma, U+03C3 ISOgrk3 {u"sigma"_s, u"&#963;"_s}, // greek small letter sigma, U+03C3 ISOgrk3
{u"tau"_qs, u"&#964;"_qs}, // greek small letter tau, U+03C4 ISOgrk3 {u"tau"_s, u"&#964;"_s}, // greek small letter tau, U+03C4 ISOgrk3
{u"upsilon"_qs, u"&#965;"_qs}, // greek small letter upsilon, U+03C5 ISOgrk3 {u"upsilon"_s, u"&#965;"_s}, // greek small letter upsilon, U+03C5 ISOgrk3
{u"phi"_qs, u"&#966;"_qs}, // greek small letter phi, U+03C6 ISOgrk3 {u"phi"_s, u"&#966;"_s}, // greek small letter phi, U+03C6 ISOgrk3
{u"chi"_qs, u"&#967;"_qs}, // greek small letter chi, U+03C7 ISOgrk3 {u"chi"_s, u"&#967;"_s}, // greek small letter chi, U+03C7 ISOgrk3
{u"psi"_qs, u"&#968;"_qs}, // greek small letter psi, U+03C8 ISOgrk3 {u"psi"_s, u"&#968;"_s}, // greek small letter psi, U+03C8 ISOgrk3
{u"omega"_qs, u"&#969;"_qs}, // greek small letter omega, U+03C9 ISOgrk3 {u"omega"_s, u"&#969;"_s}, // greek small letter omega, U+03C9 ISOgrk3
{u"thetasym"_qs, u"&#977;"_qs}, // greek theta symbol, U+03D1 NEW {u"thetasym"_s, u"&#977;"_s}, // greek theta symbol, U+03D1 NEW
{u"upsih"_qs, u"&#978;"_qs}, // greek upsilon with hook symbol, U+03D2 NEW {u"upsih"_s, u"&#978;"_s}, // greek upsilon with hook symbol, U+03D2 NEW
{u"piv"_qs, u"&#982;"_qs}, // greek pi symbol, U+03D6 ISOgrk3 {u"piv"_s, u"&#982;"_s}, // greek pi symbol, U+03D6 ISOgrk3
// General Punctuation // General Punctuation
{u"bull"_qs, u"&#8226;"_qs}, // bullet = black small circle, U+2022 ISOpub {u"bull"_s, u"&#8226;"_s}, // bullet = black small circle, U+2022 ISOpub
// bullet is NOT the same as bullet operator, U+2219 // bullet is NOT the same as bullet operator, U+2219
{u"hellip"_qs, u"&#8230;"_qs}, // horizontal ellipsis = three dot leader, U+2026 ISOpub {u"hellip"_s, u"&#8230;"_s}, // horizontal ellipsis = three dot leader, U+2026 ISOpub
{u"prime"_qs, u"&#8242;"_qs}, // prime = minutes = feet, U+2032 ISOtech {u"prime"_s, u"&#8242;"_s}, // prime = minutes = feet, U+2032 ISOtech
{u"Prime"_qs, u"&#8243;"_qs}, // double prime = seconds = inches, U+2033 ISOtech {u"Prime"_s, u"&#8243;"_s}, // double prime = seconds = inches, U+2033 ISOtech
{u"oline"_qs, u"&#8254;"_qs}, // overline = spacing overscore, U+203E NEW {u"oline"_s, u"&#8254;"_s}, // overline = spacing overscore, U+203E NEW
{u"frasl"_qs, u"&#8260;"_qs}, // fraction slash, U+2044 NEW {u"frasl"_s, u"&#8260;"_s}, // fraction slash, U+2044 NEW
// Letterlike Symbols // Letterlike Symbols
{u"weierp"_qs, u"&#8472;"_qs}, // script capital P = power set = Weierstrass p, U+2118 ISOamso {u"weierp"_s, u"&#8472;"_s}, // script capital P = power set = Weierstrass p, U+2118 ISOamso
{u"image"_qs, u"&#8465;"_qs}, // black-letter capital I = imaginary part, U+2111 ISOamso {u"image"_s, u"&#8465;"_s}, // black-letter capital I = imaginary part, U+2111 ISOamso
{u"real"_qs, u"&#8476;"_qs}, // black-letter capital R = real part symbol, U+211C ISOamso {u"real"_s, u"&#8476;"_s}, // black-letter capital R = real part symbol, U+211C ISOamso
{u"trade"_qs, u"&#8482;"_qs}, // trade mark sign, U+2122 ISOnum {u"trade"_s, u"&#8482;"_s}, // trade mark sign, U+2122 ISOnum
{u"alefsym"_qs, u"&#8501;"_qs}, // alef symbol = first transfinite cardinal, U+2135 NEW {u"alefsym"_s, u"&#8501;"_s}, // alef symbol = first transfinite cardinal, U+2135 NEW
// alef symbol is NOT the same as hebrew letter alef, // alef symbol is NOT the same as hebrew letter alef,
// U+05D0 although the same glyph could be used to depict both characters // U+05D0 although the same glyph could be used to depict both characters
// Arrows // Arrows
{u"larr"_qs, u"&#8592;"_qs}, // leftwards arrow, U+2190 ISOnum {u"larr"_s, u"&#8592;"_s}, // leftwards arrow, U+2190 ISOnum
{u"uarr"_qs, u"&#8593;"_qs}, // upwards arrow, U+2191 ISOnum {u"uarr"_s, u"&#8593;"_s}, // upwards arrow, U+2191 ISOnum
{u"rarr"_qs, u"&#8594;"_qs}, // rightwards arrow, U+2192 ISOnum {u"rarr"_s, u"&#8594;"_s}, // rightwards arrow, U+2192 ISOnum
{u"darr"_qs, u"&#8595;"_qs}, // downwards arrow, U+2193 ISOnum {u"darr"_s, u"&#8595;"_s}, // downwards arrow, U+2193 ISOnum
{u"harr"_qs, u"&#8596;"_qs}, // left right arrow, U+2194 ISOamsa {u"harr"_s, u"&#8596;"_s}, // left right arrow, U+2194 ISOamsa
{u"crarr"_qs, u"&#8629;"_qs}, // downwards arrow with corner leftwards = carriage return, U+21B5 NEW {u"crarr"_s, u"&#8629;"_s}, // downwards arrow with corner leftwards = carriage return, U+21B5 NEW
{u"lArr"_qs, u"&#8656;"_qs}, // leftwards double arrow, U+21D0 ISOtech {u"lArr"_s, u"&#8656;"_s}, // leftwards double arrow, U+21D0 ISOtech
// Unicode does not say that lArr is the same as the 'is implied by' arrow // Unicode does not say that lArr is the same as the 'is implied by' arrow
// but also does not have any other character for that function. So lArr can // but also does not have any other character for that function. So lArr can
// be used for 'is implied by' as ISOtech suggests // be used for 'is implied by' as ISOtech suggests
{u"uArr"_qs, u"&#8657;"_qs}, // upwards double arrow, U+21D1 ISOamsa {u"uArr"_s, u"&#8657;"_s}, // upwards double arrow, U+21D1 ISOamsa
{u"rArr"_qs, u"&#8658;"_qs}, // rightwards double arrow, U+21D2 ISOtech {u"rArr"_s, u"&#8658;"_s}, // rightwards double arrow, U+21D2 ISOtech
// Unicode does not say this is the 'implies' character but does not have // Unicode does not say this is the 'implies' character but does not have
// another character with this function so rArr can be used for 'implies' // another character with this function so rArr can be used for 'implies'
// as ISOtech suggests // as ISOtech suggests
{u"dArr"_qs, u"&#8659;"_qs}, // downwards double arrow, U+21D3 ISOamsa {u"dArr"_s, u"&#8659;"_s}, // downwards double arrow, U+21D3 ISOamsa
{u"hArr"_qs, u"&#8660;"_qs}, // left right double arrow, U+21D4 ISOamsa {u"hArr"_s, u"&#8660;"_s}, // left right double arrow, U+21D4 ISOamsa
// Mathematical Operators // Mathematical Operators
{u"forall"_qs, u"&#8704;"_qs}, // for all, U+2200 ISOtech {u"forall"_s, u"&#8704;"_s}, // for all, U+2200 ISOtech
{u"part"_qs, u"&#8706;"_qs}, // partial differential, U+2202 ISOtech {u"part"_s, u"&#8706;"_s}, // partial differential, U+2202 ISOtech
{u"exist"_qs, u"&#8707;"_qs}, // there exists, U+2203 ISOtech {u"exist"_s, u"&#8707;"_s}, // there exists, U+2203 ISOtech
{u"empty"_qs, u"&#8709;"_qs}, // empty set = null set, U+2205 ISOamso {u"empty"_s, u"&#8709;"_s}, // empty set = null set, U+2205 ISOamso
{u"nabla"_qs, u"&#8711;"_qs}, // nabla = backward difference, U+2207 ISOtech {u"nabla"_s, u"&#8711;"_s}, // nabla = backward difference, U+2207 ISOtech
{u"isin"_qs, u"&#8712;"_qs}, // element of, U+2208 ISOtech {u"isin"_s, u"&#8712;"_s}, // element of, U+2208 ISOtech
{u"notin"_qs, u"&#8713;"_qs}, // not an element of, U+2209 ISOtech {u"notin"_s, u"&#8713;"_s}, // not an element of, U+2209 ISOtech
{u"ni"_qs, u"&#8715;"_qs}, // contains as member, U+220B ISOtech {u"ni"_s, u"&#8715;"_s}, // contains as member, U+220B ISOtech
{u"prod"_qs, u"&#8719;"_qs}, // n-ary product = product sign, U+220F ISOamsb {u"prod"_s, u"&#8719;"_s}, // n-ary product = product sign, U+220F ISOamsb
// prod is NOT the same character as U+03A0 'greek capital letter pi' though // prod is NOT the same character as U+03A0 'greek capital letter pi' though
// the same glyph might be used for both // the same glyph might be used for both
{u"sum"_qs, u"&#8721;"_qs}, // n-ary summation, U+2211 ISOamsb {u"sum"_s, u"&#8721;"_s}, // n-ary summation, U+2211 ISOamsb
// sum is NOT the same character as U+03A3 'greek capital letter sigma' // sum is NOT the same character as U+03A3 'greek capital letter sigma'
// though the same glyph might be used for both // though the same glyph might be used for both
{u"minus"_qs, u"&#8722;"_qs}, // minus sign, U+2212 ISOtech {u"minus"_s, u"&#8722;"_s}, // minus sign, U+2212 ISOtech
{u"lowast"_qs, u"&#8727;"_qs}, // asterisk operator, U+2217 ISOtech {u"lowast"_s, u"&#8727;"_s}, // asterisk operator, U+2217 ISOtech
{u"radic"_qs, u"&#8730;"_qs}, // square root = radical sign, U+221A ISOtech {u"radic"_s, u"&#8730;"_s}, // square root = radical sign, U+221A ISOtech
{u"prop"_qs, u"&#8733;"_qs}, // proportional to, U+221D ISOtech {u"prop"_s, u"&#8733;"_s}, // proportional to, U+221D ISOtech
{u"infin"_qs, u"&#8734;"_qs}, // infinity, U+221E ISOtech {u"infin"_s, u"&#8734;"_s}, // infinity, U+221E ISOtech
{u"ang"_qs, u"&#8736;"_qs}, // angle, U+2220 ISOamso {u"ang"_s, u"&#8736;"_s}, // angle, U+2220 ISOamso
{u"and"_qs, u"&#8743;"_qs}, // logical and = wedge, U+2227 ISOtech {u"and"_s, u"&#8743;"_s}, // logical and = wedge, U+2227 ISOtech
{u"or"_qs, u"&#8744;"_qs}, // logical or = vee, U+2228 ISOtech {u"or"_s, u"&#8744;"_s}, // logical or = vee, U+2228 ISOtech
{u"cap"_qs, u"&#8745;"_qs}, // intersection = cap, U+2229 ISOtech {u"cap"_s, u"&#8745;"_s}, // intersection = cap, U+2229 ISOtech
{u"cup"_qs, u"&#8746;"_qs}, // union = cup, U+222A ISOtech {u"cup"_s, u"&#8746;"_s}, // union = cup, U+222A ISOtech
{u"int"_qs, u"&#8747;"_qs}, // integral, U+222B ISOtech {u"int"_s, u"&#8747;"_s}, // integral, U+222B ISOtech
{u"there4"_qs, u"&#8756;"_qs}, // therefore, U+2234 ISOtech {u"there4"_s, u"&#8756;"_s}, // therefore, U+2234 ISOtech
{u"sim"_qs, u"&#8764;"_qs}, // tilde operator = varies with = similar to, U+223C ISOtech {u"sim"_s, u"&#8764;"_s}, // tilde operator = varies with = similar to, U+223C ISOtech
// tilde operator is NOT the same character as the tilde, U+007E, // tilde operator is NOT the same character as the tilde, U+007E,
// although the same glyph might be used to represent both // although the same glyph might be used to represent both
{u"cong"_qs, u"&#8773;"_qs}, // approximately equal to, U+2245 ISOtech {u"cong"_s, u"&#8773;"_s}, // approximately equal to, U+2245 ISOtech
{u"asymp"_qs, u"&#8776;"_qs}, // almost equal to = asymptotic to, U+2248 ISOamsr {u"asymp"_s, u"&#8776;"_s}, // almost equal to = asymptotic to, U+2248 ISOamsr
{u"ne"_qs, u"&#8800;"_qs}, // not equal to, U+2260 ISOtech {u"ne"_s, u"&#8800;"_s}, // not equal to, U+2260 ISOtech
{u"equiv"_qs, u"&#8801;"_qs}, // identical to, U+2261 ISOtech {u"equiv"_s, u"&#8801;"_s}, // identical to, U+2261 ISOtech
{u"le"_qs, u"&#8804;"_qs}, // less-than or equal to, U+2264 ISOtech {u"le"_s, u"&#8804;"_s}, // less-than or equal to, U+2264 ISOtech
{u"ge"_qs, u"&#8805;"_qs}, // greater-than or equal to, U+2265 ISOtech {u"ge"_s, u"&#8805;"_s}, // greater-than or equal to, U+2265 ISOtech
{u"sub"_qs, u"&#8834;"_qs}, // subset of, U+2282 ISOtech {u"sub"_s, u"&#8834;"_s}, // subset of, U+2282 ISOtech
{u"sup"_qs, u"&#8835;"_qs}, // superset of, U+2283 ISOtech {u"sup"_s, u"&#8835;"_s}, // superset of, U+2283 ISOtech
{u"nsub"_qs, u"&#8836;"_qs}, // not a subset of, U+2284 ISOamsn {u"nsub"_s, u"&#8836;"_s}, // not a subset of, U+2284 ISOamsn
{u"sube"_qs, u"&#8838;"_qs}, // subset of or equal to, U+2286 ISOtech {u"sube"_s, u"&#8838;"_s}, // subset of or equal to, U+2286 ISOtech
{u"supe"_qs, u"&#8839;"_qs}, // superset of or equal to, U+2287 ISOtech {u"supe"_s, u"&#8839;"_s}, // superset of or equal to, U+2287 ISOtech
{u"oplus"_qs, u"&#8853;"_qs}, // circled plus = direct sum, U+2295 ISOamsb {u"oplus"_s, u"&#8853;"_s}, // circled plus = direct sum, U+2295 ISOamsb
{u"otimes"_qs, u"&#8855;"_qs}, // circled times = vector product, U+2297 ISOamsb {u"otimes"_s, u"&#8855;"_s}, // circled times = vector product, U+2297 ISOamsb
{u"perp"_qs, u"&#8869;"_qs}, // up tack = orthogonal to = perpendicular, U+22A5 ISOtech {u"perp"_s, u"&#8869;"_s}, // up tack = orthogonal to = perpendicular, U+22A5 ISOtech
{u"sdot"_qs, u"&#8901;"_qs}, // dot operator, U+22C5 ISOamsb {u"sdot"_s, u"&#8901;"_s}, // dot operator, U+22C5 ISOamsb
// dot operator is NOT the same character as U+00B7 middle dot // dot operator is NOT the same character as U+00B7 middle dot
// Miscellaneous Technical // Miscellaneous Technical
{u"lceil"_qs, u"&#8968;"_qs}, // left ceiling = APL upstile, U+2308 ISOamsc {u"lceil"_s, u"&#8968;"_s}, // left ceiling = APL upstile, U+2308 ISOamsc
{u"rceil"_qs, u"&#8969;"_qs}, // right ceiling, U+2309 ISOamsc {u"rceil"_s, u"&#8969;"_s}, // right ceiling, U+2309 ISOamsc
{u"lfloor"_qs, u"&#8970;"_qs}, // left floor = APL downstile, U+230A ISOamsc {u"lfloor"_s, u"&#8970;"_s}, // left floor = APL downstile, U+230A ISOamsc
{u"rfloor"_qs, u"&#8971;"_qs}, // right floor, U+230B ISOamsc {u"rfloor"_s, u"&#8971;"_s}, // right floor, U+230B ISOamsc
{u"lang"_qs, u"&#9001;"_qs}, // left-pointing angle bracket = bra, U+2329 ISOtech {u"lang"_s, u"&#9001;"_s}, // left-pointing angle bracket = bra, U+2329 ISOtech
// lang is NOT the same character as U+003C 'less than sign' // lang is NOT the same character as U+003C 'less than sign'
// or U+2039 'single left-pointing angle quotation mark' // or U+2039 'single left-pointing angle quotation mark'
{u"rang"_qs, u"&#9002;"_qs}, // right-pointing angle bracket = ket, U+232A ISOtech {u"rang"_s, u"&#9002;"_s}, // right-pointing angle bracket = ket, U+232A ISOtech
// rang is NOT the same character as U+003E 'greater than sign' // rang is NOT the same character as U+003E 'greater than sign'
// or U+203A 'single right-pointing angle quotation mark' // or U+203A 'single right-pointing angle quotation mark'
// Geometric Shapes // Geometric Shapes
{u"loz"_qs, u"&#9674;"_qs}, // lozenge, U+25CA ISOpub {u"loz"_s, u"&#9674;"_s}, // lozenge, U+25CA ISOpub
// Miscellaneous Symbols // Miscellaneous Symbols
{u"spades"_qs, u"&#9824;"_qs}, // black spade suit, U+2660 ISOpub {u"spades"_s, u"&#9824;"_s}, // black spade suit, U+2660 ISOpub
{u"clubs"_qs, u"&#9827;"_qs}, // black club suit = shamrock, U+2663 ISOpub {u"clubs"_s, u"&#9827;"_s}, // black club suit = shamrock, U+2663 ISOpub
{u"hearts"_qs, u"&#9829;"_qs}, // black heart suit = valentine, U+2665 ISOpub {u"hearts"_s, u"&#9829;"_s}, // black heart suit = valentine, U+2665 ISOpub
{u"diams"_qs, u"&#9830;"_qs} // black diamond suit, U+2666 ISOpub {u"diams"_s, u"&#9830;"_s} // black diamond suit, U+2666 ISOpub
}; };
return HTMLEntities.value(name); return HTMLEntities.value(name);
} }
@ -392,7 +392,7 @@ namespace
int nmin = 8; int nmin = 8;
int nsec = 9; int nsec = 9;
// Also accept obsolete form "Weekday, DD-Mon-YY HH:MM:SS ±hhmm" // Also accept obsolete form "Weekday, DD-Mon-YY HH:MM:SS ±hhmm"
QRegularExpression rx {u"^(?:([A-Z][a-z]+),\\s*)?(\\d{1,2})(\\s+|-)([^-\\s]+)(\\s+|-)(\\d{2,4})\\s+(\\d\\d):(\\d\\d)(?::(\\d\\d))?\\s+(\\S+)$"_qs}; QRegularExpression rx {u"^(?:([A-Z][a-z]+),\\s*)?(\\d{1,2})(\\s+|-)([^-\\s]+)(\\s+|-)(\\d{2,4})\\s+(\\d\\d):(\\d\\d)(?::(\\d\\d))?\\s+(\\S+)$"_s};
QRegularExpressionMatch rxMatch; QRegularExpressionMatch rxMatch;
QStringList parts; QStringList parts;
if (str.indexOf(rx, 0, &rxMatch) == 0) if (str.indexOf(rx, 0, &rxMatch) == 0)
@ -407,7 +407,7 @@ namespace
else else
{ {
// Check for the obsolete form "Wdy Mon DD HH:MM:SS YYYY" // Check for the obsolete form "Wdy Mon DD HH:MM:SS YYYY"
rx = QRegularExpression {u"^([A-Z][a-z]+)\\s+(\\S+)\\s+(\\d\\d)\\s+(\\d\\d):(\\d\\d):(\\d\\d)\\s+(\\d\\d\\d\\d)$"_qs}; rx = QRegularExpression {u"^([A-Z][a-z]+)\\s+(\\S+)\\s+(\\d\\d)\\s+(\\d\\d):(\\d\\d):(\\d\\d)\\s+(\\d\\d\\d\\d)$"_s};
if (str.indexOf(rx, 0, &rxMatch) != 0) if (str.indexOf(rx, 0, &rxMatch) != 0)
return QDateTime::currentDateTime(); return QDateTime::currentDateTime();
@ -466,7 +466,7 @@ namespace
bool negOffset = false; bool negOffset = false;
if (parts.count() > 10) if (parts.count() > 10)
{ {
rx = QRegularExpression {u"^([+-])(\\d\\d)(\\d\\d)$"_qs}; rx = QRegularExpression {u"^([+-])(\\d\\d)(\\d\\d)$"_s};
if (parts[10].indexOf(rx, 0, &rxMatch) == 0) if (parts[10].indexOf(rx, 0, &rxMatch) == 0)
{ {
// It's a UTC offset ±hhmm // It's a UTC offset ±hhmm
@ -622,10 +622,10 @@ void RSS::Private::Parser::parseRssArticle(QXmlStreamReader &xml)
} }
else if (name == u"enclosure") else if (name == u"enclosure")
{ {
if (xml.attributes().value(u"type"_qs) == u"application/x-bittorrent") if (xml.attributes().value(u"type"_s) == u"application/x-bittorrent")
article[Article::KeyTorrentURL] = xml.attributes().value(u"url"_qs).toString(); article[Article::KeyTorrentURL] = xml.attributes().value(u"url"_s).toString();
else if (xml.attributes().value(u"type"_qs).isEmpty()) else if (xml.attributes().value(u"type"_s).isEmpty())
altTorrentUrl = xml.attributes().value(u"url"_qs).toString(); altTorrentUrl = xml.attributes().value(u"url"_s).toString();
} }
else if (name == u"link") else if (name == u"link")
{ {
@ -720,7 +720,7 @@ void RSS::Private::Parser::parseAtomArticle(QXmlStreamReader &xml)
{ {
const QString link = (xml.attributes().isEmpty() const QString link = (xml.attributes().isEmpty()
? xml.readElementText().trimmed() ? xml.readElementText().trimmed()
: xml.attributes().value(u"href"_qs).toString()); : xml.attributes().value(u"href"_s).toString());
if (link.startsWith(u"magnet:", Qt::CaseInsensitive)) if (link.startsWith(u"magnet:", Qt::CaseInsensitive))
{ {
@ -783,7 +783,7 @@ void RSS::Private::Parser::parseAtomArticle(QXmlStreamReader &xml)
void RSS::Private::Parser::parseAtomChannel(QXmlStreamReader &xml) void RSS::Private::Parser::parseAtomChannel(QXmlStreamReader &xml)
{ {
m_baseUrl = xml.attributes().value(u"xml:base"_qs).toString(); m_baseUrl = xml.attributes().value(u"xml:base"_s).toString();
while (!xml.atEnd()) while (!xml.atEnd())
{ {

View file

@ -51,18 +51,18 @@
#include "rss_folder.h" #include "rss_folder.h"
#include "rss_item.h" #include "rss_item.h"
const QString CONF_FOLDER_NAME = u"rss"_qs; const QString CONF_FOLDER_NAME = u"rss"_s;
const QString DATA_FOLDER_NAME = u"rss/articles"_qs; const QString DATA_FOLDER_NAME = u"rss/articles"_s;
const QString FEEDS_FILE_NAME = u"feeds.json"_qs; const QString FEEDS_FILE_NAME = u"feeds.json"_s;
using namespace RSS; using namespace RSS;
QPointer<Session> Session::m_instance = nullptr; QPointer<Session> Session::m_instance = nullptr;
Session::Session() Session::Session()
: m_storeProcessingEnabled(u"RSS/Session/EnableProcessing"_qs) : m_storeProcessingEnabled(u"RSS/Session/EnableProcessing"_s)
, m_storeRefreshInterval(u"RSS/Session/RefreshInterval"_qs, 30) , m_storeRefreshInterval(u"RSS/Session/RefreshInterval"_s, 30)
, m_storeMaxArticlesPerFeed(u"RSS/Session/MaxArticlesPerFeed"_qs, 50) , m_storeMaxArticlesPerFeed(u"RSS/Session/MaxArticlesPerFeed"_s, 50)
, m_workingThread(new QThread) , m_workingThread(new QThread)
{ {
Q_ASSERT(!m_instance); // only one instance is allowed Q_ASSERT(!m_instance); // only one instance is allowed
@ -86,7 +86,7 @@ Session::Session()
.arg(fileName.toString(), errorString), Log::WARNING); .arg(fileName.toString(), errorString), Log::WARNING);
}); });
m_itemsByPath.insert(u""_qs, new Folder); // root folder m_itemsByPath.insert(u""_s, new Folder); // root folder
m_workingThread->start(); m_workingThread->start();
load(); load();
@ -102,22 +102,22 @@ Session::Session()
// (at least on Windows, QSettings is case-insensitive and it can get // (at least on Windows, QSettings is case-insensitive and it can get
// confused when asked about settings that differ only in their case) // confused when asked about settings that differ only in their case)
auto *settingsStorage = SettingsStorage::instance(); auto *settingsStorage = SettingsStorage::instance();
settingsStorage->removeValue(u"Rss/streamList"_qs); settingsStorage->removeValue(u"Rss/streamList"_s);
settingsStorage->removeValue(u"Rss/streamAlias"_qs); settingsStorage->removeValue(u"Rss/streamAlias"_s);
settingsStorage->removeValue(u"Rss/open_folders"_qs); settingsStorage->removeValue(u"Rss/open_folders"_s);
settingsStorage->removeValue(u"Rss/qt5/splitter_h"_qs); settingsStorage->removeValue(u"Rss/qt5/splitter_h"_s);
settingsStorage->removeValue(u"Rss/qt5/splitterMain"_qs); settingsStorage->removeValue(u"Rss/qt5/splitterMain"_s);
settingsStorage->removeValue(u"Rss/hosts_cookies"_qs); settingsStorage->removeValue(u"Rss/hosts_cookies"_s);
settingsStorage->removeValue(u"RSS/streamList"_qs); settingsStorage->removeValue(u"RSS/streamList"_s);
settingsStorage->removeValue(u"RSS/streamAlias"_qs); settingsStorage->removeValue(u"RSS/streamAlias"_s);
settingsStorage->removeValue(u"RSS/open_folders"_qs); settingsStorage->removeValue(u"RSS/open_folders"_s);
settingsStorage->removeValue(u"RSS/qt5/splitter_h"_qs); settingsStorage->removeValue(u"RSS/qt5/splitter_h"_s);
settingsStorage->removeValue(u"RSS/qt5/splitterMain"_qs); settingsStorage->removeValue(u"RSS/qt5/splitterMain"_s);
settingsStorage->removeValue(u"RSS/hosts_cookies"_qs); settingsStorage->removeValue(u"RSS/hosts_cookies"_s);
settingsStorage->removeValue(u"Rss/Session/EnableProcessing"_qs); settingsStorage->removeValue(u"Rss/Session/EnableProcessing"_s);
settingsStorage->removeValue(u"Rss/Session/RefreshInterval"_qs); settingsStorage->removeValue(u"Rss/Session/RefreshInterval"_s);
settingsStorage->removeValue(u"Rss/Session/MaxArticlesPerFeed"_qs); settingsStorage->removeValue(u"Rss/Session/MaxArticlesPerFeed"_s);
settingsStorage->removeValue(u"Rss/AutoDownloader/EnableProcessing"_qs); settingsStorage->removeValue(u"Rss/AutoDownloader/EnableProcessing"_s);
} }
Session::~Session() Session::~Session()
@ -125,7 +125,7 @@ Session::~Session()
qDebug() << "Deleting RSS Session..."; qDebug() << "Deleting RSS Session...";
//store(); //store();
delete m_itemsByPath[u""_qs]; // deleting root folder delete m_itemsByPath[u""_s]; // deleting root folder
qDebug() << "RSS Session deleted."; qDebug() << "RSS Session deleted.";
} }
@ -320,7 +320,7 @@ void Session::loadFolder(const QJsonObject &jsonObj, Folder *folder)
if (!valObj[u"url"].isString()) if (!valObj[u"url"].isString())
{ {
LogMsg(tr("Couldn't load RSS feed. Feed: \"%1\". Reason: URL is required.") LogMsg(tr("Couldn't load RSS feed. Feed: \"%1\". Reason: URL is required.")
.arg(u"%1\\%2"_qs.arg(folder->path(), key)), Log::WARNING); .arg(u"%1\\%2"_s.arg(folder->path(), key)), Log::WARNING);
continue; continue;
} }
@ -331,7 +331,7 @@ void Session::loadFolder(const QJsonObject &jsonObj, Folder *folder)
if (uid.isNull()) if (uid.isNull())
{ {
LogMsg(tr("Couldn't load RSS feed. Feed: \"%1\". Reason: UID is invalid.") LogMsg(tr("Couldn't load RSS feed. Feed: \"%1\". Reason: UID is invalid.")
.arg(u"%1\\%2"_qs.arg(folder->path(), key)), Log::WARNING); .arg(u"%1\\%2"_s.arg(folder->path(), key)), Log::WARNING);
continue; continue;
} }
@ -359,7 +359,7 @@ void Session::loadFolder(const QJsonObject &jsonObj, Folder *folder)
else else
{ {
LogMsg(tr("Couldn't load RSS item. Item: \"%1\". Invalid data format.") LogMsg(tr("Couldn't load RSS item. Item: \"%1\". Invalid data format.")
.arg(u"%1\\%2"_qs.arg(folder->path(), key)), Log::WARNING); .arg(u"%1\\%2"_s.arg(folder->path(), key)), Log::WARNING);
} }
} }
@ -369,8 +369,8 @@ void Session::loadFolder(const QJsonObject &jsonObj, Folder *folder)
void Session::loadLegacy() void Session::loadLegacy()
{ {
const auto legacyFeedPaths = SettingsStorage::instance()->loadValue<QStringList>(u"Rss/streamList"_qs); const auto legacyFeedPaths = SettingsStorage::instance()->loadValue<QStringList>(u"Rss/streamList"_s);
const auto feedAliases = SettingsStorage::instance()->loadValue<QStringList>(u"Rss/streamAlias"_qs); const auto feedAliases = SettingsStorage::instance()->loadValue<QStringList>(u"Rss/streamAlias"_s);
if (legacyFeedPaths.size() != feedAliases.size()) if (legacyFeedPaths.size() != feedAliases.size())
{ {
LogMsg(tr("Corrupted RSS list, not loading it."), Log::WARNING); LogMsg(tr("Corrupted RSS list, not loading it."), Log::WARNING);
@ -498,7 +498,7 @@ AsyncFileStorage *Session::dataFileStorage() const
Folder *Session::rootFolder() const Folder *Session::rootFolder() const
{ {
return static_cast<Folder *>(m_itemsByPath.value(u""_qs)); return static_cast<Folder *>(m_itemsByPath.value(u""_s));
} }
QList<Feed *> Session::feeds() const QList<Feed *> Session::feeds() const

View file

@ -47,7 +47,7 @@ SearchDownloadHandler::SearchDownloadHandler(const QString &siteUrl, const QStri
const QStringList params const QStringList params
{ {
Utils::ForeignApps::PYTHON_ISOLATE_MODE_FLAG, Utils::ForeignApps::PYTHON_ISOLATE_MODE_FLAG,
(SearchPluginManager::engineLocation() / Path(u"nova2dl.py"_qs)).toString(), (SearchPluginManager::engineLocation() / Path(u"nova2dl.py"_s)).toString(),
siteUrl, siteUrl,
url url
}; };

View file

@ -74,7 +74,7 @@ SearchHandler::SearchHandler(const QString &pattern, const QString &category, co
const QStringList params const QStringList params
{ {
Utils::ForeignApps::PYTHON_ISOLATE_MODE_FLAG, Utils::ForeignApps::PYTHON_ISOLATE_MODE_FLAG,
(SearchPluginManager::engineLocation() / Path(u"nova2.py"_qs)).toString(), (SearchPluginManager::engineLocation() / Path(u"nova2.py"_s)).toString(),
m_usedPlugins.join(u','), m_usedPlugins.join(u','),
m_category m_category
}; };

View file

@ -78,7 +78,7 @@ namespace
for (const QString &file : files) for (const QString &file : files)
{ {
const Path path {file}; const Path path {file};
if (path.hasExtension(u".pyc"_qs)) if (path.hasExtension(u".pyc"_s))
Utils::Fs::removeFile(path); Utils::Fs::removeFile(path);
} }
} }
@ -88,7 +88,7 @@ namespace
QPointer<SearchPluginManager> SearchPluginManager::m_instance = nullptr; QPointer<SearchPluginManager> SearchPluginManager::m_instance = nullptr;
SearchPluginManager::SearchPluginManager() SearchPluginManager::SearchPluginManager()
: m_updateUrl(u"https://searchplugins.qbittorrent.org/nova3/engines/"_qs) : m_updateUrl(u"https://searchplugins.qbittorrent.org/nova3/engines/"_s)
{ {
Q_ASSERT(!m_instance); // only one instance is allowed Q_ASSERT(!m_instance); // only one instance is allowed
m_instance = this; m_instance = this;
@ -204,7 +204,7 @@ void SearchPluginManager::enablePlugin(const QString &name, const bool enabled)
// Updates shipped plugin // Updates shipped plugin
void SearchPluginManager::updatePlugin(const QString &name) void SearchPluginManager::updatePlugin(const QString &name)
{ {
installPlugin(u"%1%2.py"_qs.arg(m_updateUrl, name)); installPlugin(u"%1%2.py"_s.arg(m_updateUrl, name));
} }
// Install or update plugin from file or url // Install or update plugin from file or url
@ -354,15 +354,15 @@ QString SearchPluginManager::categoryFullName(const QString &categoryName)
{ {
const QHash<QString, QString> categoryTable const QHash<QString, QString> categoryTable
{ {
{u"all"_qs, tr("All categories")}, {u"all"_s, tr("All categories")},
{u"movies"_qs, tr("Movies")}, {u"movies"_s, tr("Movies")},
{u"tv"_qs, tr("TV shows")}, {u"tv"_s, tr("TV shows")},
{u"music"_qs, tr("Music")}, {u"music"_s, tr("Music")},
{u"games"_qs, tr("Games")}, {u"games"_s, tr("Games")},
{u"anime"_qs, tr("Anime")}, {u"anime"_s, tr("Anime")},
{u"software"_qs, tr("Software")}, {u"software"_s, tr("Software")},
{u"pictures"_qs, tr("Pictures")}, {u"pictures"_s, tr("Pictures")},
{u"books"_qs, tr("Books")} {u"books"_s, tr("Books")}
}; };
return categoryTable.value(categoryName); return categoryTable.value(categoryName);
} }
@ -374,7 +374,7 @@ QString SearchPluginManager::pluginFullName(const QString &pluginName) const
Path SearchPluginManager::pluginsLocation() Path SearchPluginManager::pluginsLocation()
{ {
return (engineLocation() / Path(u"engines"_qs)); return (engineLocation() / Path(u"engines"_s));
} }
Path SearchPluginManager::engineLocation() Path SearchPluginManager::engineLocation()
@ -382,7 +382,7 @@ Path SearchPluginManager::engineLocation()
static Path location; static Path location;
if (location.isEmpty()) if (location.isEmpty())
{ {
location = specialFolderLocation(SpecialFolder::Data) / Path(u"nova3"_qs); location = specialFolderLocation(SpecialFolder::Data) / Path(u"nova3"_s);
Utils::Fs::mkpath(location); Utils::Fs::mkpath(location);
} }
@ -403,24 +403,24 @@ void SearchPluginManager::applyProxySettings()
case Net::ProxyType::HTTP: case Net::ProxyType::HTTP:
if (proxyConfig.authEnabled) if (proxyConfig.authEnabled)
{ {
proxyStrHTTP = u"http://%1:%2@%3:%4"_qs.arg(proxyConfig.username proxyStrHTTP = u"http://%1:%2@%3:%4"_s.arg(proxyConfig.username
, proxyConfig.password, proxyConfig.ip, QString::number(proxyConfig.port)); , proxyConfig.password, proxyConfig.ip, QString::number(proxyConfig.port));
} }
else else
{ {
proxyStrHTTP = u"http://%1:%2"_qs.arg(proxyConfig.ip, QString::number(proxyConfig.port)); proxyStrHTTP = u"http://%1:%2"_s.arg(proxyConfig.ip, QString::number(proxyConfig.port));
} }
break; break;
case Net::ProxyType::SOCKS5: case Net::ProxyType::SOCKS5:
if (proxyConfig.authEnabled) if (proxyConfig.authEnabled)
{ {
proxyStrSOCK = u"%1:%2@%3:%4"_qs.arg(proxyConfig.username proxyStrSOCK = u"%1:%2@%3:%4"_s.arg(proxyConfig.username
, proxyConfig.password, proxyConfig.ip, QString::number(proxyConfig.port)); , proxyConfig.password, proxyConfig.ip, QString::number(proxyConfig.port));
} }
else else
{ {
proxyStrSOCK = u"%1:%2"_qs.arg(proxyConfig.ip, QString::number(proxyConfig.port)); proxyStrSOCK = u"%1:%2"_s.arg(proxyConfig.ip, QString::number(proxyConfig.port));
} }
break; break;
@ -459,7 +459,7 @@ void SearchPluginManager::pluginDownloadFinished(const Net::DownloadResult &resu
{ {
const QString url = result.url; const QString url = result.url;
QString pluginName = url.mid(url.lastIndexOf(u'/') + 1); QString pluginName = url.mid(url.lastIndexOf(u'/') + 1);
pluginName.replace(u".py"_qs, u""_qs, Qt::CaseInsensitive); pluginName.replace(u".py"_s, u""_s, Qt::CaseInsensitive);
if (pluginInfo(pluginName)) if (pluginInfo(pluginName))
emit pluginUpdateFailed(pluginName, tr("Failed to download the plugin file. %1").arg(result.errorString)); emit pluginUpdateFailed(pluginName, tr("Failed to download the plugin file. %1").arg(result.errorString));
@ -474,20 +474,20 @@ void SearchPluginManager::updateNova()
// create nova directory if necessary // create nova directory if necessary
const Path enginePath = engineLocation(); const Path enginePath = engineLocation();
QFile packageFile {(enginePath / Path(u"__init__.py"_qs)).data()}; QFile packageFile {(enginePath / Path(u"__init__.py"_s)).data()};
packageFile.open(QIODevice::WriteOnly); packageFile.open(QIODevice::WriteOnly);
packageFile.close(); packageFile.close();
Utils::Fs::mkdir(enginePath / Path(u"engines"_qs)); Utils::Fs::mkdir(enginePath / Path(u"engines"_s));
QFile packageFile2 {(enginePath / Path(u"engines/__init__.py"_qs)).data()}; QFile packageFile2 {(enginePath / Path(u"engines/__init__.py"_s)).data()};
packageFile2.open(QIODevice::WriteOnly); packageFile2.open(QIODevice::WriteOnly);
packageFile2.close(); packageFile2.close();
// Copy search plugin files (if necessary) // Copy search plugin files (if necessary)
const auto updateFile = [&enginePath](const Path &filename, const bool compareVersion) const auto updateFile = [&enginePath](const Path &filename, const bool compareVersion)
{ {
const Path filePathBundled = Path(u":/searchengine/nova3"_qs) / filename; const Path filePathBundled = Path(u":/searchengine/nova3"_s) / filename;
const Path filePathDisk = enginePath / filename; const Path filePathDisk = enginePath / filename;
if (compareVersion && (getPluginVersion(filePathBundled) <= getPluginVersion(filePathDisk))) if (compareVersion && (getPluginVersion(filePathBundled) <= getPluginVersion(filePathDisk)))
@ -497,11 +497,11 @@ void SearchPluginManager::updateNova()
Utils::Fs::copyFile(filePathBundled, filePathDisk); Utils::Fs::copyFile(filePathBundled, filePathDisk);
}; };
updateFile(Path(u"helpers.py"_qs), true); updateFile(Path(u"helpers.py"_s), true);
updateFile(Path(u"nova2.py"_qs), true); updateFile(Path(u"nova2.py"_s), true);
updateFile(Path(u"nova2dl.py"_qs), true); updateFile(Path(u"nova2dl.py"_s), true);
updateFile(Path(u"novaprinter.py"_qs), true); updateFile(Path(u"novaprinter.py"_s), true);
updateFile(Path(u"socks.py"_qs), false); updateFile(Path(u"socks.py"_s), false);
} }
void SearchPluginManager::update() void SearchPluginManager::update()
@ -512,8 +512,8 @@ void SearchPluginManager::update()
const QStringList params const QStringList params
{ {
Utils::ForeignApps::PYTHON_ISOLATE_MODE_FLAG, Utils::ForeignApps::PYTHON_ISOLATE_MODE_FLAG,
(engineLocation() / Path(u"/nova2.py"_qs)).toString(), (engineLocation() / Path(u"/nova2.py"_s)).toString(),
u"--capabilities"_qs u"--capabilities"_s
}; };
nova.start(Utils::ForeignApps::pythonInfo().executableName, params, QIODevice::ReadOnly); nova.start(Utils::ForeignApps::pythonInfo().executableName, params, QIODevice::ReadOnly);
nova.waitForFinished(); nova.waitForFinished();
@ -544,10 +544,10 @@ void SearchPluginManager::update()
auto plugin = std::make_unique<PluginInfo>(); auto plugin = std::make_unique<PluginInfo>();
plugin->name = pluginName; plugin->name = pluginName;
plugin->version = getPluginVersion(pluginPath(pluginName)); plugin->version = getPluginVersion(pluginPath(pluginName));
plugin->fullName = engineElem.elementsByTagName(u"name"_qs).at(0).toElement().text(); plugin->fullName = engineElem.elementsByTagName(u"name"_s).at(0).toElement().text();
plugin->url = engineElem.elementsByTagName(u"url"_qs).at(0).toElement().text(); plugin->url = engineElem.elementsByTagName(u"url"_s).at(0).toElement().text();
const QStringList categories = engineElem.elementsByTagName(u"categories"_qs).at(0).toElement().text().split(u' '); const QStringList categories = engineElem.elementsByTagName(u"categories"_s).at(0).toElement().text().split(u' ');
for (QString cat : categories) for (QString cat : categories)
{ {
cat = cat.trimmed(); cat = cat.trimmed();

View file

@ -46,7 +46,7 @@ using namespace std::chrono_literals;
SettingsStorage *SettingsStorage::m_instance = nullptr; SettingsStorage *SettingsStorage::m_instance = nullptr;
SettingsStorage::SettingsStorage() SettingsStorage::SettingsStorage()
: m_nativeSettingsName {u"qBittorrent"_qs} : m_nativeSettingsName {u"qBittorrent"_s}
{ {
readNativeSettings(); readNativeSettings();

View file

@ -35,7 +35,7 @@ namespace
{ {
SettingValue<TorrentFileGuard::AutoDeleteMode> autoDeleteModeSetting() SettingValue<TorrentFileGuard::AutoDeleteMode> autoDeleteModeSetting()
{ {
return SettingValue<TorrentFileGuard::AutoDeleteMode> {u"Core/AutoDeleteAddedTorrentFile"_qs}; return SettingValue<TorrentFileGuard::AutoDeleteMode> {u"Core/AutoDeleteAddedTorrentFile"_s};
} }
} }

View file

@ -63,10 +63,10 @@ using namespace std::chrono_literals;
const std::chrono::seconds WATCH_INTERVAL {10}; const std::chrono::seconds WATCH_INTERVAL {10};
const int MAX_FAILED_RETRIES = 5; const int MAX_FAILED_RETRIES = 5;
const QString CONF_FILE_NAME = u"watched_folders.json"_qs; const QString CONF_FILE_NAME = u"watched_folders.json"_s;
const QString OPTION_ADDTORRENTPARAMS = u"add_torrent_params"_qs; const QString OPTION_ADDTORRENTPARAMS = u"add_torrent_params"_s;
const QString OPTION_RECURSIVE = u"recursive"_qs; const QString OPTION_RECURSIVE = u"recursive"_s;
namespace namespace
{ {
@ -227,7 +227,7 @@ void TorrentFilesWatcher::load()
void TorrentFilesWatcher::loadLegacy() void TorrentFilesWatcher::loadLegacy()
{ {
const auto dirs = SettingsStorage::instance()->loadValue<QVariantHash>(u"Preferences/Downloads/ScanDirsV2"_qs); const auto dirs = SettingsStorage::instance()->loadValue<QVariantHash>(u"Preferences/Downloads/ScanDirsV2"_s);
for (auto it = dirs.cbegin(); it != dirs.cend(); ++it) for (auto it = dirs.cbegin(); it != dirs.cend(); ++it)
{ {
@ -259,7 +259,7 @@ void TorrentFilesWatcher::loadLegacy()
} }
store(); store();
SettingsStorage::instance()->removeValue(u"Preferences/Downloads/ScanDirsV2"_qs); SettingsStorage::instance()->removeValue(u"Preferences/Downloads/ScanDirsV2"_s);
} }
void TorrentFilesWatcher::store() const void TorrentFilesWatcher::store() const
@ -406,7 +406,7 @@ void TorrentFilesWatcher::Worker::processWatchedFolder(const Path &path)
void TorrentFilesWatcher::Worker::processFolder(const Path &path, const Path &watchedFolderPath void TorrentFilesWatcher::Worker::processFolder(const Path &path, const Path &watchedFolderPath
, const TorrentFilesWatcher::WatchedFolderOptions &options) , const TorrentFilesWatcher::WatchedFolderOptions &options)
{ {
QDirIterator dirIter {path.data(), {u"*.torrent"_qs, u"*.magnet"_qs}, QDir::Files}; QDirIterator dirIter {path.data(), {u"*.torrent"_s, u"*.magnet"_s}, QDir::Files};
while (dirIter.hasNext()) while (dirIter.hasNext())
{ {
const Path filePath {dirIter.next()}; const Path filePath {dirIter.next()};
@ -426,7 +426,7 @@ void TorrentFilesWatcher::Worker::processFolder(const Path &path, const Path &wa
} }
} }
if (filePath.hasExtension(u".magnet"_qs)) if (filePath.hasExtension(u".magnet"_s))
{ {
const int fileMaxSize = 100 * 1024 * 1024; const int fileMaxSize = 100 * 1024 * 1024;

View file

@ -34,66 +34,66 @@
// we put all problematic UTF-8 chars/strings in this file. // we put all problematic UTF-8 chars/strings in this file.
// See issue #3059 for more details (https://github.com/qbittorrent/qBittorrent/issues/3059). // See issue #3059 for more details (https://github.com/qbittorrent/qBittorrent/issues/3059).
inline const QString C_COPYRIGHT = u"©"_qs; inline const QString C_COPYRIGHT = u"©"_s;
inline const QString C_INEQUALITY = u""_qs; inline const QString C_INEQUALITY = u""_s;
inline const QString C_INFINITY = u""_qs; inline const QString C_INFINITY = u""_s;
inline const QString C_NON_BREAKING_SPACE = u" "_qs; inline const QString C_NON_BREAKING_SPACE = u" "_s;
inline const QString C_THIN_SPACE = u""_qs; inline const QString C_THIN_SPACE = u""_s;
inline const QString C_UTP = u"μTP"_qs; inline const QString C_UTP = u"μTP"_s;
inline const QString C_LOCALE_ARABIC = u"عربي"_qs; inline const QString C_LOCALE_ARABIC = u"عربي"_s;
inline const QString C_LOCALE_ARMENIAN = u"Հայերեն"_qs; inline const QString C_LOCALE_ARMENIAN = u"Հայերեն"_s;
inline const QString C_LOCALE_AZERBAIJANI = u"Azərbaycan dili"_qs; inline const QString C_LOCALE_AZERBAIJANI = u"Azərbaycan dili"_s;
inline const QString C_LOCALE_BASQUE = u"Euskara"_qs; inline const QString C_LOCALE_BASQUE = u"Euskara"_s;
inline const QString C_LOCALE_BULGARIAN = u"Български"_qs; inline const QString C_LOCALE_BULGARIAN = u"Български"_s;
inline const QString C_LOCALE_BYELORUSSIAN = u"Беларуская"_qs; inline const QString C_LOCALE_BYELORUSSIAN = u"Беларуская"_s;
inline const QString C_LOCALE_CATALAN = u"Català"_qs; inline const QString C_LOCALE_CATALAN = u"Català"_s;
inline const QString C_LOCALE_CHINESE_SIMPLIFIED = u"简体中文"_qs; inline const QString C_LOCALE_CHINESE_SIMPLIFIED = u"简体中文"_s;
inline const QString C_LOCALE_CHINESE_TRADITIONAL_HK = u"香港正體字"_qs; inline const QString C_LOCALE_CHINESE_TRADITIONAL_HK = u"香港正體字"_s;
inline const QString C_LOCALE_CHINESE_TRADITIONAL_TW = u"正體中文"_qs; inline const QString C_LOCALE_CHINESE_TRADITIONAL_TW = u"正體中文"_s;
inline const QString C_LOCALE_CROATIAN = u"Hrvatski"_qs; inline const QString C_LOCALE_CROATIAN = u"Hrvatski"_s;
inline const QString C_LOCALE_CZECH = u"Čeština"_qs; inline const QString C_LOCALE_CZECH = u"Čeština"_s;
inline const QString C_LOCALE_DANISH = u"Dansk"_qs; inline const QString C_LOCALE_DANISH = u"Dansk"_s;
inline const QString C_LOCALE_DUTCH = u"Nederlands"_qs; inline const QString C_LOCALE_DUTCH = u"Nederlands"_s;
inline const QString C_LOCALE_ENGLISH = u"English"_qs; inline const QString C_LOCALE_ENGLISH = u"English"_s;
inline const QString C_LOCALE_ENGLISH_AUSTRALIA = u"English (Australia)"_qs; inline const QString C_LOCALE_ENGLISH_AUSTRALIA = u"English (Australia)"_s;
inline const QString C_LOCALE_ENGLISH_UNITEDKINGDOM = u"English (United Kingdom)"_qs; inline const QString C_LOCALE_ENGLISH_UNITEDKINGDOM = u"English (United Kingdom)"_s;
inline const QString C_LOCALE_ESPERANTO = u"Esperanto"_qs; inline const QString C_LOCALE_ESPERANTO = u"Esperanto"_s;
inline const QString C_LOCALE_ESTONIAN = u"Eesti, eesti keel"_qs; inline const QString C_LOCALE_ESTONIAN = u"Eesti, eesti keel"_s;
inline const QString C_LOCALE_FINNISH = u"Suomi"_qs; inline const QString C_LOCALE_FINNISH = u"Suomi"_s;
inline const QString C_LOCALE_FRENCH = u"Français"_qs; inline const QString C_LOCALE_FRENCH = u"Français"_s;
inline const QString C_LOCALE_GALICIAN = u"Galego"_qs; inline const QString C_LOCALE_GALICIAN = u"Galego"_s;
inline const QString C_LOCALE_GEORGIAN = u"ქართული"_qs; inline const QString C_LOCALE_GEORGIAN = u"ქართული"_s;
inline const QString C_LOCALE_GERMAN = u"Deutsch"_qs; inline const QString C_LOCALE_GERMAN = u"Deutsch"_s;
inline const QString C_LOCALE_GREEK = u"Ελληνικά"_qs; inline const QString C_LOCALE_GREEK = u"Ελληνικά"_s;
inline const QString C_LOCALE_HEBREW = u"עברית"_qs; inline const QString C_LOCALE_HEBREW = u"עברית"_s;
inline const QString C_LOCALE_HINDI = u"हिन्दी, हिंदी"_qs; inline const QString C_LOCALE_HINDI = u"हिन्दी, हिंदी"_s;
inline const QString C_LOCALE_HUNGARIAN = u"Magyar"_qs; inline const QString C_LOCALE_HUNGARIAN = u"Magyar"_s;
inline const QString C_LOCALE_ICELANDIC = u"Íslenska"_qs; inline const QString C_LOCALE_ICELANDIC = u"Íslenska"_s;
inline const QString C_LOCALE_INDONESIAN = u"Bahasa Indonesia"_qs; inline const QString C_LOCALE_INDONESIAN = u"Bahasa Indonesia"_s;
inline const QString C_LOCALE_ITALIAN = u"Italiano"_qs; inline const QString C_LOCALE_ITALIAN = u"Italiano"_s;
inline const QString C_LOCALE_JAPANESE = u"日本語"_qs; inline const QString C_LOCALE_JAPANESE = u"日本語"_s;
inline const QString C_LOCALE_KOREAN = u"한국어"_qs; inline const QString C_LOCALE_KOREAN = u"한국어"_s;
inline const QString C_LOCALE_LATGALIAN = u"Latgalīšu volūda"_qs; inline const QString C_LOCALE_LATGALIAN = u"Latgalīšu volūda"_s;
inline const QString C_LOCALE_LATVIAN = u"Latviešu valoda"_qs; inline const QString C_LOCALE_LATVIAN = u"Latviešu valoda"_s;
inline const QString C_LOCALE_LITHUANIAN = u"Lietuvių"_qs; inline const QString C_LOCALE_LITHUANIAN = u"Lietuvių"_s;
inline const QString C_LOCALE_MALAY = u"بهاس ملايو"_qs; inline const QString C_LOCALE_MALAY = u"بهاس ملايو"_s;
inline const QString C_LOCALE_MONGOLIAN = u"Монгол хэл"_qs; inline const QString C_LOCALE_MONGOLIAN = u"Монгол хэл"_s;
inline const QString C_LOCALE_NORWEGIAN = u"Norsk"_qs; inline const QString C_LOCALE_NORWEGIAN = u"Norsk"_s;
inline const QString C_LOCALE_OCCITAN = u"lenga d'òc"_qs; inline const QString C_LOCALE_OCCITAN = u"lenga d'òc"_s;
inline const QString C_LOCALE_PERSIAN = u"فارسی"_qs; inline const QString C_LOCALE_PERSIAN = u"فارسی"_s;
inline const QString C_LOCALE_POLISH = u"Polski"_qs; inline const QString C_LOCALE_POLISH = u"Polski"_s;
inline const QString C_LOCALE_PORTUGUESE = u"Português"_qs; inline const QString C_LOCALE_PORTUGUESE = u"Português"_s;
inline const QString C_LOCALE_PORTUGUESE_BRAZIL = u"Português brasileiro"_qs; inline const QString C_LOCALE_PORTUGUESE_BRAZIL = u"Português brasileiro"_s;
inline const QString C_LOCALE_ROMANIAN = u"Română"_qs; inline const QString C_LOCALE_ROMANIAN = u"Română"_s;
inline const QString C_LOCALE_RUSSIAN = u"Русский"_qs; inline const QString C_LOCALE_RUSSIAN = u"Русский"_s;
inline const QString C_LOCALE_SERBIAN = u"Српски"_qs; inline const QString C_LOCALE_SERBIAN = u"Српски"_s;
inline const QString C_LOCALE_SLOVAK = u"Slovenčina"_qs; inline const QString C_LOCALE_SLOVAK = u"Slovenčina"_s;
inline const QString C_LOCALE_SLOVENIAN = u"Slovenščina"_qs; inline const QString C_LOCALE_SLOVENIAN = u"Slovenščina"_s;
inline const QString C_LOCALE_SPANISH = u"Español"_qs; inline const QString C_LOCALE_SPANISH = u"Español"_s;
inline const QString C_LOCALE_SWEDISH = u"Svenska"_qs; inline const QString C_LOCALE_SWEDISH = u"Svenska"_s;
inline const QString C_LOCALE_THAI = u"ไทย"_qs; inline const QString C_LOCALE_THAI = u"ไทย"_s;
inline const QString C_LOCALE_TURKISH = u"Türkçe"_qs; inline const QString C_LOCALE_TURKISH = u"Türkçe"_s;
inline const QString C_LOCALE_UKRAINIAN = u"Українська"_qs; inline const QString C_LOCALE_UKRAINIAN = u"Українська"_s;
inline const QString C_LOCALE_UZBEK = u"أۇزبېك‎"_qs; inline const QString C_LOCALE_UZBEK = u"أۇزبېك‎"_s;
inline const QString C_LOCALE_VIETNAMESE = u"Tiếng Việt"_qs; inline const QString C_LOCALE_VIETNAMESE = u"Tiếng Việt"_s;

View file

@ -53,7 +53,7 @@ namespace
bool testPythonInstallation(const QString &exeName, PythonInfo &info) bool testPythonInstallation(const QString &exeName, PythonInfo &info)
{ {
QProcess proc; QProcess proc;
proc.start(exeName, {u"--version"_qs}, QIODevice::ReadOnly); proc.start(exeName, {u"--version"_s}, QIODevice::ReadOnly);
if (proc.waitForFinished() && (proc.exitCode() == QProcess::NormalExit)) if (proc.waitForFinished() && (proc.exitCode() == QProcess::NormalExit))
{ {
QByteArray procOutput = proc.readAllStandardOutput(); QByteArray procOutput = proc.readAllStandardOutput();
@ -71,7 +71,7 @@ namespace
// User reports: `python --version` -> "Python 3.6.6+" // User reports: `python --version` -> "Python 3.6.6+"
// So trim off unrelated characters // So trim off unrelated characters
const auto versionStr = QString::fromLocal8Bit(outputSplit[1]); const auto versionStr = QString::fromLocal8Bit(outputSplit[1]);
const int idx = versionStr.indexOf(QRegularExpression(u"[^\\.\\d]"_qs)); const int idx = versionStr.indexOf(QRegularExpression(u"[^\\.\\d]"_s));
const auto version = PythonInfo::Version::fromString(versionStr.left(idx)); const auto version = PythonInfo::Version::fromString(versionStr.left(idx));
if (!version.isValid()) if (!version.isValid())
return false; return false;
@ -186,15 +186,15 @@ namespace
{ {
const QDir baseDir {path}; const QDir baseDir {path};
if (baseDir.exists(u"python3.exe"_qs)) if (baseDir.exists(u"python3.exe"_s))
{ {
found = true; found = true;
path = baseDir.filePath(u"python3.exe"_qs); path = baseDir.filePath(u"python3.exe"_s);
} }
else if (baseDir.exists(u"python.exe"_qs)) else if (baseDir.exists(u"python.exe"_s))
{ {
found = true; found = true;
path = baseDir.filePath(u"python.exe"_qs); path = baseDir.filePath(u"python.exe"_s);
} }
} }
} }
@ -224,7 +224,7 @@ namespace
return path; return path;
// Fallback: Detect python from default locations // Fallback: Detect python from default locations
const QFileInfoList dirs = QDir(u"C:/"_qs).entryInfoList({u"Python*"_qs}, QDir::Dirs, (QDir::Name | QDir::Reversed)); const QFileInfoList dirs = QDir(u"C:/"_s).entryInfoList({u"Python*"_s}, QDir::Dirs, (QDir::Name | QDir::Reversed));
for (const QFileInfo &info : dirs) for (const QFileInfo &info : dirs)
{ {
const QString py3Path {info.absolutePath() + u"/python3.exe"}; const QString py3Path {info.absolutePath() + u"/python3.exe"};
@ -256,10 +256,10 @@ PythonInfo Utils::ForeignApps::pythonInfo()
static PythonInfo pyInfo; static PythonInfo pyInfo;
if (!pyInfo.isValid()) if (!pyInfo.isValid())
{ {
if (testPythonInstallation(u"python3"_qs, pyInfo)) if (testPythonInstallation(u"python3"_s, pyInfo))
return pyInfo; return pyInfo;
if (testPythonInstallation(u"python"_qs, pyInfo)) if (testPythonInstallation(u"python"_s, pyInfo))
return pyInfo; return pyInfo;
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)

View file

@ -36,7 +36,7 @@
namespace Utils::ForeignApps namespace Utils::ForeignApps
{ {
inline const QString PYTHON_ISOLATE_MODE_FLAG = u"-I"_qs; inline const QString PYTHON_ISOLATE_MODE_FLAG = u"-I"_s;
struct PythonInfo struct PythonInfo
{ {

View file

@ -81,12 +81,12 @@ bool Utils::Fs::smartRemoveEmptyFolderTree(const Path &path)
const QStringList deleteFilesList = const QStringList deleteFilesList =
{ {
// Windows // Windows
u"Thumbs.db"_qs, u"Thumbs.db"_s,
u"desktop.ini"_qs, u"desktop.ini"_s,
// Linux // Linux
u".directory"_qs, u".directory"_s,
// Mac OS // Mac OS
u".DS_Store"_qs u".DS_Store"_s
}; };
// travel from the deepest folder and remove anything unwanted on the way out. // travel from the deepest folder and remove anything unwanted on the way out.
@ -191,7 +191,7 @@ bool Utils::Fs::sameFiles(const Path &path1, const Path &path2)
QString Utils::Fs::toValidFileName(const QString &name, const QString &pad) QString Utils::Fs::toValidFileName(const QString &name, const QString &pad)
{ {
const QRegularExpression regex {u"[\\\\/:?\"*<>|]+"_qs}; const QRegularExpression regex {u"[\\\\/:?\"*<>|]+"_s};
QString validName = name.trimmed(); QString validName = name.trimmed();
validName.replace(regex, pad); validName.replace(regex, pad);
@ -201,7 +201,7 @@ QString Utils::Fs::toValidFileName(const QString &name, const QString &pad)
Path Utils::Fs::toValidPath(const QString &name, const QString &pad) Path Utils::Fs::toValidPath(const QString &name, const QString &pad)
{ {
const QRegularExpression regex {u"[:?\"*<>|]+"_qs}; const QRegularExpression regex {u"[:?\"*<>|]+"_s};
QString validPathStr = name; QString validPathStr = name;
validPathStr.replace(regex, pad); validPathStr.replace(regex, pad);
@ -216,7 +216,7 @@ qint64 Utils::Fs::freeDiskSpaceOnPath(const Path &path)
Path Utils::Fs::tempPath() Path Utils::Fs::tempPath()
{ {
static const Path path = Path(QDir::tempPath()) / Path(u".qBittorrent"_qs); static const Path path = Path(QDir::tempPath()) / Path(u".qBittorrent"_s);
mkdir(path); mkdir(path);
return path; return path;
} }

View file

@ -53,8 +53,8 @@ namespace Utils::Fs
QDateTime lastModified(const Path &path); QDateTime lastModified(const Path &path);
bool sameFiles(const Path &path1, const Path &path2); bool sameFiles(const Path &path1, const Path &path2);
QString toValidFileName(const QString &name, const QString &pad = u" "_qs); QString toValidFileName(const QString &name, const QString &pad = u" "_s);
Path toValidPath(const QString &name, const QString &pad = u" "_qs); Path toValidPath(const QString &name, const QString &pad = u" "_s);
Path toCanonicalPath(const Path &path); Path toCanonicalPath(const Path &path);
bool copyFile(const Path &from, const Path &to); bool copyFile(const Path &from, const Path &to);

View file

@ -193,59 +193,59 @@ void Utils::Misc::shutdownComputer(const ShutdownDialogAction &action)
if (action != ShutdownDialogAction::Shutdown) if (action != ShutdownDialogAction::Shutdown)
{ {
// Some recent systems use systemd's logind // Some recent systems use systemd's logind
QDBusInterface login1Iface(u"org.freedesktop.login1"_qs, u"/org/freedesktop/login1"_qs, QDBusInterface login1Iface(u"org.freedesktop.login1"_s, u"/org/freedesktop/login1"_s,
u"org.freedesktop.login1.Manager"_qs, QDBusConnection::systemBus()); u"org.freedesktop.login1.Manager"_s, QDBusConnection::systemBus());
if (login1Iface.isValid()) if (login1Iface.isValid())
{ {
if (action == ShutdownDialogAction::Suspend) if (action == ShutdownDialogAction::Suspend)
login1Iface.call(u"Suspend"_qs, false); login1Iface.call(u"Suspend"_s, false);
else else
login1Iface.call(u"Hibernate"_qs, false); login1Iface.call(u"Hibernate"_s, false);
return; return;
} }
// Else, other recent systems use UPower // Else, other recent systems use UPower
QDBusInterface upowerIface(u"org.freedesktop.UPower"_qs, u"/org/freedesktop/UPower"_qs, QDBusInterface upowerIface(u"org.freedesktop.UPower"_s, u"/org/freedesktop/UPower"_s,
u"org.freedesktop.UPower"_qs, QDBusConnection::systemBus()); u"org.freedesktop.UPower"_s, QDBusConnection::systemBus());
if (upowerIface.isValid()) if (upowerIface.isValid())
{ {
if (action == ShutdownDialogAction::Suspend) if (action == ShutdownDialogAction::Suspend)
upowerIface.call(u"Suspend"_qs); upowerIface.call(u"Suspend"_s);
else else
upowerIface.call(u"Hibernate"_qs); upowerIface.call(u"Hibernate"_s);
return; return;
} }
// HAL (older systems) // HAL (older systems)
QDBusInterface halIface(u"org.freedesktop.Hal"_qs, u"/org/freedesktop/Hal/devices/computer"_qs, QDBusInterface halIface(u"org.freedesktop.Hal"_s, u"/org/freedesktop/Hal/devices/computer"_s,
u"org.freedesktop.Hal.Device.SystemPowerManagement"_qs, u"org.freedesktop.Hal.Device.SystemPowerManagement"_s,
QDBusConnection::systemBus()); QDBusConnection::systemBus());
if (action == ShutdownDialogAction::Suspend) if (action == ShutdownDialogAction::Suspend)
halIface.call(u"Suspend"_qs, 5); halIface.call(u"Suspend"_s, 5);
else else
halIface.call(u"Hibernate"_qs); halIface.call(u"Hibernate"_s);
} }
else else
{ {
// Some recent systems use systemd's logind // Some recent systems use systemd's logind
QDBusInterface login1Iface(u"org.freedesktop.login1"_qs, u"/org/freedesktop/login1"_qs, QDBusInterface login1Iface(u"org.freedesktop.login1"_s, u"/org/freedesktop/login1"_s,
u"org.freedesktop.login1.Manager"_qs, QDBusConnection::systemBus()); u"org.freedesktop.login1.Manager"_s, QDBusConnection::systemBus());
if (login1Iface.isValid()) if (login1Iface.isValid())
{ {
login1Iface.call(u"PowerOff"_qs, false); login1Iface.call(u"PowerOff"_s, false);
return; return;
} }
// Else, other recent systems use ConsoleKit // Else, other recent systems use ConsoleKit
QDBusInterface consolekitIface(u"org.freedesktop.ConsoleKit"_qs, u"/org/freedesktop/ConsoleKit/Manager"_qs, QDBusInterface consolekitIface(u"org.freedesktop.ConsoleKit"_s, u"/org/freedesktop/ConsoleKit/Manager"_s,
u"org.freedesktop.ConsoleKit.Manager"_qs, QDBusConnection::systemBus()); u"org.freedesktop.ConsoleKit.Manager"_s, QDBusConnection::systemBus());
if (consolekitIface.isValid()) if (consolekitIface.isValid())
{ {
consolekitIface.call(u"Stop"_qs); consolekitIface.call(u"Stop"_s);
return; return;
} }
// HAL (older systems) // HAL (older systems)
QDBusInterface halIface(u"org.freedesktop.Hal"_qs, u"/org/freedesktop/Hal/devices/computer"_qs, QDBusInterface halIface(u"org.freedesktop.Hal"_s, u"/org/freedesktop/Hal/devices/computer"_s,
u"org.freedesktop.Hal.Device.SystemPowerManagement"_qs, u"org.freedesktop.Hal.Device.SystemPowerManagement"_s,
QDBusConnection::systemBus()); QDBusConnection::systemBus());
halIface.call(u"Shutdown"_qs); halIface.call(u"Shutdown"_s);
} }
#else #else
@ -308,48 +308,48 @@ bool Utils::Misc::isPreviewable(const Path &filePath)
const QSet<QString> multimediaExtensions = const QSet<QString> multimediaExtensions =
{ {
u".3GP"_qs, u".3GP"_s,
u".AAC"_qs, u".AAC"_s,
u".AC3"_qs, u".AC3"_s,
u".AIF"_qs, u".AIF"_s,
u".AIFC"_qs, u".AIFC"_s,
u".AIFF"_qs, u".AIFF"_s,
u".ASF"_qs, u".ASF"_s,
u".AU"_qs, u".AU"_s,
u".AVI"_qs, u".AVI"_s,
u".FLAC"_qs, u".FLAC"_s,
u".FLV"_qs, u".FLV"_s,
u".M3U"_qs, u".M3U"_s,
u".M4A"_qs, u".M4A"_s,
u".M4P"_qs, u".M4P"_s,
u".M4V"_qs, u".M4V"_s,
u".MID"_qs, u".MID"_s,
u".MKV"_qs, u".MKV"_s,
u".MOV"_qs, u".MOV"_s,
u".MP2"_qs, u".MP2"_s,
u".MP3"_qs, u".MP3"_s,
u".MP4"_qs, u".MP4"_s,
u".MPC"_qs, u".MPC"_s,
u".MPE"_qs, u".MPE"_s,
u".MPEG"_qs, u".MPEG"_s,
u".MPG"_qs, u".MPG"_s,
u".MPP"_qs, u".MPP"_s,
u".OGG"_qs, u".OGG"_s,
u".OGM"_qs, u".OGM"_s,
u".OGV"_qs, u".OGV"_s,
u".QT"_qs, u".QT"_s,
u".RA"_qs, u".RA"_s,
u".RAM"_qs, u".RAM"_s,
u".RM"_qs, u".RM"_s,
u".RMV"_qs, u".RMV"_s,
u".RMVB"_qs, u".RMVB"_s,
u".SWA"_qs, u".SWA"_s,
u".SWF"_qs, u".SWF"_s,
u".TS"_qs, u".TS"_s,
u".VOB"_qs, u".VOB"_s,
u".WAV"_qs, u".WAV"_s,
u".WMA"_qs, u".WMA"_s,
u".WMV"_qs u".WMV"_s
}; };
return multimediaExtensions.contains(filePath.extension().toUpper()); return multimediaExtensions.contains(filePath.extension().toUpper());
} }
@ -362,7 +362,7 @@ QString Utils::Misc::userFriendlyDuration(const qlonglong seconds, const qlonglo
return C_INFINITY; return C_INFINITY;
if (seconds == 0) if (seconds == 0)
return u"0"_qs; return u"0"_s;
if (seconds < 60) if (seconds < 60)
return QCoreApplication::translate("misc", "< 1m", "< 1 minute"); return QCoreApplication::translate("misc", "< 1m", "< 1 minute");
@ -392,7 +392,7 @@ QString Utils::Misc::userFriendlyDuration(const qlonglong seconds, const qlonglo
QString Utils::Misc::getUserIDString() QString Utils::Misc::getUserIDString()
{ {
QString uid = u"0"_qs; QString uid = u"0"_s;
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
const int UNLEN = 256; const int UNLEN = 256;
WCHAR buffer[UNLEN + 1] = {0}; WCHAR buffer[UNLEN + 1] = {0};
@ -540,15 +540,15 @@ QString Utils::Misc::parseHtmlLinks(const QString &rawText)
u"[a-zA-Z]{2,}" // one ab (2 char or longer) --> us u"[a-zA-Z]{2,}" // one ab (2 char or longer) --> us
u"([a-zA-Z0-9\\?%=&/_\\.:#;-]*)" // everything to 1st non-URI char, maybe nothing in case of del.icio.us/path u"([a-zA-Z0-9\\?%=&/_\\.:#;-]*)" // everything to 1st non-URI char, maybe nothing in case of del.icio.us/path
u")" u")"
u")"_qs u")"_s
); );
// Capture links // Capture links
result.replace(reURL, u"\\1<a href=\"\\2\">\\2</a>"_qs); result.replace(reURL, u"\\1<a href=\"\\2\">\\2</a>"_s);
// Capture links without scheme // Capture links without scheme
const QRegularExpression reNoScheme(u"<a\\s+href=\"(?!https?)([a-zA-Z0-9\\?%=&/_\\.-:#]+)\\s*\">"_qs); const QRegularExpression reNoScheme(u"<a\\s+href=\"(?!https?)([a-zA-Z0-9\\?%=&/_\\.-:#]+)\\s*\">"_s);
result.replace(reNoScheme, u"<a href=\"http://\\1\">"_qs); result.replace(reNoScheme, u"<a href=\"http://\\1\">"_s);
// to preserve plain text formatting // to preserve plain text formatting
result = u"<p style=\"white-space: pre-wrap;\">" + result + u"</p>"; result = u"<p style=\"white-space: pre-wrap;\">" + result + u"</p>";
@ -559,7 +559,7 @@ QString Utils::Misc::osName()
{ {
// static initialization for usage in signal handler // static initialization for usage in signal handler
static const QString name = static const QString name =
u"%1 %2 %3"_qs u"%1 %2 %3"_s
.arg(QSysInfo::prettyProductName() .arg(QSysInfo::prettyProductName()
, QSysInfo::kernelVersion() , QSysInfo::kernelVersion()
, QSysInfo::currentCpuArchitecture()); , QSysInfo::currentCpuArchitecture());
@ -569,7 +569,7 @@ QString Utils::Misc::osName()
QString Utils::Misc::boostVersionString() QString Utils::Misc::boostVersionString()
{ {
// static initialization for usage in signal handler // static initialization for usage in signal handler
static const QString ver = u"%1.%2.%3"_qs static const QString ver = u"%1.%2.%3"_s
.arg(QString::number(BOOST_VERSION / 100000) .arg(QString::number(BOOST_VERSION / 100000)
, QString::number((BOOST_VERSION / 100) % 1000) , QString::number((BOOST_VERSION / 100) % 1000)
, QString::number(BOOST_VERSION % 100)); , QString::number(BOOST_VERSION % 100));

View file

@ -60,7 +60,7 @@ namespace Utils
{ {
return (addr == QHostAddress::LocalHost) return (addr == QHostAddress::LocalHost)
|| (addr == QHostAddress::LocalHostIPv6) || (addr == QHostAddress::LocalHostIPv6)
|| (addr == QHostAddress(u"::ffff:127.0.0.1"_qs)); || (addr == QHostAddress(u"::ffff:127.0.0.1"_s));
} }
bool isIPInSubnets(const QHostAddress &addr, const QVector<Subnet> &subnets) bool isIPInSubnets(const QHostAddress &addr, const QVector<Subnet> &subnets)

View file

@ -56,7 +56,7 @@ namespace
using result_type = uint32_t; using result_type = uint32_t;
RandomLayer() RandomLayer()
: m_rtlGenRandom {Utils::Misc::loadWinAPI<PRTLGENRANDOM>(u"Advapi32.dll"_qs, "SystemFunction036")} : m_rtlGenRandom {Utils::Misc::loadWinAPI<PRTLGENRANDOM>(u"Advapi32.dll"_s, "SystemFunction036")}
{ {
if (!m_rtlGenRandom) if (!m_rtlGenRandom)
qFatal("Failed to load RtlGenRandom()"); qFatal("Failed to load RtlGenRandom()");

View file

@ -44,7 +44,7 @@ namespace Utils::String
QString wildcardToRegexPattern(const QString &pattern); QString wildcardToRegexPattern(const QString &pattern);
template <typename T> template <typename T>
T unquote(const T &str, const QString &quotes = u"\""_qs) T unquote(const T &str, const QString &quotes = u"\""_s)
{ {
if (str.length() < 2) return str; if (str.length() < 2) return str;

View file

@ -43,14 +43,14 @@
AboutDialog::AboutDialog(QWidget *parent) AboutDialog::AboutDialog(QWidget *parent)
: QDialog(parent) : QDialog(parent)
, m_ui(new Ui::AboutDialog) , m_ui(new Ui::AboutDialog)
, m_storeDialogSize(SETTINGS_KEY(u"Size"_qs)) , m_storeDialogSize(SETTINGS_KEY(u"Size"_s))
{ {
m_ui->setupUi(this); m_ui->setupUi(this);
// Title // Title
m_ui->labelName->setText(QStringLiteral("<b><h2>qBittorrent " QBT_VERSION " (%1-bit)</h2></b>").arg(QT_POINTER_SIZE * 8)); m_ui->labelName->setText(QStringLiteral("<b><h2>qBittorrent " QBT_VERSION " (%1-bit)</h2></b>").arg(QT_POINTER_SIZE * 8));
m_ui->logo->setPixmap(UIThemeManager::instance()->getScaledPixmap(u"qbittorrent-tray"_qs, 32)); m_ui->logo->setPixmap(UIThemeManager::instance()->getScaledPixmap(u"qbittorrent-tray"_s, 32));
// About // About
const QString aboutText = const QString aboutText =
@ -62,33 +62,33 @@ AboutDialog::AboutDialog(QWidget *parent)
u"<tr><td>%4</td><td><a href=\"https://forum.qbittorrent.org\">https://forum.qbittorrent.org</a></td></tr>" u"<tr><td>%4</td><td><a href=\"https://forum.qbittorrent.org\">https://forum.qbittorrent.org</a></td></tr>"
u"<tr><td>%5</td><td><a href=\"https://bugs.qbittorrent.org\">https://bugs.qbittorrent.org</a></td></tr>" u"<tr><td>%5</td><td><a href=\"https://bugs.qbittorrent.org\">https://bugs.qbittorrent.org</a></td></tr>"
u"</table>" u"</table>"
u"</p>"_qs u"</p>"_s
.arg(tr("An advanced BitTorrent client programmed in C++, based on Qt toolkit and libtorrent-rasterbar.") .arg(tr("An advanced BitTorrent client programmed in C++, based on Qt toolkit and libtorrent-rasterbar.")
.replace(u"C++"_qs, u"C\u2060+\u2060+"_qs) // make C++ non-breaking .replace(u"C++"_s, u"C\u2060+\u2060+"_s) // make C++ non-breaking
, tr("Copyright %1 2006-2022 The qBittorrent project").arg(C_COPYRIGHT) , tr("Copyright %1 2006-2022 The qBittorrent project").arg(C_COPYRIGHT)
, tr("Home Page:") , tr("Home Page:")
, tr("Forum:") , tr("Forum:")
, tr("Bug Tracker:")); , tr("Bug Tracker:"));
m_ui->labelAbout->setText(aboutText); m_ui->labelAbout->setText(aboutText);
m_ui->labelMascot->setPixmap(Utils::Gui::scaledPixmap(Path(u":/icons/mascot.png"_qs), this)); m_ui->labelMascot->setPixmap(Utils::Gui::scaledPixmap(Path(u":/icons/mascot.png"_s), this));
// Thanks // Thanks
if (const auto readResult = Utils::IO::readFile(Path(u":/thanks.html"_qs), -1, QIODevice::Text) if (const auto readResult = Utils::IO::readFile(Path(u":/thanks.html"_s), -1, QIODevice::Text)
; readResult) ; readResult)
{ {
m_ui->textBrowserThanks->setHtml(QString::fromUtf8(readResult.value())); m_ui->textBrowserThanks->setHtml(QString::fromUtf8(readResult.value()));
} }
// Translation // Translation
if (const auto readResult = Utils::IO::readFile(Path(u":/translators.html"_qs), -1, QIODevice::Text) if (const auto readResult = Utils::IO::readFile(Path(u":/translators.html"_s), -1, QIODevice::Text)
; readResult) ; readResult)
{ {
m_ui->textBrowserTranslation->setHtml(QString::fromUtf8(readResult.value())); m_ui->textBrowserTranslation->setHtml(QString::fromUtf8(readResult.value()));
} }
// License // License
if (const auto readResult = Utils::IO::readFile(Path(u":/gpl.html"_qs), -1, QIODevice::Text) if (const auto readResult = Utils::IO::readFile(Path(u":/gpl.html"_s), -1, QIODevice::Text)
; readResult) ; readResult)
{ {
m_ui->textBrowserLicense->setHtml(QString::fromUtf8(readResult.value())); m_ui->textBrowserLicense->setHtml(QString::fromUtf8(readResult.value()));
@ -103,7 +103,7 @@ AboutDialog::AboutDialog(QWidget *parent)
const QString DBIPText = u"<html><head/><body><p>" const QString DBIPText = u"<html><head/><body><p>"
u"%1 (<a href=\"https://db-ip.com/\">https://db-ip.com/</a>)" u"%1 (<a href=\"https://db-ip.com/\">https://db-ip.com/</a>)"
u"</p></body></html>"_qs u"</p></body></html>"_s
.arg(tr("The free IP to Country Lite database by DB-IP is used for resolving the countries of peers. " .arg(tr("The free IP to Country Lite database by DB-IP is used for resolving the countries of peers. "
"The database is licensed under the Creative Commons Attribution 4.0 International License")); "The database is licensed under the Creative Commons Attribution 4.0 International License"));
m_ui->labelDBIP->setText(DBIPText); m_ui->labelDBIP->setText(DBIPText);

View file

@ -67,11 +67,11 @@
namespace namespace
{ {
#define SETTINGS_KEY(name) u"AddNewTorrentDialog/" name #define SETTINGS_KEY(name) u"AddNewTorrentDialog/" name
const QString KEY_ENABLED = SETTINGS_KEY(u"Enabled"_qs); const QString KEY_ENABLED = SETTINGS_KEY(u"Enabled"_s);
const QString KEY_TOPLEVEL = SETTINGS_KEY(u"TopLevel"_qs); const QString KEY_TOPLEVEL = SETTINGS_KEY(u"TopLevel"_s);
const QString KEY_SAVEPATHHISTORY = SETTINGS_KEY(u"SavePathHistory"_qs); const QString KEY_SAVEPATHHISTORY = SETTINGS_KEY(u"SavePathHistory"_s);
const QString KEY_DOWNLOADPATHHISTORY = SETTINGS_KEY(u"DownloadPathHistory"_qs); const QString KEY_DOWNLOADPATHHISTORY = SETTINGS_KEY(u"DownloadPathHistory"_s);
const QString KEY_SAVEPATHHISTORYLENGTH = SETTINGS_KEY(u"SavePathHistoryLength"_qs); const QString KEY_SAVEPATHHISTORYLENGTH = SETTINGS_KEY(u"SavePathHistoryLength"_s);
// just a shortcut // just a shortcut
inline SettingsStorage *settings() inline SettingsStorage *settings()
@ -286,15 +286,15 @@ AddNewTorrentDialog::AddNewTorrentDialog(const BitTorrent::AddTorrentParams &inP
, m_ui(new Ui::AddNewTorrentDialog) , m_ui(new Ui::AddNewTorrentDialog)
, m_filterLine(new LineEdit(this)) , m_filterLine(new LineEdit(this))
, m_torrentParams(inParams) , m_torrentParams(inParams)
, m_storeDialogSize(SETTINGS_KEY(u"DialogSize"_qs)) , m_storeDialogSize(SETTINGS_KEY(u"DialogSize"_s))
, m_storeDefaultCategory(SETTINGS_KEY(u"DefaultCategory"_qs)) , m_storeDefaultCategory(SETTINGS_KEY(u"DefaultCategory"_s))
, m_storeRememberLastSavePath(SETTINGS_KEY(u"RememberLastSavePath"_qs)) , m_storeRememberLastSavePath(SETTINGS_KEY(u"RememberLastSavePath"_s))
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
, m_storeTreeHeaderState(u"GUI/Qt6/" SETTINGS_KEY(u"TreeHeaderState"_qs)) , m_storeTreeHeaderState(u"GUI/Qt6/" SETTINGS_KEY(u"TreeHeaderState"_s))
, m_storeSplitterState(u"GUI/Qt6/" SETTINGS_KEY(u"SplitterState"_qs)) , m_storeSplitterState(u"GUI/Qt6/" SETTINGS_KEY(u"SplitterState"_s))
#else #else
, m_storeTreeHeaderState(SETTINGS_KEY(u"TreeHeaderState"_qs)) , m_storeTreeHeaderState(SETTINGS_KEY(u"TreeHeaderState"_s))
, m_storeSplitterState(SETTINGS_KEY(u"SplitterState"_qs)) , m_storeSplitterState(SETTINGS_KEY(u"SplitterState"_s))
#endif #endif
{ {
// TODO: set dialog file properties using m_torrentParams.filePriorities // TODO: set dialog file properties using m_torrentParams.filePriorities
@ -365,7 +365,7 @@ AddNewTorrentDialog::AddNewTorrentDialog(const BitTorrent::AddTorrentParams &inP
m_ui->categoryComboBox->addItem(m_torrentParams.category); m_ui->categoryComboBox->addItem(m_torrentParams.category);
if (!defaultCategory.isEmpty()) if (!defaultCategory.isEmpty())
m_ui->categoryComboBox->addItem(defaultCategory); m_ui->categoryComboBox->addItem(defaultCategory);
m_ui->categoryComboBox->addItem(u""_qs); m_ui->categoryComboBox->addItem(u""_s);
for (const QString &category : asConst(categories)) for (const QString &category : asConst(categories))
{ {
@ -373,7 +373,7 @@ AddNewTorrentDialog::AddNewTorrentDialog(const BitTorrent::AddTorrentParams &inP
m_ui->categoryComboBox->addItem(category); m_ui->categoryComboBox->addItem(category);
} }
m_ui->tagsLineEdit->setText(m_torrentParams.tags.join(u", "_qs)); m_ui->tagsLineEdit->setText(m_torrentParams.tags.join(u", "_s));
connect(m_ui->tagsEditButton, &QAbstractButton::clicked, this, [this] connect(m_ui->tagsEditButton, &QAbstractButton::clicked, this, [this]
{ {
auto *dlg = new TorrentTagsDialog(m_torrentParams.tags, this); auto *dlg = new TorrentTagsDialog(m_torrentParams.tags, this);
@ -381,7 +381,7 @@ AddNewTorrentDialog::AddNewTorrentDialog(const BitTorrent::AddTorrentParams &inP
connect(dlg, &TorrentTagsDialog::accepted, this, [this, dlg] connect(dlg, &TorrentTagsDialog::accepted, this, [this, dlg]
{ {
m_torrentParams.tags = dlg->tags(); m_torrentParams.tags = dlg->tags();
m_ui->tagsLineEdit->setText(m_torrentParams.tags.join(u", "_qs)); m_ui->tagsLineEdit->setText(m_torrentParams.tags.join(u", "_s));
}); });
dlg->open(); dlg->open();
}); });

View file

@ -112,7 +112,7 @@ AddTorrentParamsWidget::AddTorrentParamsWidget(BitTorrent::AddTorrentParams addT
connect(dlg, &TorrentTagsDialog::accepted, this, [this, dlg] connect(dlg, &TorrentTagsDialog::accepted, this, [this, dlg]
{ {
m_addTorrentParams.tags = dlg->tags(); m_addTorrentParams.tags = dlg->tags();
m_ui->tagsLineEdit->setText(m_addTorrentParams.tags.join(u", "_qs)); m_ui->tagsLineEdit->setText(m_addTorrentParams.tags.join(u", "_s));
}); });
dlg->open(); dlg->open();
}); });
@ -163,7 +163,7 @@ void AddTorrentParamsWidget::populate()
std::sort(categories.begin(), categories.end(), Utils::Compare::NaturalLessThan<Qt::CaseInsensitive>()); std::sort(categories.begin(), categories.end(), Utils::Compare::NaturalLessThan<Qt::CaseInsensitive>());
if (!m_addTorrentParams.category.isEmpty()) if (!m_addTorrentParams.category.isEmpty())
m_ui->categoryComboBox->addItem(m_addTorrentParams.category); m_ui->categoryComboBox->addItem(m_addTorrentParams.category);
m_ui->categoryComboBox->addItem(u""_qs); m_ui->categoryComboBox->addItem(u""_s);
for (const QString &category : asConst(categories)) for (const QString &category : asConst(categories))
{ {
if (category != m_addTorrentParams.category) if (category != m_addTorrentParams.category)
@ -230,7 +230,7 @@ void AddTorrentParamsWidget::populate()
m_addTorrentParams.stopCondition = data.value<BitTorrent::Torrent::StopCondition>(); m_addTorrentParams.stopCondition = data.value<BitTorrent::Torrent::StopCondition>();
}); });
m_ui->tagsLineEdit->setText(m_addTorrentParams.tags.join(u", "_qs)); m_ui->tagsLineEdit->setText(m_addTorrentParams.tags.join(u", "_s));
m_ui->startTorrentComboBox->disconnect(this); m_ui->startTorrentComboBox->disconnect(this);
m_ui->startTorrentComboBox->setCurrentIndex(m_addTorrentParams.addPaused m_ui->startTorrentComboBox->setCurrentIndex(m_addTorrentParams.addPaused

View file

@ -48,7 +48,7 @@ namespace
{ {
QString makeLink(const QStringView url, const QStringView linkLabel) QString makeLink(const QStringView url, const QStringView linkLabel)
{ {
return u"<a href=\"%1\">%2</a>"_qs.arg(url, linkLabel); return u"<a href=\"%1\">%2</a>"_s.arg(url, linkLabel);
} }
enum AdvSettingsCols enum AdvSettingsCols
@ -424,7 +424,7 @@ void AdvancedSettings::loadAdvancedSettings()
, tr("Open documentation")) , tr("Open documentation"))
, this); , this);
labelQbtLink->setOpenExternalLinks(true); labelQbtLink->setOpenExternalLinks(true);
addRow(QBITTORRENT_HEADER, u"<b>%1</b>"_qs.arg(tr("qBittorrent Section")), labelQbtLink); addRow(QBITTORRENT_HEADER, u"<b>%1</b>"_s.arg(tr("qBittorrent Section")), labelQbtLink);
static_cast<QLabel *>(cellWidget(QBITTORRENT_HEADER, PROPERTY))->setAlignment(Qt::AlignCenter | Qt::AlignVCenter); static_cast<QLabel *>(cellWidget(QBITTORRENT_HEADER, PROPERTY))->setAlignment(Qt::AlignCenter | Qt::AlignVCenter);
auto *labelLibtorrentLink = new QLabel( auto *labelLibtorrentLink = new QLabel(
@ -432,7 +432,7 @@ void AdvancedSettings::loadAdvancedSettings()
, tr("Open documentation")) , tr("Open documentation"))
, this); , this);
labelLibtorrentLink->setOpenExternalLinks(true); labelLibtorrentLink->setOpenExternalLinks(true);
addRow(LIBTORRENT_HEADER, u"<b>%1</b>"_qs.arg(tr("libtorrent Section")), labelLibtorrentLink); addRow(LIBTORRENT_HEADER, u"<b>%1</b>"_s.arg(tr("libtorrent Section")), labelLibtorrentLink);
static_cast<QLabel *>(cellWidget(LIBTORRENT_HEADER, PROPERTY))->setAlignment(Qt::AlignCenter | Qt::AlignVCenter); static_cast<QLabel *>(cellWidget(LIBTORRENT_HEADER, PROPERTY))->setAlignment(Qt::AlignCenter | Qt::AlignVCenter);
m_comboBoxResumeDataStorage.addItem(tr("Fastresume files"), QVariant::fromValue(BitTorrent::ResumeDataStorageType::Legacy)); m_comboBoxResumeDataStorage.addItem(tr("Fastresume files"), QVariant::fromValue(BitTorrent::ResumeDataStorageType::Legacy));
@ -580,7 +580,7 @@ void AdvancedSettings::loadAdvancedSettings()
, &m_spinBoxSendBufferLowWatermark); , &m_spinBoxSendBufferLowWatermark);
m_spinBoxSendBufferWatermarkFactor.setMinimum(1); m_spinBoxSendBufferWatermarkFactor.setMinimum(1);
m_spinBoxSendBufferWatermarkFactor.setMaximum(std::numeric_limits<int>::max()); m_spinBoxSendBufferWatermarkFactor.setMaximum(std::numeric_limits<int>::max());
m_spinBoxSendBufferWatermarkFactor.setSuffix(u" %"_qs); m_spinBoxSendBufferWatermarkFactor.setSuffix(u" %"_s);
m_spinBoxSendBufferWatermarkFactor.setValue(session->sendBufferWatermarkFactor()); m_spinBoxSendBufferWatermarkFactor.setValue(session->sendBufferWatermarkFactor());
addRow(SEND_BUF_WATERMARK_FACTOR, (tr("Send buffer watermark factor") + u' ' + makeLink(u"https://www.libtorrent.org/reference-Settings.html#send_buffer_watermark_factor", u"(?)")) addRow(SEND_BUF_WATERMARK_FACTOR, (tr("Send buffer watermark factor") + u' ' + makeLink(u"https://www.libtorrent.org/reference-Settings.html#send_buffer_watermark_factor", u"(?)"))
, &m_spinBoxSendBufferWatermarkFactor); , &m_spinBoxSendBufferWatermarkFactor);
@ -818,12 +818,12 @@ void AdvancedSettings::loadAdvancedSettings()
m_spinBoxPeerTurnover.setMinimum(0); m_spinBoxPeerTurnover.setMinimum(0);
m_spinBoxPeerTurnover.setMaximum(100); m_spinBoxPeerTurnover.setMaximum(100);
m_spinBoxPeerTurnover.setValue(session->peerTurnover()); m_spinBoxPeerTurnover.setValue(session->peerTurnover());
m_spinBoxPeerTurnover.setSuffix(u" %"_qs); m_spinBoxPeerTurnover.setSuffix(u" %"_s);
addRow(PEER_TURNOVER, (tr("Peer turnover disconnect percentage") + u' ' + makeLink(u"https://www.libtorrent.org/reference-Settings.html#peer_turnover", u"(?)")) addRow(PEER_TURNOVER, (tr("Peer turnover disconnect percentage") + u' ' + makeLink(u"https://www.libtorrent.org/reference-Settings.html#peer_turnover", u"(?)"))
, &m_spinBoxPeerTurnover); , &m_spinBoxPeerTurnover);
m_spinBoxPeerTurnoverCutoff.setMinimum(0); m_spinBoxPeerTurnoverCutoff.setMinimum(0);
m_spinBoxPeerTurnoverCutoff.setMaximum(100); m_spinBoxPeerTurnoverCutoff.setMaximum(100);
m_spinBoxPeerTurnoverCutoff.setSuffix(u" %"_qs); m_spinBoxPeerTurnoverCutoff.setSuffix(u" %"_s);
m_spinBoxPeerTurnoverCutoff.setValue(session->peerTurnoverCutoff()); m_spinBoxPeerTurnoverCutoff.setValue(session->peerTurnoverCutoff());
addRow(PEER_TURNOVER_CUTOFF, (tr("Peer turnover threshold percentage") + u' ' + makeLink(u"https://www.libtorrent.org/reference-Settings.html#peer_turnover", u"(?)")) addRow(PEER_TURNOVER_CUTOFF, (tr("Peer turnover threshold percentage") + u' ' + makeLink(u"https://www.libtorrent.org/reference-Settings.html#peer_turnover", u"(?)"))
, &m_spinBoxPeerTurnoverCutoff); , &m_spinBoxPeerTurnoverCutoff);

View file

@ -43,7 +43,7 @@
BanListOptionsDialog::BanListOptionsDialog(QWidget *parent) BanListOptionsDialog::BanListOptionsDialog(QWidget *parent)
: QDialog(parent) : QDialog(parent)
, m_ui(new Ui::BanListOptionsDialog) , m_ui(new Ui::BanListOptionsDialog)
, m_storeDialogSize(SETTINGS_KEY(u"Size"_qs)) , m_storeDialogSize(SETTINGS_KEY(u"Size"_s))
, m_model(new QStringListModel(BitTorrent::Session::instance()->bannedIPs(), this)) , m_model(new QStringListModel(BitTorrent::Session::instance()->bannedIPs(), this))
{ {
m_ui->setupUi(this); m_ui->setupUi(this);

View file

@ -43,18 +43,18 @@ CookiesDialog::CookiesDialog(QWidget *parent)
: QDialog(parent) : QDialog(parent)
, m_ui(new Ui::CookiesDialog) , m_ui(new Ui::CookiesDialog)
, m_cookiesModel(new CookiesModel(Net::DownloadManager::instance()->allCookies(), this)) , m_cookiesModel(new CookiesModel(Net::DownloadManager::instance()->allCookies(), this))
, m_storeDialogSize(SETTINGS_KEY(u"Size"_qs)) , m_storeDialogSize(SETTINGS_KEY(u"Size"_s))
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
, m_storeViewState("GUI/Qt6/" SETTINGS_KEY(u"ViewState"_qs)) , m_storeViewState("GUI/Qt6/" SETTINGS_KEY(u"ViewState"_s))
#else #else
, m_storeViewState(SETTINGS_KEY(u"CookiesViewState"_qs)) , m_storeViewState(SETTINGS_KEY(u"CookiesViewState"_s))
#endif #endif
{ {
m_ui->setupUi(this); m_ui->setupUi(this);
setWindowIcon(UIThemeManager::instance()->getIcon(u"browser-cookies"_qs)); setWindowIcon(UIThemeManager::instance()->getIcon(u"browser-cookies"_s));
m_ui->buttonAdd->setIcon(UIThemeManager::instance()->getIcon(u"list-add"_qs)); m_ui->buttonAdd->setIcon(UIThemeManager::instance()->getIcon(u"list-add"_s));
m_ui->buttonDelete->setIcon(UIThemeManager::instance()->getIcon(u"list-remove"_qs)); m_ui->buttonDelete->setIcon(UIThemeManager::instance()->getIcon(u"list-remove"_s));
m_ui->buttonAdd->setIconSize(Utils::Gui::mediumIconSize()); m_ui->buttonAdd->setIconSize(Utils::Gui::mediumIconSize());
m_ui->buttonDelete->setIconSize(Utils::Gui::mediumIconSize()); m_ui->buttonDelete->setIconSize(Utils::Gui::mediumIconSize());

View file

@ -48,9 +48,9 @@ DeletionConfirmationDialog::DeletionConfirmationDialog(QWidget *parent, const in
// Icons // Icons
const QSize iconSize = Utils::Gui::largeIconSize(); const QSize iconSize = Utils::Gui::largeIconSize();
m_ui->labelWarning->setPixmap(UIThemeManager::instance()->getIcon(u"dialog-warning"_qs).pixmap(iconSize)); m_ui->labelWarning->setPixmap(UIThemeManager::instance()->getIcon(u"dialog-warning"_s).pixmap(iconSize));
m_ui->labelWarning->setFixedWidth(iconSize.width()); m_ui->labelWarning->setFixedWidth(iconSize.width());
m_ui->rememberBtn->setIcon(UIThemeManager::instance()->getIcon(u"object-locked"_qs)); m_ui->rememberBtn->setIcon(UIThemeManager::instance()->getIcon(u"object-locked"_s));
m_ui->rememberBtn->setIconSize(Utils::Gui::mediumIconSize()); m_ui->rememberBtn->setIconSize(Utils::Gui::mediumIconSize());
m_ui->checkPermDelete->setChecked(defaultDeleteFiles || Preferences::instance()->deleteTorrentFilesAsDefault()); m_ui->checkPermDelete->setChecked(defaultDeleteFiles || Preferences::instance()->deleteTorrentFilesAsDefault());

View file

@ -70,13 +70,13 @@ namespace
using namespace std::chrono_literals; using namespace std::chrono_literals;
#define SETTINGS_KEY(name) u"GUI/" name #define SETTINGS_KEY(name) u"GUI/" name
#define NOTIFICATIONS_SETTINGS_KEY(name) (SETTINGS_KEY(u"Notifications/"_qs) name) #define NOTIFICATIONS_SETTINGS_KEY(name) (SETTINGS_KEY(u"Notifications/"_s) name)
DesktopIntegration::DesktopIntegration(QObject *parent) DesktopIntegration::DesktopIntegration(QObject *parent)
: QObject(parent) : QObject(parent)
, m_storeNotificationEnabled {NOTIFICATIONS_SETTINGS_KEY(u"Enabled"_qs), true} , m_storeNotificationEnabled {NOTIFICATIONS_SETTINGS_KEY(u"Enabled"_s), true}
#ifdef QBT_USES_DBUS #ifdef QBT_USES_DBUS
, m_storeNotificationTimeOut {NOTIFICATIONS_SETTINGS_KEY(u"Timeout"_qs), -1} , m_storeNotificationTimeOut {NOTIFICATIONS_SETTINGS_KEY(u"Timeout"_s), -1}
#endif #endif
{ {
#ifdef Q_OS_MACOS #ifdef Q_OS_MACOS
@ -290,13 +290,13 @@ QIcon DesktopIntegration::getSystrayIcon() const
{ {
default: default:
case TrayIcon::Style::Normal: case TrayIcon::Style::Normal:
return UIThemeManager::instance()->getIcon(u"qbittorrent-tray"_qs); return UIThemeManager::instance()->getIcon(u"qbittorrent-tray"_s);
case TrayIcon::Style::MonoDark: case TrayIcon::Style::MonoDark:
return UIThemeManager::instance()->getIcon(u"qbittorrent-tray-dark"_qs); return UIThemeManager::instance()->getIcon(u"qbittorrent-tray-dark"_s);
case TrayIcon::Style::MonoLight: case TrayIcon::Style::MonoLight:
return UIThemeManager::instance()->getIcon(u"qbittorrent-tray-light"_qs); return UIThemeManager::instance()->getIcon(u"qbittorrent-tray-light"_s);
} }
} }
#endif // Q_OS_MACOS #endif // Q_OS_MACOS

View file

@ -51,17 +51,17 @@ namespace
return (Net::DownloadManager::hasSupportedScheme(str) return (Net::DownloadManager::hasSupportedScheme(str)
|| str.startsWith(u"magnet:", Qt::CaseInsensitive) || str.startsWith(u"magnet:", Qt::CaseInsensitive)
#ifdef QBT_USES_LIBTORRENT2 #ifdef QBT_USES_LIBTORRENT2
|| ((str.size() == 64) && !str.contains(QRegularExpression(u"[^0-9A-Fa-f]"_qs))) // v2 hex-encoded SHA-256 info-hash || ((str.size() == 64) && !str.contains(QRegularExpression(u"[^0-9A-Fa-f]"_s))) // v2 hex-encoded SHA-256 info-hash
#endif #endif
|| ((str.size() == 40) && !str.contains(QRegularExpression(u"[^0-9A-Fa-f]"_qs))) // v1 hex-encoded SHA-1 info-hash || ((str.size() == 40) && !str.contains(QRegularExpression(u"[^0-9A-Fa-f]"_s))) // v1 hex-encoded SHA-1 info-hash
|| ((str.size() == 32) && !str.contains(QRegularExpression(u"[^2-7A-Za-z]"_qs)))); // v1 Base32 encoded SHA-1 info-hash || ((str.size() == 32) && !str.contains(QRegularExpression(u"[^2-7A-Za-z]"_s)))); // v1 Base32 encoded SHA-1 info-hash
} }
} }
DownloadFromURLDialog::DownloadFromURLDialog(QWidget *parent) DownloadFromURLDialog::DownloadFromURLDialog(QWidget *parent)
: QDialog(parent) : QDialog(parent)
, m_ui(new Ui::DownloadFromURLDialog) , m_ui(new Ui::DownloadFromURLDialog)
, m_storeDialogSize(SETTINGS_KEY(u"Size"_qs)) , m_storeDialogSize(SETTINGS_KEY(u"Size"_s))
{ {
m_ui->setupUi(this); m_ui->setupUi(this);

View file

@ -69,8 +69,8 @@ ExecutionLogWidget::ExecutionLogWidget(const Log::MsgTypes types, QWidget *paren
m_ui->tabBan->layout()->addWidget(peerView); m_ui->tabBan->layout()->addWidget(peerView);
#ifndef Q_OS_MACOS #ifndef Q_OS_MACOS
m_ui->tabConsole->setTabIcon(0, UIThemeManager::instance()->getIcon(u"help-contents"_qs, u"view-calendar-journal"_qs)); m_ui->tabConsole->setTabIcon(0, UIThemeManager::instance()->getIcon(u"help-contents"_s, u"view-calendar-journal"_s));
m_ui->tabConsole->setTabIcon(1, UIThemeManager::instance()->getIcon(u"ip-blocked"_qs, u"view-filter"_qs)); m_ui->tabConsole->setTabIcon(1, UIThemeManager::instance()->getIcon(u"ip-blocked"_s, u"view-filter"_s));
#endif #endif
} }
@ -92,11 +92,11 @@ void ExecutionLogWidget::displayContextMenu(const LogListView *view, const BaseL
// only show copy action if any of the row is selected // only show copy action if any of the row is selected
if (view->currentIndex().isValid()) if (view->currentIndex().isValid())
{ {
menu->addAction(UIThemeManager::instance()->getIcon(u"edit-copy"_qs), tr("Copy") menu->addAction(UIThemeManager::instance()->getIcon(u"edit-copy"_s), tr("Copy")
, view, &LogListView::copySelection); , view, &LogListView::copySelection);
} }
menu->addAction(UIThemeManager::instance()->getIcon(u"edit-clear"_qs), tr("Clear") menu->addAction(UIThemeManager::instance()->getIcon(u"edit-clear"_s), tr("Clear")
, model, &BaseLogModel::reset); , model, &BaseLogModel::reset);
menu->popup(QCursor::pos()); menu->popup(QCursor::pos());

View file

@ -43,7 +43,7 @@
IPSubnetWhitelistOptionsDialog::IPSubnetWhitelistOptionsDialog(QWidget *parent) IPSubnetWhitelistOptionsDialog::IPSubnetWhitelistOptionsDialog(QWidget *parent)
: QDialog(parent) : QDialog(parent)
, m_ui(new Ui::IPSubnetWhitelistOptionsDialog) , m_ui(new Ui::IPSubnetWhitelistOptionsDialog)
, m_storeDialogSize(SETTINGS_KEY(u"Size"_qs)) , m_storeDialogSize(SETTINGS_KEY(u"Size"_s))
{ {
m_ui->setupUi(this); m_ui->setupUi(this);

View file

@ -38,7 +38,7 @@
LineEdit::LineEdit(QWidget *parent) LineEdit::LineEdit(QWidget *parent)
: QLineEdit(parent) : QLineEdit(parent)
{ {
auto *action = new QAction(UIThemeManager::instance()->getIcon(u"edit-find"_qs), QString()); auto *action = new QAction(UIThemeManager::instance()->getIcon(u"edit-find"_s), QString());
addAction(action, QLineEdit::LeadingPosition); addAction(action, QLineEdit::LeadingPosition);
setClearButtonEnabled(true); setClearButtonEnabled(true);

View file

@ -47,7 +47,7 @@
namespace namespace
{ {
const QString SEPARATOR = u" - "_qs; const QString SEPARATOR = u" - "_s;
int horizontalAdvance(const QFontMetrics &fontMetrics, const QString &text) int horizontalAdvance(const QFontMetrics &fontMetrics, const QString &text)
{ {

View file

@ -42,32 +42,32 @@ namespace
QColor getTimestampColor() QColor getTimestampColor()
{ {
return UIThemeManager::instance()->getColor(u"Log.TimeStamp"_qs); return UIThemeManager::instance()->getColor(u"Log.TimeStamp"_s);
} }
QColor getLogNormalColor() QColor getLogNormalColor()
{ {
return UIThemeManager::instance()->getColor(u"Log.Normal"_qs); return UIThemeManager::instance()->getColor(u"Log.Normal"_s);
} }
QColor getLogInfoColor() QColor getLogInfoColor()
{ {
return UIThemeManager::instance()->getColor(u"Log.Info"_qs); return UIThemeManager::instance()->getColor(u"Log.Info"_s);
} }
QColor getLogWarningColor() QColor getLogWarningColor()
{ {
return UIThemeManager::instance()->getColor(u"Log.Warning"_qs); return UIThemeManager::instance()->getColor(u"Log.Warning"_s);
} }
QColor getLogCriticalColor() QColor getLogCriticalColor()
{ {
return UIThemeManager::instance()->getColor(u"Log.Critical"_qs); return UIThemeManager::instance()->getColor(u"Log.Critical"_s);
} }
QColor getPeerBannedColor() QColor getPeerBannedColor()
{ {
return UIThemeManager::instance()->getColor(u"Log.BannedPeer"_qs); return UIThemeManager::instance()->getColor(u"Log.BannedPeer"_s);
} }
} }

View file

@ -112,7 +112,7 @@ using namespace std::chrono_literals;
namespace namespace
{ {
#define SETTINGS_KEY(name) u"GUI/" name #define SETTINGS_KEY(name) u"GUI/" name
#define EXECUTIONLOG_SETTINGS_KEY(name) (SETTINGS_KEY(u"Log/"_qs) name) #define EXECUTIONLOG_SETTINGS_KEY(name) (SETTINGS_KEY(u"Log/"_s) name)
const std::chrono::seconds PREVENT_SUSPEND_INTERVAL {60}; const std::chrono::seconds PREVENT_SUSPEND_INTERVAL {60};
@ -128,9 +128,9 @@ namespace
MainWindow::MainWindow(IGUIApplication *app, WindowState initialState) MainWindow::MainWindow(IGUIApplication *app, WindowState initialState)
: GUIApplicationComponent(app) : GUIApplicationComponent(app)
, m_ui(new Ui::MainWindow) , m_ui(new Ui::MainWindow)
, m_storeExecutionLogEnabled(EXECUTIONLOG_SETTINGS_KEY(u"Enabled"_qs)) , m_storeExecutionLogEnabled(EXECUTIONLOG_SETTINGS_KEY(u"Enabled"_s))
, m_storeDownloadTrackerFavicon(SETTINGS_KEY(u"DownloadTrackerFavicon"_qs)) , m_storeDownloadTrackerFavicon(SETTINGS_KEY(u"DownloadTrackerFavicon"_s))
, m_storeExecutionLogTypes(EXECUTIONLOG_SETTINGS_KEY(u"Types"_qs), Log::MsgType::ALL) , m_storeExecutionLogTypes(EXECUTIONLOG_SETTINGS_KEY(u"Types"_s), Log::MsgType::ALL)
{ {
m_ui->setupUi(this); m_ui->setupUi(this);
@ -140,7 +140,7 @@ MainWindow::MainWindow(IGUIApplication *app, WindowState initialState)
m_displaySpeedInTitle = pref->speedInTitleBar(); m_displaySpeedInTitle = pref->speedInTitleBar();
// Setting icons // Setting icons
#ifndef Q_OS_MACOS #ifndef Q_OS_MACOS
setWindowIcon(UIThemeManager::instance()->getIcon(u"qbittorrent"_qs)); setWindowIcon(UIThemeManager::instance()->getIcon(u"qbittorrent"_s));
#endif // Q_OS_MACOS #endif // Q_OS_MACOS
#if (defined(Q_OS_UNIX)) #if (defined(Q_OS_UNIX))
@ -149,30 +149,30 @@ MainWindow::MainWindow(IGUIApplication *app, WindowState initialState)
addToolbarContextMenu(); addToolbarContextMenu();
m_ui->actionOpen->setIcon(UIThemeManager::instance()->getIcon(u"list-add"_qs)); m_ui->actionOpen->setIcon(UIThemeManager::instance()->getIcon(u"list-add"_s));
m_ui->actionDownloadFromURL->setIcon(UIThemeManager::instance()->getIcon(u"insert-link"_qs)); m_ui->actionDownloadFromURL->setIcon(UIThemeManager::instance()->getIcon(u"insert-link"_s));
m_ui->actionSetGlobalSpeedLimits->setIcon(UIThemeManager::instance()->getIcon(u"speedometer"_qs)); m_ui->actionSetGlobalSpeedLimits->setIcon(UIThemeManager::instance()->getIcon(u"speedometer"_s));
m_ui->actionCreateTorrent->setIcon(UIThemeManager::instance()->getIcon(u"torrent-creator"_qs, u"document-edit"_qs)); m_ui->actionCreateTorrent->setIcon(UIThemeManager::instance()->getIcon(u"torrent-creator"_s, u"document-edit"_s));
m_ui->actionAbout->setIcon(UIThemeManager::instance()->getIcon(u"help-about"_qs)); m_ui->actionAbout->setIcon(UIThemeManager::instance()->getIcon(u"help-about"_s));
m_ui->actionStatistics->setIcon(UIThemeManager::instance()->getIcon(u"view-statistics"_qs)); m_ui->actionStatistics->setIcon(UIThemeManager::instance()->getIcon(u"view-statistics"_s));
m_ui->actionTopQueuePos->setIcon(UIThemeManager::instance()->getIcon(u"go-top"_qs)); m_ui->actionTopQueuePos->setIcon(UIThemeManager::instance()->getIcon(u"go-top"_s));
m_ui->actionIncreaseQueuePos->setIcon(UIThemeManager::instance()->getIcon(u"go-up"_qs)); m_ui->actionIncreaseQueuePos->setIcon(UIThemeManager::instance()->getIcon(u"go-up"_s));
m_ui->actionDecreaseQueuePos->setIcon(UIThemeManager::instance()->getIcon(u"go-down"_qs)); m_ui->actionDecreaseQueuePos->setIcon(UIThemeManager::instance()->getIcon(u"go-down"_s));
m_ui->actionBottomQueuePos->setIcon(UIThemeManager::instance()->getIcon(u"go-bottom"_qs)); m_ui->actionBottomQueuePos->setIcon(UIThemeManager::instance()->getIcon(u"go-bottom"_s));
m_ui->actionDelete->setIcon(UIThemeManager::instance()->getIcon(u"list-remove"_qs)); m_ui->actionDelete->setIcon(UIThemeManager::instance()->getIcon(u"list-remove"_s));
m_ui->actionDocumentation->setIcon(UIThemeManager::instance()->getIcon(u"help-contents"_qs)); m_ui->actionDocumentation->setIcon(UIThemeManager::instance()->getIcon(u"help-contents"_s));
m_ui->actionDonateMoney->setIcon(UIThemeManager::instance()->getIcon(u"wallet-open"_qs)); m_ui->actionDonateMoney->setIcon(UIThemeManager::instance()->getIcon(u"wallet-open"_s));
m_ui->actionExit->setIcon(UIThemeManager::instance()->getIcon(u"application-exit"_qs)); m_ui->actionExit->setIcon(UIThemeManager::instance()->getIcon(u"application-exit"_s));
m_ui->actionLock->setIcon(UIThemeManager::instance()->getIcon(u"object-locked"_qs)); m_ui->actionLock->setIcon(UIThemeManager::instance()->getIcon(u"object-locked"_s));
m_ui->actionOptions->setIcon(UIThemeManager::instance()->getIcon(u"configure"_qs, u"preferences-system"_qs)); m_ui->actionOptions->setIcon(UIThemeManager::instance()->getIcon(u"configure"_s, u"preferences-system"_s));
m_ui->actionPause->setIcon(UIThemeManager::instance()->getIcon(u"torrent-stop"_qs, u"media-playback-pause"_qs)); m_ui->actionPause->setIcon(UIThemeManager::instance()->getIcon(u"torrent-stop"_s, u"media-playback-pause"_s));
m_ui->actionPauseAll->setIcon(UIThemeManager::instance()->getIcon(u"torrent-stop"_qs, u"media-playback-pause"_qs)); m_ui->actionPauseAll->setIcon(UIThemeManager::instance()->getIcon(u"torrent-stop"_s, u"media-playback-pause"_s));
m_ui->actionStart->setIcon(UIThemeManager::instance()->getIcon(u"torrent-start"_qs, u"media-playback-start"_qs)); m_ui->actionStart->setIcon(UIThemeManager::instance()->getIcon(u"torrent-start"_s, u"media-playback-start"_s));
m_ui->actionStartAll->setIcon(UIThemeManager::instance()->getIcon(u"torrent-start"_qs, u"media-playback-start"_qs)); m_ui->actionStartAll->setIcon(UIThemeManager::instance()->getIcon(u"torrent-start"_s, u"media-playback-start"_s));
m_ui->menuAutoShutdownOnDownloadsCompletion->setIcon(UIThemeManager::instance()->getIcon(u"task-complete"_qs, u"application-exit"_qs)); m_ui->menuAutoShutdownOnDownloadsCompletion->setIcon(UIThemeManager::instance()->getIcon(u"task-complete"_s, u"application-exit"_s));
m_ui->actionManageCookies->setIcon(UIThemeManager::instance()->getIcon(u"browser-cookies"_qs, u"preferences-web-browser-cookies"_qs)); m_ui->actionManageCookies->setIcon(UIThemeManager::instance()->getIcon(u"browser-cookies"_s, u"preferences-web-browser-cookies"_s));
m_ui->menuLog->setIcon(UIThemeManager::instance()->getIcon(u"help-contents"_qs)); m_ui->menuLog->setIcon(UIThemeManager::instance()->getIcon(u"help-contents"_s));
m_ui->actionCheckForUpdates->setIcon(UIThemeManager::instance()->getIcon(u"view-refresh"_qs)); m_ui->actionCheckForUpdates->setIcon(UIThemeManager::instance()->getIcon(u"view-refresh"_s));
auto *lockMenu = new QMenu(this); auto *lockMenu = new QMenu(this);
lockMenu->addAction(tr("&Set Password"), this, &MainWindow::defineUILockPassword); lockMenu->addAction(tr("&Set Password"), this, &MainWindow::defineUILockPassword);
@ -231,7 +231,7 @@ MainWindow::MainWindow(IGUIApplication *app, WindowState initialState)
m_splitter->setCollapsible(0, false); m_splitter->setCollapsible(0, false);
m_tabs->addTab(m_splitter, m_tabs->addTab(m_splitter,
#ifndef Q_OS_MACOS #ifndef Q_OS_MACOS
UIThemeManager::instance()->getIcon(u"folder-remote"_qs), UIThemeManager::instance()->getIcon(u"folder-remote"_s),
#endif #endif
tr("Transfers")); tr("Transfers"));
// Filter types // Filter types
@ -678,7 +678,7 @@ void MainWindow::displayRSSTab(bool enable)
m_tabs->addTab(m_rssWidget, tr("RSS (%1)").arg(RSS::Session::instance()->rootFolder()->unreadCount())); m_tabs->addTab(m_rssWidget, tr("RSS (%1)").arg(RSS::Session::instance()->rootFolder()->unreadCount()));
#else #else
const int indexTab = m_tabs->addTab(m_rssWidget, tr("RSS (%1)").arg(RSS::Session::instance()->rootFolder()->unreadCount())); const int indexTab = m_tabs->addTab(m_rssWidget, tr("RSS (%1)").arg(RSS::Session::instance()->rootFolder()->unreadCount()));
m_tabs->setTabIcon(indexTab, UIThemeManager::instance()->getIcon(u"application-rss"_qs)); m_tabs->setTabIcon(indexTab, UIThemeManager::instance()->getIcon(u"application-rss"_s));
#endif #endif
} }
} }
@ -716,7 +716,7 @@ void MainWindow::displaySearchTab(bool enable)
m_searchWidget = new SearchWidget(app(), this); m_searchWidget = new SearchWidget(app(), this);
m_tabs->insertTab(1, m_searchWidget, m_tabs->insertTab(1, m_searchWidget,
#ifndef Q_OS_MACOS #ifndef Q_OS_MACOS
UIThemeManager::instance()->getIcon(u"edit-find"_qs), UIThemeManager::instance()->getIcon(u"edit-find"_s),
#endif #endif
tr("Search")); tr("Search"));
} }
@ -740,7 +740,7 @@ void MainWindow::updateNbTorrents()
void MainWindow::on_actionDocumentation_triggered() const void MainWindow::on_actionDocumentation_triggered() const
{ {
QDesktopServices::openUrl(QUrl(u"https://doc.qbittorrent.org"_qs)); QDesktopServices::openUrl(QUrl(u"https://doc.qbittorrent.org"_s));
} }
void MainWindow::tabChanged(int newTab) void MainWindow::tabChanged(int newTab)
@ -1338,7 +1338,7 @@ void MainWindow::dragEnterEvent(QDragEnterEvent *event)
for (const QString &mime : asConst(event->mimeData()->formats())) for (const QString &mime : asConst(event->mimeData()->formats()))
qDebug("mimeData: %s", mime.toLocal8Bit().data()); qDebug("mimeData: %s", mime.toLocal8Bit().data());
if (event->mimeData()->hasFormat(u"text/plain"_qs) || event->mimeData()->hasFormat(u"text/uri-list"_qs)) if (event->mimeData()->hasFormat(u"text/plain"_s) || event->mimeData()->hasFormat(u"text/uri-list"_s))
event->acceptProposedAction(); event->acceptProposedAction();
} }
@ -1537,7 +1537,7 @@ void MainWindow::reloadSessionStats()
MacUtils::setBadgeLabelText({}); MacUtils::setBadgeLabelText({});
} }
#else #else
const auto toolTip = u"%1\n%2"_qs.arg( const auto toolTip = u"%1\n%2"_s.arg(
tr("DL speed: %1", "e.g: Download speed: 10 KiB/s").arg(Utils::Misc::friendlyUnit(status.payloadDownloadRate, true)) tr("DL speed: %1", "e.g: Download speed: 10 KiB/s").arg(Utils::Misc::friendlyUnit(status.payloadDownloadRate, true))
, tr("UP speed: %1", "e.g: Upload speed: 10 KiB/s").arg(Utils::Misc::friendlyUnit(status.payloadUploadRate, true))); , tr("UP speed: %1", "e.g: Upload speed: 10 KiB/s").arg(Utils::Misc::friendlyUnit(status.payloadUploadRate, true)));
app()->desktopIntegration()->setToolTip(toolTip); // tray icon app()->desktopIntegration()->setToolTip(toolTip); // tray icon
@ -1775,7 +1775,7 @@ void MainWindow::handleUpdateCheckFinished(ProgramUpdater *updater, const bool i
{ {
const QString msg {tr("A new version is available.") + u"<br/>" const QString msg {tr("A new version is available.") + u"<br/>"
+ tr("Do you want to download %1?").arg(newVersion) + u"<br/><br/>" + tr("Do you want to download %1?").arg(newVersion) + u"<br/><br/>"
+ u"<a href=\"https://www.qbittorrent.org/news.php\">%1</a>"_qs.arg(tr("Open changelog..."))}; + u"<a href=\"https://www.qbittorrent.org/news.php\">%1</a>"_s.arg(tr("Open changelog..."))};
auto *msgBox = new QMessageBox {QMessageBox::Question, tr("qBittorrent Update Available"), msg auto *msgBox = new QMessageBox {QMessageBox::Question, tr("qBittorrent Update Available"), msg
, (QMessageBox::Yes | QMessageBox::No), this}; , (QMessageBox::Yes | QMessageBox::No), this};
msgBox->setAttribute(Qt::WA_DeleteOnClose); msgBox->setAttribute(Qt::WA_DeleteOnClose);
@ -1796,7 +1796,7 @@ void MainWindow::handleUpdateCheckFinished(ProgramUpdater *updater, const bool i
{ {
if (invokedByUser) if (invokedByUser)
{ {
auto *msgBox = new QMessageBox {QMessageBox::Information, u"qBittorrent"_qs auto *msgBox = new QMessageBox {QMessageBox::Information, u"qBittorrent"_s
, tr("No updates available.\nYou are already using the latest version.") , tr("No updates available.\nYou are already using the latest version.")
, QMessageBox::Ok, this}; , QMessageBox::Ok, this};
msgBox->setAttribute(Qt::WA_DeleteOnClose); msgBox->setAttribute(Qt::WA_DeleteOnClose);
@ -1820,7 +1820,7 @@ void MainWindow::toggleAlternativeSpeeds()
void MainWindow::on_actionDonateMoney_triggered() void MainWindow::on_actionDonateMoney_triggered()
{ {
QDesktopServices::openUrl(QUrl(u"https://www.qbittorrent.org/donate"_qs)); QDesktopServices::openUrl(QUrl(u"https://www.qbittorrent.org/donate"_s));
} }
void MainWindow::showConnectionSettings() void MainWindow::showConnectionSettings()
@ -1844,7 +1844,7 @@ void MainWindow::on_actionExecutionLogs_triggered(bool checked)
m_tabs->addTab(m_executionLog, tr("Execution Log")); m_tabs->addTab(m_executionLog, tr("Execution Log"));
#else #else
const int indexTab = m_tabs->addTab(m_executionLog, tr("Execution Log")); const int indexTab = m_tabs->addTab(m_executionLog, tr("Execution Log"));
m_tabs->setTabIcon(indexTab, UIThemeManager::instance()->getIcon(u"help-contents"_qs)); m_tabs->setTabIcon(indexTab, UIThemeManager::instance()->getIcon(u"help-contents"_s));
#endif #endif
} }
else else
@ -1970,12 +1970,12 @@ void MainWindow::installPython()
// Download python // Download python
#ifdef QBT_APP_64BIT #ifdef QBT_APP_64BIT
const auto installerURL = ::IsWindows8OrGreater() const auto installerURL = ::IsWindows8OrGreater()
? u"https://www.python.org/ftp/python/3.10.11/python-3.10.11-amd64.exe"_qs ? u"https://www.python.org/ftp/python/3.10.11/python-3.10.11-amd64.exe"_s
: u"https://www.python.org/ftp/python/3.8.10/python-3.8.10-amd64.exe"_qs; : u"https://www.python.org/ftp/python/3.8.10/python-3.8.10-amd64.exe"_s;
#else #else
const auto installerURL = ::IsWindows8OrGreater() const auto installerURL = ::IsWindows8OrGreater()
? u"https://www.python.org/ftp/python/3.10.11/python-3.10.11.exe"_qs ? u"https://www.python.org/ftp/python/3.10.11/python-3.10.11.exe"_s
: u"https://www.python.org/ftp/python/3.8.10/python-3.8.10.exe"_qs; : u"https://www.python.org/ftp/python/3.8.10/python-3.8.10.exe"_s;
#endif #endif
Net::DownloadManager::instance()->download( Net::DownloadManager::instance()->download(
Net::DownloadRequest(installerURL).saveToFile(true) Net::DownloadRequest(installerURL).saveToFile(true)
@ -2001,7 +2001,7 @@ void MainWindow::pythonDownloadFinished(const Net::DownloadResult &result)
const Path exePath = result.filePath + u".exe"; const Path exePath = result.filePath + u".exe";
Utils::Fs::renameFile(result.filePath, exePath); Utils::Fs::renameFile(result.filePath, exePath);
installer.start(exePath.toString(), {u"/passive"_qs}); installer.start(exePath.toString(), {u"/passive"_s});
// Wait for setup to complete // Wait for setup to complete
installer.waitForFinished(10 * 60 * 1000); installer.waitForFinished(10 * 60 * 1000);

View file

@ -42,17 +42,17 @@ DBusNotificationsInterface::DBusNotificationsInterface(const QString &service
QDBusPendingReply<QStringList> DBusNotificationsInterface::getCapabilities() QDBusPendingReply<QStringList> DBusNotificationsInterface::getCapabilities()
{ {
return asyncCall(u"GetCapabilities"_qs); return asyncCall(u"GetCapabilities"_s);
} }
QDBusPendingReply<QString, QString, QString, QString> DBusNotificationsInterface::getServerInformation() QDBusPendingReply<QString, QString, QString, QString> DBusNotificationsInterface::getServerInformation()
{ {
return asyncCall(u"GetServerInformation"_qs); return asyncCall(u"GetServerInformation"_s);
} }
QDBusReply<QString> DBusNotificationsInterface::getServerInformation(QString &vendor, QString &version, QString &specVersion) QDBusReply<QString> DBusNotificationsInterface::getServerInformation(QString &vendor, QString &version, QString &specVersion)
{ {
const QDBusMessage reply = call(QDBus::Block, u"GetServerInformation"_qs); const QDBusMessage reply = call(QDBus::Block, u"GetServerInformation"_s);
if ((reply.type() == QDBusMessage::ReplyMessage) && (reply.arguments().count() == 4)) if ((reply.type() == QDBusMessage::ReplyMessage) && (reply.arguments().count() == 4))
{ {
vendor = qdbus_cast<QString>(reply.arguments().at(1)); vendor = qdbus_cast<QString>(reply.arguments().at(1));
@ -67,10 +67,10 @@ QDBusPendingReply<uint> DBusNotificationsInterface::notify(const QString &appNam
, const uint id, const QString &icon, const QString &summary, const QString &body , const uint id, const QString &icon, const QString &summary, const QString &body
, const QStringList &actions, const QVariantMap &hints, const int timeout) , const QStringList &actions, const QVariantMap &hints, const int timeout)
{ {
return asyncCall(u"Notify"_qs, appName, id, icon, summary, body, actions, hints, timeout); return asyncCall(u"Notify"_s, appName, id, icon, summary, body, actions, hints, timeout);
} }
QDBusPendingReply<> DBusNotificationsInterface::closeNotification(const uint id) QDBusPendingReply<> DBusNotificationsInterface::closeNotification(const uint id)
{ {
return asyncCall(u"CloseNotification"_qs, id); return asyncCall(u"CloseNotification"_s, id);
} }

View file

@ -38,8 +38,8 @@
DBusNotifier::DBusNotifier(QObject *parent) DBusNotifier::DBusNotifier(QObject *parent)
: QObject(parent) : QObject(parent)
, m_notificationsInterface {new DBusNotificationsInterface(u"org.freedesktop.Notifications"_qs , m_notificationsInterface {new DBusNotificationsInterface(u"org.freedesktop.Notifications"_s
, u"/org/freedesktop/Notifications"_qs, QDBusConnection::sessionBus(), this)} , u"/org/freedesktop/Notifications"_s, QDBusConnection::sessionBus(), this)}
{ {
// Testing for 'DBusNotificationsInterface::isValid()' isn't helpful here. // Testing for 'DBusNotificationsInterface::isValid()' isn't helpful here.
// If the notification daemon is configured to run 'as needed' // If the notification daemon is configured to run 'as needed'
@ -58,10 +58,10 @@ DBusNotifier::DBusNotifier(QObject *parent)
void DBusNotifier::showMessage(const QString &title, const QString &message, const int timeout) void DBusNotifier::showMessage(const QString &title, const QString &message, const int timeout)
{ {
// Assign "default" action to notification to make it clickable // Assign "default" action to notification to make it clickable
const QStringList actions {u"default"_qs, {}}; const QStringList actions {u"default"_s, {}};
const QVariantMap hints {{u"desktop-entry"_qs, u"org.qbittorrent.qBittorrent"_qs}}; const QVariantMap hints {{u"desktop-entry"_s, u"org.qbittorrent.qBittorrent"_s}};
const QDBusPendingReply<uint> reply = m_notificationsInterface->notify(u"qBittorrent"_qs, 0 const QDBusPendingReply<uint> reply = m_notificationsInterface->notify(u"qBittorrent"_s, 0
, u"qbittorrent"_qs, title, message, actions, hints, timeout); , u"qbittorrent"_s, title, message, actions, hints, timeout);
auto *watcher = new QDBusPendingCallWatcher(reply, this); auto *watcher = new QDBusPendingCallWatcher(reply, this);
connect(watcher, &QDBusPendingCallWatcher::finished, this, [this](QDBusPendingCallWatcher *self) connect(watcher, &QDBusPendingCallWatcher::finished, this, [this](QDBusPendingCallWatcher *self)
{ {

View file

@ -86,7 +86,7 @@ namespace
const QDate date {2018, 11, 5}; // Monday const QDate date {2018, 11, 5}; // Monday
QStringList ret; QStringList ret;
for (int i = 0; i < 7; ++i) for (int i = 0; i < 7; ++i)
ret.append(locale.toString(date.addDays(i), u"dddd"_qs)); ret.append(locale.toString(date.addDays(i), u"dddd"_s));
return ret; return ret;
} }
@ -113,9 +113,9 @@ OptionsDialog::OptionsDialog(IGUIApplication *app, QWidget *parent)
: QDialog(parent) : QDialog(parent)
, GUIApplicationComponent(app) , GUIApplicationComponent(app)
, m_ui {new Ui::OptionsDialog} , m_ui {new Ui::OptionsDialog}
, m_storeDialogSize {SETTINGS_KEY(u"Size"_qs)} , m_storeDialogSize {SETTINGS_KEY(u"Size"_s)}
, m_storeHSplitterSize {SETTINGS_KEY(u"HorizontalSplitterSizes"_qs)} , m_storeHSplitterSize {SETTINGS_KEY(u"HorizontalSplitterSizes"_s)}
, m_storeLastViewedPage {SETTINGS_KEY(u"LastViewedPage"_qs)} , m_storeLastViewedPage {SETTINGS_KEY(u"LastViewedPage"_s)}
{ {
m_ui->setupUi(this); m_ui->setupUi(this);
m_applyButton = m_ui->buttonBox->button(QDialogButtonBox::Apply); m_applyButton = m_ui->buttonBox->button(QDialogButtonBox::Apply);
@ -128,18 +128,18 @@ OptionsDialog::OptionsDialog(IGUIApplication *app, QWidget *parent)
m_ui->hsplitter->setCollapsible(1, false); m_ui->hsplitter->setCollapsible(1, false);
// Main icons // Main icons
m_ui->tabSelection->item(TAB_UI)->setIcon(UIThemeManager::instance()->getIcon(u"preferences-desktop"_qs)); m_ui->tabSelection->item(TAB_UI)->setIcon(UIThemeManager::instance()->getIcon(u"preferences-desktop"_s));
m_ui->tabSelection->item(TAB_BITTORRENT)->setIcon(UIThemeManager::instance()->getIcon(u"preferences-bittorrent"_qs, u"preferences-system-network"_qs)); m_ui->tabSelection->item(TAB_BITTORRENT)->setIcon(UIThemeManager::instance()->getIcon(u"preferences-bittorrent"_s, u"preferences-system-network"_s));
m_ui->tabSelection->item(TAB_CONNECTION)->setIcon(UIThemeManager::instance()->getIcon(u"network-connect"_qs, u"network-wired"_qs)); m_ui->tabSelection->item(TAB_CONNECTION)->setIcon(UIThemeManager::instance()->getIcon(u"network-connect"_s, u"network-wired"_s));
m_ui->tabSelection->item(TAB_DOWNLOADS)->setIcon(UIThemeManager::instance()->getIcon(u"download"_qs, u"folder-download"_qs)); m_ui->tabSelection->item(TAB_DOWNLOADS)->setIcon(UIThemeManager::instance()->getIcon(u"download"_s, u"folder-download"_s));
m_ui->tabSelection->item(TAB_SPEED)->setIcon(UIThemeManager::instance()->getIcon(u"speedometer"_qs, u"chronometer"_qs)); m_ui->tabSelection->item(TAB_SPEED)->setIcon(UIThemeManager::instance()->getIcon(u"speedometer"_s, u"chronometer"_s));
m_ui->tabSelection->item(TAB_RSS)->setIcon(UIThemeManager::instance()->getIcon(u"application-rss"_qs, u"application-rss+xml"_qs)); m_ui->tabSelection->item(TAB_RSS)->setIcon(UIThemeManager::instance()->getIcon(u"application-rss"_s, u"application-rss+xml"_s));
#ifdef DISABLE_WEBUI #ifdef DISABLE_WEBUI
m_ui->tabSelection->item(TAB_WEBUI)->setHidden(true); m_ui->tabSelection->item(TAB_WEBUI)->setHidden(true);
#else #else
m_ui->tabSelection->item(TAB_WEBUI)->setIcon(UIThemeManager::instance()->getIcon(u"preferences-webui"_qs, u"network-server"_qs)); m_ui->tabSelection->item(TAB_WEBUI)->setIcon(UIThemeManager::instance()->getIcon(u"preferences-webui"_s, u"network-server"_s));
#endif #endif
m_ui->tabSelection->item(TAB_ADVANCED)->setIcon(UIThemeManager::instance()->getIcon(u"preferences-advanced"_qs, u"preferences-other"_qs)); m_ui->tabSelection->item(TAB_ADVANCED)->setIcon(UIThemeManager::instance()->getIcon(u"preferences-advanced"_s, u"preferences-other"_s));
// set uniform size for all icons // set uniform size for all icons
int maxHeight = -1; int maxHeight = -1;
@ -401,7 +401,7 @@ void OptionsDialog::saveBehaviorTabOptions() const
if (pref->getLocale() != locale) if (pref->getLocale() != locale)
{ {
auto *translator = new QTranslator; auto *translator = new QTranslator;
if (translator->load(u":/lang/qbittorrent_"_qs + locale)) if (translator->load(u":/lang/qbittorrent_"_s + locale))
qDebug("%s locale recognized, using translation.", qUtf8Printable(locale)); qDebug("%s locale recognized, using translation.", qUtf8Printable(locale));
else else
qDebug("%s locale unrecognized, using default (en).", qUtf8Printable(locale)); qDebug("%s locale unrecognized, using default (en).", qUtf8Printable(locale));
@ -589,7 +589,7 @@ void OptionsDialog::loadDownloadsTabOptions()
#else #else
m_ui->autoRunConsole->hide(); m_ui->autoRunConsole->hide();
#endif #endif
const auto autoRunStr = u"%1\n %2\n %3\n %4\n %5\n %6\n %7\n %8\n %9\n %10\n %11\n %12\n %13\n%14"_qs const auto autoRunStr = u"%1\n %2\n %3\n %4\n %5\n %6\n %7\n %8\n %9\n %10\n %11\n %12\n %13\n%14"_s
.arg(tr("Supported parameters (case sensitive):") .arg(tr("Supported parameters (case sensitive):")
, tr("%N: Torrent name") , tr("%N: Torrent name")
, tr("%L: Category") , tr("%L: Category")
@ -823,7 +823,7 @@ void OptionsDialog::loadConnectionTabOptions()
m_ui->textFilterPath->setFileNameFilter(tr("All supported filters") + u" (*.dat *.p2p *.p2b);;.dat (*.dat);;.p2p (*.p2p);;.p2b (*.p2b)"); m_ui->textFilterPath->setFileNameFilter(tr("All supported filters") + u" (*.dat *.p2p *.p2b);;.dat (*.dat);;.p2p (*.p2p);;.p2b (*.p2b)");
m_ui->textFilterPath->setSelectedPath(session->IPFilterFile()); m_ui->textFilterPath->setSelectedPath(session->IPFilterFile());
m_ui->IpFilterRefreshBtn->setIcon(UIThemeManager::instance()->getIcon(u"view-refresh"_qs)); m_ui->IpFilterRefreshBtn->setIcon(UIThemeManager::instance()->getIcon(u"view-refresh"_s));
m_ui->IpFilterRefreshBtn->setEnabled(m_ui->checkIPFilter->isChecked()); m_ui->IpFilterRefreshBtn->setEnabled(m_ui->checkIPFilter->isChecked());
m_ui->checkIpFilterTrackers->setChecked(session->isTrackerFilteringEnabled()); m_ui->checkIpFilterTrackers->setChecked(session->isTrackerFilteringEnabled());
@ -914,11 +914,11 @@ void OptionsDialog::loadSpeedTabOptions()
const auto *pref = Preferences::instance(); const auto *pref = Preferences::instance();
const auto *session = BitTorrent::Session::instance(); const auto *session = BitTorrent::Session::instance();
m_ui->labelGlobalRate->setPixmap(UIThemeManager::instance()->getScaledPixmap(u"slow_off"_qs, Utils::Gui::mediumIconSize(this).height())); m_ui->labelGlobalRate->setPixmap(UIThemeManager::instance()->getScaledPixmap(u"slow_off"_s, Utils::Gui::mediumIconSize(this).height()));
m_ui->spinUploadLimit->setValue(session->globalUploadSpeedLimit() / 1024); m_ui->spinUploadLimit->setValue(session->globalUploadSpeedLimit() / 1024);
m_ui->spinDownloadLimit->setValue(session->globalDownloadSpeedLimit() / 1024); m_ui->spinDownloadLimit->setValue(session->globalDownloadSpeedLimit() / 1024);
m_ui->labelAltRate->setPixmap(UIThemeManager::instance()->getScaledPixmap(u"slow"_qs, Utils::Gui::mediumIconSize(this).height())); m_ui->labelAltRate->setPixmap(UIThemeManager::instance()->getScaledPixmap(u"slow"_s, Utils::Gui::mediumIconSize(this).height()));
m_ui->spinUploadLimitAlt->setValue(session->altGlobalUploadSpeedLimit() / 1024); m_ui->spinUploadLimitAlt->setValue(session->altGlobalUploadSpeedLimit() / 1024);
m_ui->spinDownloadLimitAlt->setValue(session->altGlobalDownloadSpeedLimit() / 1024); m_ui->spinDownloadLimitAlt->setValue(session->altGlobalDownloadSpeedLimit() / 1024);
@ -1284,11 +1284,11 @@ void OptionsDialog::saveWebUITabOptions() const
void OptionsDialog::initializeLanguageCombo() void OptionsDialog::initializeLanguageCombo()
{ {
// List language files // List language files
const QDir langDir(u":/lang"_qs); const QDir langDir(u":/lang"_s);
const QStringList langFiles = langDir.entryList(QStringList(u"qbittorrent_*.qm"_qs), QDir::Files); const QStringList langFiles = langDir.entryList(QStringList(u"qbittorrent_*.qm"_s), QDir::Files);
for (const QString &langFile : langFiles) for (const QString &langFile : langFiles)
{ {
const QString localeStr = langFile.section(u"_"_qs, 1, -1).section(u"."_qs, 0, 0); // remove "qbittorrent_" and ".qm" const QString localeStr = langFile.section(u"_"_s, 1, -1).section(u"."_s, 0, 0); // remove "qbittorrent_" and ".qm"
m_ui->comboI18n->addItem(/*QIcon(":/icons/flags/"+country+".svg"), */ Utils::Misc::languageToLocalizedString(localeStr), localeStr); m_ui->comboI18n->addItem(/*QIcon(":/icons/flags/"+country+".svg"), */ Utils::Misc::languageToLocalizedString(localeStr), localeStr);
qDebug() << "Supported locale:" << localeStr; qDebug() << "Supported locale:" << localeStr;
} }
@ -1613,19 +1613,19 @@ void OptionsDialog::setLocale(const QString &localeStr)
QString name; QString name;
if (localeStr.startsWith(u"eo", Qt::CaseInsensitive)) if (localeStr.startsWith(u"eo", Qt::CaseInsensitive))
{ {
name = u"eo"_qs; name = u"eo"_s;
} }
else if (localeStr.startsWith(u"ltg", Qt::CaseInsensitive)) else if (localeStr.startsWith(u"ltg", Qt::CaseInsensitive))
{ {
name = u"ltg"_qs; name = u"ltg"_s;
} }
else else
{ {
QLocale locale(localeStr); QLocale locale(localeStr);
if (locale.language() == QLocale::Uzbek) if (locale.language() == QLocale::Uzbek)
name = u"uz@Latn"_qs; name = u"uz@Latn"_s;
else if (locale.language() == QLocale::Azerbaijani) else if (locale.language() == QLocale::Azerbaijani)
name = u"az@latin"_qs; name = u"az@latin"_s;
else else
name = locale.name(); name = locale.name();
} }
@ -1644,7 +1644,7 @@ void OptionsDialog::setLocale(const QString &localeStr)
if (index < 0) if (index < 0)
{ {
// Unrecognized, use US English // Unrecognized, use US English
index = m_ui->comboI18n->findData(u"en"_qs, Qt::UserRole); index = m_ui->comboI18n->findData(u"en"_s, Qt::UserRole);
Q_ASSERT(index >= 0); Q_ASSERT(index >= 0);
} }
m_ui->comboI18n->setCurrentIndex(index); m_ui->comboI18n->setCurrentIndex(index);
@ -1757,7 +1757,7 @@ void OptionsDialog::webUIHttpsCertChanged(const Path &path)
m_ui->textWebUIHttpsCert->setSelectedPath(path); m_ui->textWebUIHttpsCert->setSelectedPath(path);
m_ui->lblSslCertStatus->setPixmap(UIThemeManager::instance()->getScaledPixmap( m_ui->lblSslCertStatus->setPixmap(UIThemeManager::instance()->getScaledPixmap(
(isCertValid ? u"security-high"_qs : u"security-low"_qs), 24)); (isCertValid ? u"security-high"_s : u"security-low"_s), 24));
} }
void OptionsDialog::webUIHttpsKeyChanged(const Path &path) void OptionsDialog::webUIHttpsKeyChanged(const Path &path)
@ -1767,7 +1767,7 @@ void OptionsDialog::webUIHttpsKeyChanged(const Path &path)
m_ui->textWebUIHttpsKey->setSelectedPath(path); m_ui->textWebUIHttpsKey->setSelectedPath(path);
m_ui->lblSslKeyStatus->setPixmap(UIThemeManager::instance()->getScaledPixmap( m_ui->lblSslKeyStatus->setPixmap(UIThemeManager::instance()->getScaledPixmap(
(isKeyValid ? u"security-high"_qs : u"security-low"_qs), 24)); (isKeyValid ? u"security-high"_s : u"security-low"_s), 24));
} }
bool OptionsDialog::isWebUiEnabled() const bool OptionsDialog::isWebUiEnabled() const

View file

@ -62,15 +62,15 @@ void PowerManagementInhibitor::requestIdle()
QDBusMessage call = m_useGSM QDBusMessage call = m_useGSM
? QDBusMessage::createMethodCall( ? QDBusMessage::createMethodCall(
u"org.gnome.SessionManager"_qs, u"org.gnome.SessionManager"_s,
u"/org/gnome/SessionManager"_qs, u"/org/gnome/SessionManager"_s,
u"org.gnome.SessionManager"_qs, u"org.gnome.SessionManager"_s,
u"Uninhibit"_qs) u"Uninhibit"_s)
: QDBusMessage::createMethodCall( : QDBusMessage::createMethodCall(
u"org.freedesktop.PowerManagement"_qs, u"org.freedesktop.PowerManagement"_s,
u"/org/freedesktop/PowerManagement/Inhibit"_qs, u"/org/freedesktop/PowerManagement/Inhibit"_s,
u"org.freedesktop.PowerManagement.Inhibit"_qs, u"org.freedesktop.PowerManagement.Inhibit"_s,
u"UnInhibit"_qs); u"UnInhibit"_s);
call.setArguments({m_cookie}); call.setArguments({m_cookie});
QDBusPendingCall pcall = QDBusConnection::sessionBus().asyncCall(call, 1000); QDBusPendingCall pcall = QDBusConnection::sessionBus().asyncCall(call, 1000);
@ -90,20 +90,20 @@ void PowerManagementInhibitor::requestBusy()
QDBusMessage call = m_useGSM QDBusMessage call = m_useGSM
? QDBusMessage::createMethodCall( ? QDBusMessage::createMethodCall(
u"org.gnome.SessionManager"_qs, u"org.gnome.SessionManager"_s,
u"/org/gnome/SessionManager"_qs, u"/org/gnome/SessionManager"_s,
u"org.gnome.SessionManager"_qs, u"org.gnome.SessionManager"_s,
u"Inhibit"_qs) u"Inhibit"_s)
: QDBusMessage::createMethodCall( : QDBusMessage::createMethodCall(
u"org.freedesktop.PowerManagement"_qs, u"org.freedesktop.PowerManagement"_s,
u"/org/freedesktop/PowerManagement/Inhibit"_qs, u"/org/freedesktop/PowerManagement/Inhibit"_s,
u"org.freedesktop.PowerManagement.Inhibit"_qs, u"org.freedesktop.PowerManagement.Inhibit"_s,
u"Inhibit"_qs); u"Inhibit"_s);
QList<QVariant> args = {u"qBittorrent"_qs}; QList<QVariant> args = {u"qBittorrent"_s};
if (m_useGSM) if (m_useGSM)
args << 0u; args << 0u;
args << u"Active torrents are presented"_qs; args << u"Active torrents are presented"_s;
if (m_useGSM) if (m_useGSM)
args << 8u; args << 8u;
call.setArguments(args); call.setArguments(args);

View file

@ -57,7 +57,7 @@ void PreviewListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &o
{ {
const qreal progress = (index.data().toReal() * 100); const qreal progress = (index.data().toReal() * 100);
const QString text = (progress >= 100) const QString text = (progress >= 100)
? u"100%"_qs ? u"100%"_s
: (Utils::String::fromDouble(progress, 1) + u'%'); : (Utils::String::fromDouble(progress, 1) + u'%');
m_progressBarPainter.paint(painter, option, text, static_cast<int>(progress)); m_progressBarPainter.paint(painter, option, text, static_cast<int>(progress));

View file

@ -51,11 +51,11 @@ PreviewSelectDialog::PreviewSelectDialog(QWidget *parent, const BitTorrent::Torr
: QDialog(parent) : QDialog(parent)
, m_ui(new Ui::PreviewSelectDialog) , m_ui(new Ui::PreviewSelectDialog)
, m_torrent(torrent) , m_torrent(torrent)
, m_storeDialogSize(SETTINGS_KEY(u"Size"_qs)) , m_storeDialogSize(SETTINGS_KEY(u"Size"_s))
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
, m_storeTreeHeaderState(u"GUI/Qt6/" SETTINGS_KEY(u"HeaderState"_qs)) , m_storeTreeHeaderState(u"GUI/Qt6/" SETTINGS_KEY(u"HeaderState"_s))
#else #else
, m_storeTreeHeaderState(SETTINGS_KEY(u"HeaderState"_qs)) , m_storeTreeHeaderState(SETTINGS_KEY(u"HeaderState"_s))
#endif #endif
{ {
m_ui->setupUi(this); m_ui->setupUi(this);

View file

@ -65,7 +65,7 @@ namespace
if (newVersion == currentVersion) if (newVersion == currentVersion)
{ {
const bool isDevVersion = QStringLiteral(QBT_VERSION_STATUS).contains( const bool isDevVersion = QStringLiteral(QBT_VERSION_STATUS).contains(
QRegularExpression(u"(alpha|beta|rc)"_qs)); QRegularExpression(u"(alpha|beta|rc)"_s));
if (isDevVersion) if (isDevVersion)
return true; return true;
} }
@ -75,7 +75,7 @@ namespace
void ProgramUpdater::checkForUpdates() const void ProgramUpdater::checkForUpdates() const
{ {
const auto RSS_URL = u"https://www.fosshub.com/feed/5b8793a7f9ee5a5c3e97a3b2.xml"_qs; const auto RSS_URL = u"https://www.fosshub.com/feed/5b8793a7f9ee5a5c3e97a3b2.xml"_s;
// Don't change this User-Agent. In case our updater goes haywire, // Don't change this User-Agent. In case our updater goes haywire,
// the filehost can identify it and contact us. // the filehost can identify it and contact us.
Net::DownloadManager::instance()->download( Net::DownloadManager::instance()->download(
@ -108,11 +108,11 @@ void ProgramUpdater::rssDownloadFinished(const Net::DownloadResult &result)
}; };
#ifdef Q_OS_MACOS #ifdef Q_OS_MACOS
const QString OS_TYPE = u"Mac OS X"_qs; const QString OS_TYPE = u"Mac OS X"_s;
#elif defined(Q_OS_WIN) #elif defined(Q_OS_WIN)
const QString OS_TYPE = (::IsWindows7OrGreater() && QSysInfo::currentCpuArchitecture().endsWith(u"64")) const QString OS_TYPE = (::IsWindows7OrGreater() && QSysInfo::currentCpuArchitecture().endsWith(u"64"))
? u"Windows x64"_qs ? u"Windows x64"_s
: u"Windows"_qs; : u"Windows"_s;
#endif #endif
bool inItem = false; bool inItem = false;

View file

@ -42,7 +42,7 @@
ProgressBarPainter::ProgressBarPainter() ProgressBarPainter::ProgressBarPainter()
{ {
#if (defined(Q_OS_WIN) || defined(Q_OS_MACOS)) #if (defined(Q_OS_WIN) || defined(Q_OS_MACOS))
auto *fusionStyle = new QProxyStyle {u"fusion"_qs}; auto *fusionStyle = new QProxyStyle {u"fusion"_s};
fusionStyle->setParent(&m_dummyProgressBar); fusionStyle->setParent(&m_dummyProgressBar);
m_dummyProgressBar.setStyle(fusionStyle); m_dummyProgressBar.setStyle(fusionStyle);
#endif #endif

View file

@ -190,7 +190,7 @@ void DownloadedPiecesBar::clear()
QString DownloadedPiecesBar::simpleToolTipText() const QString DownloadedPiecesBar::simpleToolTipText() const
{ {
const QString borderColor = colorBoxBorderColor().name(); const QString borderColor = colorBoxBorderColor().name();
const QString rowHTML = u"<tr><td width=20 bgcolor='%1' style='border: 1px solid \"%2\";'></td><td>%3</td></tr>"_qs; const QString rowHTML = u"<tr><td width=20 bgcolor='%1' style='border: 1px solid \"%2\";'></td><td>%3</td></tr>"_s;
return u"<table cellspacing=4>" return u"<table cellspacing=4>"
+ rowHTML.arg(backgroundColor().name(), borderColor, tr("Missing pieces")) + rowHTML.arg(backgroundColor().name(), borderColor, tr("Missing pieces"))
+ rowHTML.arg(m_dlPieceColor.name(), borderColor, tr("Partial pieces")) + rowHTML.arg(m_dlPieceColor.name(), borderColor, tr("Partial pieces"))

View file

@ -298,7 +298,7 @@ void PeerListWidget::showPeerListMenu()
menu->setAttribute(Qt::WA_DeleteOnClose); menu->setAttribute(Qt::WA_DeleteOnClose);
menu->setToolTipsVisible(true); menu->setToolTipsVisible(true);
QAction *addNewPeer = menu->addAction(UIThemeManager::instance()->getIcon(u"peers-add"_qs), tr("Add peers...") QAction *addNewPeer = menu->addAction(UIThemeManager::instance()->getIcon(u"peers-add"_s), tr("Add peers...")
, this, [this, torrent]() , this, [this, torrent]()
{ {
const QVector<BitTorrent::PeerAddress> peersList = PeersAdditionDialog::askForPeers(this); const QVector<BitTorrent::PeerAddress> peersList = PeersAdditionDialog::askForPeers(this);
@ -311,10 +311,10 @@ void PeerListWidget::showPeerListMenu()
else if (peerCount > 0) else if (peerCount > 0)
QMessageBox::information(this, tr("Adding peers"), tr("Peers are added to this torrent.")); QMessageBox::information(this, tr("Adding peers"), tr("Peers are added to this torrent."));
}); });
QAction *copyPeers = menu->addAction(UIThemeManager::instance()->getIcon(u"edit-copy"_qs), tr("Copy IP:port") QAction *copyPeers = menu->addAction(UIThemeManager::instance()->getIcon(u"edit-copy"_s), tr("Copy IP:port")
, this, &PeerListWidget::copySelectedPeers); , this, &PeerListWidget::copySelectedPeers);
menu->addSeparator(); menu->addSeparator();
QAction *banPeers = menu->addAction(UIThemeManager::instance()->getIcon(u"peers-remove"_qs), tr("Ban peer permanently") QAction *banPeers = menu->addAction(UIThemeManager::instance()->getIcon(u"peers-remove"_s), tr("Ban peer permanently")
, this, &PeerListWidget::banSelectedPeers); , this, &PeerListWidget::banSelectedPeers);
// disable actions // disable actions

View file

@ -170,7 +170,7 @@ void PieceAvailabilityBar::clear()
QString PieceAvailabilityBar::simpleToolTipText() const QString PieceAvailabilityBar::simpleToolTipText() const
{ {
const QString borderColor = colorBoxBorderColor().name(); const QString borderColor = colorBoxBorderColor().name();
const QString rowHTML = u"<tr><td width=20 bgcolor='%1' style='border: 1px solid \"%2\";'></td><td>%3</td></tr>"_qs; const QString rowHTML = u"<tr><td width=20 bgcolor='%1' style='border: 1px solid \"%2\";'></td><td>%3</td></tr>"_s;
return u"<table cellspacing=4>" return u"<table cellspacing=4>"
+ rowHTML.arg(backgroundColor().name(), borderColor, tr("Unavailable pieces")) + rowHTML.arg(backgroundColor().name(), borderColor, tr("Unavailable pieces"))
+ rowHTML.arg(pieceColor().name(), borderColor, tr("Available pieces")) + rowHTML.arg(pieceColor().name(), borderColor, tr("Available pieces"))

View file

@ -111,9 +111,9 @@ PropertiesWidget::PropertiesWidget(QWidget *parent)
// Tracker list // Tracker list
m_trackerList = new TrackerListWidget(this); m_trackerList = new TrackerListWidget(this);
m_ui->trackerUpButton->setIcon(UIThemeManager::instance()->getIcon(u"go-up"_qs)); m_ui->trackerUpButton->setIcon(UIThemeManager::instance()->getIcon(u"go-up"_s));
m_ui->trackerUpButton->setIconSize(Utils::Gui::smallIconSize()); m_ui->trackerUpButton->setIconSize(Utils::Gui::smallIconSize());
m_ui->trackerDownButton->setIcon(UIThemeManager::instance()->getIcon(u"go-down"_qs)); m_ui->trackerDownButton->setIcon(UIThemeManager::instance()->getIcon(u"go-down"_s));
m_ui->trackerDownButton->setIconSize(Utils::Gui::smallIconSize()); m_ui->trackerDownButton->setIconSize(Utils::Gui::smallIconSize());
connect(m_ui->trackerUpButton, &QPushButton::clicked, m_trackerList, &TrackerListWidget::moveSelectionUp); connect(m_ui->trackerUpButton, &QPushButton::clicked, m_trackerList, &TrackerListWidget::moveSelectionUp);
connect(m_ui->trackerDownButton, &QPushButton::clicked, m_trackerList, &TrackerListWidget::moveSelectionDown); connect(m_ui->trackerDownButton, &QPushButton::clicked, m_trackerList, &TrackerListWidget::moveSelectionDown);
@ -512,16 +512,16 @@ void PropertiesWidget::displayWebSeedListMenu()
QMenu *menu = new QMenu(this); QMenu *menu = new QMenu(this);
menu->setAttribute(Qt::WA_DeleteOnClose); menu->setAttribute(Qt::WA_DeleteOnClose);
menu->addAction(UIThemeManager::instance()->getIcon(u"list-add"_qs), tr("New Web seed"), this, &PropertiesWidget::askWebSeed); menu->addAction(UIThemeManager::instance()->getIcon(u"list-add"_s), tr("New Web seed"), this, &PropertiesWidget::askWebSeed);
if (!rows.isEmpty()) if (!rows.isEmpty())
{ {
menu->addAction(UIThemeManager::instance()->getIcon(u"edit-clear"_qs, u"list-remove"_qs), tr("Remove Web seed") menu->addAction(UIThemeManager::instance()->getIcon(u"edit-clear"_s, u"list-remove"_s), tr("Remove Web seed")
, this, &PropertiesWidget::deleteSelectedUrlSeeds); , this, &PropertiesWidget::deleteSelectedUrlSeeds);
menu->addSeparator(); menu->addSeparator();
menu->addAction(UIThemeManager::instance()->getIcon(u"edit-copy"_qs), tr("Copy Web seed URL") menu->addAction(UIThemeManager::instance()->getIcon(u"edit-copy"_s), tr("Copy Web seed URL")
, this, &PropertiesWidget::copySelectedWebSeedsToClipboard); , this, &PropertiesWidget::copySelectedWebSeedsToClipboard);
menu->addAction(UIThemeManager::instance()->getIcon(u"edit-rename"_qs), tr("Edit Web seed URL") menu->addAction(UIThemeManager::instance()->getIcon(u"edit-rename"_s), tr("Edit Web seed URL")
, this, &PropertiesWidget::editWebSeed); , this, &PropertiesWidget::editWebSeed);
} }
@ -555,7 +555,7 @@ void PropertiesWidget::configure()
delete m_speedWidget; delete m_speedWidget;
} }
const auto displayText = u"<center><b>%1</b><p>%2</p></center>"_qs const auto displayText = u"<center><b>%1</b><p>%2</p></center>"_s
.arg(tr("Speed graphs are disabled"), tr("You can enable it in Advanced Options")); .arg(tr("Speed graphs are disabled"), tr("You can enable it in Advanced Options"));
auto *label = new QLabel(displayText, this); auto *label = new QLabel(displayText, this);
label->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); label->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
@ -571,12 +571,12 @@ void PropertiesWidget::askWebSeed()
// Ask user for a new url seed // Ask user for a new url seed
const QString urlSeed = AutoExpandableDialog::getText(this, tr("New URL seed", "New HTTP source"), const QString urlSeed = AutoExpandableDialog::getText(this, tr("New URL seed", "New HTTP source"),
tr("New URL seed:"), QLineEdit::Normal, tr("New URL seed:"), QLineEdit::Normal,
u"http://www."_qs, &ok); u"http://www."_s, &ok);
if (!ok) return; if (!ok) return;
qDebug("Adding %s web seed", qUtf8Printable(urlSeed)); qDebug("Adding %s web seed", qUtf8Printable(urlSeed));
if (!m_ui->listWebSeeds->findItems(urlSeed, Qt::MatchFixedString).empty()) if (!m_ui->listWebSeeds->findItems(urlSeed, Qt::MatchFixedString).empty())
{ {
QMessageBox::warning(this, u"qBittorrent"_qs, tr("This URL seed is already in the list."), QMessageBox::Ok); QMessageBox::warning(this, u"qBittorrent"_s, tr("This URL seed is already in the list."), QMessageBox::Ok);
return; return;
} }
if (m_torrent) if (m_torrent)
@ -628,7 +628,7 @@ void PropertiesWidget::editWebSeed()
if (!m_ui->listWebSeeds->findItems(newSeed, Qt::MatchFixedString).empty()) if (!m_ui->listWebSeeds->findItems(newSeed, Qt::MatchFixedString).empty())
{ {
QMessageBox::warning(this, u"qBittorrent"_qs, QMessageBox::warning(this, u"qBittorrent"_s,
tr("This URL seed is already in the list."), tr("This URL seed is already in the list."),
QMessageBox::Ok); QMessageBox::Ok);
return; return;

View file

@ -45,7 +45,7 @@ PropTabBar::PropTabBar(QWidget *parent)
// General tab // General tab
QPushButton *mainInfosButton = new QPushButton( QPushButton *mainInfosButton = new QPushButton(
#ifndef Q_OS_MACOS #ifndef Q_OS_MACOS
UIThemeManager::instance()->getIcon(u"help-about"_qs, u"document-properties"_qs), UIThemeManager::instance()->getIcon(u"help-about"_s, u"document-properties"_s),
#endif #endif
tr("General"), parent); tr("General"), parent);
mainInfosButton->setShortcut(Qt::ALT + Qt::Key_G); mainInfosButton->setShortcut(Qt::ALT + Qt::Key_G);
@ -54,7 +54,7 @@ PropTabBar::PropTabBar(QWidget *parent)
// Trackers tab // Trackers tab
QPushButton *trackersButton = new QPushButton( QPushButton *trackersButton = new QPushButton(
#ifndef Q_OS_MACOS #ifndef Q_OS_MACOS
UIThemeManager::instance()->getIcon(u"trackers"_qs, u"network-server"_qs), UIThemeManager::instance()->getIcon(u"trackers"_s, u"network-server"_s),
#endif #endif
tr("Trackers"), parent); tr("Trackers"), parent);
trackersButton->setShortcut(Qt::ALT + Qt::Key_C); trackersButton->setShortcut(Qt::ALT + Qt::Key_C);
@ -63,7 +63,7 @@ PropTabBar::PropTabBar(QWidget *parent)
// Peers tab // Peers tab
QPushButton *peersButton = new QPushButton( QPushButton *peersButton = new QPushButton(
#ifndef Q_OS_MACOS #ifndef Q_OS_MACOS
UIThemeManager::instance()->getIcon(u"peers"_qs), UIThemeManager::instance()->getIcon(u"peers"_s),
#endif #endif
tr("Peers"), parent); tr("Peers"), parent);
peersButton->setShortcut(Qt::ALT + Qt::Key_R); peersButton->setShortcut(Qt::ALT + Qt::Key_R);
@ -72,7 +72,7 @@ PropTabBar::PropTabBar(QWidget *parent)
// URL seeds tab // URL seeds tab
QPushButton *URLSeedsButton = new QPushButton( QPushButton *URLSeedsButton = new QPushButton(
#ifndef Q_OS_MACOS #ifndef Q_OS_MACOS
UIThemeManager::instance()->getIcon(u"network-server"_qs), UIThemeManager::instance()->getIcon(u"network-server"_s),
#endif #endif
tr("HTTP Sources"), parent); tr("HTTP Sources"), parent);
URLSeedsButton->setShortcut(Qt::ALT + Qt::Key_B); URLSeedsButton->setShortcut(Qt::ALT + Qt::Key_B);
@ -81,7 +81,7 @@ PropTabBar::PropTabBar(QWidget *parent)
// Files tab // Files tab
QPushButton *filesButton = new QPushButton( QPushButton *filesButton = new QPushButton(
#ifndef Q_OS_MACOS #ifndef Q_OS_MACOS
UIThemeManager::instance()->getIcon(u"directory"_qs), UIThemeManager::instance()->getIcon(u"directory"_s),
#endif #endif
tr("Content"), parent); tr("Content"), parent);
filesButton->setShortcut(Qt::ALT + Qt::Key_Z); filesButton->setShortcut(Qt::ALT + Qt::Key_Z);
@ -92,7 +92,7 @@ PropTabBar::PropTabBar(QWidget *parent)
// Speed tab // Speed tab
QPushButton *speedButton = new QPushButton( QPushButton *speedButton = new QPushButton(
#ifndef Q_OS_MACOS #ifndef Q_OS_MACOS
UIThemeManager::instance()->getIcon(u"chart-line"_qs), UIThemeManager::instance()->getIcon(u"chart-line"_s),
#endif #endif
tr("Speed"), parent); tr("Speed"), parent);
speedButton->setShortcut(Qt::ALT + Qt::Key_D); speedButton->setShortcut(Qt::ALT + Qt::Key_D);

View file

@ -93,13 +93,13 @@ TrackerListWidget::TrackerListWidget(PropertiesWidget *properties)
connect(header(), &QHeaderView::sortIndicatorChanged, this, &TrackerListWidget::saveSettings); connect(header(), &QHeaderView::sortIndicatorChanged, this, &TrackerListWidget::saveSettings);
// Set DHT, PeX, LSD items // Set DHT, PeX, LSD items
m_DHTItem = new QTreeWidgetItem({ u""_qs, u"** [DHT] **"_qs, u""_qs, u"0"_qs, u""_qs, u""_qs, u"0"_qs }); m_DHTItem = new QTreeWidgetItem({ u""_s, u"** [DHT] **"_s, u""_s, u"0"_s, u""_s, u""_s, u"0"_s });
insertTopLevelItem(0, m_DHTItem); insertTopLevelItem(0, m_DHTItem);
setRowColor(0, QColorConstants::Svg::grey); setRowColor(0, QColorConstants::Svg::grey);
m_PEXItem = new QTreeWidgetItem({ u""_qs, u"** [PeX] **"_qs, u""_qs, u"0"_qs, u""_qs, u""_qs, u"0"_qs }); m_PEXItem = new QTreeWidgetItem({ u""_s, u"** [PeX] **"_s, u""_s, u"0"_s, u""_s, u""_s, u"0"_s });
insertTopLevelItem(1, m_PEXItem); insertTopLevelItem(1, m_PEXItem);
setRowColor(1, QColorConstants::Svg::grey); setRowColor(1, QColorConstants::Svg::grey);
m_LSDItem = new QTreeWidgetItem({ u""_qs, u"** [LSD] **"_qs, u""_qs, u"0"_qs, u""_qs, u""_qs, u"0"_qs }); m_LSDItem = new QTreeWidgetItem({ u""_s, u"** [LSD] **"_s, u""_s, u"0"_s, u""_s, u""_s, u"0"_s });
insertTopLevelItem(2, m_LSDItem); insertTopLevelItem(2, m_LSDItem);
setRowColor(2, QColorConstants::Svg::grey); setRowColor(2, QColorConstants::Svg::grey);
@ -573,25 +573,25 @@ void TrackerListWidget::showTrackerListMenu()
menu->setAttribute(Qt::WA_DeleteOnClose); menu->setAttribute(Qt::WA_DeleteOnClose);
// Add actions // Add actions
menu->addAction(UIThemeManager::instance()->getIcon(u"list-add"_qs), tr("Add trackers...") menu->addAction(UIThemeManager::instance()->getIcon(u"list-add"_s), tr("Add trackers...")
, this, &TrackerListWidget::openAddTrackersDialog); , this, &TrackerListWidget::openAddTrackersDialog);
if (!getSelectedTrackerItems().isEmpty()) if (!getSelectedTrackerItems().isEmpty())
{ {
menu->addAction(UIThemeManager::instance()->getIcon(u"edit-rename"_qs),tr("Edit tracker URL...") menu->addAction(UIThemeManager::instance()->getIcon(u"edit-rename"_s),tr("Edit tracker URL...")
, this, &TrackerListWidget::editSelectedTracker); , this, &TrackerListWidget::editSelectedTracker);
menu->addAction(UIThemeManager::instance()->getIcon(u"edit-clear"_qs, u"list-remove"_qs), tr("Remove tracker") menu->addAction(UIThemeManager::instance()->getIcon(u"edit-clear"_s, u"list-remove"_s), tr("Remove tracker")
, this, &TrackerListWidget::deleteSelectedTrackers); , this, &TrackerListWidget::deleteSelectedTrackers);
menu->addAction(UIThemeManager::instance()->getIcon(u"edit-copy"_qs), tr("Copy tracker URL") menu->addAction(UIThemeManager::instance()->getIcon(u"edit-copy"_s), tr("Copy tracker URL")
, this, &TrackerListWidget::copyTrackerUrl); , this, &TrackerListWidget::copyTrackerUrl);
} }
if (!torrent->isPaused()) if (!torrent->isPaused())
{ {
menu->addAction(UIThemeManager::instance()->getIcon(u"reannounce"_qs, u"view-refresh"_qs), tr("Force reannounce to selected trackers") menu->addAction(UIThemeManager::instance()->getIcon(u"reannounce"_s, u"view-refresh"_s), tr("Force reannounce to selected trackers")
, this, &TrackerListWidget::reannounceSelected); , this, &TrackerListWidget::reannounceSelected);
menu->addSeparator(); menu->addSeparator();
menu->addAction(UIThemeManager::instance()->getIcon(u"reannounce"_qs, u"view-refresh"_qs), tr("Force reannounce to all trackers") menu->addAction(UIThemeManager::instance()->getIcon(u"reannounce"_s, u"view-refresh"_s), tr("Force reannounce to all trackers")
, this, [this]() , this, [this]()
{ {
BitTorrent::Torrent *h = m_properties->getCurrentTorrent(); BitTorrent::Torrent *h = m_properties->getCurrentTorrent();

View file

@ -48,12 +48,12 @@ TrackersAdditionDialog::TrackersAdditionDialog(QWidget *parent, BitTorrent::Torr
: QDialog(parent) : QDialog(parent)
, m_ui(new Ui::TrackersAdditionDialog) , m_ui(new Ui::TrackersAdditionDialog)
, m_torrent(torrent) , m_torrent(torrent)
, m_storeDialogSize(SETTINGS_KEY(u"Size"_qs)) , m_storeDialogSize(SETTINGS_KEY(u"Size"_s))
, m_storeTrackersListURL(SETTINGS_KEY(u"TrackersListURL"_qs)) , m_storeTrackersListURL(SETTINGS_KEY(u"TrackersListURL"_s))
{ {
m_ui->setupUi(this); m_ui->setupUi(this);
m_ui->downloadButton->setIcon(UIThemeManager::instance()->getIcon(u"downloading"_qs, u"download"_qs)); m_ui->downloadButton->setIcon(UIThemeManager::instance()->getIcon(u"downloading"_s, u"download"_s));
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Add")); m_ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Add"));
connect(m_ui->downloadButton, &QAbstractButton::clicked, this, &TrackersAdditionDialog::onDownloadButtonClicked); connect(m_ui->downloadButton, &QAbstractButton::clicked, this, &TrackersAdditionDialog::onDownloadButtonClicked);
@ -108,7 +108,7 @@ void TrackersAdditionDialog::onTorrentListDownloadFinished(const Net::DownloadRe
// Add fetched trackers to the list // Add fetched trackers to the list
const QString existingText = m_ui->textEditTrackersList->toPlainText(); const QString existingText = m_ui->textEditTrackersList->toPlainText();
if (!existingText.isEmpty() && !existingText.endsWith(u'\n')) if (!existingText.isEmpty() && !existingText.endsWith(u'\n'))
m_ui->textEditTrackersList->insertPlainText(u"\n"_qs); m_ui->textEditTrackersList->insertPlainText(u"\n"_s);
// append the data as-is // append the data as-is
const auto trackers = QString::fromUtf8(result.data).trimmed(); const auto trackers = QString::fromUtf8(result.data).trimmed();

View file

@ -102,9 +102,9 @@ void ArticleListWidget::handleArticleRead(RSS::Article *rssArticle)
auto *item = mapRSSArticle(rssArticle); auto *item = mapRSSArticle(rssArticle);
if (!item) return; if (!item) return;
const QBrush foregroundBrush {UIThemeManager::instance()->getColor(u"RSS.ReadArticle"_qs)}; const QBrush foregroundBrush {UIThemeManager::instance()->getColor(u"RSS.ReadArticle"_s)};
item->setData(Qt::ForegroundRole, foregroundBrush); item->setData(Qt::ForegroundRole, foregroundBrush);
item->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"loading"_qs, u"sphere"_qs)); item->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"loading"_s, u"sphere"_s));
checkInvariant(); checkInvariant();
} }
@ -129,15 +129,15 @@ QListWidgetItem *ArticleListWidget::createItem(RSS::Article *article) const
item->setData(Qt::UserRole, QVariant::fromValue(article)); item->setData(Qt::UserRole, QVariant::fromValue(article));
if (article->isRead()) if (article->isRead())
{ {
const QBrush foregroundBrush {UIThemeManager::instance()->getColor(u"RSS.ReadArticle"_qs)}; const QBrush foregroundBrush {UIThemeManager::instance()->getColor(u"RSS.ReadArticle"_s)};
item->setData(Qt::ForegroundRole, foregroundBrush); item->setData(Qt::ForegroundRole, foregroundBrush);
item->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"loading"_qs, u"sphere"_qs)); item->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"loading"_s, u"sphere"_s));
} }
else else
{ {
const QBrush foregroundBrush {UIThemeManager::instance()->getColor(u"RSS.UnreadArticle"_qs)}; const QBrush foregroundBrush {UIThemeManager::instance()->getColor(u"RSS.UnreadArticle"_s)};
item->setData(Qt::ForegroundRole, foregroundBrush); item->setData(Qt::ForegroundRole, foregroundBrush);
item->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"loading"_qs, u"sphere"_qs)); item->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"loading"_s, u"sphere"_s));
} }
return item; return item;

View file

@ -57,22 +57,22 @@
#include "gui/utils.h" #include "gui/utils.h"
#include "ui_automatedrssdownloader.h" #include "ui_automatedrssdownloader.h"
const QString EXT_JSON = u".json"_qs; const QString EXT_JSON = u".json"_s;
const QString EXT_LEGACY = u".rssrules"_qs; const QString EXT_LEGACY = u".rssrules"_s;
AutomatedRssDownloader::AutomatedRssDownloader(QWidget *parent) AutomatedRssDownloader::AutomatedRssDownloader(QWidget *parent)
: QDialog(parent) : QDialog(parent)
, m_formatFilterJSON {u"%1 (*%2)"_qs.arg(tr("Rules"), EXT_JSON)} , m_formatFilterJSON {u"%1 (*%2)"_s.arg(tr("Rules"), EXT_JSON)}
, m_formatFilterLegacy {u"%1 (*%2)"_qs.arg(tr("Rules (legacy)"), EXT_LEGACY)} , m_formatFilterLegacy {u"%1 (*%2)"_s.arg(tr("Rules (legacy)"), EXT_LEGACY)}
, m_ui {new Ui::AutomatedRssDownloader} , m_ui {new Ui::AutomatedRssDownloader}
, m_addTorrentParamsWidget {new AddTorrentParamsWidget} , m_addTorrentParamsWidget {new AddTorrentParamsWidget}
, m_storeDialogSize {u"RssFeedDownloader/geometrySize"_qs} , m_storeDialogSize {u"RssFeedDownloader/geometrySize"_s}
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
, m_storeMainSplitterState {u"GUI/Qt6/RSSFeedDownloader/HSplitterSizes"_qs} , m_storeMainSplitterState {u"GUI/Qt6/RSSFeedDownloader/HSplitterSizes"_s}
, m_storeRuleDefSplitterState {u"GUI/Qt6/RSSFeedDownloader/RuleDefSplitterState"_qs} , m_storeRuleDefSplitterState {u"GUI/Qt6/RSSFeedDownloader/RuleDefSplitterState"_s}
#else #else
, m_storeMainSplitterState {u"RssFeedDownloader/qt5/hsplitterSizes"_qs} , m_storeMainSplitterState {u"RssFeedDownloader/qt5/hsplitterSizes"_s}
, m_storeRuleDefSplitterState {u"RssFeedDownloader/qt5/RuleDefSplitterState"_qs} , m_storeRuleDefSplitterState {u"RssFeedDownloader/qt5/RuleDefSplitterState"_s}
#endif #endif
{ {
m_ui->setupUi(this); m_ui->setupUi(this);
@ -88,9 +88,9 @@ AutomatedRssDownloader::AutomatedRssDownloader(QWidget *parent)
connect(m_ui->renameRuleBtn, &QPushButton::clicked, this, &AutomatedRssDownloader::onRenameRuleBtnClicked); connect(m_ui->renameRuleBtn, &QPushButton::clicked, this, &AutomatedRssDownloader::onRenameRuleBtnClicked);
// Icons // Icons
m_ui->renameRuleBtn->setIcon(UIThemeManager::instance()->getIcon(u"edit-rename"_qs)); m_ui->renameRuleBtn->setIcon(UIThemeManager::instance()->getIcon(u"edit-rename"_s));
m_ui->removeRuleBtn->setIcon(UIThemeManager::instance()->getIcon(u"edit-clear"_qs, u"list-remove"_qs)); m_ui->removeRuleBtn->setIcon(UIThemeManager::instance()->getIcon(u"edit-clear"_s, u"list-remove"_s));
m_ui->addRuleBtn->setIcon(UIThemeManager::instance()->getIcon(u"list-add"_qs)); m_ui->addRuleBtn->setIcon(UIThemeManager::instance()->getIcon(u"list-add"_s));
// Ui Settings // Ui Settings
m_ui->ruleList->setSortingEnabled(true); m_ui->ruleList->setSortingEnabled(true);
@ -104,7 +104,7 @@ AutomatedRssDownloader::AutomatedRssDownloader(QWidget *parent)
connect(m_ui->checkRegex, &QAbstractButton::toggled, this, &AutomatedRssDownloader::updateFieldsToolTips); connect(m_ui->checkRegex, &QAbstractButton::toggled, this, &AutomatedRssDownloader::updateFieldsToolTips);
connect(m_ui->ruleList, &QWidget::customContextMenuRequested, this, &AutomatedRssDownloader::displayRulesListMenu); connect(m_ui->ruleList, &QWidget::customContextMenuRequested, this, &AutomatedRssDownloader::displayRulesListMenu);
m_episodeRegex = new QRegularExpression(u"^(^\\d{1,4}x(\\d{1,4}(-(\\d{1,4})?)?;){1,}){1,1}"_qs m_episodeRegex = new QRegularExpression(u"^(^\\d{1,4}x(\\d{1,4}(-(\\d{1,4})?)?;){1,}){1,1}"_s
, QRegularExpression::CaseInsensitiveOption); , QRegularExpression::CaseInsensitiveOption);
const QString tip = u"<p>" + tr("Matches articles based on episode filter.") + u"</p><p><b>" + tr("Example: ") const QString tip = u"<p>" + tr("Matches articles based on episode filter.") + u"</p><p><b>" + tr("Example: ")
+ u"1x2;8-15;5;30-;</b>" + tr(" will match 2, 5, 8 through 15, 30 and onward episodes of season one", "example X will match") + u"</p>" + u"1x2;8-15;5;30-;</b>" + tr(" will match 2, 5, 8 through 15, 30 and onward episodes of season one", "example X will match") + u"</p>"
@ -421,7 +421,7 @@ void AutomatedRssDownloader::onExportBtnClicked()
QString selectedFilter {m_formatFilterJSON}; QString selectedFilter {m_formatFilterJSON};
Path path {QFileDialog::getSaveFileName( Path path {QFileDialog::getSaveFileName(
this, tr("Export RSS rules"), QDir::homePath() this, tr("Export RSS rules"), QDir::homePath()
, u"%1;;%2"_qs.arg(m_formatFilterJSON, m_formatFilterLegacy), &selectedFilter)}; , u"%1;;%2"_s.arg(m_formatFilterJSON, m_formatFilterLegacy), &selectedFilter)};
if (path.isEmpty()) return; if (path.isEmpty()) return;
@ -457,7 +457,7 @@ void AutomatedRssDownloader::onImportBtnClicked()
QString selectedFilter {m_formatFilterJSON}; QString selectedFilter {m_formatFilterJSON};
const Path path {QFileDialog::getOpenFileName( const Path path {QFileDialog::getOpenFileName(
this, tr("Import RSS rules"), QDir::homePath() this, tr("Import RSS rules"), QDir::homePath()
, u"%1;;%2"_qs.arg(m_formatFilterJSON, m_formatFilterLegacy), &selectedFilter)}; , u"%1;;%2"_s.arg(m_formatFilterJSON, m_formatFilterLegacy), &selectedFilter)};
const int fileMaxSize = 10 * 1024 * 1024; const int fileMaxSize = 10 * 1024 * 1024;
const auto readResult = Utils::IO::readFile(path, fileMaxSize); const auto readResult = Utils::IO::readFile(path, fileMaxSize);
@ -494,7 +494,7 @@ void AutomatedRssDownloader::displayRulesListMenu()
QMenu *menu = new QMenu(this); QMenu *menu = new QMenu(this);
menu->setAttribute(Qt::WA_DeleteOnClose); menu->setAttribute(Qt::WA_DeleteOnClose);
menu->addAction(UIThemeManager::instance()->getIcon(u"list-add"_qs), tr("Add new rule...") menu->addAction(UIThemeManager::instance()->getIcon(u"list-add"_s), tr("Add new rule...")
, this, &AutomatedRssDownloader::onAddRuleBtnClicked); , this, &AutomatedRssDownloader::onAddRuleBtnClicked);
const QList<QListWidgetItem *> selection = m_ui->ruleList->selectedItems(); const QList<QListWidgetItem *> selection = m_ui->ruleList->selectedItems();
@ -503,20 +503,20 @@ void AutomatedRssDownloader::displayRulesListMenu()
{ {
if (selection.count() == 1) if (selection.count() == 1)
{ {
menu->addAction(UIThemeManager::instance()->getIcon(u"edit-clear"_qs, u"list-remove"_qs), tr("Delete rule") menu->addAction(UIThemeManager::instance()->getIcon(u"edit-clear"_s, u"list-remove"_s), tr("Delete rule")
, this, &AutomatedRssDownloader::onRemoveRuleBtnClicked); , this, &AutomatedRssDownloader::onRemoveRuleBtnClicked);
menu->addSeparator(); menu->addSeparator();
menu->addAction(UIThemeManager::instance()->getIcon(u"edit-rename"_qs), tr("Rename rule...") menu->addAction(UIThemeManager::instance()->getIcon(u"edit-rename"_s), tr("Rename rule...")
, this, &AutomatedRssDownloader::renameSelectedRule); , this, &AutomatedRssDownloader::renameSelectedRule);
} }
else else
{ {
menu->addAction(UIThemeManager::instance()->getIcon(u"edit-clear"_qs, u"list-remove"_qs), tr("Delete selected rules") menu->addAction(UIThemeManager::instance()->getIcon(u"edit-clear"_s, u"list-remove"_s), tr("Delete selected rules")
, this, &AutomatedRssDownloader::onRemoveRuleBtnClicked); , this, &AutomatedRssDownloader::onRemoveRuleBtnClicked);
} }
menu->addSeparator(); menu->addSeparator();
menu->addAction(UIThemeManager::instance()->getIcon(u"edit-clear"_qs), tr("Clear downloaded episodes...") menu->addAction(UIThemeManager::instance()->getIcon(u"edit-clear"_s), tr("Clear downloaded episodes...")
, this, &AutomatedRssDownloader::clearSelectedRuleDownloadedEpisodeList); , this, &AutomatedRssDownloader::clearSelectedRuleDownloadedEpisodeList);
} }
@ -646,7 +646,7 @@ void AutomatedRssDownloader::addFeedArticlesToTree(RSS::Feed *feed, const QStrin
QFont f = treeFeedItem->font(0); QFont f = treeFeedItem->font(0);
f.setBold(true); f.setBold(true);
treeFeedItem->setFont(0, f); treeFeedItem->setFont(0, f);
treeFeedItem->setData(0, Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"directory"_qs)); treeFeedItem->setData(0, Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"directory"_s));
treeFeedItem->setData(0, Qt::UserRole, feed->url()); treeFeedItem->setData(0, Qt::UserRole, feed->url());
m_ui->matchingArticlesTree->addTopLevelItem(treeFeedItem); m_ui->matchingArticlesTree->addTopLevelItem(treeFeedItem);
} }
@ -694,7 +694,7 @@ void AutomatedRssDownloader::updateFieldsToolTips(bool regex)
tip += tr("An expression with an empty %1 clause (e.g. %2)", tip += tr("An expression with an empty %1 clause (e.g. %2)",
"We talk about regex/wildcards in the RSS filters section here." "We talk about regex/wildcards in the RSS filters section here."
" So a valid sentence would be: An expression with an empty | clause (e.g. expr|)" " So a valid sentence would be: An expression with an empty | clause (e.g. expr|)"
).arg(u"<tt>|</tt>"_qs, u"<tt>expr|</tt>"_qs); ).arg(u"<tt>|</tt>"_s, u"<tt>expr|</tt>"_s);
m_ui->lineContains->setToolTip(tip + tr(" will match all articles.") + u"</p>"); m_ui->lineContains->setToolTip(tip + tr(" will match all articles.") + u"</p>");
m_ui->lineNotContains->setToolTip(tip + tr(" will exclude all articles.") + u"</p>"); m_ui->lineNotContains->setToolTip(tip + tr(" will exclude all articles.") + u"</p>");
} }
@ -740,8 +740,8 @@ void AutomatedRssDownloader::updateMustLineValidity()
} }
else else
{ {
m_ui->lineContains->setStyleSheet(u"QLineEdit { color: #ff0000; }"_qs); m_ui->lineContains->setStyleSheet(u"QLineEdit { color: #ff0000; }"_s);
m_ui->labelMustStat->setPixmap(UIThemeManager::instance()->getIcon(u"dialog-warning"_qs, u"task-attention"_qs).pixmap(16, 16)); m_ui->labelMustStat->setPixmap(UIThemeManager::instance()->getIcon(u"dialog-warning"_s, u"task-attention"_s).pixmap(16, 16));
m_ui->labelMustStat->setToolTip(error); m_ui->labelMustStat->setToolTip(error);
} }
} }
@ -787,8 +787,8 @@ void AutomatedRssDownloader::updateMustNotLineValidity()
} }
else else
{ {
m_ui->lineNotContains->setStyleSheet(u"QLineEdit { color: #ff0000; }"_qs); m_ui->lineNotContains->setStyleSheet(u"QLineEdit { color: #ff0000; }"_s);
m_ui->labelMustNotStat->setPixmap(UIThemeManager::instance()->getIcon(u"dialog-warning"_qs, u"task-attention"_qs).pixmap(16, 16)); m_ui->labelMustNotStat->setPixmap(UIThemeManager::instance()->getIcon(u"dialog-warning"_s, u"task-attention"_s).pixmap(16, 16));
m_ui->labelMustNotStat->setToolTip(error); m_ui->labelMustNotStat->setToolTip(error);
} }
} }
@ -805,8 +805,8 @@ void AutomatedRssDownloader::updateEpisodeFilterValidity()
} }
else else
{ {
m_ui->lineEFilter->setStyleSheet(u"QLineEdit { color: #ff0000; }"_qs); m_ui->lineEFilter->setStyleSheet(u"QLineEdit { color: #ff0000; }"_s);
m_ui->labelEpFilterStat->setPixmap(UIThemeManager::instance()->getIcon(u"dialog-warning"_qs, u"task-attention"_qs).pixmap(16, 16)); m_ui->labelEpFilterStat->setPixmap(UIThemeManager::instance()->getIcon(u"dialog-warning"_s, u"task-attention"_s).pixmap(16, 16));
} }
} }

View file

@ -79,11 +79,11 @@ namespace
QIcon rssFeedIcon(const RSS::Feed *feed) QIcon rssFeedIcon(const RSS::Feed *feed)
{ {
if (feed->isLoading()) if (feed->isLoading())
return UIThemeManager::instance()->getIcon(u"loading"_qs); return UIThemeManager::instance()->getIcon(u"loading"_s);
if (feed->hasError()) if (feed->hasError())
return UIThemeManager::instance()->getIcon(u"task-reject"_qs, u"unavailable"_qs); return UIThemeManager::instance()->getIcon(u"task-reject"_s, u"unavailable"_s);
return loadIcon(feed->iconPath(), u"application-rss"_qs); return loadIcon(feed->iconPath(), u"application-rss"_s);
} }
} }
@ -108,7 +108,7 @@ FeedListWidget::FeedListWidget(QWidget *parent)
m_unreadStickyItem->setData(0, Qt::UserRole, QVariant::fromValue( m_unreadStickyItem->setData(0, Qt::UserRole, QVariant::fromValue(
reinterpret_cast<intptr_t>(RSS::Session::instance()->rootFolder()))); reinterpret_cast<intptr_t>(RSS::Session::instance()->rootFolder())));
m_unreadStickyItem->setText(0, tr("Unread (%1)").arg(RSS::Session::instance()->rootFolder()->unreadCount())); m_unreadStickyItem->setText(0, tr("Unread (%1)").arg(RSS::Session::instance()->rootFolder()->unreadCount()));
m_unreadStickyItem->setData(0, Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"mail-inbox"_qs)); m_unreadStickyItem->setData(0, Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"mail-inbox"_s));
m_unreadStickyItem->setData(0, StickyItemTagRole, true); m_unreadStickyItem->setData(0, StickyItemTagRole, true);
@ -157,7 +157,7 @@ void FeedListWidget::handleItemUnreadCountChanged(RSS::Item *rssItem)
{ {
QTreeWidgetItem *item = mapRSSItem(rssItem); QTreeWidgetItem *item = mapRSSItem(rssItem);
Q_ASSERT(item); Q_ASSERT(item);
item->setData(0, Qt::DisplayRole, u"%1 (%2)"_qs.arg(rssItem->name(), QString::number(rssItem->unreadCount()))); item->setData(0, Qt::DisplayRole, u"%1 (%2)"_s.arg(rssItem->name(), QString::number(rssItem->unreadCount())));
} }
} }
@ -166,7 +166,7 @@ void FeedListWidget::handleItemPathChanged(RSS::Item *rssItem)
QTreeWidgetItem *item = mapRSSItem(rssItem); QTreeWidgetItem *item = mapRSSItem(rssItem);
Q_ASSERT(item); Q_ASSERT(item);
item->setData(0, Qt::DisplayRole, u"%1 (%2)"_qs.arg(rssItem->name(), QString::number(rssItem->unreadCount()))); item->setData(0, Qt::DisplayRole, u"%1 (%2)"_s.arg(rssItem->name(), QString::number(rssItem->unreadCount())));
RSS::Item *parentRssItem = RSS::Session::instance()->itemByPath(RSS::Item::parentPath(rssItem->path())); RSS::Item *parentRssItem = RSS::Session::instance()->itemByPath(RSS::Item::parentPath(rssItem->path()));
QTreeWidgetItem *parentItem = mapRSSItem(parentRssItem); QTreeWidgetItem *parentItem = mapRSSItem(parentRssItem);
@ -273,7 +273,7 @@ void FeedListWidget::dropEvent(QDropEvent *event)
QTreeWidgetItem *FeedListWidget::createItem(RSS::Item *rssItem, QTreeWidgetItem *parentItem) QTreeWidgetItem *FeedListWidget::createItem(RSS::Item *rssItem, QTreeWidgetItem *parentItem)
{ {
auto *item = new FeedListItem; auto *item = new FeedListItem;
item->setData(0, Qt::DisplayRole, u"%1 (%2)"_qs.arg(rssItem->name(), QString::number(rssItem->unreadCount()))); item->setData(0, Qt::DisplayRole, u"%1 (%2)"_s.arg(rssItem->name(), QString::number(rssItem->unreadCount())));
item->setData(0, Qt::UserRole, QVariant::fromValue(reinterpret_cast<intptr_t>(rssItem))); item->setData(0, Qt::UserRole, QVariant::fromValue(reinterpret_cast<intptr_t>(rssItem)));
m_rssToTreeItemMapping[rssItem] = item; m_rssToTreeItemMapping[rssItem] = item;
@ -281,7 +281,7 @@ QTreeWidgetItem *FeedListWidget::createItem(RSS::Item *rssItem, QTreeWidgetItem
if (auto *feed = qobject_cast<RSS::Feed *>(rssItem)) if (auto *feed = qobject_cast<RSS::Feed *>(rssItem))
icon = rssFeedIcon(feed); icon = rssFeedIcon(feed);
else else
icon = UIThemeManager::instance()->getIcon(u"directory"_qs); icon = UIThemeManager::instance()->getIcon(u"directory"_s);
item->setData(0, Qt::DecorationRole, icon); item->setData(0, Qt::DecorationRole, icon);
connect(rssItem, &RSS::Item::unreadCountChanged, this, &FeedListWidget::handleItemUnreadCountChanged); connect(rssItem, &RSS::Item::unreadCountChanged, this, &FeedListWidget::handleItemUnreadCountChanged);

View file

@ -46,7 +46,7 @@ HtmlBrowser::HtmlBrowser(QWidget *parent)
{ {
m_netManager = new QNetworkAccessManager(this); m_netManager = new QNetworkAccessManager(this);
m_diskCache = new QNetworkDiskCache(this); m_diskCache = new QNetworkDiskCache(this);
m_diskCache->setCacheDirectory((specialFolderLocation(SpecialFolder::Cache) / Path(u"rss"_qs)).data()); m_diskCache->setCacheDirectory((specialFolderLocation(SpecialFolder::Cache) / Path(u"rss"_s)).data());
m_diskCache->setMaximumCacheSize(50 * 1024 * 1024); m_diskCache->setMaximumCacheSize(50 * 1024 * 1024);
qDebug() << "HtmlBrowser cache path:" << m_diskCache->cacheDirectory() << " max size:" << m_diskCache->maximumCacheSize() / 1024 / 1024 << "MB"; qDebug() << "HtmlBrowser cache path:" << m_diskCache->cacheDirectory() << " max size:" << m_diskCache->maximumCacheSize() / 1024 / 1024 << "MB";
m_netManager->setCache(m_diskCache); m_netManager->setCache(m_diskCache);
@ -60,7 +60,7 @@ QVariant HtmlBrowser::loadResource(int type, const QUrl &name)
{ {
QUrl url(name); QUrl url(name);
if (url.scheme().isEmpty()) if (url.scheme().isEmpty())
url.setScheme(u"http"_qs); url.setScheme(u"http"_s);
QIODevice *dev = m_diskCache->data(url); QIODevice *dev = m_diskCache->data(url);
if (dev) if (dev)
@ -104,7 +104,7 @@ void HtmlBrowser::resourceLoaded(QNetworkReply *reply)
metaData.setUrl(reply->request().url()); metaData.setUrl(reply->request().url());
metaData.setSaveToDisk(true); metaData.setSaveToDisk(true);
atts[QNetworkRequest::HttpStatusCodeAttribute] = 200; atts[QNetworkRequest::HttpStatusCodeAttribute] = 200;
atts[QNetworkRequest::HttpReasonPhraseAttribute] = u"Ok"_qs; atts[QNetworkRequest::HttpReasonPhraseAttribute] = u"Ok"_s;
metaData.setAttributes(atts); metaData.setAttributes(atts);
metaData.setLastModified(QDateTime::currentDateTime()); metaData.setLastModified(QDateTime::currentDateTime());
metaData.setExpirationDate(QDateTime::currentDateTime().addDays(1)); metaData.setExpirationDate(QDateTime::currentDateTime().addDays(1));

View file

@ -62,22 +62,22 @@ RSSWidget::RSSWidget(QWidget *parent)
m_ui->setupUi(this); m_ui->setupUi(this);
// Icons // Icons
m_ui->actionCopyFeedURL->setIcon(UIThemeManager::instance()->getIcon(u"edit-copy"_qs)); m_ui->actionCopyFeedURL->setIcon(UIThemeManager::instance()->getIcon(u"edit-copy"_s));
m_ui->actionDelete->setIcon(UIThemeManager::instance()->getIcon(u"edit-clear"_qs)); m_ui->actionDelete->setIcon(UIThemeManager::instance()->getIcon(u"edit-clear"_s));
m_ui->actionDownloadTorrent->setIcon(UIThemeManager::instance()->getIcon(u"downloading"_qs, u"download"_qs)); m_ui->actionDownloadTorrent->setIcon(UIThemeManager::instance()->getIcon(u"downloading"_s, u"download"_s));
m_ui->actionEditFeedURL->setIcon(UIThemeManager::instance()->getIcon(u"edit-rename"_qs)); m_ui->actionEditFeedURL->setIcon(UIThemeManager::instance()->getIcon(u"edit-rename"_s));
m_ui->actionMarkItemsRead->setIcon(UIThemeManager::instance()->getIcon(u"task-complete"_qs, u"mail-mark-read"_qs)); m_ui->actionMarkItemsRead->setIcon(UIThemeManager::instance()->getIcon(u"task-complete"_s, u"mail-mark-read"_s));
m_ui->actionNewFolder->setIcon(UIThemeManager::instance()->getIcon(u"folder-new"_qs)); m_ui->actionNewFolder->setIcon(UIThemeManager::instance()->getIcon(u"folder-new"_s));
m_ui->actionNewSubscription->setIcon(UIThemeManager::instance()->getIcon(u"list-add"_qs)); m_ui->actionNewSubscription->setIcon(UIThemeManager::instance()->getIcon(u"list-add"_s));
m_ui->actionOpenNewsURL->setIcon(UIThemeManager::instance()->getIcon(u"application-url"_qs)); m_ui->actionOpenNewsURL->setIcon(UIThemeManager::instance()->getIcon(u"application-url"_s));
m_ui->actionRename->setIcon(UIThemeManager::instance()->getIcon(u"edit-rename"_qs)); m_ui->actionRename->setIcon(UIThemeManager::instance()->getIcon(u"edit-rename"_s));
m_ui->actionUpdate->setIcon(UIThemeManager::instance()->getIcon(u"view-refresh"_qs)); m_ui->actionUpdate->setIcon(UIThemeManager::instance()->getIcon(u"view-refresh"_s));
m_ui->actionUpdateAllFeeds->setIcon(UIThemeManager::instance()->getIcon(u"view-refresh"_qs)); m_ui->actionUpdateAllFeeds->setIcon(UIThemeManager::instance()->getIcon(u"view-refresh"_s));
#ifndef Q_OS_MACOS #ifndef Q_OS_MACOS
m_ui->newFeedButton->setIcon(UIThemeManager::instance()->getIcon(u"list-add"_qs)); m_ui->newFeedButton->setIcon(UIThemeManager::instance()->getIcon(u"list-add"_s));
m_ui->markReadButton->setIcon(UIThemeManager::instance()->getIcon(u"task-complete"_qs, u"mail-mark-read"_qs)); m_ui->markReadButton->setIcon(UIThemeManager::instance()->getIcon(u"task-complete"_s, u"mail-mark-read"_s));
m_ui->updateAllButton->setIcon(UIThemeManager::instance()->getIcon(u"view-refresh"_qs)); m_ui->updateAllButton->setIcon(UIThemeManager::instance()->getIcon(u"view-refresh"_s));
m_ui->rssDownloaderBtn->setIcon(UIThemeManager::instance()->getIcon(u"downloading"_qs, u"download"_qs)); m_ui->rssDownloaderBtn->setIcon(UIThemeManager::instance()->getIcon(u"downloading"_s, u"download"_s));
#endif #endif
m_articleListWidget = new ArticleListWidget(m_ui->splitterMain); m_articleListWidget = new ArticleListWidget(m_ui->splitterMain);
@ -254,7 +254,7 @@ void RSSWidget::askNewFolder()
const QString newFolderPath = RSS::Item::joinPath(rssDestFolder->path(), newName); const QString newFolderPath = RSS::Item::joinPath(rssDestFolder->path(), newName);
const nonstd::expected<void, QString> result = RSS::Session::instance()->addFolder(newFolderPath); const nonstd::expected<void, QString> result = RSS::Session::instance()->addFolder(newFolderPath);
if (!result) if (!result)
QMessageBox::warning(this, u"qBittorrent"_qs, result.error(), QMessageBox::Ok); QMessageBox::warning(this, u"qBittorrent"_s, result.error(), QMessageBox::Ok);
// Expand destination folder to display new feed // Expand destination folder to display new feed
if (destItem && (destItem != m_feedListWidget->stickyUnreadItem())) if (destItem && (destItem != m_feedListWidget->stickyUnreadItem()))
@ -268,7 +268,7 @@ void RSSWidget::on_newFeedButton_clicked()
{ {
// Ask for feed URL // Ask for feed URL
const QString clipText = qApp->clipboard()->text(); const QString clipText = qApp->clipboard()->text();
const QString defaultURL = Net::DownloadManager::hasSupportedScheme(clipText) ? clipText : u"http://"_qs; const QString defaultURL = Net::DownloadManager::hasSupportedScheme(clipText) ? clipText : u"http://"_s;
bool ok = false; bool ok = false;
QString newURL = AutoExpandableDialog::getText( QString newURL = AutoExpandableDialog::getText(
@ -296,7 +296,7 @@ void RSSWidget::on_newFeedButton_clicked()
const QString newFeedPath = RSS::Item::joinPath(rssDestFolder->path(), newURL); const QString newFeedPath = RSS::Item::joinPath(rssDestFolder->path(), newURL);
const nonstd::expected<void, QString> result = RSS::Session::instance()->addFeed(newURL, newFeedPath); const nonstd::expected<void, QString> result = RSS::Session::instance()->addFeed(newURL, newFeedPath);
if (!result) if (!result)
QMessageBox::warning(this, u"qBittorrent"_qs, result.error(), QMessageBox::Ok); QMessageBox::warning(this, u"qBittorrent"_s, result.error(), QMessageBox::Ok);
// Expand destination folder to display new feed // Expand destination folder to display new feed
if (destItem && (destItem != m_feedListWidget->stickyUnreadItem())) if (destItem && (destItem != m_feedListWidget->stickyUnreadItem()))
@ -445,7 +445,7 @@ void RSSWidget::editSelectedRSSFeedURL()
const nonstd::expected<void, QString> result = RSS::Session::instance()->setFeedURL(rssFeed, newURL); const nonstd::expected<void, QString> result = RSS::Session::instance()->setFeedURL(rssFeed, newURL);
if (!result) if (!result)
QMessageBox::warning(this, u"qBittorrent"_qs, result.error(), QMessageBox::Ok); QMessageBox::warning(this, u"qBittorrent"_s, result.error(), QMessageBox::Ok);
} }
void RSSWidget::refreshSelectedItems() void RSSWidget::refreshSelectedItems()
@ -512,11 +512,11 @@ void RSSWidget::handleCurrentArticleItemChanged(QListWidgetItem *currentItem, QL
QString html = QString html =
u"<div style='border: 2px solid red; margin-left: 5px; margin-right: 5px; margin-bottom: 5px;'>" + u"<div style='border: 2px solid red; margin-left: 5px; margin-right: 5px; margin-bottom: 5px;'>" +
u"<div style='background-color: \"%1\"; font-weight: bold; color: \"%2\";'>%3</div>"_qs.arg(highlightedBaseColor, highlightedBaseTextColor, article->title()); u"<div style='background-color: \"%1\"; font-weight: bold; color: \"%2\";'>%3</div>"_s.arg(highlightedBaseColor, highlightedBaseTextColor, article->title());
if (article->date().isValid()) if (article->date().isValid())
html += u"<div style='background-color: \"%1\";'><b>%2</b>%3</div>"_qs.arg(alternateBaseColor, tr("Date: "), QLocale::system().toString(article->date().toLocalTime())); html += u"<div style='background-color: \"%1\";'><b>%2</b>%3</div>"_s.arg(alternateBaseColor, tr("Date: "), QLocale::system().toString(article->date().toLocalTime()));
if (!article->author().isEmpty()) if (!article->author().isEmpty())
html += u"<div style='background-color: \"%1\";'><b>%2</b>%3</div>"_qs.arg(alternateBaseColor, tr("Author: "), article->author()); html += u"<div style='background-color: \"%1\";'><b>%2</b>%3</div>"_s.arg(alternateBaseColor, tr("Author: "), article->author());
html += u"</div>" html += u"</div>"
u"<div style='margin-left: 5px; margin-right: 5px;'>"; u"<div style='margin-left: 5px; margin-right: 5px;'>";
if (Qt::mightBeRichText(article->description())) if (Qt::mightBeRichText(article->description()))
@ -531,23 +531,23 @@ void RSSWidget::handleCurrentArticleItemChanged(QListWidgetItem *currentItem, QL
rx.setPatternOptions(QRegularExpression::InvertedGreedinessOption rx.setPatternOptions(QRegularExpression::InvertedGreedinessOption
| QRegularExpression::CaseInsensitiveOption); | QRegularExpression::CaseInsensitiveOption);
rx.setPattern(u"\\[img\\](.+)\\[/img\\]"_qs); rx.setPattern(u"\\[img\\](.+)\\[/img\\]"_s);
description = description.replace(rx, u"<img src=\"\\1\">"_qs); description = description.replace(rx, u"<img src=\"\\1\">"_s);
rx.setPattern(u"\\[url=(\")?(.+)\\1\\]"_qs); rx.setPattern(u"\\[url=(\")?(.+)\\1\\]"_s);
description = description.replace(rx, u"<a href=\"\\2\">"_qs); description = description.replace(rx, u"<a href=\"\\2\">"_s);
description = description.replace(u"[/url]"_qs, u"</a>"_qs, Qt::CaseInsensitive); description = description.replace(u"[/url]"_s, u"</a>"_s, Qt::CaseInsensitive);
rx.setPattern(u"\\[(/)?([bius])\\]"_qs); rx.setPattern(u"\\[(/)?([bius])\\]"_s);
description = description.replace(rx, u"<\\1\\2>"_qs); description = description.replace(rx, u"<\\1\\2>"_s);
rx.setPattern(u"\\[color=(\")?(.+)\\1\\]"_qs); rx.setPattern(u"\\[color=(\")?(.+)\\1\\]"_s);
description = description.replace(rx, u"<span style=\"color:\\2\">"_qs); description = description.replace(rx, u"<span style=\"color:\\2\">"_s);
description = description.replace(u"[/color]"_qs, u"</span>"_qs, Qt::CaseInsensitive); description = description.replace(u"[/color]"_s, u"</span>"_s, Qt::CaseInsensitive);
rx.setPattern(u"\\[size=(\")?(.+)\\d\\1\\]"_qs); rx.setPattern(u"\\[size=(\")?(.+)\\d\\1\\]"_s);
description = description.replace(rx, u"<span style=\"font-size:\\2px\">"_qs); description = description.replace(rx, u"<span style=\"font-size:\\2px\">"_s);
description = description.replace(u"[/size]"_qs, u"</span>"_qs, Qt::CaseInsensitive); description = description.replace(u"[/size]"_s, u"</span>"_s, Qt::CaseInsensitive);
html += u"<pre>" + description + u"</pre>"; html += u"<pre>" + description + u"</pre>";
} }

View file

@ -63,7 +63,7 @@ enum PluginColumns
PluginSelectDialog::PluginSelectDialog(SearchPluginManager *pluginManager, QWidget *parent) PluginSelectDialog::PluginSelectDialog(SearchPluginManager *pluginManager, QWidget *parent)
: QDialog(parent) : QDialog(parent)
, m_ui(new Ui::PluginSelectDialog) , m_ui(new Ui::PluginSelectDialog)
, m_storeDialogSize(SETTINGS_KEY(u"Size"_qs)) , m_storeDialogSize(SETTINGS_KEY(u"Size"_s))
, m_pluginManager(pluginManager) , m_pluginManager(pluginManager)
{ {
m_ui->setupUi(this); m_ui->setupUi(this);
@ -73,7 +73,7 @@ PluginSelectDialog::PluginSelectDialog(SearchPluginManager *pluginManager, QWidg
m_ui->pluginsTree->header()->setFirstSectionMovable(true); m_ui->pluginsTree->header()->setFirstSectionMovable(true);
m_ui->pluginsTree->header()->setSortIndicator(0, Qt::AscendingOrder); m_ui->pluginsTree->header()->setSortIndicator(0, Qt::AscendingOrder);
m_ui->actionUninstall->setIcon(UIThemeManager::instance()->getIcon(u"list-remove"_qs)); m_ui->actionUninstall->setIcon(UIThemeManager::instance()->getIcon(u"list-remove"_s));
connect(m_ui->actionEnable, &QAction::toggled, this, &PluginSelectDialog::enableSelection); connect(m_ui->actionEnable, &QAction::toggled, this, &PluginSelectDialog::enableSelection);
connect(m_ui->pluginsTree, &QTreeWidget::customContextMenuRequested, this, &PluginSelectDialog::displayContextMenu); connect(m_ui->pluginsTree, &QTreeWidget::customContextMenuRequested, this, &PluginSelectDialog::displayContextMenu);
@ -139,7 +139,7 @@ void PluginSelectDialog::dragEnterEvent(QDragEnterEvent *event)
qDebug("mimeData: %s", qUtf8Printable(mime)); qDebug("mimeData: %s", qUtf8Printable(mime));
} }
if (event->mimeData()->hasFormat(u"text/plain"_qs) || event->mimeData()->hasFormat(u"text/uri-list"_qs)) if (event->mimeData()->hasFormat(u"text/plain"_s) || event->mimeData()->hasFormat(u"text/uri-list"_s))
{ {
event->acceptProposedAction(); event->acceptProposedAction();
} }
@ -158,12 +158,12 @@ void PluginSelectDialog::togglePluginState(QTreeWidgetItem *item, int)
if (plugin->enabled) if (plugin->enabled)
{ {
item->setText(PLUGIN_STATE, tr("Yes")); item->setText(PLUGIN_STATE, tr("Yes"));
setRowColor(m_ui->pluginsTree->indexOfTopLevelItem(item), u"green"_qs); setRowColor(m_ui->pluginsTree->indexOfTopLevelItem(item), u"green"_s);
} }
else else
{ {
item->setText(PLUGIN_STATE, tr("No")); item->setText(PLUGIN_STATE, tr("No"));
setRowColor(m_ui->pluginsTree->indexOfTopLevelItem(item), u"red"_qs); setRowColor(m_ui->pluginsTree->indexOfTopLevelItem(item), u"red"_s);
} }
} }
@ -208,7 +208,7 @@ void PluginSelectDialog::on_actionUninstall_triggered()
// Disable it instead // Disable it instead
m_pluginManager->enablePlugin(id, false); m_pluginManager->enablePlugin(id, false);
item->setText(PLUGIN_STATE, tr("No")); item->setText(PLUGIN_STATE, tr("No"));
setRowColor(index, u"red"_qs); setRowColor(index, u"red"_s);
} }
} }
@ -229,12 +229,12 @@ void PluginSelectDialog::enableSelection(bool enable)
if (enable) if (enable)
{ {
item->setText(PLUGIN_STATE, tr("Yes")); item->setText(PLUGIN_STATE, tr("Yes"));
setRowColor(index, u"green"_qs); setRowColor(index, u"green"_s);
} }
else else
{ {
item->setText(PLUGIN_STATE, tr("No")); item->setText(PLUGIN_STATE, tr("No"));
setRowColor(index, u"red"_qs); setRowColor(index, u"red"_s);
} }
} }
} }
@ -294,12 +294,12 @@ void PluginSelectDialog::addNewPlugin(const QString &pluginName)
if (plugin->enabled) if (plugin->enabled)
{ {
item->setText(PLUGIN_STATE, tr("Yes")); item->setText(PLUGIN_STATE, tr("Yes"));
setRowColor(m_ui->pluginsTree->indexOfTopLevelItem(item), u"green"_qs); setRowColor(m_ui->pluginsTree->indexOfTopLevelItem(item), u"green"_s);
} }
else else
{ {
item->setText(PLUGIN_STATE, tr("No")); item->setText(PLUGIN_STATE, tr("No"));
setRowColor(m_ui->pluginsTree->indexOfTopLevelItem(item), u"red"_qs); setRowColor(m_ui->pluginsTree->indexOfTopLevelItem(item), u"red"_s);
} }
// Handle icon // Handle icon
if (plugin->iconPath.exists()) if (plugin->iconPath.exists())
@ -356,7 +356,7 @@ void PluginSelectDialog::askForPluginUrl()
{ {
bool ok = false; bool ok = false;
QString clipTxt = qApp->clipboard()->text(); QString clipTxt = qApp->clipboard()->text();
auto defaultUrl = u"http://"_qs; auto defaultUrl = u"http://"_s;
if (Net::DownloadManager::hasSupportedScheme(clipTxt) && clipTxt.endsWith(u".py")) if (Net::DownloadManager::hasSupportedScheme(clipTxt) && clipTxt.endsWith(u".py"))
defaultUrl = clipTxt; defaultUrl = clipTxt;
QString url = AutoExpandableDialog::getText( QString url = AutoExpandableDialog::getText(
@ -415,7 +415,7 @@ void PluginSelectDialog::iconDownloadFinished(const Net::DownloadResult &result)
PluginInfo *plugin = m_pluginManager->pluginInfo(id); PluginInfo *plugin = m_pluginManager->pluginInfo(id);
if (!plugin) continue; if (!plugin) continue;
const QString ext = result.url.endsWith(u".ico", Qt::CaseInsensitive) ? u".ico"_qs : u".png"_qs; const QString ext = result.url.endsWith(u".ico", Qt::CaseInsensitive) ? u".ico"_s : u".png"_s;
const Path iconPath = SearchPluginManager::pluginsLocation() / Path(id + ext); const Path iconPath = SearchPluginManager::pluginsLocation() / Path(id + ext);
if (Utils::Fs::copyFile(filePath, iconPath)) if (Utils::Fs::copyFile(filePath, iconPath))
{ {

View file

@ -36,7 +36,7 @@
PluginSourceDialog::PluginSourceDialog(QWidget *parent) PluginSourceDialog::PluginSourceDialog(QWidget *parent)
: QDialog(parent) : QDialog(parent)
, m_ui(new Ui::PluginSourceDialog) , m_ui(new Ui::PluginSourceDialog)
, m_storeDialogSize(SETTINGS_KEY(u"Size"_qs)) , m_storeDialogSize(SETTINGS_KEY(u"Size"_s))
{ {
m_ui->setupUi(this); m_ui->setupUi(this);

View file

@ -56,7 +56,7 @@ SearchJobWidget::SearchJobWidget(SearchHandler *searchHandler, QWidget *parent)
: QWidget(parent) : QWidget(parent)
, m_ui(new Ui::SearchJobWidget) , m_ui(new Ui::SearchJobWidget)
, m_searchHandler(searchHandler) , m_searchHandler(searchHandler)
, m_nameFilteringMode(u"Search/FilteringMode"_qs) , m_nameFilteringMode(u"Search/FilteringMode"_s)
{ {
m_ui->setupUi(this); m_ui->setupUi(this);
@ -390,22 +390,22 @@ void SearchJobWidget::contextMenuEvent(QContextMenuEvent *event)
auto *menu = new QMenu(this); auto *menu = new QMenu(this);
menu->setAttribute(Qt::WA_DeleteOnClose); menu->setAttribute(Qt::WA_DeleteOnClose);
menu->addAction(UIThemeManager::instance()->getIcon(u"download"_qs) menu->addAction(UIThemeManager::instance()->getIcon(u"download"_s)
, tr("Open download window"), this, [this]() { downloadTorrents(AddTorrentOption::ShowDialog); }); , tr("Open download window"), this, [this]() { downloadTorrents(AddTorrentOption::ShowDialog); });
menu->addAction(UIThemeManager::instance()->getIcon(u"downloading"_qs, u"download"_qs) menu->addAction(UIThemeManager::instance()->getIcon(u"downloading"_s, u"download"_s)
, tr("Download"), this, [this]() { downloadTorrents(AddTorrentOption::SkipDialog); }); , tr("Download"), this, [this]() { downloadTorrents(AddTorrentOption::SkipDialog); });
menu->addSeparator(); menu->addSeparator();
menu->addAction(UIThemeManager::instance()->getIcon(u"application-url"_qs), tr("Open description page") menu->addAction(UIThemeManager::instance()->getIcon(u"application-url"_s), tr("Open description page")
, this, &SearchJobWidget::openTorrentPages); , this, &SearchJobWidget::openTorrentPages);
QMenu *copySubMenu = menu->addMenu( QMenu *copySubMenu = menu->addMenu(
UIThemeManager::instance()->getIcon(u"edit-copy"_qs), tr("Copy")); UIThemeManager::instance()->getIcon(u"edit-copy"_s), tr("Copy"));
copySubMenu->addAction(UIThemeManager::instance()->getIcon(u"name"_qs, u"edit-copy"_qs), tr("Name") copySubMenu->addAction(UIThemeManager::instance()->getIcon(u"name"_s, u"edit-copy"_s), tr("Name")
, this, &SearchJobWidget::copyTorrentNames); , this, &SearchJobWidget::copyTorrentNames);
copySubMenu->addAction(UIThemeManager::instance()->getIcon(u"insert-link"_qs, u"edit-copy"_qs), tr("Download link") copySubMenu->addAction(UIThemeManager::instance()->getIcon(u"insert-link"_s, u"edit-copy"_s), tr("Download link")
, this, &SearchJobWidget::copyTorrentDownloadLinks); , this, &SearchJobWidget::copyTorrentDownloadLinks);
copySubMenu->addAction(UIThemeManager::instance()->getIcon(u"application-url"_qs, u"edit-copy"_qs), tr("Description page URL") copySubMenu->addAction(UIThemeManager::instance()->getIcon(u"application-url"_s, u"edit-copy"_s), tr("Description page URL")
, this, &SearchJobWidget::copyTorrentURLs); , this, &SearchJobWidget::copyTorrentURLs);
menu->popup(event->globalPos()); menu->popup(event->globalPos());

View file

@ -69,14 +69,14 @@ namespace
switch (st) switch (st)
{ {
case SearchJobWidget::Status::Ongoing: case SearchJobWidget::Status::Ongoing:
return u"queued"_qs; return u"queued"_s;
case SearchJobWidget::Status::Finished: case SearchJobWidget::Status::Finished:
return u"task-complete"_qs; return u"task-complete"_s;
case SearchJobWidget::Status::Aborted: case SearchJobWidget::Status::Aborted:
return u"task-reject"_qs; return u"task-reject"_s;
case SearchJobWidget::Status::Error: case SearchJobWidget::Status::Error:
case SearchJobWidget::Status::NoResults: case SearchJobWidget::Status::NoResults:
return u"dialog-warning"_qs; return u"dialog-warning"_s;
default: default:
return {}; return {};
} }
@ -110,8 +110,8 @@ SearchWidget::SearchWidget(IGUIApplication *app, MainWindow *mainWindow)
#ifndef Q_OS_MACOS #ifndef Q_OS_MACOS
// Icons // Icons
m_ui->searchButton->setIcon(UIThemeManager::instance()->getIcon(u"edit-find"_qs)); m_ui->searchButton->setIcon(UIThemeManager::instance()->getIcon(u"edit-find"_s));
m_ui->pluginsButton->setIcon(UIThemeManager::instance()->getIcon(u"plugins"_qs, u"preferences-system-network"_qs)); m_ui->pluginsButton->setIcon(UIThemeManager::instance()->getIcon(u"plugins"_s, u"preferences-system-network"_s));
#else #else
// On macOS the icons overlap the text otherwise // On macOS the icons overlap the text otherwise
QSize iconSize = m_ui->tabWidget->iconSize(); QSize iconSize = m_ui->tabWidget->iconSize();
@ -179,7 +179,7 @@ bool SearchWidget::eventFilter(QObject *object, QEvent *event)
void SearchWidget::fillCatCombobox() void SearchWidget::fillCatCombobox()
{ {
m_ui->comboCategory->clear(); m_ui->comboCategory->clear();
m_ui->comboCategory->addItem(SearchPluginManager::categoryFullName(u"all"_qs), u"all"_qs); m_ui->comboCategory->addItem(SearchPluginManager::categoryFullName(u"all"_s), u"all"_s);
using QStrPair = std::pair<QString, QString>; using QStrPair = std::pair<QString, QString>;
QVector<QStrPair> tmpList; QVector<QStrPair> tmpList;
@ -200,9 +200,9 @@ void SearchWidget::fillCatCombobox()
void SearchWidget::fillPluginComboBox() void SearchWidget::fillPluginComboBox()
{ {
m_ui->selectPlugin->clear(); m_ui->selectPlugin->clear();
m_ui->selectPlugin->addItem(tr("Only enabled"), u"enabled"_qs); m_ui->selectPlugin->addItem(tr("Only enabled"), u"enabled"_s);
m_ui->selectPlugin->addItem(tr("All plugins"), u"all"_qs); m_ui->selectPlugin->addItem(tr("All plugins"), u"all"_s);
m_ui->selectPlugin->addItem(tr("Select..."), u"multi"_qs); m_ui->selectPlugin->addItem(tr("Select..."), u"multi"_s);
using QStrPair = std::pair<QString, QString>; using QStrPair = std::pair<QString, QString>;
QVector<QStrPair> tmpList; QVector<QStrPair> tmpList;
@ -349,7 +349,7 @@ void SearchWidget::on_searchButton_clicked()
m_allTabs.append(newTab); m_allTabs.append(newTab);
QString tabName = pattern; QString tabName = pattern;
tabName.replace(QRegularExpression(u"&{1}"_qs), u"&&"_qs); tabName.replace(QRegularExpression(u"&{1}"_s), u"&&"_s);
m_ui->tabWidget->addTab(newTab, tabName); m_ui->tabWidget->addTab(newTab, tabName);
m_ui->tabWidget->setCurrentWidget(newTab); m_ui->tabWidget->setCurrentWidget(newTab);

View file

@ -52,14 +52,14 @@ namespace
SpeedLimitDialog::SpeedLimitDialog(QWidget *parent) SpeedLimitDialog::SpeedLimitDialog(QWidget *parent)
: QDialog {parent} : QDialog {parent}
, m_ui {new Ui::SpeedLimitDialog} , m_ui {new Ui::SpeedLimitDialog}
, m_storeDialogSize {SETTINGS_KEY(u"Size"_qs)} , m_storeDialogSize {SETTINGS_KEY(u"Size"_s)}
{ {
m_ui->setupUi(this); m_ui->setupUi(this);
m_ui->labelGlobalSpeedIcon->setPixmap( m_ui->labelGlobalSpeedIcon->setPixmap(
UIThemeManager::instance()->getScaledPixmap(u"slow_off"_qs, Utils::Gui::mediumIconSize(this).height())); UIThemeManager::instance()->getScaledPixmap(u"slow_off"_s, Utils::Gui::mediumIconSize(this).height()));
m_ui->labelAltGlobalSpeedIcon->setPixmap( m_ui->labelAltGlobalSpeedIcon->setPixmap(
UIThemeManager::instance()->getScaledPixmap(u"slow"_qs, Utils::Gui::mediumIconSize(this).height())); UIThemeManager::instance()->getScaledPixmap(u"slow"_s, Utils::Gui::mediumIconSize(this).height()));
const auto initSlider = [](QSlider *slider, const int value, const int maximum) const auto initSlider = [](QSlider *slider, const int value, const int maximum)
{ {

View file

@ -45,7 +45,7 @@
StatsDialog::StatsDialog(QWidget *parent) StatsDialog::StatsDialog(QWidget *parent)
: QDialog(parent) : QDialog(parent)
, m_ui(new Ui::StatsDialog) , m_ui(new Ui::StatsDialog)
, m_storeDialogSize(SETTINGS_KEY(u"Size"_qs)) , m_storeDialogSize(SETTINGS_KEY(u"Size"_s))
{ {
m_ui->setupUi(this); m_ui->setupUi(this);
@ -86,13 +86,13 @@ void StatsDialog::update()
m_ui->labelGlobalRatio->setText( m_ui->labelGlobalRatio->setText(
((atd > 0) && (atu > 0)) ((atd > 0) && (atu > 0))
? Utils::String::fromDouble(static_cast<qreal>(atu) / atd, 2) ? Utils::String::fromDouble(static_cast<qreal>(atu) / atd, 2)
: u"-"_qs); : u"-"_s);
#ifndef QBT_USES_LIBTORRENT2 #ifndef QBT_USES_LIBTORRENT2
// Cache hits // Cache hits
const qreal readRatio = cs.readRatio; const qreal readRatio = cs.readRatio;
m_ui->labelCacheHits->setText(u"%1%"_qs.arg((readRatio > 0) m_ui->labelCacheHits->setText(u"%1%"_s.arg((readRatio > 0)
? Utils::String::fromDouble((100 * readRatio), 2) ? Utils::String::fromDouble((100 * readRatio), 2)
: u"0"_qs)); : u"0"_s));
#endif #endif
// Buffers size // Buffers size
m_ui->labelTotalBuf->setText(Utils::Misc::friendlyUnit(cs.totalUsedBuffers * 16 * 1024)); m_ui->labelTotalBuf->setText(Utils::Misc::friendlyUnit(cs.totalUsedBuffers * 16 * 1024));
@ -100,12 +100,12 @@ void StatsDialog::update()
// From lt manual: disk_write_queue and disk_read_queue are the number of peers currently waiting on a disk write or disk read // From lt manual: disk_write_queue and disk_read_queue are the number of peers currently waiting on a disk write or disk read
// to complete before it receives or sends any more data on the socket. It's a metric of how disk bound you are. // to complete before it receives or sends any more data on the socket. It's a metric of how disk bound you are.
m_ui->labelWriteStarve->setText(u"%1%"_qs.arg(((ss.diskWriteQueue > 0) && (ss.peersCount > 0)) m_ui->labelWriteStarve->setText(u"%1%"_s.arg(((ss.diskWriteQueue > 0) && (ss.peersCount > 0))
? Utils::String::fromDouble((100. * ss.diskWriteQueue / ss.peersCount), 2) ? Utils::String::fromDouble((100. * ss.diskWriteQueue / ss.peersCount), 2)
: u"0"_qs)); : u"0"_s));
m_ui->labelReadStarve->setText(u"%1%"_qs.arg(((ss.diskReadQueue > 0) && (ss.peersCount > 0)) m_ui->labelReadStarve->setText(u"%1%"_s.arg(((ss.diskReadQueue > 0) && (ss.peersCount > 0))
? Utils::String::fromDouble((100. * ss.diskReadQueue / ss.peersCount), 2) ? Utils::String::fromDouble((100. * ss.diskReadQueue / ss.peersCount), 2)
: u"0"_qs)); : u"0"_s));
// Disk queues // Disk queues
m_ui->labelQueuedJobs->setText(QString::number(cs.jobQueueLength)); m_ui->labelQueuedJobs->setText(QString::number(cs.jobQueueLength));

View file

@ -49,7 +49,7 @@ StatusBar::StatusBar(QWidget *parent)
#ifndef Q_OS_MACOS #ifndef Q_OS_MACOS
// Redefining global stylesheet breaks certain elements on mac like tabs. // Redefining global stylesheet breaks certain elements on mac like tabs.
// Qt checks whether the stylesheet class inherits("QMacStyle") and this becomes false. // Qt checks whether the stylesheet class inherits("QMacStyle") and this becomes false.
setStyleSheet(u"QStatusBar::item { border-width: 0; }"_qs); setStyleSheet(u"QStatusBar::item { border-width: 0; }"_s);
#endif #endif
BitTorrent::Session *const session = BitTorrent::Session::instance(); BitTorrent::Session *const session = BitTorrent::Session::instance();
@ -63,27 +63,27 @@ StatusBar::StatusBar(QWidget *parent)
m_connecStatusLblIcon->setFlat(true); m_connecStatusLblIcon->setFlat(true);
m_connecStatusLblIcon->setFocusPolicy(Qt::NoFocus); m_connecStatusLblIcon->setFocusPolicy(Qt::NoFocus);
m_connecStatusLblIcon->setCursor(Qt::PointingHandCursor); m_connecStatusLblIcon->setCursor(Qt::PointingHandCursor);
m_connecStatusLblIcon->setIcon(UIThemeManager::instance()->getIcon(u"firewalled"_qs)); m_connecStatusLblIcon->setIcon(UIThemeManager::instance()->getIcon(u"firewalled"_s));
m_connecStatusLblIcon->setToolTip(u"<b>%1</b><br><i>%2</i>"_qs.arg(tr("Connection status:") m_connecStatusLblIcon->setToolTip(u"<b>%1</b><br><i>%2</i>"_s.arg(tr("Connection status:")
, tr("No direct connections. This may indicate network configuration problems."))); , tr("No direct connections. This may indicate network configuration problems.")));
connect(m_connecStatusLblIcon, &QAbstractButton::clicked, this, &StatusBar::connectionButtonClicked); connect(m_connecStatusLblIcon, &QAbstractButton::clicked, this, &StatusBar::connectionButtonClicked);
m_dlSpeedLbl = new QPushButton(this); m_dlSpeedLbl = new QPushButton(this);
m_dlSpeedLbl->setIcon(UIThemeManager::instance()->getIcon(u"downloading"_qs, u"downloading_small"_qs)); m_dlSpeedLbl->setIcon(UIThemeManager::instance()->getIcon(u"downloading"_s, u"downloading_small"_s));
connect(m_dlSpeedLbl, &QAbstractButton::clicked, this, &StatusBar::capSpeed); connect(m_dlSpeedLbl, &QAbstractButton::clicked, this, &StatusBar::capSpeed);
m_dlSpeedLbl->setFlat(true); m_dlSpeedLbl->setFlat(true);
m_dlSpeedLbl->setFocusPolicy(Qt::NoFocus); m_dlSpeedLbl->setFocusPolicy(Qt::NoFocus);
m_dlSpeedLbl->setCursor(Qt::PointingHandCursor); m_dlSpeedLbl->setCursor(Qt::PointingHandCursor);
m_dlSpeedLbl->setStyleSheet(u"text-align:left;"_qs); m_dlSpeedLbl->setStyleSheet(u"text-align:left;"_s);
m_dlSpeedLbl->setMinimumWidth(200); m_dlSpeedLbl->setMinimumWidth(200);
m_upSpeedLbl = new QPushButton(this); m_upSpeedLbl = new QPushButton(this);
m_upSpeedLbl->setIcon(UIThemeManager::instance()->getIcon(u"upload"_qs, u"seeding"_qs)); m_upSpeedLbl->setIcon(UIThemeManager::instance()->getIcon(u"upload"_s, u"seeding"_s));
connect(m_upSpeedLbl, &QAbstractButton::clicked, this, &StatusBar::capSpeed); connect(m_upSpeedLbl, &QAbstractButton::clicked, this, &StatusBar::capSpeed);
m_upSpeedLbl->setFlat(true); m_upSpeedLbl->setFlat(true);
m_upSpeedLbl->setFocusPolicy(Qt::NoFocus); m_upSpeedLbl->setFocusPolicy(Qt::NoFocus);
m_upSpeedLbl->setCursor(Qt::PointingHandCursor); m_upSpeedLbl->setCursor(Qt::PointingHandCursor);
m_upSpeedLbl->setStyleSheet(u"text-align:left;"_qs); m_upSpeedLbl->setStyleSheet(u"text-align:left;"_s);
m_upSpeedLbl->setMinimumWidth(200); m_upSpeedLbl->setMinimumWidth(200);
m_DHTLbl = new QLabel(tr("DHT: %1 nodes").arg(0), this); m_DHTLbl = new QLabel(tr("DHT: %1 nodes").arg(0), this);
@ -140,7 +140,7 @@ StatusBar::StatusBar(QWidget *parent)
layout->addWidget(m_upSpeedLbl); layout->addWidget(m_upSpeedLbl);
addPermanentWidget(container); addPermanentWidget(container);
setStyleSheet(u"QWidget {margin: 0;}"_qs); setStyleSheet(u"QWidget {margin: 0;}"_s);
container->adjustSize(); container->adjustSize();
adjustSize(); adjustSize();
// Is DHT enabled // Is DHT enabled
@ -174,8 +174,8 @@ void StatusBar::updateConnectionStatus()
if (!BitTorrent::Session::instance()->isListening()) if (!BitTorrent::Session::instance()->isListening())
{ {
m_connecStatusLblIcon->setIcon(UIThemeManager::instance()->getIcon(u"disconnected"_qs)); m_connecStatusLblIcon->setIcon(UIThemeManager::instance()->getIcon(u"disconnected"_s));
const QString tooltip = u"<b>%1</b><br>%2"_qs.arg(tr("Connection Status:"), tr("Offline. This usually means that qBittorrent failed to listen on the selected port for incoming connections.")); const QString tooltip = u"<b>%1</b><br>%2"_s.arg(tr("Connection Status:"), tr("Offline. This usually means that qBittorrent failed to listen on the selected port for incoming connections."));
m_connecStatusLblIcon->setToolTip(tooltip); m_connecStatusLblIcon->setToolTip(tooltip);
} }
else else
@ -183,14 +183,14 @@ void StatusBar::updateConnectionStatus()
if (sessionStatus.hasIncomingConnections) if (sessionStatus.hasIncomingConnections)
{ {
// Connection OK // Connection OK
m_connecStatusLblIcon->setIcon(UIThemeManager::instance()->getIcon(u"connected"_qs)); m_connecStatusLblIcon->setIcon(UIThemeManager::instance()->getIcon(u"connected"_s));
const QString tooltip = u"<b>%1</b><br>%2"_qs.arg(tr("Connection Status:"), tr("Online")); const QString tooltip = u"<b>%1</b><br>%2"_s.arg(tr("Connection Status:"), tr("Online"));
m_connecStatusLblIcon->setToolTip(tooltip); m_connecStatusLblIcon->setToolTip(tooltip);
} }
else else
{ {
m_connecStatusLblIcon->setIcon(UIThemeManager::instance()->getIcon(u"firewalled"_qs)); m_connecStatusLblIcon->setIcon(UIThemeManager::instance()->getIcon(u"firewalled"_s));
const QString tooltip = u"<b>%1</b><br><i>%2</i>"_qs.arg(tr("Connection Status:"), tr("No direct connections. This may indicate network configuration problems.")); const QString tooltip = u"<b>%1</b><br><i>%2</i>"_s.arg(tr("Connection Status:"), tr("No direct connections. This may indicate network configuration problems."));
m_connecStatusLblIcon->setToolTip(tooltip); m_connecStatusLblIcon->setToolTip(tooltip);
} }
} }
@ -240,13 +240,13 @@ void StatusBar::updateAltSpeedsBtn(bool alternative)
{ {
if (alternative) if (alternative)
{ {
m_altSpeedsBtn->setIcon(UIThemeManager::instance()->getIcon(u"slow"_qs)); m_altSpeedsBtn->setIcon(UIThemeManager::instance()->getIcon(u"slow"_s));
m_altSpeedsBtn->setToolTip(tr("Click to switch to regular speed limits")); m_altSpeedsBtn->setToolTip(tr("Click to switch to regular speed limits"));
m_altSpeedsBtn->setDown(true); m_altSpeedsBtn->setDown(true);
} }
else else
{ {
m_altSpeedsBtn->setIcon(UIThemeManager::instance()->getIcon(u"slow_off"_qs)); m_altSpeedsBtn->setIcon(UIThemeManager::instance()->getIcon(u"slow_off"_s));
m_altSpeedsBtn->setToolTip(tr("Click to switch to alternative speed limits")); m_altSpeedsBtn->setToolTip(tr("Click to switch to alternative speed limits"));
m_altSpeedsBtn->setDown(false); m_altSpeedsBtn->setDown(false);
} }

View file

@ -74,7 +74,7 @@ namespace
{ {
public: public:
UnifiedFileIconProvider() UnifiedFileIconProvider()
: m_textPlainIcon {UIThemeManager::instance()->getIcon(u"help-about"_qs, u"text-plain"_qs)} : m_textPlainIcon {UIThemeManager::instance()->getIcon(u"help-about"_s, u"text-plain"_s)}
{ {
} }
@ -163,7 +163,7 @@ namespace
*/ */
bool doesQFileIconProviderWork() bool doesQFileIconProviderWork()
{ {
const Path PSEUDO_UNIQUE_FILE_NAME = Utils::Fs::tempPath() / Path(u"qBittorrent-test-QFileIconProvider-845eb448-7ad5-4cdb-b764-b3f322a266a9"_qs); const Path PSEUDO_UNIQUE_FILE_NAME = Utils::Fs::tempPath() / Path(u"qBittorrent-test-QFileIconProvider-845eb448-7ad5-4cdb-b764-b3f322a266a9"_s);
QFileIconProvider provider; QFileIconProvider provider;
const QIcon testIcon1 = provider.icon(QFileInfo((PSEUDO_UNIQUE_FILE_NAME + u".pdf").data())); const QIcon testIcon1 = provider.icon(QFileInfo((PSEUDO_UNIQUE_FILE_NAME + u".pdf").data()));
const QIcon testIcon2 = provider.icon(QFileInfo((PSEUDO_UNIQUE_FILE_NAME + u".png").data())); const QIcon testIcon2 = provider.icon(QFileInfo((PSEUDO_UNIQUE_FILE_NAME + u".png").data()));

Some files were not shown because too many files have changed in this diff Show more