Browse Source

Merge pull request #12260 from Chocobo1/latin1

Construct QString more efficiently
adaptive-webui-19844
Mike Tzou 5 years ago committed by GitHub
parent
commit
5049b76b40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/app/application.cpp
  2. 4
      src/app/cmdoptions.cpp
  3. 2
      src/app/main.cpp
  4. 14
      src/app/stacktrace_win.h
  5. 16
      src/base/bittorrent/session.cpp
  6. 2
      src/base/http/responsegenerator.cpp
  7. 4
      src/base/net/geoipmanager.cpp
  8. 8
      src/base/net/proxyconfigurationmanager.cpp
  9. 2
      src/base/rss/rss_autodownloader.cpp
  10. 8
      src/base/rss/rss_autodownloadrule.cpp
  11. 2
      src/base/rss/rss_feed.cpp
  12. 10
      src/base/rss/rss_session.cpp
  13. 10
      src/base/search/searchpluginmanager.cpp
  14. 2
      src/gui/aboutdialog.cpp
  15. 4
      src/gui/advancedsettings.cpp
  16. 2
      src/gui/categoryfiltermodel.cpp
  17. 2
      src/gui/lineedit.cpp
  18. 4
      src/gui/mainwindow.cpp
  19. 2
      src/gui/optionsdialog.cpp
  20. 8
      src/gui/rss/automatedrssdownloader.cpp
  21. 6
      src/gui/rss/feedlistwidget.cpp
  22. 9
      src/gui/statsdialog.cpp
  23. 2
      src/gui/tagfiltermodel.cpp
  24. 2
      src/gui/torrentcreatordialog.cpp
  25. 6
      src/gui/transferlistfilterswidget.cpp
  26. 2
      src/webui/api/apierror.h
  27. 4
      src/webui/api/searchcontroller.cpp

2
src/app/application.cpp

@ -587,7 +587,7 @@ int Application::exec(const QStringList &params) @@ -587,7 +587,7 @@ int Application::exec(const QStringList &params)
#ifndef DISABLE_WEBUI
Preferences *const pref = Preferences::instance();
// Display some information to the user
const QString mesg = QString("\n******** %1 ********\n").arg(tr("Information"))
const QString mesg = QString::fromLatin1("\n******** %1 ********\n").arg(tr("Information"))
+ tr("To control qBittorrent, access the Web UI at %1")
.arg(QString("http://localhost:") + QString::number(pref->getWebUiPort())) + '\n';
printf("%s", qUtf8Printable(mesg));

4
src/app/cmdoptions.cpp

@ -364,7 +364,7 @@ QStringList QBtCommandLineParameters::paramList() const @@ -364,7 +364,7 @@ QStringList QBtCommandLineParameters::paramList() const
// torrent paths or URLs.
if (!savePath.isEmpty())
result.append(QString("@savePath=%1").arg(savePath));
result.append(QLatin1String("@savePath=") + savePath);
if (addPaused == TriStateBool::True) {
result.append(QLatin1String("@addPaused=1"));
@ -377,7 +377,7 @@ QStringList QBtCommandLineParameters::paramList() const @@ -377,7 +377,7 @@ QStringList QBtCommandLineParameters::paramList() const
result.append(QLatin1String("@skipChecking"));
if (!category.isEmpty())
result.append(QString("@category=%1").arg(category));
result.append(QLatin1String("@category=") + category);
if (sequential)
result.append(QLatin1String("@sequential"));

2
src/app/main.cpp

@ -395,7 +395,7 @@ bool userAgreesWithLegalNotice() @@ -395,7 +395,7 @@ bool userAgreesWithLegalNotice()
Q_ASSERT(!pref->getAcceptedLegal());
#ifdef DISABLE_GUI
const QString eula = QString("\n*** %1 ***\n").arg(QObject::tr("Legal Notice"))
const QString eula = QString::fromLatin1("\n*** %1 ***\n").arg(QObject::tr("Legal Notice"))
+ QObject::tr("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.") + "\n\n"
+ QObject::tr("No further notices will be issued.") + "\n\n"
+ QObject::tr("Press %1 key to accept and continue...").arg("'y'") + '\n';

14
src/app/stacktrace_win.h

@ -93,8 +93,8 @@ BOOL CALLBACK straceWin::EnumModulesCB(LPCSTR ModuleName, DWORD64 BaseOfDll, PVO @@ -93,8 +93,8 @@ BOOL CALLBACK straceWin::EnumModulesCB(LPCSTR ModuleName, DWORD64 BaseOfDll, PVO
EnumModulesContext* context = (EnumModulesContext*)UserContext;
mod.SizeOfStruct = sizeof(IMAGEHLP_MODULE64);
if(SymGetModuleInfo64(context->hProcess, BaseOfDll, &mod)) {
QString moduleBase = QString("0x%1").arg(BaseOfDll, 16, 16, QLatin1Char('0'));
QString line = QString("%1 %2 Image: %3")
QString moduleBase = QString::fromLatin1("0x%1").arg(BaseOfDll, 16, 16, QLatin1Char('0'));
QString line = QString::fromLatin1("%1 %2 Image: %3")
.arg(mod.ModuleName, -25)
.arg(moduleBase, -13)
.arg(mod.LoadedImageName);
@ -102,7 +102,7 @@ BOOL CALLBACK straceWin::EnumModulesCB(LPCSTR ModuleName, DWORD64 BaseOfDll, PVO @@ -102,7 +102,7 @@ BOOL CALLBACK straceWin::EnumModulesCB(LPCSTR ModuleName, DWORD64 BaseOfDll, PVO
QString pdbName(mod.LoadedPdbName);
if(!pdbName.isEmpty()) {
QString line2 = QString("%1 %2")
QString line2 = QString::fromLatin1("%1 %2")
.arg("", 35)
.arg(pdbName);
context->stream << line2 << '\n';
@ -165,7 +165,7 @@ QString straceWin::getSourcePathAndLineNumber(HANDLE hProcess, DWORD64 addr) @@ -165,7 +165,7 @@ QString straceWin::getSourcePathAndLineNumber(HANDLE hProcess, DWORD64 addr)
}
#endif
#endif
return QString("%1 : %2").arg(path).arg(line.LineNumber);
return QString::fromLatin1("%1 : %2").arg(path).arg(line.LineNumber);
}
return QString();
@ -296,7 +296,7 @@ const QString straceWin::getBacktrace() @@ -296,7 +296,7 @@ const QString straceWin::getBacktrace()
sourceFile = getSourcePathAndLineNumber(hProcess, ihsf.InstructionOffset - 1);
}
else {
funcName = QString("0x%1").arg(ihsf.InstructionOffset, 8, 16, QLatin1Char('0'));
funcName = QString::fromLatin1("0x%1").arg(ihsf.InstructionOffset, 8, 16, QLatin1Char('0'));
}
SymSetContext(hProcess, &ihsf, NULL);
#ifndef __MINGW32__
@ -304,7 +304,7 @@ const QString straceWin::getBacktrace() @@ -304,7 +304,7 @@ const QString straceWin::getBacktrace()
SymEnumSymbols(hProcess, 0, NULL, EnumSymbolsCB, (PVOID)&params);
#endif
QString insOffset = QString("0x%1").arg(ihsf.InstructionOffset, 16, 16, QLatin1Char('0'));
QString insOffset = QString::fromLatin1("0x%1").arg(ihsf.InstructionOffset, 16, 16, QLatin1Char('0'));
QString formatLine = "#%1 %2 %3 %4";
#ifndef __MINGW32__
formatLine += "(%5)";
@ -318,7 +318,7 @@ const QString straceWin::getBacktrace() @@ -318,7 +318,7 @@ const QString straceWin::getBacktrace()
.arg(params.join(", "));
if (!sourceFile.isEmpty())
debugLine += QString("[ %1 ]").arg(sourceFile);
debugLine += QString::fromLatin1("[ %1 ]").arg(sourceFile);
#else
;
#endif

16
src/base/bittorrent/session.cpp

@ -1810,7 +1810,7 @@ bool Session::deleteTorrent(const InfoHash &hash, const DeleteOption deleteOptio @@ -1810,7 +1810,7 @@ bool Session::deleteTorrent(const InfoHash &hash, const DeleteOption deleteOptio
// Remove it from torrent resume directory
const QDir resumeDataDir(m_resumeFolderPath);
QStringList filters;
filters << QString("%1.*").arg(torrent->hash());
filters << QString::fromLatin1("%1.*").arg(torrent->hash());
const QStringList files = resumeDataDir.entryList(filters, QDir::Files, QDir::Unsorted);
for (const QString &file : files)
Utils::Fs::forceRemove(resumeDataDir.absoluteFilePath(file));
@ -2457,8 +2457,8 @@ void Session::exportTorrentFile(TorrentHandle *const torrent, TorrentExportFolde @@ -2457,8 +2457,8 @@ void Session::exportTorrentFile(TorrentHandle *const torrent, TorrentExportFolde
((folder == TorrentExportFolder::Finished) && !finishedTorrentExportDirectory().isEmpty()));
const QString validName = Utils::Fs::toValidFileSystemName(torrent->name());
const QString torrentFilename = QString("%1.torrent").arg(torrent->hash());
QString torrentExportFilename = QString("%1.torrent").arg(validName);
const QString torrentFilename = QString::fromLatin1("%1.torrent").arg(torrent->hash());
QString torrentExportFilename = QString::fromLatin1("%1.torrent").arg(validName);
const QString torrentPath = QDir(m_resumeFolderPath).absoluteFilePath(torrentFilename);
const QDir exportPath(folder == TorrentExportFolder::Regular ? torrentExportDirectory() : finishedTorrentExportDirectory());
if (exportPath.exists() || exportPath.mkpath(exportPath.absolutePath())) {
@ -2466,7 +2466,7 @@ void Session::exportTorrentFile(TorrentHandle *const torrent, TorrentExportFolde @@ -2466,7 +2466,7 @@ void Session::exportTorrentFile(TorrentHandle *const torrent, TorrentExportFolde
int counter = 0;
while (QFile::exists(newTorrentPath) && !Utils::Fs::sameFiles(torrentPath, newTorrentPath)) {
// Append number to torrent name to make it unique
torrentExportFilename = QString("%1 %2.torrent").arg(validName).arg(++counter);
torrentExportFilename = QString::fromLatin1("%1 %2.torrent").arg(validName).arg(++counter);
newTorrentPath = exportPath.absoluteFilePath(torrentExportFilename);
}
@ -3923,7 +3923,7 @@ void Session::handleTorrentResumeDataReady(TorrentHandle *const torrent, const l @@ -3923,7 +3923,7 @@ void Session::handleTorrentResumeDataReady(TorrentHandle *const torrent, const l
out.reserve(1024 * 1024); // most fastresume file sizes are under 1 MB
lt::bencode(std::back_inserter(out), data);
const QString filename = QString("%1.fastresume").arg(torrent->hash());
const QString filename = QString::fromLatin1("%1.fastresume").arg(torrent->hash());
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
QMetaObject::invokeMethod(m_resumeDataSavingManager
, [this, filename, out]() { m_resumeDataSavingManager->save(filename, out); });
@ -4160,7 +4160,7 @@ void Session::startUpTorrents() @@ -4160,7 +4160,7 @@ void Session::startUpTorrents()
int resumedTorrentsCount = 0;
const auto startupTorrent = [this, &resumeDataDir, &resumedTorrentsCount](const TorrentResumeData &params)
{
const QString filePath = resumeDataDir.filePath(QString("%1.torrent").arg(params.hash));
const QString filePath = resumeDataDir.filePath(QString::fromLatin1("%1.torrent").arg(params.hash));
qDebug() << "Starting up torrent" << params.hash << "...";
if (!addTorrent_impl(params.addTorrentData, params.magnetUri, TorrentInfo::loadFromFile(filePath), params.data))
LogMsg(tr("Unable to resume torrent '%1'.", "e.g: Unable to resume torrent 'hash'.")
@ -4220,8 +4220,8 @@ void Session::startUpTorrents() @@ -4220,8 +4220,8 @@ void Session::startUpTorrents()
}
if (numOfRemappedFiles > 0) {
LogMsg(QString(tr("Queue positions were corrected in %1 resume files"))
.arg(numOfRemappedFiles), Log::CRITICAL);
LogMsg(tr("Queue positions were corrected in %1 resume files").arg(numOfRemappedFiles)
, Log::CRITICAL);
}
// starting up downloading torrents (queue position > 0)

2
src/base/http/responsegenerator.cpp

@ -54,7 +54,7 @@ QByteArray Http::toByteArray(Response response) @@ -54,7 +54,7 @@ QByteArray Http::toByteArray(Response response)
// Header Fields
for (auto i = response.headers.constBegin(); i != response.headers.constEnd(); ++i)
buf += QString("%1: %2").arg(i.key(), i.value()).toLatin1().append(CRLF);
buf += QString::fromLatin1("%1: %2").arg(i.key(), i.value()).toLatin1().append(CRLF);
// the first empty line
buf += CRLF;

4
src/base/net/geoipmanager.cpp

@ -88,7 +88,7 @@ void GeoIPManager::loadDatabase() @@ -88,7 +88,7 @@ void GeoIPManager::loadDatabase()
m_geoIPDatabase = nullptr;
const QString filepath = Utils::Fs::expandPathAbs(
QString("%1%2/%3").arg(specialFolderLocation(SpecialFolder::Data), GEODB_FOLDER, GEODB_FILENAME));
QString::fromLatin1("%1%2/%3").arg(specialFolderLocation(SpecialFolder::Data), GEODB_FOLDER, GEODB_FILENAME));
QString error;
m_geoIPDatabase = GeoIPDatabase::load(filepath, error);
@ -442,7 +442,7 @@ void GeoIPManager::downloadFinished(const DownloadResult &result) @@ -442,7 +442,7 @@ void GeoIPManager::downloadFinished(const DownloadResult &result)
specialFolderLocation(SpecialFolder::Data) + GEODB_FOLDER);
if (!QDir(targetPath).exists())
QDir().mkpath(targetPath);
QFile targetFile(QString("%1/%2").arg(targetPath, GEODB_FILENAME));
QFile targetFile(QString::fromLatin1("%1/%2").arg(targetPath, GEODB_FILENAME));
if (!targetFile.open(QFile::WriteOnly) || (targetFile.write(data) == -1))
LogMsg(tr("Couldn't save downloaded IP geolocation database file."), Log::WARNING);
else

8
src/base/net/proxyconfigurationmanager.cpp

@ -139,17 +139,17 @@ void ProxyConfigurationManager::configureProxy() @@ -139,17 +139,17 @@ void ProxyConfigurationManager::configureProxy()
if (!m_isProxyOnlyForTorrents) {
switch (m_config.type) {
case ProxyType::HTTP_PW:
proxyStrHTTP = QString("http://%1:%2@%3:%4").arg(m_config.username
proxyStrHTTP = QString::fromLatin1("http://%1:%2@%3:%4").arg(m_config.username
, m_config.password, m_config.ip, QString::number(m_config.port));
break;
case ProxyType::HTTP:
proxyStrHTTP = QString("http://%1:%2").arg(m_config.ip, QString::number(m_config.port));
proxyStrHTTP = QString::fromLatin1("http://%1:%2").arg(m_config.ip, QString::number(m_config.port));
break;
case ProxyType::SOCKS5:
proxyStrSOCK = QString("%1:%2").arg(m_config.ip, QString::number(m_config.port));
proxyStrSOCK = QString::fromLatin1("%1:%2").arg(m_config.ip, QString::number(m_config.port));
break;
case ProxyType::SOCKS5_PW:
proxyStrSOCK = QString("%1:%2@%3:%4").arg(m_config.username
proxyStrSOCK = QString::fromLatin1("%1:%2@%3:%4").arg(m_config.username
, m_config.password, m_config.ip, QString::number(m_config.port));
break;
default:

2
src/base/rss/rss_autodownloader.cpp

@ -100,7 +100,7 @@ QPointer<AutoDownloader> AutoDownloader::m_instance = nullptr; @@ -100,7 +100,7 @@ QPointer<AutoDownloader> AutoDownloader::m_instance = nullptr;
QString computeSmartFilterRegex(const QStringList &filters)
{
return QString("(?:_|\\b)(?:%1)(?:_|\\b)").arg(filters.join(QString(")|(?:")));
return QString::fromLatin1("(?:_|\\b)(?:%1)(?:_|\\b)").arg(filters.join(QString(")|(?:")));
}
AutoDownloader::AutoDownloader()

8
src/base/rss/rss_autodownloadrule.cpp

@ -323,7 +323,7 @@ bool AutoDownloadRule::matchesEpisodeFilterExpression(const QString &articleTitl @@ -323,7 +323,7 @@ bool AutoDownloadRule::matchesEpisodeFilterExpression(const QString &articleTitl
}
}
else { // Single number
const QString expStr {QString("\\b(?:s0?%1[ -_\\.]?e0?%2|%1x0?%2)(?:\\D|\\b)").arg(season, episode)};
const QString expStr {QString::fromLatin1("\\b(?:s0?%1[ -_\\.]?e0?%2|%1x0?%2)(?:\\D|\\b)").arg(season, episode)};
if (cachedRegex(expStr).match(articleTitle).hasMatch())
return true;
}
@ -354,7 +354,7 @@ bool AutoDownloadRule::matchesSmartEpisodeFilter(const QString &articleTitle) co @@ -354,7 +354,7 @@ bool AutoDownloadRule::matchesSmartEpisodeFilter(const QString &articleTitle) co
if (!isRepack && !isProper)
return false;
const QString fullEpisodeStr = QString("%1%2%3").arg(episodeStr,
const QString fullEpisodeStr = QString::fromLatin1("%1%2%3").arg(episodeStr,
isRepack ? "-REPACK" : "",
isProper ? "-PROPER" : "");
const bool previouslyMatchedFull = m_dataPtr->previouslyMatchedEpisodes.contains(fullEpisodeStr);
@ -366,8 +366,8 @@ bool AutoDownloadRule::matchesSmartEpisodeFilter(const QString &articleTitle) co @@ -366,8 +366,8 @@ bool AutoDownloadRule::matchesSmartEpisodeFilter(const QString &articleTitle) co
// If this is a REPACK and PROPER download, add the individual entries to the list
// so we don't download those
if (isRepack && isProper) {
m_dataPtr->lastComputedEpisodes.append(QString("%1-REPACK").arg(episodeStr));
m_dataPtr->lastComputedEpisodes.append(QString("%1-PROPER").arg(episodeStr));
m_dataPtr->lastComputedEpisodes.append(episodeStr + QLatin1String("-REPACK"));
m_dataPtr->lastComputedEpisodes.append(episodeStr + QLatin1String("-PROPER"));
}
}

2
src/base/rss/rss_feed.cpp

@ -400,7 +400,7 @@ void Feed::downloadIcon() @@ -400,7 +400,7 @@ void Feed::downloadIcon()
// Download the RSS Feed icon
// XXX: This works for most sites but it is not perfect
const QUrl url(m_url);
const auto iconUrl = QString("%1://%2/favicon.ico").arg(url.scheme(), url.host());
const auto iconUrl = QString::fromLatin1("%1://%2/favicon.ico").arg(url.scheme(), url.host());
Net::DownloadManager::instance()->download(
Net::DownloadRequest(iconUrl).saveToFile(true)
, this, &Feed::handleIconDownloadFinished);

10
src/base/rss/rss_session.cpp

@ -296,7 +296,7 @@ void Session::loadFolder(const QJsonObject &jsonObj, Folder *folder) @@ -296,7 +296,7 @@ void Session::loadFolder(const QJsonObject &jsonObj, Folder *folder)
const QJsonObject valObj {val.toObject()};
if (valObj.contains("url")) {
if (!valObj["url"].isString()) {
LogMsg(QString("Couldn't load RSS Feed '%1'. URL is required.")
LogMsg(tr("Couldn't load RSS Feed '%1'. URL is required.")
.arg(QString("%1\\%2").arg(folder->path(), key)), Log::WARNING);
continue;
}
@ -305,13 +305,13 @@ void Session::loadFolder(const QJsonObject &jsonObj, Folder *folder) @@ -305,13 +305,13 @@ void Session::loadFolder(const QJsonObject &jsonObj, Folder *folder)
if (valObj.contains("uid")) {
uid = QUuid {valObj["uid"].toString()};
if (uid.isNull()) {
LogMsg(QString("Couldn't load RSS Feed '%1'. UID is invalid.")
LogMsg(tr("Couldn't load RSS Feed '%1'. UID is invalid.")
.arg(QString("%1\\%2").arg(folder->path(), key)), Log::WARNING);
continue;
}
if (m_feedsByUID.contains(uid)) {
LogMsg(QString("Duplicate RSS Feed UID: %1. Configuration seems to be corrupted.")
LogMsg(tr("Duplicate RSS Feed UID: %1. Configuration seems to be corrupted.")
.arg(uid.toString()), Log::WARNING);
continue;
}
@ -329,8 +329,8 @@ void Session::loadFolder(const QJsonObject &jsonObj, Folder *folder) @@ -329,8 +329,8 @@ void Session::loadFolder(const QJsonObject &jsonObj, Folder *folder)
}
}
else {
LogMsg(QString("Couldn't load RSS Item '%1'. Invalid data format.")
.arg(QString("%1\\%2").arg(folder->path(), key)), Log::WARNING);
LogMsg(tr("Couldn't load RSS Item '%1'. Invalid data format.")
.arg(QString::fromLatin1("%1\\%2").arg(folder->path(), key)), Log::WARNING);
}
}

10
src/base/search/searchpluginmanager.cpp

@ -185,7 +185,7 @@ void SearchPluginManager::enablePlugin(const QString &name, const bool enabled) @@ -185,7 +185,7 @@ void SearchPluginManager::enablePlugin(const QString &name, const bool enabled)
// Updates shipped plugin
void SearchPluginManager::updatePlugin(const QString &name)
{
installPlugin(QString("%1%2.py").arg(m_updateUrl, name));
installPlugin(QString::fromLatin1("%1%2.py").arg(m_updateUrl, name));
}
// Install or update plugin from file or url
@ -283,12 +283,12 @@ bool SearchPluginManager::uninstallPlugin(const QString &name) @@ -283,12 +283,12 @@ bool SearchPluginManager::uninstallPlugin(const QString &name)
void SearchPluginManager::updateIconPath(PluginInfo *const plugin)
{
if (!plugin) return;
QString iconPath = QString("%1/%2.png").arg(pluginsLocation(), plugin->name);
QString iconPath = QString::fromLatin1("%1/%2.png").arg(pluginsLocation(), plugin->name);
if (QFile::exists(iconPath)) {
plugin->iconPath = iconPath;
}
else {
iconPath = QString("%1/%2.ico").arg(pluginsLocation(), plugin->name);
iconPath = QString::fromLatin1("%1/%2.ico").arg(pluginsLocation(), plugin->name);
if (QFile::exists(iconPath))
plugin->iconPath = iconPath;
}
@ -338,7 +338,7 @@ QString SearchPluginManager::pluginFullName(const QString &pluginName) @@ -338,7 +338,7 @@ QString SearchPluginManager::pluginFullName(const QString &pluginName)
QString SearchPluginManager::pluginsLocation()
{
return QString("%1/engines").arg(engineLocation());
return QString::fromLatin1("%1/engines").arg(engineLocation());
}
QString SearchPluginManager::engineLocation()
@ -526,7 +526,7 @@ bool SearchPluginManager::isUpdateNeeded(const QString &pluginName, const Plugin @@ -526,7 +526,7 @@ bool SearchPluginManager::isUpdateNeeded(const QString &pluginName, const Plugin
QString SearchPluginManager::pluginPath(const QString &name)
{
return QString("%1/%2.py").arg(pluginsLocation(), name);
return QString::fromLatin1("%1/%2.py").arg(pluginsLocation(), name);
}
PluginVersion SearchPluginManager::getPluginVersion(const QString &filePath)

2
src/gui/aboutdialog.cpp

@ -43,7 +43,7 @@ AboutDialog::AboutDialog(QWidget *parent) @@ -43,7 +43,7 @@ AboutDialog::AboutDialog(QWidget *parent)
setAttribute(Qt::WA_DeleteOnClose);
// Title
m_ui->labelName->setText(QString("<b><h2>qBittorrent " QBT_VERSION " (%1-bit)</h2></b>").arg(QT_POINTER_SIZE * 8));
m_ui->labelName->setText(QString::fromLatin1("<b><h2>qBittorrent " QBT_VERSION " (%1-bit)</h2></b>").arg(QT_POINTER_SIZE * 8));
m_ui->logo->setPixmap(Utils::Gui::scaledPixmapSvg(":/icons/skin/qbittorrent-tray.svg", this, 32));

4
src/gui/advancedsettings.cpp

@ -333,7 +333,7 @@ void AdvancedSettings::loadAdvancedSettings() @@ -333,7 +333,7 @@ void AdvancedSettings::loadAdvancedSettings()
, tr("Open documentation"))
, this);
labelQbtLink->setOpenExternalLinks(true);
addRow(QBITTORRENT_HEADER, QString("<b>%1</b>").arg(tr("qBittorrent Section")), labelQbtLink);
addRow(QBITTORRENT_HEADER, QString::fromLatin1("<b>%1</b>").arg(tr("qBittorrent Section")), labelQbtLink);
static_cast<QLabel *>(cellWidget(QBITTORRENT_HEADER, PROPERTY))->setAlignment(Qt::AlignCenter | Qt::AlignVCenter);
auto *labelLibtorrentLink = new QLabel(
@ -341,7 +341,7 @@ void AdvancedSettings::loadAdvancedSettings() @@ -341,7 +341,7 @@ void AdvancedSettings::loadAdvancedSettings()
, tr("Open documentation"))
, this);
labelLibtorrentLink->setOpenExternalLinks(true);
addRow(LIBTORRENT_HEADER, QString("<b>%1</b>").arg(tr("libtorrent Section")), labelLibtorrentLink);
addRow(LIBTORRENT_HEADER, QString::fromLatin1("<b>%1</b>").arg(tr("libtorrent Section")), labelLibtorrentLink);
static_cast<QLabel *>(cellWidget(LIBTORRENT_HEADER, PROPERTY))->setAlignment(Qt::AlignCenter | Qt::AlignVCenter);
#if defined(Q_OS_WIN)

2
src/gui/categoryfiltermodel.cpp

@ -75,7 +75,7 @@ public: @@ -75,7 +75,7 @@ public:
if (!m_parent || m_parent->name().isEmpty())
return m_name;
return QString("%1/%2").arg(m_parent->fullName(), m_name);
return QString::fromLatin1("%1/%2").arg(m_parent->fullName(), m_name);
}
CategoryModelItem *parent() const

2
src/gui/lineedit.cpp

@ -27,7 +27,7 @@ LineEdit::LineEdit(QWidget *parent) @@ -27,7 +27,7 @@ LineEdit::LineEdit(QWidget *parent)
m_searchButton->setStyleSheet("QToolButton {border: none; padding: 2px;}");
// padding between text and widget borders
setStyleSheet(QString("QLineEdit {padding-left: %1px;}").arg(m_searchButton->sizeHint().width()));
setStyleSheet(QString::fromLatin1("QLineEdit {padding-left: %1px;}").arg(m_searchButton->sizeHint().width()));
setClearButtonEnabled(true);

4
src/gui/mainwindow.cpp

@ -1539,7 +1539,7 @@ void MainWindow::reloadSessionStats() @@ -1539,7 +1539,7 @@ void MainWindow::reloadSessionStats()
, tr("UP speed: %1", "e.g: Upload speed: 10 KiB/s").arg(Utils::Misc::friendlyUnit(status.payloadUploadRate, true)));
#else
// OSes such as Windows do not support html here
const QString toolTip = QString("%1\n%2").arg(
const QString toolTip = QString::fromLatin1("%1\n%2").arg(
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)));
#endif // Q_OS_UNIX
@ -1818,7 +1818,7 @@ void MainWindow::handleUpdateCheckFinished(bool updateAvailable, QString newVers @@ -1818,7 +1818,7 @@ void MainWindow::handleUpdateCheckFinished(bool updateAvailable, QString newVers
answer = QMessageBox::question(this, tr("qBittorrent Update Available")
, tr("A new version is available.") + "<br/>"
+ tr("Do you want to download %1?").arg(newVersion) + "<br/><br/>"
+ QString("<a href=\"https://www.qbittorrent.org/news.php\">%1</a>").arg(tr("Open changelog..."))
+ QString::fromLatin1("<a href=\"https://www.qbittorrent.org/news.php\">%1</a>").arg(tr("Open changelog..."))
, QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
if (answer == QMessageBox::Yes) {
// The user want to update, let's download the update

2
src/gui/optionsdialog.cpp

@ -1559,7 +1559,7 @@ void OptionsDialog::on_addScanFolderButton_clicked() @@ -1559,7 +1559,7 @@ void OptionsDialog::on_addScanFolderButton_clicked()
}
if (!error.isEmpty())
QMessageBox::critical(this, tr("Adding entry failed"), QString("%1\n%2").arg(error, dir));
QMessageBox::critical(this, tr("Adding entry failed"), QString::fromLatin1("%1\n%2").arg(error, dir));
}
}

8
src/gui/rss/automatedrssdownloader.cpp

@ -59,8 +59,8 @@ const QString EXT_LEGACY {QStringLiteral(".rssrules")}; @@ -59,8 +59,8 @@ const QString EXT_LEGACY {QStringLiteral(".rssrules")};
AutomatedRssDownloader::AutomatedRssDownloader(QWidget *parent)
: QDialog(parent)
, m_formatFilterJSON(QString("%1 (*%2)").arg(tr("Rules"), EXT_JSON))
, m_formatFilterLegacy(QString("%1 (*%2)").arg(tr("Rules (legacy)"), EXT_LEGACY))
, m_formatFilterJSON(QString::fromLatin1("%1 (*%2)").arg(tr("Rules"), EXT_JSON))
, m_formatFilterLegacy(QString::fromLatin1("%1 (*%2)").arg(tr("Rules (legacy)"), EXT_LEGACY))
, m_ui(new Ui::AutomatedRssDownloader)
, m_currentRuleItem(nullptr)
{
@ -413,7 +413,7 @@ void AutomatedRssDownloader::on_exportBtn_clicked() @@ -413,7 +413,7 @@ void AutomatedRssDownloader::on_exportBtn_clicked()
QString selectedFilter {m_formatFilterJSON};
QString path = QFileDialog::getSaveFileName(
this, tr("Export RSS rules"), QDir::homePath()
, QString("%1;;%2").arg(m_formatFilterJSON, m_formatFilterLegacy), &selectedFilter);
, QString::fromLatin1("%1;;%2").arg(m_formatFilterJSON, m_formatFilterLegacy), &selectedFilter);
if (path.isEmpty()) return;
const RSS::AutoDownloader::RulesFileFormat format {
@ -445,7 +445,7 @@ void AutomatedRssDownloader::on_importBtn_clicked() @@ -445,7 +445,7 @@ void AutomatedRssDownloader::on_importBtn_clicked()
QString selectedFilter {m_formatFilterJSON};
QString path = QFileDialog::getOpenFileName(
this, tr("Import RSS rules"), QDir::homePath()
, QString("%1;;%2").arg(m_formatFilterJSON, m_formatFilterLegacy), &selectedFilter);
, QString::fromLatin1("%1;;%2").arg(m_formatFilterJSON, m_formatFilterLegacy), &selectedFilter);
if (path.isEmpty() || !QFile::exists(path))
return;

6
src/gui/rss/feedlistwidget.cpp

@ -113,7 +113,7 @@ void FeedListWidget::handleItemUnreadCountChanged(RSS::Item *rssItem) @@ -113,7 +113,7 @@ void FeedListWidget::handleItemUnreadCountChanged(RSS::Item *rssItem)
else {
QTreeWidgetItem *item = mapRSSItem(rssItem);
Q_ASSERT(item);
item->setData(0, Qt::DisplayRole, QString("%1 (%2)").arg(rssItem->name()).arg(rssItem->unreadCount()));
item->setData(0, Qt::DisplayRole, QString::fromLatin1("%1 (%2)").arg(rssItem->name(), QString::number(rssItem->unreadCount())));
}
}
@ -122,7 +122,7 @@ void FeedListWidget::handleItemPathChanged(RSS::Item *rssItem) @@ -122,7 +122,7 @@ void FeedListWidget::handleItemPathChanged(RSS::Item *rssItem)
QTreeWidgetItem *item = mapRSSItem(rssItem);
Q_ASSERT(item);
item->setData(0, Qt::DisplayRole, QString("%1 (%2)").arg(rssItem->name()).arg(rssItem->unreadCount()));
item->setData(0, Qt::DisplayRole, QString::fromLatin1("%1 (%2)").arg(rssItem->name(), QString::number(rssItem->unreadCount())));
RSS::Item *parentRssItem = RSS::Session::instance()->itemByPath(RSS::Item::parentPath(rssItem->path()));
QTreeWidgetItem *parentItem = mapRSSItem(parentRssItem);
@ -228,7 +228,7 @@ void FeedListWidget::dropEvent(QDropEvent *event) @@ -228,7 +228,7 @@ void FeedListWidget::dropEvent(QDropEvent *event)
QTreeWidgetItem *FeedListWidget::createItem(RSS::Item *rssItem, QTreeWidgetItem *parentItem)
{
auto *item = new QTreeWidgetItem;
item->setData(0, Qt::DisplayRole, QString("%1 (%2)").arg(rssItem->name()).arg(rssItem->unreadCount()));
item->setData(0, Qt::DisplayRole, QString::fromLatin1("%1 (%2)").arg(rssItem->name(), QString::number(rssItem->unreadCount())));
item->setData(0, Qt::UserRole, reinterpret_cast<quintptr>(rssItem));
m_rssToTreeItemMapping[rssItem] = item;

9
src/gui/statsdialog.cpp

@ -80,20 +80,19 @@ void StatsDialog::update() @@ -80,20 +80,19 @@ void StatsDialog::update()
: "-");
// Cache hits
qreal readRatio = cs.readRatio;
m_ui->labelCacheHits->setText(QString("%1%").arg(
readRatio > 0
m_ui->labelCacheHits->setText(QString::fromLatin1("%1%").arg((readRatio > 0)
? Utils::String::fromDouble(100 * readRatio, 2)
: "0"));
: QLatin1String("0")));
// Buffers size
m_ui->labelTotalBuf->setText(Utils::Misc::friendlyUnit(cs.totalUsedBuffers * 16 * 1024));
// Disk overload (100%) equivalent
// 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.
m_ui->labelWriteStarve->setText(QString("%1%").arg(((ss.diskWriteQueue > 0) && (ss.peersCount > 0))
m_ui->labelWriteStarve->setText(QString::fromLatin1("%1%").arg(((ss.diskWriteQueue > 0) && (ss.peersCount > 0))
? Utils::String::fromDouble((100. * ss.diskWriteQueue / ss.peersCount), 2)
: QLatin1String("0")));
m_ui->labelReadStarve->setText(QString("%1%").arg(((ss.diskReadQueue > 0) && (ss.peersCount > 0))
m_ui->labelReadStarve->setText(QString::fromLatin1("%1%").arg(((ss.diskReadQueue > 0) && (ss.peersCount > 0))
? Utils::String::fromDouble((100. * ss.diskReadQueue / ss.peersCount), 2)
: QLatin1String("0")));

2
src/gui/tagfiltermodel.cpp

@ -319,7 +319,7 @@ QVector<TagModelItem *> TagFilterModel::findItems(const QSet<QString> &tags) @@ -319,7 +319,7 @@ QVector<TagModelItem *> TagFilterModel::findItems(const QSet<QString> &tags)
if (item)
items.push_back(item);
else
qWarning() << QString("Requested tag '%1' missing from the model.").arg(tag);
qWarning() << QString::fromLatin1("Requested tag '%1' missing from the model.").arg(tag);
}
return items;
}

2
src/gui/torrentcreatordialog.cpp

@ -215,7 +215,7 @@ void TorrentCreatorDialog::handleCreationSuccess(const QString &path, const QStr @@ -215,7 +215,7 @@ void TorrentCreatorDialog::handleCreationSuccess(const QString &path, const QStr
BitTorrent::Session::instance()->addTorrent(info, params);
}
QMessageBox::information(this, tr("Torrent creator")
, QString("%1\n%2").arg(tr("Torrent created:"), Utils::Fs::toNativePath(path)));
, QString::fromLatin1("%1\n%2").arg(tr("Torrent created:"), Utils::Fs::toNativePath(path)));
setInteractionEnabled(true);
}

6
src/gui/transferlistfilterswidget.cpp

@ -327,7 +327,7 @@ void TrackerFiltersList::addItem(const QString &tracker, const QString &hash) @@ -327,7 +327,7 @@ void TrackerFiltersList::addItem(const QString &tracker, const QString &hash)
trackerItem->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon("network-server"));
const QString scheme = getScheme(tracker);
downloadFavicon(QString("%1://%2/favicon.ico").arg((scheme.startsWith("http") ? scheme : "http"), host));
downloadFavicon(QString::fromLatin1("%1://%2/favicon.ico").arg((scheme.startsWith("http") ? scheme : "http"), host));
}
if (!trackerItem) return;
@ -340,7 +340,7 @@ void TrackerFiltersList::addItem(const QString &tracker, const QString &hash) @@ -340,7 +340,7 @@ void TrackerFiltersList::addItem(const QString &tracker, const QString &hash)
return;
}
trackerItem->setText(QString("%1 (%2)").arg(host).arg(tmp.size()));
trackerItem->setText(QString::fromLatin1("%1 (%2)").arg(host, QString::number(tmp.size())));
if (exists) {
if (currentRow() == rowFromTracker(host))
applyFilter(currentRow());
@ -384,7 +384,7 @@ void TrackerFiltersList::removeItem(const QString &tracker, const QString &hash) @@ -384,7 +384,7 @@ void TrackerFiltersList::removeItem(const QString &tracker, const QString &hash)
return;
}
if (trackerItem)
trackerItem->setText(QString("%1 (%2)").arg(host).arg(tmp.size()));
trackerItem->setText(QString::fromLatin1("%1 (%2)").arg(host, QString::number(tmp.size())));
}
else {
row = 1;

2
src/webui/api/apierror.h

@ -42,7 +42,7 @@ enum class APIErrorType @@ -42,7 +42,7 @@ enum class APIErrorType
class APIError : public RuntimeError
{
public:
explicit APIError(APIErrorType type, const QString &message = "");
explicit APIError(APIErrorType type, const QString &message = {});
APIErrorType type() const;

4
src/webui/api/searchcontroller.cpp

@ -66,7 +66,7 @@ void SearchController::startAction() @@ -66,7 +66,7 @@ void SearchController::startAction()
requireParams({"pattern", "category", "plugins"});
if (!Utils::ForeignApps::pythonInfo().isValid())
throw APIError(APIErrorType::Conflict, "Python must be installed to use the Search Engine.");
throw APIError(APIErrorType::Conflict, tr("Python must be installed to use the Search Engine."));
const QString pattern = params()["pattern"].trimmed();
const QString category = params()["category"].trimmed();
@ -89,7 +89,7 @@ void SearchController::startAction() @@ -89,7 +89,7 @@ void SearchController::startAction()
ISession *const session = sessionManager()->session();
auto activeSearches = session->getData<QSet<int>>(ACTIVE_SEARCHES);
if (activeSearches.size() >= MAX_CONCURRENT_SEARCHES)
throw APIError(APIErrorType::Conflict, QString("Unable to create more than %1 concurrent searches.").arg(MAX_CONCURRENT_SEARCHES));
throw APIError(APIErrorType::Conflict, tr("Unable to create more than %1 concurrent searches.").arg(MAX_CONCURRENT_SEARCHES));
const auto id = generateSearchId();
const SearchHandlerPtr searchHandler {SearchPluginManager::instance()->startSearch(pattern, category, pluginsToUse)};

Loading…
Cancel
Save