Add sequential downloading menu items

This commit is contained in:
buinsky
2014-12-09 19:54:35 +03:00
parent 6644791458
commit 2a712a81ea
12 changed files with 149 additions and 21 deletions

View File

@@ -100,6 +100,8 @@ QMap<QString, QMap<QString, RequestHandler::Action> > RequestHandler::initialize
ADD_ACTION(command, getTorrentDlLimit);
ADD_ACTION(command, setTorrentUpLimit);
ADD_ACTION(command, setTorrentDlLimit);
ADD_ACTION(command, toggleSequentialDownload);
ADD_ACTION(command, toggleFirstLastPiecePrio);
ADD_ACTION(command, delete);
ADD_ACTION(command, deletePerm);
ADD_ACTION(command, increasePrio);
@@ -426,6 +428,30 @@ void RequestHandler::action_command_setTorrentDlLimit()
h.set_download_limit(limit);
}
void RequestHandler::action_command_toggleSequentialDownload()
{
QStringList hashes = request().posts["hashes"].split("|");
foreach (const QString &hash, hashes) {
try {
QTorrentHandle h = QBtSession::instance()->getTorrentHandle(hash);
h.toggleSequentialDownload();
}
catch(invalid_handle&) {}
}
}
void RequestHandler::action_command_toggleFirstLastPiecePrio()
{
QStringList hashes = request().posts["hashes"].split("|");
foreach (const QString &hash, hashes) {
try {
QTorrentHandle h = QBtSession::instance()->getTorrentHandle(hash);
h.toggleFirstLastPiecePrio();
}
catch(invalid_handle&) {}
}
}
void RequestHandler::action_command_delete()
{
QStringList hashes = request().posts["hashes"].split("|");