Browse Source

- qBittorrent can now listen on ports < 1024 (must be root)

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
454c093033
  1. 4
      src/bittorrent.cpp
  2. 2
      src/main.cpp
  3. 2
      src/preferences.h
  4. 27
      src/ui/options.ui

4
src/bittorrent.cpp

@ -1602,9 +1602,9 @@ void Bittorrent::addConsoleMessage(QString msg, QString) {
} }
} }
// Set DHT port (>= 1000 or 0 if same as BT) // Set DHT port (>= 1 or 0 if same as BT)
void Bittorrent::setDHTPort(int dht_port) { void Bittorrent::setDHTPort(int dht_port) {
if(dht_port == 0 || dht_port >= 1000) { if(dht_port >= 0) {
if(dht_port == current_dht_port) return; if(dht_port == current_dht_port) return;
struct dht_settings DHTSettings; struct dht_settings DHTSettings;
DHTSettings.service_port = dht_port; DHTSettings.service_port = dht_port;

2
src/main.cpp

@ -225,7 +225,7 @@ int main(int argc, char *argv[]){
if(parts.size() == 2) { if(parts.size() == 2) {
bool ok = false; bool ok = false;
int new_port = parts.last().toInt(&ok); int new_port = parts.last().toInt(&ok);
if(ok && new_port > 1024 && new_port <= 65535) { if(ok && new_port > 0 && new_port <= 65535) {
Preferences::setWebUiPort(new_port); Preferences::setWebUiPort(new_port);
} }
} }

2
src/preferences.h

@ -545,7 +545,7 @@ public:
static int getDHTPort() { static int getDHTPort() {
QSettings settings("qBittorrent", "qBittorrent"); QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Bittorrent/DHTPort"), 6882).toInt(); return settings.value(QString::fromUtf8("Preferences/Bittorrent/DHTPort"), 6881).toInt();
} }
static bool isLSDEnabled() { static bool isLSDEnabled() {

27
src/ui/options.ui

@ -1138,7 +1138,7 @@ QGroupBox {
<item> <item>
<widget class="QSpinBox" name="spinPort"> <widget class="QSpinBox" name="spinPort">
<property name="minimum"> <property name="minimum">
<number>1000</number> <number>1</number>
</property> </property>
<property name="maximum"> <property name="maximum">
<number>65535</number> <number>65535</number>
@ -1520,7 +1520,7 @@ QGroupBox {
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>620</width> <width>620</width>
<height>495</height> <height>490</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_20"> <layout class="QVBoxLayout" name="verticalLayout_20">
@ -1584,13 +1584,13 @@ QGroupBox {
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="minimum"> <property name="minimum">
<number>1024</number> <number>1</number>
</property> </property>
<property name="maximum"> <property name="maximum">
<number>65525</number> <number>65525</number>
</property> </property>
<property name="value"> <property name="value">
<number>6882</number> <number>6881</number>
</property> </property>
</widget> </widget>
</item> </item>
@ -1937,7 +1937,7 @@ QGroupBox {
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>620</width> <width>620</width>
<height>495</height> <height>490</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_16"> <layout class="QVBoxLayout" name="verticalLayout_16">
@ -2016,6 +2016,9 @@ QGroupBox {
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum"> <property name="maximum">
<number>65535</number> <number>65535</number>
</property> </property>
@ -2216,6 +2219,9 @@ QGroupBox {
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum"> <property name="maximum">
<number>65535</number> <number>65535</number>
</property> </property>
@ -2365,7 +2371,7 @@ QGroupBox {
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>620</width> <width>620</width>
<height>495</height> <height>490</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_21"> <layout class="QVBoxLayout" name="verticalLayout_21">
@ -2462,7 +2468,7 @@ QGroupBox {
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>620</width> <width>620</width>
<height>495</height> <height>490</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_23"> <layout class="QVBoxLayout" name="verticalLayout_23">
@ -2497,11 +2503,14 @@ QGroupBox {
</item> </item>
<item> <item>
<widget class="QSpinBox" name="spinWebUiPort"> <widget class="QSpinBox" name="spinWebUiPort">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum"> <property name="maximum">
<number>65535</number> <number>65535</number>
</property> </property>
<property name="value"> <property name="value">
<number>80</number> <number>8080</number>
</property> </property>
</widget> </widget>
</item> </item>
@ -2626,7 +2635,7 @@ QGroupBox {
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>620</width> <width>620</width>
<height>495</height> <height>490</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_24"> <layout class="QVBoxLayout" name="verticalLayout_24">

Loading…
Cancel
Save