Browse Source

Merge pull request #9217 from Chocobo1/char

Replace single-character string with character literal
adaptive-webui-19844
Mike Tzou 6 years ago committed by GitHub
parent
commit
5d4da09093
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      src/app/application.cpp
  2. 4
      src/app/cmdoptions.cpp
  3. 2
      src/base/bittorrent/magneturi.cpp
  4. 2
      src/base/bittorrent/peerinfo.cpp
  5. 12
      src/base/bittorrent/session.cpp
  6. 2
      src/base/bittorrent/torrentcreatorthread.cpp
  7. 22
      src/base/bittorrent/torrenthandle.cpp
  8. 2
      src/base/bittorrent/tracker.cpp
  9. 2
      src/base/net/dnsupdater.cpp
  10. 8
      src/base/net/smtp.cpp
  11. 12
      src/base/preferences.cpp
  12. 8
      src/base/rss/rss_autodownloadrule.cpp
  13. 6
      src/base/search/searchhandler.cpp
  14. 8
      src/base/search/searchpluginmanager.cpp
  15. 18
      src/base/utils/fs.cpp
  16. 6
      src/base/utils/misc.cpp
  17. 2
      src/gui/addnewtorrentdialog.cpp
  18. 4
      src/gui/mainwindow.cpp
  19. 2
      src/gui/previewlistdelegate.h
  20. 2
      src/gui/properties/peerlistdelegate.h
  21. 8
      src/gui/properties/peerlistwidget.cpp
  22. 2
      src/gui/properties/propertieswidget.cpp
  23. 2
      src/gui/properties/proplistdelegate.cpp
  24. 6
      src/gui/properties/trackerlistwidget.cpp
  25. 4
      src/gui/rss/automatedrssdownloader.cpp
  26. 8
      src/gui/statusbar.cpp
  27. 12
      src/gui/tagfiltermodel.cpp
  28. 4
      src/gui/transferlistdelegate.cpp
  29. 2
      src/gui/transferlistmodel.cpp
  30. 2
      src/gui/utils.cpp
  31. 2
      src/webui/api/synccontroller.cpp
  32. 6
      src/webui/api/torrentscontroller.cpp

10
src/app/application.cpp

@ -99,10 +99,10 @@ namespace
// just a shortcut // just a shortcut
inline SettingsStorage *settings() { return SettingsStorage::instance(); } inline SettingsStorage *settings() { return SettingsStorage::instance(); }
const QString LOG_FOLDER("logs"); const QString LOG_FOLDER = QStringLiteral("logs");
const char PARAMS_SEPARATOR[] = "|"; const QChar PARAMS_SEPARATOR = '|';
const QString DEFAULT_PORTABLE_MODE_PROFILE_DIR = QLatin1String("profile"); const QString DEFAULT_PORTABLE_MODE_PROFILE_DIR = QStringLiteral("profile");
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
@ -265,7 +265,7 @@ void Application::setFileLoggerAgeType(const int value)
void Application::processMessage(const QString &message) void Application::processMessage(const QString &message)
{ {
QStringList params = message.split(QLatin1String(PARAMS_SEPARATOR), QString::SkipEmptyParts); QStringList params = message.split(PARAMS_SEPARATOR, QString::SkipEmptyParts);
// If Application is not running (i.e., other // If Application is not running (i.e., other
// components are not ready) store params // components are not ready) store params
if (m_running) if (m_running)
@ -409,7 +409,7 @@ void Application::allTorrentsFinished()
bool Application::sendParams(const QStringList &params) bool Application::sendParams(const QStringList &params)
{ {
return sendMessage(params.join(QLatin1String(PARAMS_SEPARATOR))); return sendMessage(params.join(PARAMS_SEPARATOR));
} }
// As program parameters, we can get paths or urls. // As program parameters, we can get paths or urls.

4
src/app/cmdoptions.cpp

@ -402,7 +402,7 @@ QBtCommandLineParameters parseCommandLine(const QStringList &args)
const QString &arg = args[i]; const QString &arg = args[i];
if ((arg.startsWith("--") && !arg.endsWith(".torrent")) if ((arg.startsWith("--") && !arg.endsWith(".torrent"))
|| (arg.startsWith("-") && (arg.size() == 2))) { || (arg.startsWith('-') && (arg.size() == 2))) {
// Parse known parameters // Parse known parameters
if (arg == SHOW_HELP_OPTION) { if (arg == SHOW_HELP_OPTION) {
result.showHelp = true; result.showHelp = true;
@ -499,7 +499,7 @@ QString wrapText(const QString &text, int initialIndentation = USAGE_TEXT_COLUMN
foreach (const QString &word, words.mid(1)) { foreach (const QString &word, words.mid(1)) {
if (lines.last().length() + word.length() + 1 < currentLineMaxLength) { if (lines.last().length() + word.length() + 1 < currentLineMaxLength) {
lines.last().append(" " + word); lines.last().append(' ' + word);
} }
else { else {
lines.append(QString(initialIndentation, ' ') + word); lines.append(QString(initialIndentation, ' ') + word);

2
src/base/bittorrent/magneturi.cpp

@ -46,7 +46,7 @@ namespace
rawBc = rawBc.mid(8); // skip bc://bt/ rawBc = rawBc.mid(8); // skip bc://bt/
rawBc = QByteArray::fromBase64(rawBc); // Decode base64 rawBc = QByteArray::fromBase64(rawBc); // Decode base64
// Format is now AA/url_encoded_filename/size_bytes/info_hash/ZZ // Format is now AA/url_encoded_filename/size_bytes/info_hash/ZZ
QStringList parts = QString(rawBc).split("/"); QStringList parts = QString(rawBc).split('/');
if (parts.size() != 5) return QString(); if (parts.size() != 5) return QString();
QString filename = parts.at(1); QString filename = parts.at(1);

2
src/base/bittorrent/peerinfo.cpp

@ -377,7 +377,7 @@ void PeerInfo::determineFlags()
// L = Peer is local // L = Peer is local
if (fromLSD()) { if (fromLSD()) {
m_flags += "L"; m_flags += 'L';
flagsDescriptionList += "L = " flagsDescriptionList += "L = "
+ tr("peer from LSD"); + tr("peer from LSD");
} }

12
src/base/bittorrent/session.cpp

@ -688,7 +688,7 @@ QString Session::torrentTempPath(const TorrentInfo &torrentInfo) const
if ((torrentInfo.filesCount() > 1) && !torrentInfo.hasRootFolder()) if ((torrentInfo.filesCount() > 1) && !torrentInfo.hasRootFolder())
return tempPath() return tempPath()
+ QString::fromStdString(torrentInfo.nativeInfo()->orig_files().name()) + QString::fromStdString(torrentInfo.nativeInfo()->orig_files().name())
+ "/"; + '/';
return tempPath(); return tempPath();
} }
@ -793,7 +793,7 @@ bool Session::removeCategory(const QString &name)
bool result = false; bool result = false;
if (isSubcategoriesEnabled()) { if (isSubcategoriesEnabled()) {
// remove subcategories // remove subcategories
const QString test = name + "/"; const QString test = name + '/';
Dict::removeIf(m_categories, [this, &test, &result](const QString &category, const QString &) Dict::removeIf(m_categories, [this, &test, &result](const QString &category, const QString &)
{ {
if (category.startsWith(test)) { if (category.startsWith(test)) {
@ -3664,7 +3664,7 @@ void Session::handleTorrentFinished(TorrentHandle *const torrent)
const QString torrentRelpath = torrent->filePath(i); const QString torrentRelpath = torrent->filePath(i);
if (torrentRelpath.endsWith(".torrent", Qt::CaseInsensitive)) { if (torrentRelpath.endsWith(".torrent", Qt::CaseInsensitive)) {
qDebug("Found possible recursive torrent download."); qDebug("Found possible recursive torrent download.");
const QString torrentFullpath = torrent->savePath(true) + "/" + torrentRelpath; const QString torrentFullpath = torrent->savePath(true) + '/' + torrentRelpath;
qDebug("Full subtorrent path is %s", qUtf8Printable(torrentFullpath)); qDebug("Full subtorrent path is %s", qUtf8Printable(torrentFullpath));
TorrentInfo torrentInfo = TorrentInfo::loadFromFile(torrentFullpath); TorrentInfo torrentInfo = TorrentInfo::loadFromFile(torrentFullpath);
if (torrentInfo.isValid()) { if (torrentInfo.isValid()) {
@ -3814,7 +3814,7 @@ void Session::recursiveTorrentDownload(const InfoHash &hash)
tr("Recursive download of file '%1' embedded in torrent '%2'" tr("Recursive download of file '%1' embedded in torrent '%2'"
, "Recursive download of 'test.torrent' embedded in torrent 'test2'") , "Recursive download of 'test.torrent' embedded in torrent 'test2'")
.arg(Utils::Fs::toNativePath(torrentRelpath), torrent->name())); .arg(Utils::Fs::toNativePath(torrentRelpath), torrent->name()));
const QString torrentFullpath = torrent->savePath() + "/" + torrentRelpath; const QString torrentFullpath = torrent->savePath() + '/' + torrentRelpath;
AddTorrentParams params; AddTorrentParams params;
// Passing the save path along to the sub torrent file // Passing the save path along to the sub torrent file
@ -4309,7 +4309,7 @@ void Session::handleListenSucceededAlert(libt::listen_succeeded_alert *p)
proto = "TCP"; proto = "TCP";
else if (p->sock_type == libt::listen_succeeded_alert::tcp_ssl) else if (p->sock_type == libt::listen_succeeded_alert::tcp_ssl)
proto = "TCP_SSL"; proto = "TCP_SSL";
qDebug() << "Successfully listening on " << proto << p->endpoint.address().to_string(ec).c_str() << "/" << p->endpoint.port(); qDebug() << "Successfully listening on " << proto << p->endpoint.address().to_string(ec).c_str() << '/' << p->endpoint.port();
Logger::instance()->addMessage( Logger::instance()->addMessage(
tr("qBittorrent is successfully listening on interface %1 port: %2/%3", "e.g: qBittorrent is successfully listening on interface 192.168.0.1 port: TCP/6881") tr("qBittorrent is successfully listening on interface %1 port: %2/%3", "e.g: qBittorrent is successfully listening on interface 192.168.0.1 port: TCP/6881")
.arg(p->endpoint.address().to_string(ec).c_str(), proto, QString::number(p->endpoint.port())), Log::INFO); .arg(p->endpoint.address().to_string(ec).c_str(), proto, QString::number(p->endpoint.port())), Log::INFO);
@ -4336,7 +4336,7 @@ void Session::handleListenFailedAlert(libt::listen_failed_alert *p)
proto = "I2P"; proto = "I2P";
else if (p->sock_type == libt::listen_failed_alert::socks5) else if (p->sock_type == libt::listen_failed_alert::socks5)
proto = "SOCKS5"; proto = "SOCKS5";
qDebug() << "Failed listening on " << proto << p->endpoint.address().to_string(ec).c_str() << "/" << p->endpoint.port(); qDebug() << "Failed listening on " << proto << p->endpoint.address().to_string(ec).c_str() << '/' << p->endpoint.port();
Logger::instance()->addMessage( Logger::instance()->addMessage(
tr("qBittorrent failed listening on interface %1 port: %2/%3. Reason: %4.", tr("qBittorrent failed listening on interface %1 port: %2/%3. Reason: %4.",
"e.g: qBittorrent failed listening on interface 192.168.0.1 port: TCP/6881. Reason: already in use.") "e.g: qBittorrent failed listening on interface 192.168.0.1 port: TCP/6881. Reason: already in use.")

2
src/base/bittorrent/torrentcreatorthread.cpp

@ -89,7 +89,7 @@ void TorrentCreatorThread::run()
emit updateProgress(0); emit updateProgress(0);
try { try {
const QString parentPath = Utils::Fs::branchPath(m_params.inputPath) + "/"; const QString parentPath = Utils::Fs::branchPath(m_params.inputPath) + '/';
// Adding files to the torrent // Adding files to the torrent
libt::file_storage fs; libt::file_storage fs;

22
src/base/bittorrent/torrenthandle.cpp

@ -328,7 +328,7 @@ QString TorrentHandle::rootPath(bool actual) const
return QString(); return QString();
QString firstFilePath = filePath(0); QString firstFilePath = filePath(0);
const int slashIndex = firstFilePath.indexOf("/"); const int slashIndex = firstFilePath.indexOf('/');
if (slashIndex >= 0) if (slashIndex >= 0)
return QDir(savePath(actual)).absoluteFilePath(firstFilePath.left(slashIndex)); return QDir(savePath(actual)).absoluteFilePath(firstFilePath.left(slashIndex));
else else
@ -556,7 +556,7 @@ bool TorrentHandle::belongsToCategory(const QString &category) const
if (m_category == category) return true; if (m_category == category) return true;
if (m_session->isSubcategoriesEnabled() && m_category.startsWith(category + "/")) if (m_session->isSubcategoriesEnabled() && m_category.startsWith(category + '/'))
return true; return true;
return false; return false;
@ -1683,12 +1683,12 @@ void TorrentHandle::handleFileRenamedAlert(const libtorrent::file_renamed_alert
// TODO: Check this! // TODO: Check this!
if (filesCount() > 1) { if (filesCount() > 1) {
// Check if folders were renamed // Check if folders were renamed
QStringList oldPathParts = m_torrentInfo.origFilePath(p->index).split("/"); QStringList oldPathParts = m_torrentInfo.origFilePath(p->index).split('/');
oldPathParts.removeLast(); oldPathParts.removeLast();
QString oldPath = oldPathParts.join("/"); QString oldPath = oldPathParts.join('/');
QStringList newPathParts = newName.split("/"); QStringList newPathParts = newName.split('/');
newPathParts.removeLast(); newPathParts.removeLast();
QString newPath = newPathParts.join("/"); QString newPath = newPathParts.join('/');
if (!newPathParts.isEmpty() && (oldPath != newPath)) { if (!newPathParts.isEmpty() && (oldPath != newPath)) {
qDebug("oldPath(%s) != newPath(%s)", qUtf8Printable(oldPath), qUtf8Printable(newPath)); qDebug("oldPath(%s) != newPath(%s)", qUtf8Printable(oldPath), qUtf8Printable(newPath));
oldPath = QString("%1/%2").arg(savePath(true), oldPath); oldPath = QString("%1/%2").arg(savePath(true), oldPath);
@ -2018,7 +2018,7 @@ void TorrentHandle::prioritizeFiles(const QVector<int> &priorities)
// Make sure the file does not already exists // Make sure the file does not already exists
if (QDir(parentAbsPath).dirName() != ".unwanted") { if (QDir(parentAbsPath).dirName() != ".unwanted") {
QString unwantedAbsPath = parentAbsPath + "/.unwanted"; QString unwantedAbsPath = parentAbsPath + "/.unwanted";
QString newAbsPath = unwantedAbsPath + "/" + Utils::Fs::fileName(filepath); QString newAbsPath = unwantedAbsPath + '/' + Utils::Fs::fileName(filepath);
qDebug() << "Unwanted path is" << unwantedAbsPath; qDebug() << "Unwanted path is" << unwantedAbsPath;
if (QFile::exists(newAbsPath)) { if (QFile::exists(newAbsPath)) {
qWarning() << "File" << newAbsPath << "already exists at destination."; qWarning() << "File" << newAbsPath << "already exists at destination.";
@ -2038,8 +2038,8 @@ void TorrentHandle::prioritizeFiles(const QVector<int> &priorities)
} }
#endif #endif
QString parentPath = Utils::Fs::branchPath(filepath); QString parentPath = Utils::Fs::branchPath(filepath);
if (!parentPath.isEmpty() && !parentPath.endsWith("/")) if (!parentPath.isEmpty() && !parentPath.endsWith('/'))
parentPath += "/"; parentPath += '/';
renameFile(i, parentPath + ".unwanted/" + Utils::Fs::fileName(filepath)); renameFile(i, parentPath + ".unwanted/" + Utils::Fs::fileName(filepath));
} }
} }
@ -2056,8 +2056,8 @@ void TorrentHandle::prioritizeFiles(const QVector<int> &priorities)
renameFile(i, QDir(newRelPath).filePath(oldName)); renameFile(i, QDir(newRelPath).filePath(oldName));
// Remove .unwanted directory if empty // Remove .unwanted directory if empty
qDebug() << "Attempting to remove .unwanted folder at " << QDir(spath + "/" + newRelPath).absoluteFilePath(".unwanted"); qDebug() << "Attempting to remove .unwanted folder at " << QDir(spath + '/' + newRelPath).absoluteFilePath(".unwanted");
QDir(spath + "/" + newRelPath).rmdir(".unwanted"); QDir(spath + '/' + newRelPath).rmdir(".unwanted");
} }
} }
} }

2
src/base/bittorrent/tracker.cpp

@ -60,7 +60,7 @@ bool Peer::operator==(const Peer &other) const
QString Peer::uid() const QString Peer::uid() const
{ {
return ip + ":" + QString::number(port); return ip + ':' + QString::number(port);
} }
libtorrent::entry Peer::toEntry(bool noPeerId) const libtorrent::entry Peer::toEntry(bool noPeerId) const

2
src/base/net/dnsupdater.cpp

@ -181,7 +181,7 @@ void DNSUpdater::processIPUpdateReply(const QString &reply)
{ {
Logger *const logger = Logger::instance(); Logger *const logger = Logger::instance();
qDebug() << Q_FUNC_INFO << reply; qDebug() << Q_FUNC_INFO << reply;
QString code = reply.split(" ").first(); QString code = reply.split(' ').first();
qDebug() << Q_FUNC_INFO << "Code:" << code; qDebug() << Q_FUNC_INFO << "Code:" << code;
if ((code == "good") || (code == "nochg")) { if ((code == "good") || (code == "nochg")) {

8
src/base/net/smtp.cpp

@ -299,7 +299,7 @@ QByteArray Smtp::encodeMimeHeader(const QString &key, const QString &value, QTex
if (firstWord) if (firstWord)
line += word; line += word;
else else
line += " " + word; line += ' ' + word;
firstWord = false; firstWord = false;
} }
} }
@ -423,7 +423,7 @@ void Smtp::authenticate()
// Skip authentication // Skip authentication
logError("The SMTP server does not seem to support any of the authentications modes " logError("The SMTP server does not seem to support any of the authentications modes "
"we support [CRAM-MD5|PLAIN|LOGIN], skipping authentication, " "we support [CRAM-MD5|PLAIN|LOGIN], skipping authentication, "
"knowing it is likely to fail... Server Auth Modes: " + auth.join("|")); "knowing it is likely to fail... Server Auth Modes: " + auth.join('|'));
m_state = Authenticated; m_state = Authenticated;
// At this point the server will not send any response // At this point the server will not send any response
// So fill the buffer with a fake one to pass the tests // So fill the buffer with a fake one to pass the tests
@ -503,7 +503,7 @@ void Smtp::authLogin()
void Smtp::logError(const QString &msg) void Smtp::logError(const QString &msg)
{ {
qDebug() << "Email Notification Error:" << msg; qDebug() << "Email Notification Error:" << msg;
Logger::instance()->addMessage(tr("Email Notification Error:") + " " + msg, Log::CRITICAL); Logger::instance()->addMessage(tr("Email Notification Error:") + ' ' + msg, Log::CRITICAL);
} }
QString Smtp::getCurrentDateTime() const QString Smtp::getCurrentDateTime() const
@ -529,7 +529,7 @@ QString Smtp::getCurrentDateTime() const
std::snprintf(buf, sizeof(buf), "%+05d", timeOffset); std::snprintf(buf, sizeof(buf), "%+05d", timeOffset);
QString timeOffsetStr = buf; QString timeOffsetStr = buf;
QString ret = weekDayStr + ", " + dayStr + " " + monthStr + " " + yearStr + " " + timeStr + " " + timeOffsetStr; QString ret = weekDayStr + ", " + dayStr + ' ' + monthStr + ' ' + yearStr + ' ' + timeStr + ' ' + timeOffsetStr;
return ret; return ret;
} }

12
src/base/preferences.cpp

@ -256,7 +256,7 @@ void Preferences::setWinStartup(bool b)
{ {
QSettings settings("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run", QSettings::NativeFormat); QSettings settings("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run", QSettings::NativeFormat);
if (b) { if (b) {
const QString binPath = "\"" + Utils::Fs::toNativePath(qApp->applicationFilePath()) + "\""; const QString binPath = '"' + Utils::Fs::toNativePath(qApp->applicationFilePath()) + '"';
settings.setValue("qBittorrent", binPath); settings.setValue("qBittorrent", binPath);
} }
else { else {
@ -500,7 +500,7 @@ void Preferences::setWebUiAuthSubnetWhitelist(QStringList subnets)
QString Preferences::getServerDomains() const QString Preferences::getServerDomains() const
{ {
return value("Preferences/WebUI/ServerDomains", "*").toString(); return value("Preferences/WebUI/ServerDomains", '*').toString();
} }
void Preferences::setServerDomains(const QString &str) void Preferences::setServerDomains(const QString &str)
@ -510,7 +510,7 @@ void Preferences::setServerDomains(const QString &str)
QString Preferences::getWebUiAddress() const QString Preferences::getWebUiAddress() const
{ {
return value("Preferences/WebUI/Address", "*").toString().trimmed(); return value("Preferences/WebUI/Address", '*').toString().trimmed();
} }
void Preferences::setWebUiAddress(const QString &addr) void Preferences::setWebUiAddress(const QString &addr)
@ -987,7 +987,7 @@ QString Preferences::getPythonPath()
// Fallback: Detect python from default locations // Fallback: Detect python from default locations
const QStringList dirs = QDir("C:/").entryList(QStringList("Python*"), QDir::Dirs, QDir::Name | QDir::Reversed); const QStringList dirs = QDir("C:/").entryList(QStringList("Python*"), QDir::Dirs, QDir::Name | QDir::Reversed);
foreach (const QString &dir, dirs) { foreach (const QString &dir, dirs) {
const QString path("C:/" + dir + "/"); const QString path("C:/" + dir + '/');
if (QFile::exists(path + "python.exe")) if (QFile::exists(path + "python.exe"))
return path; return path;
} }
@ -1058,8 +1058,8 @@ void Preferences::setMagnetLinkAssoc(bool set)
// Magnet association // Magnet association
if (set) { if (set) {
const QString commandStr = "\"" + qApp->applicationFilePath() + "\" \"%1\""; const QString commandStr = '"' + qApp->applicationFilePath() + "\" \"%1\"";
const QString iconStr = "\"" + qApp->applicationFilePath() + "\",1"; const QString iconStr = '"' + qApp->applicationFilePath() + "\",1";
settings.setValue("magnet/Default", "URL:Magnet link"); settings.setValue("magnet/Default", "URL:Magnet link");
settings.setValue("magnet/Content Type", "application/x-magnet"); settings.setValue("magnet/Content Type", "application/x-magnet");

8
src/base/rss/rss_autodownloadrule.cpp

@ -502,7 +502,7 @@ void AutoDownloadRule::setMustContain(const QString &tokens)
if (m_dataPtr->useRegex) if (m_dataPtr->useRegex)
m_dataPtr->mustContain = QStringList() << tokens; m_dataPtr->mustContain = QStringList() << tokens;
else else
m_dataPtr->mustContain = tokens.split("|"); m_dataPtr->mustContain = tokens.split('|');
// Check for single empty string - if so, no condition // Check for single empty string - if so, no condition
if ((m_dataPtr->mustContain.size() == 1) && m_dataPtr->mustContain[0].isEmpty()) if ((m_dataPtr->mustContain.size() == 1) && m_dataPtr->mustContain[0].isEmpty())
@ -516,7 +516,7 @@ void AutoDownloadRule::setMustNotContain(const QString &tokens)
if (m_dataPtr->useRegex) if (m_dataPtr->useRegex)
m_dataPtr->mustNotContain = QStringList() << tokens; m_dataPtr->mustNotContain = QStringList() << tokens;
else else
m_dataPtr->mustNotContain = tokens.split("|"); m_dataPtr->mustNotContain = tokens.split('|');
// Check for single empty string - if so, no condition // Check for single empty string - if so, no condition
if ((m_dataPtr->mustNotContain.size() == 1) && m_dataPtr->mustNotContain[0].isEmpty()) if ((m_dataPtr->mustNotContain.size() == 1) && m_dataPtr->mustNotContain[0].isEmpty())
@ -605,12 +605,12 @@ int AutoDownloadRule::ignoreDays() const
QString AutoDownloadRule::mustContain() const QString AutoDownloadRule::mustContain() const
{ {
return m_dataPtr->mustContain.join("|"); return m_dataPtr->mustContain.join('|');
} }
QString AutoDownloadRule::mustNotContain() const QString AutoDownloadRule::mustNotContain() const
{ {
return m_dataPtr->mustNotContain.join("|"); return m_dataPtr->mustNotContain.join('|');
} }
bool AutoDownloadRule::useSmartFilter() const bool AutoDownloadRule::useSmartFilter() const

6
src/base/search/searchhandler.cpp

@ -65,13 +65,13 @@ SearchHandler::SearchHandler(const QString &pattern, const QString &category, co
const QStringList params { const QStringList params {
Utils::Fs::toNativePath(m_manager->engineLocation() + "/nova2.py"), Utils::Fs::toNativePath(m_manager->engineLocation() + "/nova2.py"),
m_usedPlugins.join(","), m_usedPlugins.join(','),
m_category m_category
}; };
// Launch search // Launch search
m_searchProcess->setProgram(Utils::ForeignApps::pythonInfo().executableName); m_searchProcess->setProgram(Utils::ForeignApps::pythonInfo().executableName);
m_searchProcess->setArguments(params + m_pattern.split(" ")); m_searchProcess->setArguments(params + m_pattern.split(' '));
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)) #if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
connect(m_searchProcess, &QProcess::errorOccurred, this, &SearchHandler::processFailed); connect(m_searchProcess, &QProcess::errorOccurred, this, &SearchHandler::processFailed);
@ -161,7 +161,7 @@ void SearchHandler::processFailed()
// file url | file name | file size | nb seeds | nb leechers | Search engine url // file url | file name | file size | nb seeds | nb leechers | Search engine url
bool SearchHandler::parseSearchResult(const QString &line, SearchResult &searchResult) bool SearchHandler::parseSearchResult(const QString &line, SearchResult &searchResult)
{ {
const QStringList parts = line.split("|"); const QStringList parts = line.split('|');
const int nbFields = parts.size(); const int nbFields = parts.size();
if (nbFields < (NB_PLUGIN_COLUMNS - 1)) return false; // -1 because desc_link is optional if (nbFields < (NB_PLUGIN_COLUMNS - 1)) return false; // -1 because desc_link is optional

8
src/base/search/searchpluginmanager.cpp

@ -204,7 +204,7 @@ void SearchPluginManager::installPlugin(const QString &source)
path = QUrl(path).toLocalFile(); path = QUrl(path).toLocalFile();
QString pluginName = Utils::Fs::fileName(path); QString pluginName = Utils::Fs::fileName(path);
pluginName.chop(pluginName.size() - pluginName.lastIndexOf(".")); pluginName.chop(pluginName.size() - pluginName.lastIndexOf('.'));
if (!path.endsWith(".py", Qt::CaseInsensitive)) if (!path.endsWith(".py", Qt::CaseInsensitive))
emit pluginInstallationFailed(pluginName, tr("Unknown search engine plugin file format.")); emit pluginInstallationFailed(pluginName, tr("Unknown search engine plugin file format."));
@ -375,7 +375,7 @@ void SearchPluginManager::pluginDownloaded(const QString &url, QString filePath)
filePath = Utils::Fs::fromNativePath(filePath); filePath = Utils::Fs::fromNativePath(filePath);
QString pluginName = Utils::Fs::fileName(url); QString pluginName = Utils::Fs::fileName(url);
pluginName.chop(pluginName.size() - pluginName.lastIndexOf(".")); // Remove extension pluginName.chop(pluginName.size() - pluginName.lastIndexOf('.')); // Remove extension
installPlugin_impl(pluginName, filePath); installPlugin_impl(pluginName, filePath);
Utils::Fs::forceRemove(filePath); Utils::Fs::forceRemove(filePath);
} }
@ -502,13 +502,13 @@ void SearchPluginManager::parseVersionInfo(const QByteArray &info)
foreach (QByteArray line, lines) { foreach (QByteArray line, lines) {
line = line.trimmed(); line = line.trimmed();
if (line.isEmpty()) continue; if (line.isEmpty()) continue;
if (line.startsWith("#")) continue; if (line.startsWith('#')) continue;
QList<QByteArray> list = line.split(' '); QList<QByteArray> list = line.split(' ');
if (list.size() != 2) continue; if (list.size() != 2) continue;
QString pluginName = QString(list.first()); QString pluginName = QString(list.first());
if (!pluginName.endsWith(":")) continue; if (!pluginName.endsWith(':')) continue;
pluginName.chop(1); // remove trailing ':' pluginName.chop(1); // remove trailing ':'
PluginVersion version = PluginVersion::tryParse(list.last(), {}); PluginVersion version = PluginVersion::tryParse(list.last(), {});

18
src/base/utils/fs.cpp

@ -78,14 +78,14 @@ QString Utils::Fs::fromNativePath(const QString &path)
QString Utils::Fs::fileExtension(const QString &filename) QString Utils::Fs::fileExtension(const QString &filename)
{ {
QString ext = QString(filename).remove(QB_EXT); QString ext = QString(filename).remove(QB_EXT);
const int pointIndex = ext.lastIndexOf("."); const int pointIndex = ext.lastIndexOf('.');
return (pointIndex >= 0) ? ext.mid(pointIndex + 1) : QString(); return (pointIndex >= 0) ? ext.mid(pointIndex + 1) : QString();
} }
QString Utils::Fs::fileName(const QString &filePath) QString Utils::Fs::fileName(const QString &filePath)
{ {
QString path = fromNativePath(filePath); QString path = fromNativePath(filePath);
const int slashIndex = path.lastIndexOf("/"); const int slashIndex = path.lastIndexOf('/');
if (slashIndex == -1) if (slashIndex == -1)
return path; return path;
return path.mid(slashIndex + 1); return path.mid(slashIndex + 1);
@ -94,7 +94,7 @@ QString Utils::Fs::fileName(const QString &filePath)
QString Utils::Fs::folderName(const QString &filePath) QString Utils::Fs::folderName(const QString &filePath)
{ {
QString path = fromNativePath(filePath); QString path = fromNativePath(filePath);
const int slashIndex = path.lastIndexOf("/"); const int slashIndex = path.lastIndexOf('/');
if (slashIndex == -1) if (slashIndex == -1)
return path; return path;
return path.left(slashIndex); return path.left(slashIndex);
@ -121,13 +121,13 @@ bool Utils::Fs::smartRemoveEmptyFolderTree(const QString &path)
}; };
// 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.
QStringList dirList(path + "/"); // get all sub directories paths QStringList dirList(path + '/'); // get all sub directories paths
QDirIterator iter(path, (QDir::AllDirs | QDir::NoDotAndDotDot), QDirIterator::Subdirectories); QDirIterator iter(path, (QDir::AllDirs | QDir::NoDotAndDotDot), QDirIterator::Subdirectories);
while (iter.hasNext()) while (iter.hasNext())
dirList << iter.next() + "/"; dirList << iter.next() + '/';
// sort descending by directory depth // sort descending by directory depth
std::sort(dirList.begin(), dirList.end() std::sort(dirList.begin(), dirList.end()
, [](const QString &l, const QString &r) { return l.count("/") > r.count("/"); }); , [](const QString &l, const QString &r) { return l.count('/') > r.count('/'); });
for (const QString &p : qAsConst(dirList)) { for (const QString &p : qAsConst(dirList)) {
// remove unwanted files // remove unwanted files
@ -139,7 +139,7 @@ bool Utils::Fs::smartRemoveEmptyFolderTree(const QString &path)
QDir dir(p); QDir dir(p);
QStringList tmpFileList = dir.entryList(QDir::Files); QStringList tmpFileList = dir.entryList(QDir::Files);
for (const QString &f : tmpFileList) { for (const QString &f : tmpFileList) {
if (f.endsWith("~")) if (f.endsWith('~'))
forceRemove(p + f); forceRemove(p + f);
} }
@ -246,9 +246,9 @@ qint64 Utils::Fs::freeDiskSpaceOnPath(const QString &path)
QString Utils::Fs::branchPath(const QString &filePath, QString *removed) QString Utils::Fs::branchPath(const QString &filePath, QString *removed)
{ {
QString ret = fromNativePath(filePath); QString ret = fromNativePath(filePath);
if (ret.endsWith("/")) if (ret.endsWith('/'))
ret.chop(1); ret.chop(1);
const int slashIndex = ret.lastIndexOf("/"); const int slashIndex = ret.lastIndexOf('/');
if (slashIndex >= 0) { if (slashIndex >= 0) {
if (removed) if (removed)
*removed = ret.mid(slashIndex + 1); *removed = ret.mid(slashIndex + 1);

6
src/base/utils/misc.cpp

@ -501,7 +501,7 @@ void Utils::Misc::openFolderSelect(const QString &absolutePath)
const QString path = Utils::Fs::fromNativePath(absolutePath); const QString path = Utils::Fs::fromNativePath(absolutePath);
// If the item to select doesn't exist, try to open its parent // If the item to select doesn't exist, try to open its parent
if (!QFileInfo::exists(path)) { if (!QFileInfo::exists(path)) {
openPath(path.left(path.lastIndexOf("/"))); openPath(path.left(path.lastIndexOf('/')));
return; return;
} }
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
@ -540,10 +540,10 @@ void Utils::Misc::openFolderSelect(const QString &absolutePath)
} }
else { else {
// "caja" manager can't pinpoint the file, see: https://github.com/qbittorrent/qBittorrent/issues/5003 // "caja" manager can't pinpoint the file, see: https://github.com/qbittorrent/qBittorrent/issues/5003
openPath(path.left(path.lastIndexOf("/"))); openPath(path.left(path.lastIndexOf('/')));
} }
#else #else
openPath(path.left(path.lastIndexOf("/"))); openPath(path.left(path.lastIndexOf('/')));
#endif #endif
} }

2
src/gui/addnewtorrentdialog.cpp

@ -445,7 +445,7 @@ void AddNewTorrentDialog::updateDiskSpaceLabel()
sizeString += " ("; sizeString += " (";
sizeString += tr("Free space on disk: %1").arg(Utils::Misc::friendlyUnit(Utils::Fs::freeDiskSpaceOnPath( sizeString += tr("Free space on disk: %1").arg(Utils::Misc::friendlyUnit(Utils::Fs::freeDiskSpaceOnPath(
m_ui->savePath->selectedPath()))); m_ui->savePath->selectedPath())));
sizeString += ")"; sizeString += ')';
m_ui->labelSize->setText(sizeString); m_ui->labelSize->setText(sizeString);
} }

4
src/gui/mainwindow.cpp

@ -2037,7 +2037,7 @@ bool MainWindow::addPythonPathToEnv()
QString pathEnvar = QString::fromLocal8Bit(qgetenv("PATH").constData()); QString pathEnvar = QString::fromLocal8Bit(qgetenv("PATH").constData());
if (pathEnvar.isNull()) if (pathEnvar.isNull())
pathEnvar = ""; pathEnvar = "";
pathEnvar = pythonPath + ";" + pathEnvar; pathEnvar = pythonPath + ';' + pathEnvar;
qDebug("New PATH envvar is: %s", qUtf8Printable(pathEnvar)); qDebug("New PATH envvar is: %s", qUtf8Printable(pathEnvar));
qputenv("PATH", Utils::Fs::toNativePath(pathEnvar).toLocal8Bit()); qputenv("PATH", Utils::Fs::toNativePath(pathEnvar).toLocal8Bit());
return true; return true;
@ -2069,7 +2069,7 @@ void MainWindow::pythonDownloadSuccess(const QString &url, const QString &filePa
if (QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA) { if (QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA) {
QFile::rename(filePath, filePath + ".exe"); QFile::rename(filePath, filePath + ".exe");
installer.start("\"" + Utils::Fs::toNativePath(filePath) + ".exe\" /passive"); installer.start('"' + Utils::Fs::toNativePath(filePath) + ".exe\" /passive");
} }
else { else {
QFile::rename(filePath, filePath + ".msi"); QFile::rename(filePath, filePath + ".msi");

2
src/gui/previewlistdelegate.h

@ -70,7 +70,7 @@ public:
QStyleOptionProgressBar newopt; QStyleOptionProgressBar newopt;
qreal progress = index.data().toDouble() * 100.; qreal progress = index.data().toDouble() * 100.;
newopt.rect = opt.rect; newopt.rect = opt.rect;
newopt.text = ((progress == 100.0) ? QString("100%") : Utils::String::fromDouble(progress, 1) + "%"); newopt.text = ((progress == 100.0) ? QString("100%") : Utils::String::fromDouble(progress, 1) + '%');
newopt.progress = static_cast<int>(progress); newopt.progress = static_cast<int>(progress);
newopt.maximum = 100; newopt.maximum = 100;
newopt.minimum = 0; newopt.minimum = 0;

2
src/gui/properties/peerlistdelegate.h

@ -100,7 +100,7 @@ public:
case RELEVANCE: { case RELEVANCE: {
qreal progress = index.data().toDouble(); qreal progress = index.data().toDouble();
opt.displayAlignment = Qt::AlignRight | Qt::AlignVCenter; opt.displayAlignment = Qt::AlignRight | Qt::AlignVCenter;
QItemDelegate::drawDisplay(painter, opt, opt.rect, Utils::String::fromDouble(progress * 100.0, 1) + "%"); QItemDelegate::drawDisplay(painter, opt, opt.rect, Utils::String::fromDouble(progress * 100.0, 1) + '%');
} }
break; break;
default: default:

8
src/gui/properties/peerlistwidget.cpp

@ -304,9 +304,9 @@ void PeerListWidget::copySelectedPeers()
QString ip = m_listModel->data(m_listModel->index(row, PeerListDelegate::IP_HIDDEN)).toString(); QString ip = m_listModel->data(m_listModel->index(row, PeerListDelegate::IP_HIDDEN)).toString();
QString myport = m_listModel->data(m_listModel->index(row, PeerListDelegate::PORT)).toString(); QString myport = m_listModel->data(m_listModel->index(row, PeerListDelegate::PORT)).toString();
if (ip.indexOf('.') == -1) // IPv6 if (ip.indexOf('.') == -1) // IPv6
selectedPeers << "[" + ip + "]:" + myport; selectedPeers << '[' + ip + "]:" + myport;
else // IPv4 else // IPv4
selectedPeers << ip + ":" + myport; selectedPeers << ip + ':' + myport;
} }
QApplication::clipboard()->setText(selectedPeers.join('\n')); QApplication::clipboard()->setText(selectedPeers.join('\n'));
} }
@ -404,8 +404,8 @@ QStandardItem *PeerListWidget::addPeer(const QString &ip, BitTorrent::TorrentHan
m_listModel->setData(m_listModel->index(row, PeerListDelegate::TOT_UP), peer.totalUpload()); m_listModel->setData(m_listModel->index(row, PeerListDelegate::TOT_UP), peer.totalUpload());
m_listModel->setData(m_listModel->index(row, PeerListDelegate::RELEVANCE), peer.relevance()); m_listModel->setData(m_listModel->index(row, PeerListDelegate::RELEVANCE), peer.relevance());
QStringList downloadingFiles(torrent->info().filesForPiece(peer.downloadingPieceIndex())); QStringList downloadingFiles(torrent->info().filesForPiece(peer.downloadingPieceIndex()));
m_listModel->setData(m_listModel->index(row, PeerListDelegate::DOWNLOADING_PIECE), downloadingFiles.join(QLatin1String(";"))); m_listModel->setData(m_listModel->index(row, PeerListDelegate::DOWNLOADING_PIECE), downloadingFiles.join(QLatin1Char(';')));
m_listModel->setData(m_listModel->index(row, PeerListDelegate::DOWNLOADING_PIECE), downloadingFiles.join(QLatin1String("\n")), Qt::ToolTipRole); m_listModel->setData(m_listModel->index(row, PeerListDelegate::DOWNLOADING_PIECE), downloadingFiles.join(QLatin1Char('\n')), Qt::ToolTipRole);
return m_listModel->item(row, PeerListDelegate::IP); return m_listModel->item(row, PeerListDelegate::IP);
} }

2
src/gui/properties/propertieswidget.cpp

@ -474,7 +474,7 @@ void PropertiesWidget::loadDynamicData()
// Progress // Progress
qreal progress = m_torrent->progress() * 100.; qreal progress = m_torrent->progress() * 100.;
m_ui->labelProgressVal->setText(Utils::String::fromDouble(progress, 1) + "%"); m_ui->labelProgressVal->setText(Utils::String::fromDouble(progress, 1) + '%');
m_downloadedPieces->setProgress(m_torrent->pieces(), m_torrent->downloadingPieces()); m_downloadedPieces->setProgress(m_torrent->pieces(), m_torrent->downloadingPieces());
} }
else { else {

2
src/gui/properties/proplistdelegate.cpp

@ -87,7 +87,7 @@ void PropListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti
QStyleOptionProgressBar newopt; QStyleOptionProgressBar newopt;
qreal progress = index.data().toDouble() * 100.; qreal progress = index.data().toDouble() * 100.;
newopt.rect = opt.rect; newopt.rect = opt.rect;
newopt.text = ((progress == 100.0) ? QString("100%") : Utils::String::fromDouble(progress, 1) + "%"); newopt.text = ((progress == 100.0) ? QString("100%") : Utils::String::fromDouble(progress, 1) + '%');
newopt.progress = int(progress); newopt.progress = int(progress);
newopt.maximum = 100; newopt.maximum = 100;
newopt.minimum = 0; newopt.minimum = 0;

6
src/gui/properties/trackerlistwidget.cpp

@ -371,9 +371,9 @@ void TrackerListWidget::loadTrackers()
item->setText(COL_PEERS, QString::number(entry.nativeEntry().scrape_incomplete > 0 ? entry.nativeEntry().scrape_incomplete : 0)); item->setText(COL_PEERS, QString::number(entry.nativeEntry().scrape_incomplete > 0 ? entry.nativeEntry().scrape_incomplete : 0));
item->setText(COL_DOWNLOADED, QString::number(entry.nativeEntry().scrape_downloaded > 0 ? entry.nativeEntry().scrape_downloaded : 0)); item->setText(COL_DOWNLOADED, QString::number(entry.nativeEntry().scrape_downloaded > 0 ? entry.nativeEntry().scrape_downloaded : 0));
#else #else
item->setText(COL_SEEDS, "0"); item->setText(COL_SEEDS, '0');
item->setText(COL_PEERS, "0"); item->setText(COL_PEERS, '0');
item->setText(COL_DOWNLOADED, "0"); item->setText(COL_DOWNLOADED, '0');
#endif #endif
item->setTextAlignment(COL_TIER, (Qt::AlignRight | Qt::AlignVCenter)); item->setTextAlignment(COL_TIER, (Qt::AlignRight | Qt::AlignVCenter));

4
src/gui/rss/automatedrssdownloader.cpp

@ -675,7 +675,7 @@ void AutomatedRssDownloader::updateMustLineValidity()
if (isRegex) if (isRegex)
tokens << text; tokens << text;
else else
foreach (const QString &token, text.split("|")) foreach (const QString &token, text.split('|'))
tokens << Utils::String::wildcardToRegex(token); tokens << Utils::String::wildcardToRegex(token);
foreach (const QString &token, tokens) { foreach (const QString &token, tokens) {
@ -713,7 +713,7 @@ void AutomatedRssDownloader::updateMustNotLineValidity()
if (isRegex) if (isRegex)
tokens << text; tokens << text;
else else
foreach (const QString &token, text.split("|")) foreach (const QString &token, text.split('|'))
tokens << Utils::String::wildcardToRegex(token); tokens << Utils::String::wildcardToRegex(token);
foreach (const QString &token, tokens) { foreach (const QString &token, tokens) {

8
src/gui/statusbar.cpp

@ -209,14 +209,14 @@ void StatusBar::updateSpeedLabels()
QString speedLbl = Utils::Misc::friendlyUnit(sessionStatus.payloadDownloadRate, true); QString speedLbl = Utils::Misc::friendlyUnit(sessionStatus.payloadDownloadRate, true);
int speedLimit = BitTorrent::Session::instance()->downloadSpeedLimit(); int speedLimit = BitTorrent::Session::instance()->downloadSpeedLimit();
if (speedLimit) if (speedLimit)
speedLbl += " [" + Utils::Misc::friendlyUnit(speedLimit, true) + "]"; speedLbl += " [" + Utils::Misc::friendlyUnit(speedLimit, true) + ']';
speedLbl += " (" + Utils::Misc::friendlyUnit(sessionStatus.totalPayloadDownload) + ")"; speedLbl += " (" + Utils::Misc::friendlyUnit(sessionStatus.totalPayloadDownload) + ')';
m_dlSpeedLbl->setText(speedLbl); m_dlSpeedLbl->setText(speedLbl);
speedLimit = BitTorrent::Session::instance()->uploadSpeedLimit(); speedLimit = BitTorrent::Session::instance()->uploadSpeedLimit();
speedLbl = Utils::Misc::friendlyUnit(sessionStatus.payloadUploadRate, true); speedLbl = Utils::Misc::friendlyUnit(sessionStatus.payloadUploadRate, true);
if (speedLimit) if (speedLimit)
speedLbl += " [" + Utils::Misc::friendlyUnit(speedLimit, true) + "]"; speedLbl += " [" + Utils::Misc::friendlyUnit(speedLimit, true) + ']';
speedLbl += " (" + Utils::Misc::friendlyUnit(sessionStatus.totalPayloadUpload) + ")"; speedLbl += " (" + Utils::Misc::friendlyUnit(sessionStatus.totalPayloadUpload) + ')';
m_upSpeedLbl->setText(speedLbl); m_upSpeedLbl->setText(speedLbl);
} }

12
src/gui/tagfiltermodel.cpp

@ -39,16 +39,16 @@ namespace
{ {
QString getSpecialAllTag() QString getSpecialAllTag()
{ {
static const QString *const ALL_TAG = new QString(" "); const QString ALL_TAG = QLatin1String(" ");
Q_ASSERT(!BitTorrent::Session::isValidTag(*ALL_TAG)); Q_ASSERT(!BitTorrent::Session::isValidTag(ALL_TAG));
return *ALL_TAG; return ALL_TAG;
} }
QString getSpecialUntaggedTag() QString getSpecialUntaggedTag()
{ {
static const QString *const UNTAGGED_TAG = new QString(" "); const QString UNTAGGED_TAG = QLatin1String(" ");
Q_ASSERT(!BitTorrent::Session::isValidTag(*UNTAGGED_TAG)); Q_ASSERT(!BitTorrent::Session::isValidTag(UNTAGGED_TAG));
return *UNTAGGED_TAG; return UNTAGGED_TAG;
} }
} }

4
src/gui/transferlistdelegate.cpp

@ -91,7 +91,7 @@ void TransferListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
qlonglong total = index.data(Qt::UserRole).toLongLong(); qlonglong total = index.data(Qt::UserRole).toLongLong();
if (hideValues && (!value && !total)) if (hideValues && (!value && !total))
break; break;
QString display = QString::number(value) + " (" + QString::number(total) + ")"; QString display = QString::number(value) + " (" + QString::number(total) + ')';
opt.displayAlignment = Qt::AlignRight | Qt::AlignVCenter; opt.displayAlignment = Qt::AlignRight | Qt::AlignVCenter;
QItemDelegate::drawDisplay(painter, opt, opt.rect, display); QItemDelegate::drawDisplay(painter, opt, opt.rect, display);
} }
@ -160,7 +160,7 @@ void TransferListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
QStyleOptionProgressBar newopt; QStyleOptionProgressBar newopt;
qreal progress = index.data().toDouble() * 100.; qreal progress = index.data().toDouble() * 100.;
newopt.rect = opt.rect; newopt.rect = opt.rect;
newopt.text = ((progress == 100.0) ? QString("100%") : Utils::String::fromDouble(progress, 1) + "%"); newopt.text = ((progress == 100.0) ? QString("100%") : Utils::String::fromDouble(progress, 1) + '%');
newopt.progress = static_cast<int>(progress); newopt.progress = static_cast<int>(progress);
newopt.maximum = 100; newopt.maximum = 100;
newopt.minimum = 0; newopt.minimum = 0;

2
src/gui/transferlistmodel.cpp

@ -93,7 +93,7 @@ QVariant TransferListModel::headerData(int section, Qt::Orientation orientation,
if (orientation == Qt::Horizontal) { if (orientation == Qt::Horizontal) {
if (role == Qt::DisplayRole) { if (role == Qt::DisplayRole) {
switch (section) { switch (section) {
case TR_PRIORITY: return "#"; case TR_PRIORITY: return QChar('#');
case TR_NAME: return tr("Name", "i.e: torrent name"); case TR_NAME: return tr("Name", "i.e: torrent name");
case TR_SIZE: return tr("Size", "i.e: torrent size"); case TR_SIZE: return tr("Size", "i.e: torrent size");
case TR_PROGRESS: return tr("Done", "% Done"); case TR_PROGRESS: return tr("Done", "% Done");

2
src/gui/utils.cpp

@ -73,7 +73,7 @@ QPixmap Utils::Gui::scaledPixmap(const QString &path, const QWidget *widget, con
QPixmap Utils::Gui::scaledPixmapSvg(const QString &path, const QWidget *widget, const int baseHeight) QPixmap Utils::Gui::scaledPixmapSvg(const QString &path, const QWidget *widget, const int baseHeight)
{ {
const int scaledHeight = baseHeight * Utils::Gui::screenScalingFactor(widget); const int scaledHeight = baseHeight * Utils::Gui::screenScalingFactor(widget);
const QString normalizedKey = path + "@" + QString::number(scaledHeight); const QString normalizedKey = path + '@' + QString::number(scaledHeight);
QPixmap pm; QPixmap pm;
QPixmapCache cache; QPixmapCache cache;

2
src/webui/api/synccontroller.cpp

@ -465,7 +465,7 @@ void SyncController::torrentPeersAction()
peer[KEY_PEER_RELEVANCE] = pi.relevance(); peer[KEY_PEER_RELEVANCE] = pi.relevance();
peer[KEY_PEER_FILES] = torrent->info().filesForPiece(pi.downloadingPieceIndex()).join(QLatin1String("\n")); peer[KEY_PEER_FILES] = torrent->info().filesForPiece(pi.downloadingPieceIndex()).join(QLatin1String("\n"));
peers[pi.address().ip.toString() + ":" + QString::number(pi.address().port)] = peer; peers[pi.address().ip.toString() + ':' + QString::number(pi.address().port)] = peer;
} }
data["peers"] = peers; data["peers"] = peers;

6
src/webui/api/torrentscontroller.cpp

@ -734,16 +734,16 @@ void TorrentsController::setLocationAction()
{ {
checkParams({"hashes", "location"}); checkParams({"hashes", "location"});
const QStringList hashes {params()["hashes"].split("|")}; const QStringList hashes {params()["hashes"].split('|')};
const QString newLocation {params()["location"].trimmed()}; const QString newLocation {params()["location"].trimmed()};
if (newLocation.isEmpty()) if (newLocation.isEmpty())
throw APIError(APIErrorType::BadParams, tr("Save path is empty")); throw APIError(APIErrorType::BadParams, tr("Save path is empty"));
// try to create the location if it does not exist // try to create the location if it does not exist
if (!QDir(newLocation).mkpath(".")) if (!QDir(newLocation).mkpath("."))
throw APIError(APIErrorType::Conflict, tr("Cannot make save path")); throw APIError(APIErrorType::Conflict, tr("Cannot make save path"));
// check permissions // check permissions
if (!QFileInfo(newLocation).isWritable()) if (!QFileInfo(newLocation).isWritable())
throw APIError(APIErrorType::AccessDenied, tr("Cannot write to directory")); throw APIError(APIErrorType::AccessDenied, tr("Cannot write to directory"));

Loading…
Cancel
Save