mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-10-22 10:46:04 +03:00
FEATURE: Outgoing ports range can be customized (for QoS)
This commit is contained in:
parent
8618f13b7a
commit
95da161be3
4 changed files with 60 additions and 16 deletions
|
@ -4,6 +4,7 @@
|
||||||
- FEATURE: Added "Added/Completed On" columns to transfer list
|
- FEATURE: Added "Added/Completed On" columns to transfer list
|
||||||
- FEATURE: Added "Upload/Download limit" columns to transfer list
|
- FEATURE: Added "Upload/Download limit" columns to transfer list
|
||||||
- FEATURE: Torrent files can be exported to a given directory
|
- 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
|
* Mon Jan 18 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.1.0
|
||||||
- FEATURE: Graphical User Interface can be disabled at compilation time (headless running)
|
- FEATURE: Graphical User Interface can be disabled at compilation time (headless running)
|
||||||
|
|
|
@ -7,15 +7,14 @@
|
||||||
#include "preferences.h"
|
#include "preferences.h"
|
||||||
|
|
||||||
enum AdvSettingsCols {PROPERTY, VALUE};
|
enum AdvSettingsCols {PROPERTY, VALUE};
|
||||||
enum AdvSettingsRows {DISK_CACHE};
|
enum AdvSettingsRows {DISK_CACHE, OUTGOING_PORT_MIN, OUTGOING_PORT_MAX };
|
||||||
#define ROW_COUNT 1
|
#define ROW_COUNT 3
|
||||||
enum AdvValueTYPE {UINT=1001};
|
|
||||||
|
|
||||||
class AdvancedSettings: public QTableWidget {
|
class AdvancedSettings: public QTableWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QSpinBox *spin_cache;
|
QSpinBox *spin_cache, *outgoing_ports_min, *outgoing_ports_max;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AdvancedSettings(QWidget *parent=0): QTableWidget(parent) {
|
AdvancedSettings(QWidget *parent=0): QTableWidget(parent) {
|
||||||
|
@ -33,24 +32,45 @@ public:
|
||||||
|
|
||||||
~AdvancedSettings() {
|
~AdvancedSettings() {
|
||||||
delete spin_cache;
|
delete spin_cache;
|
||||||
|
delete outgoing_ports_min;
|
||||||
|
delete outgoing_ports_max;
|
||||||
}
|
}
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void saveAdvancedSettings() {
|
void saveAdvancedSettings() {
|
||||||
// Disk cache
|
// Disk write cache
|
||||||
Preferences::setDiskCacheSize(spin_cache->value());
|
Preferences::setDiskCacheSize(spin_cache->value());
|
||||||
|
// Outgoing ports
|
||||||
|
Preferences::setOutgoingPortsMin(outgoing_ports_min->value());
|
||||||
|
Preferences::setOutgoingPortsMax(outgoing_ports_max->value());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void loadAdvancedSettings() {
|
void loadAdvancedSettings() {
|
||||||
// Disk write cache
|
// 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();
|
spin_cache = new QSpinBox();
|
||||||
connect(spin_cache, SIGNAL(valueChanged(int)), this, SLOT(emitSettingsChanged()));
|
connect(spin_cache, SIGNAL(valueChanged(int)), this, SLOT(emitSettingsChanged()));
|
||||||
spin_cache->setMinimum(1);
|
spin_cache->setMinimum(1);
|
||||||
spin_cache->setMaximum(200);
|
spin_cache->setMaximum(200);
|
||||||
spin_cache->setValue(Preferences::diskCacheSize());
|
spin_cache->setValue(Preferences::diskCacheSize());
|
||||||
setCellWidget(DISK_CACHE, VALUE, spin_cache);
|
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() {
|
void emitSettingsChanged() {
|
||||||
|
|
|
@ -427,6 +427,8 @@ void Bittorrent::configureSession() {
|
||||||
sessionSettings.active_limit = -1;
|
sessionSettings.active_limit = -1;
|
||||||
setQueueingEnabled(false);
|
setQueueingEnabled(false);
|
||||||
}
|
}
|
||||||
|
// Outgoing ports
|
||||||
|
sessionSettings.outgoing_ports = std::make_pair(Preferences::outgoingPortsMin(), Preferences::outgoingPortsMax());
|
||||||
setSessionSettings(sessionSettings);
|
setSessionSettings(sessionSettings);
|
||||||
// Bittorrent
|
// Bittorrent
|
||||||
// * Max connections limit
|
// * Max connections limit
|
||||||
|
|
|
@ -181,16 +181,6 @@ public:
|
||||||
return settings.setValue(QString::fromUtf8("Preferences/Downloads/PreAllocation"), enabled);
|
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() {
|
static bool useAdditionDialog() {
|
||||||
QSettings settings("qBittorrent", "qBittorrent");
|
QSettings settings("qBittorrent", "qBittorrent");
|
||||||
return settings.value(QString::fromUtf8("Preferences/Downloads/AdditionDialog"), true).toBool();
|
return settings.value(QString::fromUtf8("Preferences/Downloads/AdditionDialog"), true).toBool();
|
||||||
|
@ -837,6 +827,37 @@ public:
|
||||||
return pass_ha1;
|
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
|
#endif // PREFERENCES_H
|
||||||
|
|
Loading…
Reference in a new issue