diff --git a/INSTALL b/INSTALL index bcf05d696..087eef831 100644 --- a/INSTALL +++ b/INSTALL @@ -27,6 +27,7 @@ Dependencies: - libcurl - libupnp (>= 1.2.1) *OPTIONAL* + -> For Universal Plug 'n Play Port forwarding support - python >= 2.3 (previous might work - not tested): needed by search engine. diff --git a/src/GUI.cpp b/src/GUI.cpp index 0b0957341..796d6901e 100644 --- a/src/GUI.cpp +++ b/src/GUI.cpp @@ -104,6 +104,9 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent){ } nbTorrents = 0; tabs->setTabText(0, tr("Transfers") +" (0)"); +#ifndef NO_UPNP + connect(&BTSession, SIGNAL(noWanServiceDetected()), this, SLOT(displayNoUPnPWanServiceDetected())); +#endif connect(&BTSession, SIGNAL(addedTorrent(const QString&, torrent_handle&, bool)), this, SLOT(torrentAdded(const QString&, torrent_handle&, bool))); connect(&BTSession, SIGNAL(duplicateTorrent(const QString&)), this, SLOT(torrentDuplicate(const QString&))); connect(&BTSession, SIGNAL(invalidTorrent(const QString&)), this, SLOT(torrentCorrupted(const QString&))); @@ -277,6 +280,12 @@ void GUI::readParamsOnSocket(){ } } +#ifndef NO_UPNP +void GUI::displayNoUPnPWanServiceDetected(){ + setInfoBar(tr("UPnP: no WAN service detected..."), "red"); +} +#endif + // Toggle paused state of selected torrent void GUI::togglePausedState(const QModelIndex& index){ int row = index.row(); @@ -953,7 +962,7 @@ void GUI::configureSession(bool deleteOptions){ BTSession.setListeningPortsRange(options->getPorts()); new_listenPort = BTSession.getListenPort(); if(new_listenPort != old_listenPort){ - setInfoBar(tr("Listening on port: %1", "e.g: Listening on port: 1666").arg( QString(misc::toString(new_listenPort).c_str()))); + setInfoBar(tr("qBittorrent is bind to port: %1", "e.g: qBittorrent is bind to port: 1666").arg( QString(misc::toString(new_listenPort).c_str()))); } // Apply max connec limit (-1 if disabled) BTSession.setMaxConnections(options->getMaxConnec()); @@ -978,26 +987,32 @@ void GUI::configureSession(bool deleteOptions){ BTSession.setGlobalRatio(options->getRatio()); // DHT (Trackerless) if(options->isDHTEnabled()){ + setInfoBar(tr("DHT support [ON], port: %1").arg(options->getDHTPort()), "blue"); BTSession.enableDHT(); // Set DHT Port BTSession.setDHTPort(options->getDHTPort()); }else{ + setInfoBar(tr("DHT support [OFF]"), "blue"); BTSession.disableDHT(); } #ifndef NO_UPNP // Upnp if(options->isUPnPEnabled()){ + setInfoBar(tr("UPnP support [ON], port: %1").arg(options->getUPnPPort()), "blue"); BTSession.enableUPnP(options->getUPnPPort()); BTSession.setUPnPPort(options->getUPnPPort()); }else{ + setInfoBar(tr("UPnP support [OFF]"), "blue"); BTSession.disableUPnP(); } #endif // PeX if(!options->isPeXDisabled()){ qDebug("Enabling Peer eXchange (PeX)"); + setInfoBar(tr("PeX support [OFF]"), "blue"); BTSession.enablePeerExchange(); }else{ + setInfoBar(tr("PeX support [OFF]"), "blue"); qDebug("Peer eXchange (PeX) disabled"); } // Apply filtering settings diff --git a/src/GUI.h b/src/GUI.h index 73d7547db..68fced354 100644 --- a/src/GUI.h +++ b/src/GUI.h @@ -140,6 +140,10 @@ class GUI : public QMainWindow, private Ui::MainWindow{ void OptionsSaved(const QString& info, bool deleteOptions); // HTTP slots void askForTorrentUrl(); +#ifndef NO_UPNP + void displayNoUPnPWanServiceDetected(); +#endif + public slots: void torrentAdded(const QString& path, torrent_handle& h, bool fastResume); diff --git a/src/bittorrent.cpp b/src/bittorrent.cpp index 9af9a57ee..5b77a3a80 100644 --- a/src/bittorrent.cpp +++ b/src/bittorrent.cpp @@ -89,10 +89,16 @@ void bittorrent::enableUPnP(int port){ true, "qBittorrent"); m_upnp = new CUPnPControlPoint(port); + connect(m_upnp, SIGNAL(noWanServiceDetected()), this, SLOT(noWanServiceEventHandler())); m_upnp->AddPortMappings(m_upnpMappings); } } +void bittorrent::noWanServiceEventHandler(){ + // Forward this signal + emit noWanServiceDetected(); +} + // Set UPnP port (>= 1000) void bittorrent::setUPnPPort(int upnp_port){ if(!UPnPEnabled){ diff --git a/src/bittorrent.h b/src/bittorrent.h index 19b93e3ba..617bfc336 100644 --- a/src/bittorrent.h +++ b/src/bittorrent.h @@ -133,6 +133,9 @@ class bittorrent : public QObject{ void resumeUnfinished(); bool loadTrackerFile(const QString& hash); void saveTrackerFile(const QString& hash); +#ifndef NO_UPNP + void noWanServiceEventHandler(); +#endif signals: void invalidTorrent(const QString& path); @@ -147,6 +150,9 @@ class bittorrent : public QObject{ void scanDirFoundTorrents(const QStringList& pathList); void newDownloadedTorrent(const QString& path, const QString& url); void aboutToDownloadFromUrl(const QString& url); +#ifndef NO_UPNP + void noWanServiceDetected(); +#endif }; #endif