Browse Source

Use single quotes for char.

Use case insensitive compare.
Swap conditionals
adaptive-webui-19844
Thomas Piccirello 7 years ago committed by Chocobo1
parent
commit
4846b0ec28
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 34
      src/webui/webapplication.cpp
  2. 6
      src/webui/www/public/scripts/contextmenu.js

34
src/webui/webapplication.cpp

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

6
src/webui/www/public/scripts/contextmenu.js

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

Loading…
Cancel
Save