diff --git a/src/webui/btjson.cpp b/src/webui/btjson.cpp index 34bd0f986..08e21e9ac 100644 --- a/src/webui/btjson.cpp +++ b/src/webui/btjson.cpp @@ -103,6 +103,7 @@ static const char KEY_TORRENT_SEQUENTIAL_DOWNLOAD[] = "seq_dl"; static const char KEY_TORRENT_FIRST_LAST_PIECE_PRIO[] = "f_l_piece_prio"; static const char KEY_TORRENT_LABEL[] = "label"; static const char KEY_TORRENT_SUPER_SEEDING[] = "super_seeding"; +static const char KEY_TORRENT_FORCE_START[] = "force_start"; // Tracker keys static const char KEY_TRACKER_URL[] = "url"; @@ -234,6 +235,7 @@ private: * - "state": Torrent state * - "seq_dl": Torrent sequential download state * - "f_l_piece_prio": Torrent first last piece priority state + * - "force_start": Torrent force start state */ QByteArray btjson::getTorrents(QString filter, QString label, QString sortedColumn, bool reverse, int limit, int offset) @@ -582,6 +584,7 @@ QVariantMap toMap(const QTorrentHandle& h) ret[KEY_TORRENT_FIRST_LAST_PIECE_PRIO] = h.first_last_piece_first(); ret[KEY_TORRENT_LABEL] = TorrentPersistentData::instance()->getLabel(h.hash()); ret[KEY_TORRENT_SUPER_SEEDING] = status.super_seeding; + ret[KEY_TORRENT_FORCE_START] = h.is_forced(status); return ret; } diff --git a/src/webui/webapplication.cpp b/src/webui/webapplication.cpp index 1cf9aaf37..90adb1519 100644 --- a/src/webui/webapplication.cpp +++ b/src/webui/webapplication.cpp @@ -103,6 +103,7 @@ QMap > WebApplication::initialize ADD_ACTION(command, toggleSequentialDownload); ADD_ACTION(command, toggleFirstLastPiecePrio); ADD_ACTION(command, setSuperSeeding); + ADD_ACTION(command, setForceStart); ADD_ACTION(command, delete); ADD_ACTION(command, deletePerm); ADD_ACTION(command, increasePrio); @@ -551,6 +552,19 @@ void WebApplication::action_command_setSuperSeeding() } } +void WebApplication::action_command_setForceStart() +{ + CHECK_URI(0); + CHECK_PARAMETERS("hashes" << "value"); + bool value = request().posts["value"] == "true"; + QStringList hashes = request().posts["hashes"].split("|"); + foreach (const QString &hash, hashes) { + QTorrentHandle h = QBtSession::instance()->getTorrentHandle(hash); + if (h.is_valid()) + QBtSession::instance()->resumeTorrent(hash, value); + } +} + void WebApplication::action_command_delete() { CHECK_URI(0); diff --git a/src/webui/webapplication.h b/src/webui/webapplication.h index 3100cb454..fad03f724 100644 --- a/src/webui/webapplication.h +++ b/src/webui/webapplication.h @@ -77,6 +77,7 @@ private: void action_command_toggleSequentialDownload(); void action_command_toggleFirstLastPiecePrio(); void action_command_setSuperSeeding(); + void action_command_setForceStart(); void action_command_delete(); void action_command_deletePerm(); void action_command_increasePrio(); diff --git a/src/webui/www/private/index.html b/src/webui/www/private/index.html index 2f0edbf0f..96c7db16d 100644 --- a/src/webui/www/private/index.html +++ b/src/webui/www/private/index.html @@ -96,6 +96,7 @@