mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-15 17:53:08 -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
1
TODO
1
TODO
|
@ -52,7 +52,6 @@
|
||||||
* beta 7
|
* beta 7
|
||||||
- update doc for plugins (and add screenies)
|
- update doc for plugins (and add screenies)
|
||||||
- update doc for options
|
- update doc for options
|
||||||
- remove ratio should be applied to finished torrent only (and disabled as a default!)
|
|
||||||
- Review torrent content selection
|
- Review torrent content selection
|
||||||
* check the one in ktorrent
|
* check the one in ktorrent
|
||||||
- Translations update (IN PROGRESS)
|
- Translations update (IN PROGRESS)
|
||||||
|
|
|
@ -102,20 +102,18 @@ void bittorrent::preAllocateAllFiles(bool b) {
|
||||||
|
|
||||||
void bittorrent::deleteBigRatios() {
|
void bittorrent::deleteBigRatios() {
|
||||||
if(max_ratio == -1) return;
|
if(max_ratio == -1) return;
|
||||||
std::vector<torrent_handle> handles = s->get_torrents();
|
QString hash;
|
||||||
unsigned int nbHandles = handles.size();
|
foreach(hash, finishedTorrents) {
|
||||||
for(unsigned int i=0; i<nbHandles; ++i) {
|
QTorrentHandle h = getTorrentHandle(hash);
|
||||||
QTorrentHandle h = handles[i];
|
|
||||||
if(!h.is_valid()) {
|
if(!h.is_valid()) {
|
||||||
qDebug("/!\\ Error: Invalid handle");
|
qDebug("/!\\ Error: Invalid handle");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
QString hash = h.hash();
|
QString hash = h.hash();
|
||||||
if(getRealRatio(hash) > max_ratio) {
|
if(getRealRatio(hash) > max_ratio) {
|
||||||
bool finished = finishedTorrents.contains(hash);
|
|
||||||
QString fileName = h.name();
|
QString fileName = h.name();
|
||||||
deleteTorrent(hash);
|
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) {
|
void bittorrent::setDeleteRatio(float ratio) {
|
||||||
if(ratio != -1 && ratio < 1.) ratio = 1.;
|
if(ratio != -1 && ratio < 1.) ratio = 1.;
|
||||||
max_ratio = ratio;
|
max_ratio = ratio;
|
||||||
|
qDebug("* Set deleteRatio to %.1f", max_ratio);
|
||||||
deleteBigRatios();
|
deleteBigRatios();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -531,8 +531,8 @@ void options_imp::loadOptions(){
|
||||||
checkPeX->setChecked(settings.value(QString::fromUtf8("PeX"), true).toBool());
|
checkPeX->setChecked(settings.value(QString::fromUtf8("PeX"), true).toBool());
|
||||||
checkLSD->setChecked(settings.value(QString::fromUtf8("LSD"), true).toBool());
|
checkLSD->setChecked(settings.value(QString::fromUtf8("LSD"), true).toBool());
|
||||||
comboEncryption->setCurrentIndex(settings.value(QString::fromUtf8("Encryption"), 0).toInt());
|
comboEncryption->setCurrentIndex(settings.value(QString::fromUtf8("Encryption"), 0).toInt());
|
||||||
floatValue = settings.value(QString::fromUtf8("DesiredRatio"), 0).toDouble();
|
floatValue = settings.value(QString::fromUtf8("DesiredRatio"), -1).toDouble();
|
||||||
if(floatValue) {
|
if(floatValue >= 1.) {
|
||||||
// Enable
|
// Enable
|
||||||
checkRatioLimit->setChecked(true);
|
checkRatioLimit->setChecked(true);
|
||||||
spinRatio->setEnabled(true);
|
spinRatio->setEnabled(true);
|
||||||
|
@ -542,8 +542,8 @@ void options_imp::loadOptions(){
|
||||||
checkRatioLimit->setChecked(false);
|
checkRatioLimit->setChecked(false);
|
||||||
spinRatio->setEnabled(false);
|
spinRatio->setEnabled(false);
|
||||||
}
|
}
|
||||||
floatValue = settings.value(QString::fromUtf8("MaxRatio"), 0).toDouble();
|
floatValue = settings.value(QString::fromUtf8("MaxRatio"), -1).toDouble();
|
||||||
if(floatValue) {
|
if(floatValue >= 1.) {
|
||||||
// Enable
|
// Enable
|
||||||
checkRatioRemove->setChecked(true);
|
checkRatioRemove->setChecked(true);
|
||||||
spinMaxRatio->setEnabled(true);
|
spinMaxRatio->setEnabled(true);
|
||||||
|
@ -663,7 +663,7 @@ float options_imp::getDesiredRatio() const{
|
||||||
if(checkRatioLimit->isChecked()){
|
if(checkRatioLimit->isChecked()){
|
||||||
return spinRatio->value();
|
return spinRatio->value();
|
||||||
}
|
}
|
||||||
return 0;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return Share ratio
|
// Return Share ratio
|
||||||
|
@ -671,7 +671,7 @@ float options_imp::getDeleteRatio() const{
|
||||||
if(checkRatioRemove->isChecked()){
|
if(checkRatioRemove->isChecked()){
|
||||||
return spinMaxRatio->value();
|
return spinMaxRatio->value();
|
||||||
}
|
}
|
||||||
return 0;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return Save Path
|
// Return Save Path
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue