diff --git a/TODO b/TODO index 441df4987..d156b8896 100644 --- a/TODO +++ b/TODO @@ -52,7 +52,6 @@ * beta 7 - update doc for plugins (and add screenies) - update doc for options - - remove ratio should be applied to finished torrent only (and disabled as a default!) - Review torrent content selection * check the one in ktorrent - Translations update (IN PROGRESS) diff --git a/src/bittorrent.cpp b/src/bittorrent.cpp index 50e9a7723..b5709fdfc 100644 --- a/src/bittorrent.cpp +++ b/src/bittorrent.cpp @@ -102,20 +102,18 @@ void bittorrent::preAllocateAllFiles(bool b) { void bittorrent::deleteBigRatios() { if(max_ratio == -1) return; - std::vector handles = s->get_torrents(); - unsigned int nbHandles = handles.size(); - for(unsigned int i=0; i 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(); } diff --git a/src/options_imp.cpp b/src/options_imp.cpp index 8a5cb9029..070082cd4 100644 --- a/src/options_imp.cpp +++ b/src/options_imp.cpp @@ -531,8 +531,8 @@ void options_imp::loadOptions(){ checkPeX->setChecked(settings.value(QString::fromUtf8("PeX"), true).toBool()); checkLSD->setChecked(settings.value(QString::fromUtf8("LSD"), true).toBool()); comboEncryption->setCurrentIndex(settings.value(QString::fromUtf8("Encryption"), 0).toInt()); - floatValue = settings.value(QString::fromUtf8("DesiredRatio"), 0).toDouble(); - if(floatValue) { + floatValue = settings.value(QString::fromUtf8("DesiredRatio"), -1).toDouble(); + if(floatValue >= 1.) { // Enable checkRatioLimit->setChecked(true); spinRatio->setEnabled(true); @@ -542,8 +542,8 @@ void options_imp::loadOptions(){ checkRatioLimit->setChecked(false); spinRatio->setEnabled(false); } - floatValue = settings.value(QString::fromUtf8("MaxRatio"), 0).toDouble(); - if(floatValue) { + floatValue = settings.value(QString::fromUtf8("MaxRatio"), -1).toDouble(); + if(floatValue >= 1.) { // Enable checkRatioRemove->setChecked(true); spinMaxRatio->setEnabled(true); @@ -663,7 +663,7 @@ float options_imp::getDesiredRatio() const{ if(checkRatioLimit->isChecked()){ return spinRatio->value(); } - return 0; + return -1; } // Return Share ratio @@ -671,7 +671,7 @@ float options_imp::getDeleteRatio() const{ if(checkRatioRemove->isChecked()){ return spinMaxRatio->value(); } - return 0; + return -1; } // Return Save Path