1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-23 21:14:33 +00:00

Use single quotes for char.

Use case insensitive compare.
Swap conditionals
This commit is contained in:
Thomas Piccirello 2017-07-18 22:06:38 -04:00 committed by Chocobo1
parent 771033a449
commit 4846b0ec28
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
2 changed files with 20 additions and 20 deletions

View File

@ -596,7 +596,7 @@ void WebApplication::action_command_getTorrentsUpLimit()
{ {
CHECK_URI(0); CHECK_URI(0);
CHECK_PARAMETERS("hashes"); CHECK_PARAMETERS("hashes");
QStringList hashes = request().posts["hashes"].split("|"); QStringList hashes = request().posts["hashes"].split('|');
print(btjson::getTorrentsRatesLimits(hashes, false), Http::CONTENT_TYPE_JSON); print(btjson::getTorrentsRatesLimits(hashes, false), Http::CONTENT_TYPE_JSON);
} }
@ -604,7 +604,7 @@ void WebApplication::action_command_getTorrentsDlLimit()
{ {
CHECK_URI(0); CHECK_URI(0);
CHECK_PARAMETERS("hashes"); CHECK_PARAMETERS("hashes");
QStringList hashes = request().posts["hashes"].split("|"); QStringList hashes = request().posts["hashes"].split('|');
print(btjson::getTorrentsRatesLimits(hashes, true), Http::CONTENT_TYPE_JSON); print(btjson::getTorrentsRatesLimits(hashes, true), Http::CONTENT_TYPE_JSON);
} }
@ -617,7 +617,7 @@ void WebApplication::action_command_setTorrentsUpLimit()
if (limit == 0) if (limit == 0)
limit = -1; limit = -1;
QStringList hashes = request().posts["hashes"].split("|"); QStringList hashes = request().posts["hashes"].split('|');
foreach (const QString &hash, hashes) { foreach (const QString &hash, hashes) {
BitTorrent::TorrentHandle *const torrent = BitTorrent::Session::instance()->findTorrent(hash); BitTorrent::TorrentHandle *const torrent = BitTorrent::Session::instance()->findTorrent(hash);
if (torrent) if (torrent)
@ -634,7 +634,7 @@ void WebApplication::action_command_setTorrentsDlLimit()
if (limit == 0) if (limit == 0)
limit = -1; limit = -1;
QStringList hashes = request().posts["hashes"].split("|"); QStringList hashes = request().posts["hashes"].split('|');
foreach (const QString &hash, hashes) { foreach (const QString &hash, hashes) {
BitTorrent::TorrentHandle *const torrent = BitTorrent::Session::instance()->findTorrent(hash); BitTorrent::TorrentHandle *const torrent = BitTorrent::Session::instance()->findTorrent(hash);
if (torrent) if (torrent)
@ -660,7 +660,7 @@ void WebApplication::action_command_toggleSequentialDownload()
{ {
CHECK_URI(0); CHECK_URI(0);
CHECK_PARAMETERS("hashes"); CHECK_PARAMETERS("hashes");
QStringList hashes = request().posts["hashes"].split("|"); QStringList hashes = request().posts["hashes"].split('|');
foreach (const QString &hash, hashes) { foreach (const QString &hash, hashes) {
BitTorrent::TorrentHandle *const torrent = BitTorrent::Session::instance()->findTorrent(hash); BitTorrent::TorrentHandle *const torrent = BitTorrent::Session::instance()->findTorrent(hash);
if (torrent) if (torrent)
@ -672,7 +672,7 @@ void WebApplication::action_command_toggleFirstLastPiecePrio()
{ {
CHECK_URI(0); CHECK_URI(0);
CHECK_PARAMETERS("hashes"); CHECK_PARAMETERS("hashes");
QStringList hashes = request().posts["hashes"].split("|"); QStringList hashes = request().posts["hashes"].split('|');
foreach (const QString &hash, hashes) { foreach (const QString &hash, hashes) {
BitTorrent::TorrentHandle *const torrent = BitTorrent::Session::instance()->findTorrent(hash); BitTorrent::TorrentHandle *const torrent = BitTorrent::Session::instance()->findTorrent(hash);
if (torrent) if (torrent)
@ -685,7 +685,7 @@ void WebApplication::action_command_setSuperSeeding()
CHECK_URI(0); CHECK_URI(0);
CHECK_PARAMETERS("hashes" << "value"); CHECK_PARAMETERS("hashes" << "value");
bool value = request().posts["value"] == "true"; bool value = request().posts["value"] == "true";
QStringList hashes = request().posts["hashes"].split("|"); QStringList hashes = request().posts["hashes"].split('|');
foreach (const QString &hash, hashes) { foreach (const QString &hash, hashes) {
BitTorrent::TorrentHandle *const torrent = BitTorrent::Session::instance()->findTorrent(hash); BitTorrent::TorrentHandle *const torrent = BitTorrent::Session::instance()->findTorrent(hash);
if (torrent) if (torrent)
@ -698,7 +698,7 @@ void WebApplication::action_command_setForceStart()
CHECK_URI(0); CHECK_URI(0);
CHECK_PARAMETERS("hashes" << "value"); CHECK_PARAMETERS("hashes" << "value");
bool value = request().posts["value"] == "true"; bool value = request().posts["value"] == "true";
QStringList hashes = request().posts["hashes"].split("|"); QStringList hashes = request().posts["hashes"].split('|');
foreach (const QString &hash, hashes) { foreach (const QString &hash, hashes) {
BitTorrent::TorrentHandle *const torrent = BitTorrent::Session::instance()->findTorrent(hash); BitTorrent::TorrentHandle *const torrent = BitTorrent::Session::instance()->findTorrent(hash);
if (torrent) if (torrent)
@ -710,7 +710,7 @@ void WebApplication::action_command_delete()
{ {
CHECK_URI(0); CHECK_URI(0);
CHECK_PARAMETERS("hashes"); CHECK_PARAMETERS("hashes");
QStringList hashes = request().posts["hashes"].split("|"); QStringList hashes = request().posts["hashes"].split('|');
foreach (const QString &hash, hashes) foreach (const QString &hash, hashes)
BitTorrent::Session::instance()->deleteTorrent(hash, false); BitTorrent::Session::instance()->deleteTorrent(hash, false);
} }
@ -719,7 +719,7 @@ void WebApplication::action_command_deletePerm()
{ {
CHECK_URI(0); CHECK_URI(0);
CHECK_PARAMETERS("hashes"); CHECK_PARAMETERS("hashes");
QStringList hashes = request().posts["hashes"].split("|"); QStringList hashes = request().posts["hashes"].split('|');
foreach (const QString &hash, hashes) foreach (const QString &hash, hashes)
BitTorrent::Session::instance()->deleteTorrent(hash, true); BitTorrent::Session::instance()->deleteTorrent(hash, true);
} }
@ -734,7 +734,7 @@ void WebApplication::action_command_increasePrio()
return; return;
} }
QStringList hashes = request().posts["hashes"].split("|"); QStringList hashes = request().posts["hashes"].split('|');
BitTorrent::Session::instance()->increaseTorrentsPriority(hashes); BitTorrent::Session::instance()->increaseTorrentsPriority(hashes);
} }
@ -748,7 +748,7 @@ void WebApplication::action_command_decreasePrio()
return; return;
} }
QStringList hashes = request().posts["hashes"].split("|"); QStringList hashes = request().posts["hashes"].split('|');
BitTorrent::Session::instance()->decreaseTorrentsPriority(hashes); BitTorrent::Session::instance()->decreaseTorrentsPriority(hashes);
} }
@ -762,7 +762,7 @@ void WebApplication::action_command_topPrio()
return; return;
} }
QStringList hashes = request().posts["hashes"].split("|"); QStringList hashes = request().posts["hashes"].split('|');
BitTorrent::Session::instance()->topTorrentsPriority(hashes); BitTorrent::Session::instance()->topTorrentsPriority(hashes);
} }
@ -776,7 +776,7 @@ void WebApplication::action_command_bottomPrio()
return; return;
} }
QStringList hashes = request().posts["hashes"].split("|"); QStringList hashes = request().posts["hashes"].split('|');
BitTorrent::Session::instance()->bottomTorrentsPriority(hashes); BitTorrent::Session::instance()->bottomTorrentsPriority(hashes);
} }
@ -828,13 +828,13 @@ void WebApplication::action_command_setAutoTMM()
CHECK_URI(0); CHECK_URI(0);
CHECK_PARAMETERS("hashes" << "enable"); CHECK_PARAMETERS("hashes" << "enable");
QStringList hashes = request().posts["hashes"].split("|"); QStringList hashes = request().posts["hashes"].split('|');
QString enableStr = request().posts["enable"]; QString enableStr = request().posts["enable"];
foreach (const QString &hash, hashes) { foreach (const QString &hash, hashes) {
BitTorrent::TorrentHandle *const torrent = BitTorrent::Session::instance()->findTorrent(hash); BitTorrent::TorrentHandle *const torrent = BitTorrent::Session::instance()->findTorrent(hash);
if (torrent) if (torrent)
torrent->setAutoTMMEnabled(enableStr == "true"); torrent->setAutoTMMEnabled(QString::compare(enableStr, "true", Qt::CaseInsensitive) == 0);
} }
} }
@ -853,7 +853,7 @@ void WebApplication::action_command_setCategory()
CHECK_URI(0); CHECK_URI(0);
CHECK_PARAMETERS("hashes" << "category"); CHECK_PARAMETERS("hashes" << "category");
QStringList hashes = request().posts["hashes"].split("|"); QStringList hashes = request().posts["hashes"].split('|');
QString category = request().posts["category"].trimmed(); QString category = request().posts["category"].trimmed();
foreach (const QString &hash, hashes) { foreach (const QString &hash, hashes) {

View File

@ -287,10 +287,10 @@ var TorrentsTableContextMenu = new Class({
else else
there_are_force_start = true; there_are_force_start = true;
if (data['auto_tmm'] != true) if (data['auto_tmm'] === true)
all_are_auto_tmm = false;
else
there_are_auto_tmm = true; there_are_auto_tmm = true;
else
all_are_auto_tmm = false;
}); });
show_seq_dl = true; show_seq_dl = true;