WebUI Add Limit Share Ratio context menu option

Closes #6815, #7602.
This commit is contained in:
Thomas Piccirello
2018-03-14 00:41:16 -04:00
committed by Chocobo1
parent 1f42ab8c4f
commit 9f36b54b04
11 changed files with 240 additions and 0 deletions

View File

@@ -121,6 +121,9 @@ QVariantMap serialize(const BitTorrent::TorrentHandle &torrent)
ret[KEY_TORRENT_AMOUNT_LEFT] = torrent.incompletedSize();
ret[KEY_TORRENT_AMOUNT_COMPLETED] = torrent.completedSize();
ret[KEY_TORRENT_MAX_RATIO] = torrent.maxRatio();
ret[KEY_TORRENT_MAX_SEEDING_TIME] = torrent.maxSeedingTime();
ret[KEY_TORRENT_RATIO_LIMIT] = torrent.ratioLimit();
ret[KEY_TORRENT_SEEDING_TIME_LIMIT] = torrent.seedingTimeLimit();
ret[KEY_TORRENT_LAST_SEEN_COMPLETE_TIME] = torrent.lastSeenComplete().toTime_t();
ret[KEY_TORRENT_AUTO_TORRENT_MANAGEMENT] = torrent.isAutoTMMEnabled();
ret[KEY_TORRENT_TIME_ACTIVE] = torrent.activeTime();

View File

@@ -70,6 +70,9 @@ const char KEY_TORRENT_AMOUNT_UPLOADED_SESSION[] = "uploaded_session";
const char KEY_TORRENT_AMOUNT_LEFT[] = "amount_left";
const char KEY_TORRENT_AMOUNT_COMPLETED[] = "completed";
const char KEY_TORRENT_MAX_RATIO[] = "max_ratio";
const char KEY_TORRENT_MAX_SEEDING_TIME[] = "max_seeding_time";
const char KEY_TORRENT_RATIO_LIMIT[] = "ratio_limit";
const char KEY_TORRENT_SEEDING_TIME_LIMIT[] = "seeding_time_limit";
const char KEY_TORRENT_LAST_SEEN_COMPLETE_TIME[] = "seen_complete";
const char KEY_TORRENT_LAST_ACTIVITY_TIME[] = "last_activity";
const char KEY_TORRENT_TOTAL_SIZE[] = "total_size";

View File

@@ -352,6 +352,9 @@ namespace
// - "save_path": Torrent save path
// - "completed": Amount of data completed
// - "max_ratio": Upload max share ratio
// - "max_seeding_time": Upload max seeding time
// - "ratio_limit": Upload share ratio limit
// - "seeding_time_limit": Upload seeding time limit
// - "seen_complete": Indicates the time when the torrent was last seen complete/whole
// - "last_activity": Last time when a chunk was downloaded/uploaded
// - "total_size": Size including unwanted data

View File

@@ -623,6 +623,21 @@ void TorrentsController::setDownloadLimitAction()
applyToTorrents(hashes, [limit](BitTorrent::TorrentHandle *torrent) { torrent->setDownloadLimit(limit); });
}
void TorrentsController::setShareLimitsAction()
{
checkParams({"hashes", "ratioLimit", "seedingTimeLimit"});
const qreal ratioLimit = params()["ratioLimit"].toDouble();
const qlonglong seedingTimeLimit = params()["seedingTimeLimit"].toLongLong();
const QStringList hashes = params()["hashes"].split('|');
applyToTorrents(hashes, [ratioLimit, seedingTimeLimit](BitTorrent::TorrentHandle *torrent)
{
torrent->setRatioLimit(ratioLimit);
torrent->setSeedingTimeLimit(seedingTimeLimit);
});
}
void TorrentsController::toggleSequentialDownloadAction()
{
checkParams({"hashes"});

View File

@@ -61,6 +61,7 @@ private slots:
void downloadLimitAction();
void setUploadLimitAction();
void setDownloadLimitAction();
void setShareLimitsAction();
void increasePrioAction();
void decreasePrioAction();
void topPrioAction();