From e0a0a0beb1ac02c885400e1f722d46b0827da266 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Tue, 27 Mar 2007 21:12:33 +0000 Subject: [PATCH] - fix for UPnP option --- TODO | 3 ++- src/GUI.cpp | 6 +++++- src/bittorrent.cpp | 4 ++-- src/bittorrent.h | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/TODO b/TODO index 06d6d36df..8a29bffe9 100644 --- a/TODO +++ b/TODO @@ -42,4 +42,5 @@ - Display Url seeds in torrent properties and allow to edit them - Improve Ipfilter.dat parser (move to a thread ?) - Use tooltips to explain options -- Exit confirmation only if there are active downloads \ No newline at end of file +- Exit confirmation only if there are active downloads +- Support UPnP port edition \ No newline at end of file diff --git a/src/GUI.cpp b/src/GUI.cpp index 166ec14fc..5eba72f57 100644 --- a/src/GUI.cpp +++ b/src/GUI.cpp @@ -986,7 +986,11 @@ void GUI::configureSession(bool deleteOptions){ } #ifndef NO_UPNP // Upnp - BTSession.enableUPnP(); + if(options->isDHTEnabled()){ + BTSession.enableUPnP(options->getUPnPPort()); + }else{ + BTSession.disableUPnP(); + } #endif // PeX if(!options->isPeXDisabled()){ diff --git a/src/bittorrent.cpp b/src/bittorrent.cpp index d9466155b..092d0c3cd 100644 --- a/src/bittorrent.cpp +++ b/src/bittorrent.cpp @@ -75,7 +75,7 @@ torrent_handle bittorrent::getTorrentHandle(const QString& hash) const{ } #ifndef NO_UPNP -void bittorrent::enableUPnP(){ +void bittorrent::enableUPnP(int port){ if(!UPnPEnabled){ qDebug("Enabling UPnP"); UPnPEnabled = true; @@ -85,7 +85,7 @@ void bittorrent::enableUPnP(){ "TCP", true, "qBittorrent"); - m_upnp = new CUPnPControlPoint(50000); + m_upnp = new CUPnPControlPoint(port); m_upnp->AddPortMappings(m_upnpMappings); } } diff --git a/src/bittorrent.h b/src/bittorrent.h index 99104c7b0..cc2a3c2e4 100644 --- a/src/bittorrent.h +++ b/src/bittorrent.h @@ -119,7 +119,7 @@ class bittorrent : public QObject{ void setSessionSettings(session_settings sessionSettings); void setDefaultSavePath(const QString& savepath); #ifndef NO_UPNP - void enableUPnP(); + void enableUPnP(int port=50000); void disableUPnP(); #endif