Browse Source

- UPnP option should now be working

adaptive-webui-19844
Christophe Dumez 18 years ago
parent
commit
d778766e29
  1. 2
      TODO
  2. 2
      src/options.ui
  3. 33
      src/options_imp.cpp
  4. 4
      src/options_imp.h

2
TODO

@ -36,7 +36,7 @@ @@ -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

2
src/options.ui

@ -668,7 +668,7 @@ @@ -668,7 +668,7 @@
</widget>
</item>
<item>
<widget class="QSpinBox" name="spin_UPnP_port" >
<widget class="QSpinBox" name="spin_upnp_port" >
<property name="minimumSize" >
<size>
<width>6</width>

33
src/options_imp.cpp

@ -132,8 +132,10 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){ @@ -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(){ @@ -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(){ @@ -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{ @@ -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();

4
src/options_imp.h

@ -53,6 +53,10 @@ class options_imp : public QDialog, private Ui::Dialog{ @@ -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;

Loading…
Cancel
Save