Browse Source

Added support for strict super seeding

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
fb874695c9
  1. 1
      Changelog
  2. 22
      src/advancedsettings.h
  3. 12
      src/preferences.h

1
Changelog

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

22
src/advancedsettings.h

@ -8,15 +8,15 @@
#include "preferences.h" #include "preferences.h"
enum AdvSettingsCols {PROPERTY, VALUE}; 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 }; 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 10 #define ROW_COUNT 11
class AdvancedSettings: public QTableWidget { class AdvancedSettings: public QTableWidget {
Q_OBJECT Q_OBJECT
private: private:
QSpinBox *spin_cache, *outgoing_ports_min, *outgoing_ports_max, *spin_list_refresh, *spin_maxhalfopen; 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: public:
AdvancedSettings(QWidget *parent=0): QTableWidget(parent) { AdvancedSettings(QWidget *parent=0): QTableWidget(parent) {
@ -46,6 +46,7 @@ public:
delete cb_resolve_countries; delete cb_resolve_countries;
delete cb_resolve_hosts; delete cb_resolve_hosts;
delete spin_maxhalfopen; delete spin_maxhalfopen;
delete cb_super_seeding;
} }
public slots: public slots:
@ -68,6 +69,10 @@ public slots:
Preferences::resolvePeerHostNames(cb_resolve_hosts->isChecked()); Preferences::resolvePeerHostNames(cb_resolve_hosts->isChecked());
// Max Half-Open connections // Max Half-Open connections
Preferences::setMaxHalfOpenConnections(spin_maxhalfopen->value()); Preferences::setMaxHalfOpenConnections(spin_maxhalfopen->value());
#ifdef LIBTORRENT_0_15
// Super seeding
Preferences::enableSuperSeeding(cb_super_seeding->isChecked());
#endif
} }
protected slots: protected slots:
@ -143,6 +148,17 @@ protected slots:
spin_maxhalfopen->setMinimum(0); spin_maxhalfopen->setMinimum(0);
spin_maxhalfopen->setMaximum(99999); spin_maxhalfopen->setMaximum(99999);
spin_maxhalfopen->setValue(Preferences::getMaxHalfOpenConnections()); 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() { void emitSettingsChanged() {

12
src/preferences.h

@ -929,6 +929,18 @@ public:
settings.setValue(QString::fromUtf8("Preferences/Connection/MaxHalfOpenConnec"), value); 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 #endif // PREFERENCES_H

Loading…
Cancel
Save