diff --git a/TODO b/TODO index 4c2b57341..06d6d36df 100644 --- a/TODO +++ b/TODO @@ -36,7 +36,7 @@ - Use a QListWidget to allow multiple input paths - Possibility to add url seeds - Add IPv6 support (at least start working on it) -- UPnP support (debug, sync with aMule CVS, option entry) +- UPnP support (debug, sync with aMule CVS) - Allow user to change application style? (WinXP, MacOS, CleanLooks...) : app.setStyle(new QCleanlooksStyle()); - Update v0.9.0 changelog after its release - Display Url seeds in torrent properties and allow to edit them diff --git a/src/options.ui b/src/options.ui index cef7ba3bb..78518dc8a 100644 --- a/src/options.ui +++ b/src/options.ui @@ -668,7 +668,7 @@ - + 6 diff --git a/src/options_imp.cpp b/src/options_imp.cpp index 15b498386..5c3c6bf8d 100644 --- a/src/options_imp.cpp +++ b/src/options_imp.cpp @@ -132,8 +132,10 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){ connect(enableScan_checkBox, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton())); connect(disableMaxConnec, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton())); connect(disableDHT, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton())); + connect(disableUPnP, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton())); connect(disablePeX, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton())); connect(spin_dht_port, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton())); + connect(spin_upnp_port, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton())); // Language connect(combo_i18n, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton())); // IPFilter @@ -184,6 +186,9 @@ void options_imp::saveOptions(){ settings.setValue("PortRangeMax", getPorts().second); settings.setValue("ShareRatio", getRatio()); settings.setValue("DHTPort", getDHTPort()); +#ifndef NO_UPNP + settings.setValue("UPnPPort", getUPnPPort()); +#endif settings.setValue("PeXState", isPeXDisabled()); settings.setValue("ScanDir", getScanDir()); // End Main options @@ -316,6 +321,20 @@ void options_imp::loadOptions(){ } spin_dht_port->setValue(value); } +#ifndef NO_UPNP + value = settings.value("UPnPPort", 50000).toInt(); + if(value < 0){ + disableUPnP->setChecked(true); + groupUPnP->setEnabled(false); + }else{ + disableUPnP->setChecked(false); + groupUPnP->setEnabled(true); + if(value < 1000){ + value = 50000; + } + spin_upnp_port->setValue(value); + } +#endif boolValue = settings.value("PeXState", 0).toBool(); if(boolValue){ // Pex disabled @@ -443,6 +462,20 @@ int options_imp::getDHTPort() const{ } } +#ifndef NO_UPNP +int options_imp::getUPnPPort() const{ + if(isUPnPEnabled()){ + return spin_upnp_port->value(); + }else{ + return -1; + } +} + +bool options_imp::isUPnPEnabled() const{ + return !disableUPnP->isChecked(); +} +#endif + QString options_imp::getPreviewProgram() const{ QString preview_txt = preview_program->text(); preview_txt.trimmed(); diff --git a/src/options_imp.h b/src/options_imp.h index f7ac489bb..a0f9477a1 100644 --- a/src/options_imp.h +++ b/src/options_imp.h @@ -53,6 +53,10 @@ class options_imp : public QDialog, private Ui::Dialog{ QString getScanDir() const; bool isDHTEnabled() const; int getDHTPort() const; +#ifndef NO_UPNP + bool isUPnPEnabled() const; + int getUPnPPort() const; +#endif bool isPeXDisabled() const; // Filter Settings bool isFilteringEnabled() const;