diff --git a/src/webui/btjson.cpp b/src/webui/btjson.cpp index 827505fed..34bca0112 100644 --- a/src/webui/btjson.cpp +++ b/src/webui/btjson.cpp @@ -110,6 +110,7 @@ static const char KEY_TORRENT_RATIO_LIMIT[] = "ratio_limit"; static const char KEY_TORRENT_LAST_SEEN_COMPLETE_TIME[] = "seen_complete"; static const char KEY_TORRENT_LAST_ACTIVITY_TIME[] = "last_activity"; static const char KEY_TORRENT_TOTAL_SIZE[] = "total_size"; +static const char KEY_TORRENT_AUTO_TORRENT_MANAGEMENT[] = "auto_tmm"; // Peer keys static const char KEY_PEER_IP[] = "ip"; @@ -824,6 +825,7 @@ QVariantMap toMap(BitTorrent::TorrentHandle *const torrent) ret[KEY_TORRENT_AMOUNT_COMPLETED] = torrent->completedSize(); ret[KEY_TORRENT_RATIO_LIMIT] = torrent->maxRatio(); ret[KEY_TORRENT_LAST_SEEN_COMPLETE_TIME] = torrent->lastSeenComplete().toTime_t(); + ret[KEY_TORRENT_AUTO_TORRENT_MANAGEMENT] = torrent->isAutoTMMEnabled(); if (torrent->isPaused() || torrent->isChecking()) ret[KEY_TORRENT_LAST_ACTIVITY_TIME] = 0; diff --git a/src/webui/webapplication.cpp b/src/webui/webapplication.cpp index bbf6deed2..559f5abd6 100644 --- a/src/webui/webapplication.cpp +++ b/src/webui/webapplication.cpp @@ -122,6 +122,7 @@ QMap > WebApplication::initialize ADD_ACTION(command, bottomPrio); ADD_ACTION(command, setLocation); ADD_ACTION(command, rename); + ADD_ACTION(command, setAutoTMM); ADD_ACTION(command, recheck); ADD_ACTION(command, setCategory); ADD_ACTION(command, addCategory); @@ -822,6 +823,21 @@ void WebApplication::action_command_rename() } } +void WebApplication::action_command_setAutoTMM() +{ + CHECK_URI(0); + CHECK_PARAMETERS("hashes" << "enable"); + + 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"); + } +} + void WebApplication::action_command_recheck() { CHECK_URI(0); diff --git a/src/webui/webapplication.h b/src/webui/webapplication.h index 3f39946e6..8909268fe 100644 --- a/src/webui/webapplication.h +++ b/src/webui/webapplication.h @@ -92,6 +92,7 @@ private: void action_command_bottomPrio(); void action_command_setLocation(); void action_command_rename(); + void action_command_setAutoTMM(); void action_command_recheck(); void action_command_setCategory(); void action_command_addCategory(); diff --git a/src/webui/www/private/index.html b/src/webui/www/private/index.html index 9cfb2cc94..95992837f 100644 --- a/src/webui/www/private/index.html +++ b/src/webui/www/private/index.html @@ -115,6 +115,9 @@ QBT_TR(Category)QBT_TR[CONTEXT=TransferListWidget] QBT_TR(Category)QBT_TR[CONTEXT=TransferListWidget] +
  • + QBT_TR(Automatic Torrent Management)QBT_TR[CONTEXT=TransferListWidget] QBT_TR(Automatic Torrent Management)QBT_TR[CONTEXT=TransferListWidget] +
  • QBT_TR(Priority)QBT_TR[CONTEXT=TransferListWidget]