Browse Source

FEATURE: Outgoing ports range can be customized (for QoS)

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
95da161be3
  1. 1
      Changelog
  2. 32
      src/advancedsettings.h
  3. 2
      src/bittorrent.cpp
  4. 41
      src/preferences.h

1
Changelog

@ -4,6 +4,7 @@ @@ -4,6 +4,7 @@
- FEATURE: Added "Added/Completed On" columns to transfer list
- FEATURE: Added "Upload/Download limit" columns to transfer list
- FEATURE: Torrent files can be exported to a given directory
- FEATURE: Outgoing ports range can be customized (for QoS)
* Mon Jan 18 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.1.0
- FEATURE: Graphical User Interface can be disabled at compilation time (headless running)

32
src/advancedsettings.h

@ -7,15 +7,14 @@ @@ -7,15 +7,14 @@
#include "preferences.h"
enum AdvSettingsCols {PROPERTY, VALUE};
enum AdvSettingsRows {DISK_CACHE};
#define ROW_COUNT 1
enum AdvValueTYPE {UINT=1001};
enum AdvSettingsRows {DISK_CACHE, OUTGOING_PORT_MIN, OUTGOING_PORT_MAX };
#define ROW_COUNT 3
class AdvancedSettings: public QTableWidget {
Q_OBJECT
private:
QSpinBox *spin_cache;
QSpinBox *spin_cache, *outgoing_ports_min, *outgoing_ports_max;
public:
AdvancedSettings(QWidget *parent=0): QTableWidget(parent) {
@ -33,24 +32,45 @@ public: @@ -33,24 +32,45 @@ public:
~AdvancedSettings() {
delete spin_cache;
delete outgoing_ports_min;
delete outgoing_ports_max;
}
public slots:
void saveAdvancedSettings() {
// Disk cache
// Disk write cache
Preferences::setDiskCacheSize(spin_cache->value());
// Outgoing ports
Preferences::setOutgoingPortsMin(outgoing_ports_min->value());
Preferences::setOutgoingPortsMax(outgoing_ports_max->value());
}
protected slots:
void loadAdvancedSettings() {
// Disk write cache
setItem(DISK_CACHE, PROPERTY, new QTableWidgetItem(tr("Disk write cache size (MiB)"), UINT));
setItem(DISK_CACHE, PROPERTY, new QTableWidgetItem(tr("Disk write cache size (MiB)")));
spin_cache = new QSpinBox();
connect(spin_cache, SIGNAL(valueChanged(int)), this, SLOT(emitSettingsChanged()));
spin_cache->setMinimum(1);
spin_cache->setMaximum(200);
spin_cache->setValue(Preferences::diskCacheSize());
setCellWidget(DISK_CACHE, VALUE, spin_cache);
// Outgoing port Min
setItem(OUTGOING_PORT_MIN, PROPERTY, new QTableWidgetItem(tr("Outgoing ports (Min)")));
outgoing_ports_min = new QSpinBox();
connect(outgoing_ports_min, SIGNAL(valueChanged(int)), this, SLOT(emitSettingsChanged()));
outgoing_ports_min->setMinimum(0);
outgoing_ports_min->setMaximum(65535);
outgoing_ports_min->setValue(Preferences::outgoingPortsMin());
setCellWidget(OUTGOING_PORT_MIN, VALUE, outgoing_ports_min);
// Outgoing port Min
setItem(OUTGOING_PORT_MAX, PROPERTY, new QTableWidgetItem(tr("Outgoing ports (Max)")));
outgoing_ports_max = new QSpinBox();
connect(outgoing_ports_max, SIGNAL(valueChanged(int)), this, SLOT(emitSettingsChanged()));
outgoing_ports_max->setMinimum(0);
outgoing_ports_max->setMaximum(65535);
outgoing_ports_max->setValue(Preferences::outgoingPortsMax());
setCellWidget(OUTGOING_PORT_MAX, VALUE, outgoing_ports_max);
}
void emitSettingsChanged() {

2
src/bittorrent.cpp

@ -427,6 +427,8 @@ void Bittorrent::configureSession() { @@ -427,6 +427,8 @@ void Bittorrent::configureSession() {
sessionSettings.active_limit = -1;
setQueueingEnabled(false);
}
// Outgoing ports
sessionSettings.outgoing_ports = std::make_pair(Preferences::outgoingPortsMin(), Preferences::outgoingPortsMax());
setSessionSettings(sessionSettings);
// Bittorrent
// * Max connections limit

41
src/preferences.h

@ -181,16 +181,6 @@ public: @@ -181,16 +181,6 @@ public:
return settings.setValue(QString::fromUtf8("Preferences/Downloads/PreAllocation"), enabled);
}
static uint diskCacheSize() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Downloads/DiskCache"), 16).toUInt();
}
static void setDiskCacheSize(uint size) {
QSettings settings("qBittorrent", "qBittorrent");
settings.setValue(QString::fromUtf8("Preferences/Downloads/DiskCache"), size);
}
static bool useAdditionDialog() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Downloads/AdditionDialog"), true).toBool();
@ -837,6 +827,37 @@ public: @@ -837,6 +827,37 @@ public:
return pass_ha1;
}
// Advanced settings
static uint diskCacheSize() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Downloads/DiskCache"), 16).toUInt();
}
static void setDiskCacheSize(uint size) {
QSettings settings("qBittorrent", "qBittorrent");
settings.setValue(QString::fromUtf8("Preferences/Downloads/DiskCache"), size);
}
static uint outgoingPortsMin() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Advanced/OutgoingPortsMin"), 0).toUInt();
}
static void setOutgoingPortsMin(uint val) {
QSettings settings("qBittorrent", "qBittorrent");
settings.setValue(QString::fromUtf8("Preferences/Advanced/OutgoingPortsMin"), val);
}
static uint outgoingPortsMax() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Advanced/OutgoingPortsMax"), 0).toUInt();
}
static void setOutgoingPortsMax(uint val) {
QSettings settings("qBittorrent", "qBittorrent");
settings.setValue(QString::fromUtf8("Preferences/Advanced/OutgoingPortsMax"), val);
}
};
#endif // PREFERENCES_H

Loading…
Cancel
Save