mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-28 05:27:15 +03:00
Merge pull request #2826 from pmzqla/webui-queueing
WebUI: Check if torrent queueing is enabled before changing torrent priorities
This commit is contained in:
commit
7af4928b18
1 changed files with 24 additions and 0 deletions
|
@ -573,6 +573,12 @@ void WebApplication::action_command_increasePrio()
|
||||||
{
|
{
|
||||||
CHECK_URI(0);
|
CHECK_URI(0);
|
||||||
CHECK_PARAMETERS("hashes");
|
CHECK_PARAMETERS("hashes");
|
||||||
|
|
||||||
|
if (!Preferences::instance()->isQueueingSystemEnabled()) {
|
||||||
|
status(403, "Torrent queueing must be enabled");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
QStringList hashes = request().posts["hashes"].split("|");
|
QStringList hashes = request().posts["hashes"].split("|");
|
||||||
|
|
||||||
std::priority_queue<QPair<int, QTorrentHandle>,
|
std::priority_queue<QPair<int, QTorrentHandle>,
|
||||||
|
@ -606,6 +612,12 @@ void WebApplication::action_command_decreasePrio()
|
||||||
{
|
{
|
||||||
CHECK_URI(0);
|
CHECK_URI(0);
|
||||||
CHECK_PARAMETERS("hashes");
|
CHECK_PARAMETERS("hashes");
|
||||||
|
|
||||||
|
if (!Preferences::instance()->isQueueingSystemEnabled()) {
|
||||||
|
status(403, "Torrent queueing must be enabled");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
QStringList hashes = request().posts["hashes"].split("|");
|
QStringList hashes = request().posts["hashes"].split("|");
|
||||||
|
|
||||||
std::priority_queue<QPair<int, QTorrentHandle>,
|
std::priority_queue<QPair<int, QTorrentHandle>,
|
||||||
|
@ -640,6 +652,12 @@ void WebApplication::action_command_topPrio()
|
||||||
{
|
{
|
||||||
CHECK_URI(0);
|
CHECK_URI(0);
|
||||||
CHECK_PARAMETERS("hashes");
|
CHECK_PARAMETERS("hashes");
|
||||||
|
|
||||||
|
if (!Preferences::instance()->isQueueingSystemEnabled()) {
|
||||||
|
status(403, "Torrent queueing must be enabled");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
foreach (const QString &hash, request().posts["hashes"].split("|")) {
|
foreach (const QString &hash, request().posts["hashes"].split("|")) {
|
||||||
QTorrentHandle h = QBtSession::instance()->getTorrentHandle(hash);
|
QTorrentHandle h = QBtSession::instance()->getTorrentHandle(hash);
|
||||||
if (h.is_valid()) h.queue_position_top();
|
if (h.is_valid()) h.queue_position_top();
|
||||||
|
@ -650,6 +668,12 @@ void WebApplication::action_command_bottomPrio()
|
||||||
{
|
{
|
||||||
CHECK_URI(0);
|
CHECK_URI(0);
|
||||||
CHECK_PARAMETERS("hashes");
|
CHECK_PARAMETERS("hashes");
|
||||||
|
|
||||||
|
if (!Preferences::instance()->isQueueingSystemEnabled()) {
|
||||||
|
status(403, "Torrent queueing must be enabled");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
foreach (const QString &hash, request().posts["hashes"].split("|")) {
|
foreach (const QString &hash, request().posts["hashes"].split("|")) {
|
||||||
QTorrentHandle h = QBtSession::instance()->getTorrentHandle(hash);
|
QTorrentHandle h = QBtSession::instance()->getTorrentHandle(hash);
|
||||||
if (h.is_valid()) h.queue_position_bottom();
|
if (h.is_valid()) h.queue_position_bottom();
|
||||||
|
|
Loading…
Reference in a new issue