mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-02-02 01:44:26 +00:00
Still simplifying program options
This commit is contained in:
parent
335e7366fd
commit
da599da36d
@ -521,8 +521,6 @@ void Bittorrent::configureSession() {
|
||||
addConsoleMessage(tr("Encryption support [OFF]"), QString::fromUtf8("blue"));
|
||||
}
|
||||
applyEncryptionSettings(encryptionSettings);
|
||||
// * Desired ratio
|
||||
setGlobalRatio(Preferences::getDesiredRatio());
|
||||
// * Maximum ratio
|
||||
setDeleteRatio(Preferences::getDeleteRatio());
|
||||
// Ip Filter
|
||||
@ -1763,26 +1761,6 @@ void Bittorrent::addConsoleMessage(QString msg, QString) {
|
||||
s->set_upload_rate_limit(rate);
|
||||
}
|
||||
|
||||
// libtorrent allow to adjust ratio for each torrent
|
||||
// This function will apply to same ratio to all torrents
|
||||
void Bittorrent::setGlobalRatio(float ratio) {
|
||||
if(ratio != -1 && ratio < 1.) ratio = 1.;
|
||||
if(ratio == -1) {
|
||||
// 0 means unlimited for libtorrent
|
||||
ratio = 0;
|
||||
}
|
||||
std::vector<torrent_handle> handles = s->get_torrents();
|
||||
std::vector<torrent_handle>::iterator it;
|
||||
for(it = handles.begin(); it != handles.end(); it++) {
|
||||
QTorrentHandle h(*it);
|
||||
if(!h.is_valid()) {
|
||||
qDebug("/!\\ Error: Invalid handle");
|
||||
continue;
|
||||
}
|
||||
h.set_ratio(ratio);
|
||||
}
|
||||
}
|
||||
|
||||
// Torrents will a ratio superior to the given value will
|
||||
// be automatically deleted
|
||||
void Bittorrent::setDeleteRatio(float ratio) {
|
||||
|
@ -153,7 +153,6 @@ public slots:
|
||||
void setMaxUploadsPerTorrent(int max);
|
||||
void setDownloadRateLimit(long rate);
|
||||
void setUploadRateLimit(long rate);
|
||||
void setGlobalRatio(float ratio);
|
||||
void setDeleteRatio(float ratio);
|
||||
void setDHTPort(int dht_port);
|
||||
void setPeerProxySettings(const proxy_settings &proxySettings);
|
||||
|
@ -168,7 +168,6 @@ 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(checkRatioLimit, SIGNAL(toggled(bool)), this, SLOT(enableShareRatio(bool)));
|
||||
connect(checkRatioRemove, SIGNAL(toggled(bool)), this, SLOT(enableDeleteRatio(bool)));
|
||||
connect(comboPeerID, SIGNAL(currentIndexChanged(int)), this, SLOT(enableSpoofingSettings(int)));
|
||||
// Proxy tab
|
||||
@ -231,9 +230,7 @@ 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(checkRatioLimit, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||
connect(checkRatioRemove, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||
connect(spinRatio, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
|
||||
connect(spinMaxRatio, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
|
||||
// Proxy tab
|
||||
connect(comboProxyType_http, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton()));
|
||||
@ -471,7 +468,6 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
|
||||
Preferences::setPeerID("qB");
|
||||
}
|
||||
settings.setValue(QString::fromUtf8("Encryption"), getEncryptionSetting());
|
||||
settings.setValue(QString::fromUtf8("DesiredRatio"), getDesiredRatio());
|
||||
settings.setValue(QString::fromUtf8("MaxRatio"), getDeleteRatio());
|
||||
// End Bittorrent preferences
|
||||
settings.endGroup();
|
||||
@ -793,17 +789,7 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
|
||||
}
|
||||
}
|
||||
comboEncryption->setCurrentIndex(Preferences::getEncryptionSetting());
|
||||
floatValue = Preferences::getDesiredRatio();
|
||||
if(floatValue >= 1.) {
|
||||
// Enable
|
||||
checkRatioLimit->setChecked(true);
|
||||
spinRatio->setEnabled(true);
|
||||
spinRatio->setValue(floatValue);
|
||||
} else {
|
||||
// Disable
|
||||
checkRatioLimit->setChecked(false);
|
||||
spinRatio->setEnabled(false);
|
||||
}
|
||||
// Ratio limit
|
||||
floatValue = Preferences::getDeleteRatio();
|
||||
if(floatValue >= 1.) {
|
||||
// Enable
|
||||
@ -989,14 +975,6 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
|
||||
return spinDHTPort->value();
|
||||
}
|
||||
|
||||
// Return Share ratio
|
||||
float options_imp::getDesiredRatio() const{
|
||||
if(checkRatioLimit->isChecked()){
|
||||
return spinRatio->value();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Return Share ratio
|
||||
float options_imp::getDeleteRatio() const{
|
||||
if(checkRatioRemove->isChecked()){
|
||||
@ -1132,10 +1110,6 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
|
||||
applyButton->setEnabled(true);
|
||||
}
|
||||
|
||||
void options_imp::enableShareRatio(bool checked){
|
||||
spinRatio->setEnabled(checked);
|
||||
}
|
||||
|
||||
void options_imp::enableDeleteRatio(bool checked){
|
||||
spinMaxRatio->setEnabled(checked);
|
||||
}
|
||||
|
@ -97,7 +97,6 @@ protected:
|
||||
bool isLSDEnabled() const;
|
||||
bool isRSSEnabled() const;
|
||||
int getEncryptionSetting() const;
|
||||
float getDesiredRatio() const;
|
||||
float getDeleteRatio() const;
|
||||
// Proxy options
|
||||
QString getHTTPProxyIp() const;
|
||||
@ -137,7 +136,6 @@ protected slots:
|
||||
void enableMaxConnecsLimit(bool checked);
|
||||
void enableMaxConnecsLimitPerTorrent(bool checked);
|
||||
void enableMaxUploadsLimitPerTorrent(bool checked);
|
||||
void enableShareRatio(bool checked);
|
||||
void enableDeleteRatio(bool checked);
|
||||
void enableSpoofingSettings(int index);
|
||||
void setStyle(QString style);
|
||||
|
@ -693,11 +693,6 @@ public:
|
||||
settings.setValue(QString::fromUtf8("Preferences/Bittorrent/Encryption"), val);
|
||||
}
|
||||
|
||||
static float getDesiredRatio() {
|
||||
QSettings settings("qBittorrent", "qBittorrent");
|
||||
return settings.value(QString::fromUtf8("Preferences/Bittorrent/DesiredRatio"), -1).toDouble();
|
||||
}
|
||||
|
||||
static float getDeleteRatio() {
|
||||
QSettings settings("qBittorrent", "qBittorrent");
|
||||
return settings.value(QString::fromUtf8("Preferences/Bittorrent/MaxRatio"), -1).toDouble();
|
||||
|
@ -457,6 +457,9 @@
|
||||
<property name="text">
|
||||
<string>Show splash screen on start up</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@ -471,6 +474,9 @@
|
||||
<property name="text">
|
||||
<string>Show qBittorrent icon in notification area</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@ -1506,7 +1512,7 @@ QGroupBox {
|
||||
}</string>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Schedule alternative speed limits</string>
|
||||
<string>Schedule the use of alternative speed limits</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
@ -1950,60 +1956,6 @@ QGroupBox {
|
||||
<string>Share ratio settings</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkRatioLimit">
|
||||
<property name="text">
|
||||
<string>Desired ratio:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDoubleSpinBox" name="spinRatio">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignHCenter</set>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>10.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.100000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
@ -2895,8 +2847,6 @@ QGroupBox {
|
||||
<tabstop>checkNATPMP</tabstop>
|
||||
<tabstop>checkLSD</tabstop>
|
||||
<tabstop>comboEncryption</tabstop>
|
||||
<tabstop>checkRatioLimit</tabstop>
|
||||
<tabstop>spinRatio</tabstop>
|
||||
<tabstop>checkRatioRemove</tabstop>
|
||||
<tabstop>spinMaxRatio</tabstop>
|
||||
<tabstop>spinWebUiPort</tabstop>
|
||||
|
Loading…
x
Reference in New Issue
Block a user