mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-30 20:28:05 -06:00
FEATURE: Torrents can be automatically paused once they reach a given ratio
This commit is contained in:
@@ -168,7 +168,7 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
|
||||
connect(checkMaxConnecs, SIGNAL(toggled(bool)), this, SLOT(enableMaxConnecsLimit(bool)));
|
||||
connect(checkMaxConnecsPerTorrent, SIGNAL(toggled(bool)), this, SLOT(enableMaxConnecsLimitPerTorrent(bool)));
|
||||
connect(checkMaxUploadsPerTorrent, SIGNAL(toggled(bool)), this, SLOT(enableMaxUploadsLimitPerTorrent(bool)));
|
||||
connect(checkRatioRemove, SIGNAL(toggled(bool)), this, SLOT(enableDeleteRatio(bool)));
|
||||
connect(checkMaxRatio, SIGNAL(toggled(bool)), this, SLOT(enableMaxRatio(bool)));
|
||||
connect(comboPeerID, SIGNAL(currentIndexChanged(int)), this, SLOT(enableSpoofingSettings(int)));
|
||||
// Proxy tab
|
||||
connect(comboProxyType_http, SIGNAL(currentIndexChanged(int)),this, SLOT(enableHTTPProxy(int)));
|
||||
@@ -230,8 +230,9 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
|
||||
connect(client_version, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
|
||||
connect(client_build, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
|
||||
connect(comboEncryption, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton()));
|
||||
connect(checkRatioRemove, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||
connect(checkMaxRatio, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||
connect(spinMaxRatio, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
|
||||
connect(comboRatioLimitAct, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton()));
|
||||
// Proxy tab
|
||||
connect(comboProxyType_http, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton()));
|
||||
connect(textProxyIP_http, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
|
||||
@@ -465,7 +466,8 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
|
||||
Preferences::setPeerID("qB");
|
||||
}
|
||||
settings.setValue(QString::fromUtf8("Encryption"), getEncryptionSetting());
|
||||
settings.setValue(QString::fromUtf8("MaxRatio"), getDeleteRatio());
|
||||
Preferences::setMaxRatio(getMaxRatio());
|
||||
Preferences::setMaxRatioAction(comboRatioLimitAct->currentIndex());
|
||||
// End Bittorrent preferences
|
||||
settings.endGroup();
|
||||
// Misc preferences
|
||||
@@ -780,17 +782,20 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
|
||||
}
|
||||
comboEncryption->setCurrentIndex(Preferences::getEncryptionSetting());
|
||||
// Ratio limit
|
||||
floatValue = Preferences::getDeleteRatio();
|
||||
if(floatValue >= 1.) {
|
||||
floatValue = Preferences::getMaxRatio();
|
||||
if(floatValue > 0.) {
|
||||
// Enable
|
||||
checkRatioRemove->setChecked(true);
|
||||
checkMaxRatio->setChecked(true);
|
||||
spinMaxRatio->setEnabled(true);
|
||||
comboRatioLimitAct->setEnabled(true);
|
||||
spinMaxRatio->setValue(floatValue);
|
||||
} else {
|
||||
// Disable
|
||||
checkRatioRemove->setChecked(false);
|
||||
checkMaxRatio->setChecked(false);
|
||||
spinMaxRatio->setEnabled(false);
|
||||
comboRatioLimitAct->setEnabled(false);
|
||||
}
|
||||
comboRatioLimitAct->setCurrentIndex(Preferences::getMaxRatioAction());
|
||||
// End Bittorrent preferences
|
||||
// Misc preferences
|
||||
// * IP Filter
|
||||
@@ -957,8 +962,8 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
|
||||
}
|
||||
|
||||
// Return Share ratio
|
||||
float options_imp::getDeleteRatio() const{
|
||||
if(checkRatioRemove->isChecked()){
|
||||
float options_imp::getMaxRatio() const{
|
||||
if(checkMaxRatio->isChecked()){
|
||||
return spinMaxRatio->value();
|
||||
}
|
||||
return -1;
|
||||
@@ -1091,8 +1096,9 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
|
||||
applyButton->setEnabled(true);
|
||||
}
|
||||
|
||||
void options_imp::enableDeleteRatio(bool checked){
|
||||
void options_imp::enableMaxRatio(bool checked){
|
||||
spinMaxRatio->setEnabled(checked);
|
||||
comboRatioLimitAct->setEnabled(checked);
|
||||
}
|
||||
|
||||
void options_imp::enablePeerProxy(int index){
|
||||
|
||||
Reference in New Issue
Block a user