mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-15 01:33:07 -07:00
- remove ratio should be applied to finished torrent only (and disabled as a default!) - FIXED
This commit is contained in:
parent
b2bf7047d9
commit
fe7c0db425
3 changed files with 11 additions and 13 deletions
|
@ -102,20 +102,18 @@ void bittorrent::preAllocateAllFiles(bool b) {
|
|||
|
||||
void bittorrent::deleteBigRatios() {
|
||||
if(max_ratio == -1) return;
|
||||
std::vector<torrent_handle> handles = s->get_torrents();
|
||||
unsigned int nbHandles = handles.size();
|
||||
for(unsigned int i=0; i<nbHandles; ++i) {
|
||||
QTorrentHandle h = handles[i];
|
||||
QString hash;
|
||||
foreach(hash, finishedTorrents) {
|
||||
QTorrentHandle h = getTorrentHandle(hash);
|
||||
if(!h.is_valid()) {
|
||||
qDebug("/!\\ Error: Invalid handle");
|
||||
continue;
|
||||
}
|
||||
QString hash = h.hash();
|
||||
if(getRealRatio(hash) > max_ratio) {
|
||||
bool finished = finishedTorrents.contains(hash);
|
||||
QString fileName = h.name();
|
||||
deleteTorrent(hash);
|
||||
emit torrent_deleted(hash, fileName, finished);
|
||||
emit torrent_deleted(hash, fileName, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -973,6 +971,7 @@ void bittorrent::setGlobalRatio(float ratio) {
|
|||
void bittorrent::setDeleteRatio(float ratio) {
|
||||
if(ratio != -1 && ratio < 1.) ratio = 1.;
|
||||
max_ratio = ratio;
|
||||
qDebug("* Set deleteRatio to %.1f", max_ratio);
|
||||
deleteBigRatios();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue