Added support for strict super seeding

This commit is contained in:
Christophe Dumez 2010-03-25 19:31:48 +00:00
parent 63457c034f
commit fb874695c9
3 changed files with 32 additions and 3 deletions

View file

@ -1,5 +1,6 @@
* Unreleased - Christophe Dumez <chris@qbittorrent.org> - v2.3.0
- FEATURE: Max number of half-open connections can now be edited
- FEATURE: Added support for strict super seeding
* Sun Mar 14 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.2.0
- FEATURE: User can set alternative speed limits for fast toggling

View file

@ -8,15 +8,15 @@
#include "preferences.h"
enum AdvSettingsCols {PROPERTY, VALUE};
enum AdvSettingsRows {DISK_CACHE, OUTGOING_PORT_MIN, OUTGOING_PORT_MAX, IGNORE_LIMIT_LAN, COUNT_OVERHEAD, RECHECK_COMPLETED, LIST_REFRESH, RESOLVE_COUNTRIES, RESOLVE_HOSTS, MAX_HALF_OPEN };
#define ROW_COUNT 10
enum AdvSettingsRows {DISK_CACHE, OUTGOING_PORT_MIN, OUTGOING_PORT_MAX, IGNORE_LIMIT_LAN, COUNT_OVERHEAD, RECHECK_COMPLETED, LIST_REFRESH, RESOLVE_COUNTRIES, RESOLVE_HOSTS, MAX_HALF_OPEN, SUPER_SEEDING };
#define ROW_COUNT 11
class AdvancedSettings: public QTableWidget {
Q_OBJECT
private:
QSpinBox *spin_cache, *outgoing_ports_min, *outgoing_ports_max, *spin_list_refresh, *spin_maxhalfopen;
QCheckBox *cb_ignore_limits_lan, *cb_count_overhead, *cb_recheck_completed, *cb_resolve_countries, *cb_resolve_hosts;
QCheckBox *cb_ignore_limits_lan, *cb_count_overhead, *cb_recheck_completed, *cb_resolve_countries, *cb_resolve_hosts, *cb_super_seeding;
public:
AdvancedSettings(QWidget *parent=0): QTableWidget(parent) {
@ -46,6 +46,7 @@ public:
delete cb_resolve_countries;
delete cb_resolve_hosts;
delete spin_maxhalfopen;
delete cb_super_seeding;
}
public slots:
@ -68,6 +69,10 @@ public slots:
Preferences::resolvePeerHostNames(cb_resolve_hosts->isChecked());
// Max Half-Open connections
Preferences::setMaxHalfOpenConnections(spin_maxhalfopen->value());
#ifdef LIBTORRENT_0_15
// Super seeding
Preferences::enableSuperSeeding(cb_super_seeding->isChecked());
#endif
}
protected slots:
@ -143,6 +148,17 @@ protected slots:
spin_maxhalfopen->setMinimum(0);
spin_maxhalfopen->setMaximum(99999);
spin_maxhalfopen->setValue(Preferences::getMaxHalfOpenConnections());
setCellWidget(MAX_HALF_OPEN, VALUE, spin_maxhalfopen);
// Super seeding
setItem(SUPER_SEEDING, PROPERTY, new QTableWidgetItem(tr("Strict super seeding")));
cb_super_seeding = new QCheckBox();
connect(cb_super_seeding, SIGNAL(toggled(bool)), this, SLOT(emitSettingsChanged()));
#ifdef LIBTORRENT_0_15
cb_super_seeding->setChecked(Preferences::isSuperSeedingEnabled());
#else
cb_super_seeding->setEnabled(false);
#endif
setCellWidget(SUPER_SEEDING, VALUE, cb_super_seeding);
}
void emitSettingsChanged() {

View file

@ -929,6 +929,18 @@ public:
settings.setValue(QString::fromUtf8("Preferences/Connection/MaxHalfOpenConnec"), value);
}
#ifdef LIBTORRENT_0_15
static bool isSuperSeedingEnabled() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Advanced/SuperSeeding"), false).toBool();
}
static void enableSuperSeeding(bool enabled) {
QSettings settings("qBittorrent", "qBittorrent");
settings.setValue(QString::fromUtf8("Preferences/Advanced/SuperSeeding"), enabled);
}
#endif
};
#endif // PREFERENCES_H