Started to simplify program preferences (merged UPnP/NAT-PMP)

This commit is contained in:
Christophe Dumez
2010-12-05 16:29:18 +00:00
parent 8bcb51ba9c
commit 3feffdf8fa
9 changed files with 21 additions and 69 deletions

View File

@@ -941,7 +941,7 @@ QGroupBox {
<x>0</x>
<y>0</y>
<width>507</width>
<height>485</height>
<height>457</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_20">
@@ -1000,17 +1000,7 @@ QGroupBox {
<item>
<widget class="QCheckBox" name="checkUPnP">
<property name="text">
<string>Enable UPnP port mapping</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkNATPMP">
<property name="text">
<string>Enable NAT-PMP port mapping</string>
<string>Use UPnP / NAT-PMP port forwarding from my router</string>
</property>
<property name="checked">
<bool>true</bool>
@@ -1409,8 +1399,8 @@ QGroupBox {
<rect>
<x>0</x>
<y>0</y>
<width>524</width>
<height>406</height>
<width>423</width>
<height>334</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_33">
@@ -2181,8 +2171,8 @@ QGroupBox {
<rect>
<x>0</x>
<y>0</y>
<width>524</width>
<height>406</height>
<width>396</width>
<height>229</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_23">
@@ -2344,8 +2334,8 @@ QGroupBox {
<rect>
<x>0</x>
<y>0</y>
<width>524</width>
<height>406</height>
<width>98</width>
<height>28</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_36"/>
@@ -2401,7 +2391,6 @@ QGroupBox {
<tabstop>checkStartPaused</tabstop>
<tabstop>spinPort</tabstop>
<tabstop>checkUPnP</tabstop>
<tabstop>checkNATPMP</tabstop>
<tabstop>checkLSD</tabstop>
<tabstop>comboEncryption</tabstop>
<tabstop>checkMaxRatio</tabstop>

View File

@@ -144,7 +144,6 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
// Connection tab
connect(spinPort, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
connect(checkUPnP, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkNATPMP, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkUploadLimit, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkDownloadLimit, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(spinUploadLimit, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
@@ -359,7 +358,6 @@ void options_imp::saveOptions(){
// Connection preferences
pref.setSessionPort(getPort());
pref.setUPnPEnabled(isUPnPEnabled());
pref.setNATPMPEnabled(isNATPMPEnabled());
const QPair<int, int> down_up_limit = getGlobalBandwidthLimits();
pref.setGlobalDownloadLimit(down_up_limit.first);
pref.setGlobalUploadLimit(down_up_limit.second);
@@ -529,7 +527,6 @@ void options_imp::loadOptions(){
// Connection preferences
spinPort->setValue(pref.getSessionPort());
checkUPnP->setChecked(pref.isUPnPEnabled());
checkNATPMP->setChecked(pref.isNATPMPEnabled());
intValue = pref.getGlobalDownloadLimit();
if(intValue > 0) {
// Enabled
@@ -717,10 +714,6 @@ bool options_imp::isUPnPEnabled() const{
return checkUPnP->isChecked();
}
bool options_imp::isNATPMPEnabled() const{
return checkNATPMP->isChecked();
}
// Return Download & Upload limits in kbps
// [download,upload]
QPair<int,int> options_imp::getGlobalBandwidthLimits() const{

View File

@@ -114,7 +114,6 @@ private:
// Connection options
int getPort() const;
bool isUPnPEnabled() const;
bool isNATPMPEnabled() const;
QPair<int,int> getGlobalBandwidthLimits() const;
// Bittorrent options
int getMaxConnecs() const;

View File

@@ -335,14 +335,6 @@ public:
setValue(QString::fromUtf8("Preferences/Connection/UPnP"), enabled);
}
bool isNATPMPEnabled() const {
return value(QString::fromUtf8("Preferences/Connection/NAT-PMP"), true).toBool();
}
void setNATPMPEnabled(bool enabled) {
setValue(QString::fromUtf8("Preferences/Connection/NAT-PMP"), enabled);
}
int getGlobalDownloadLimit() const {
return value("Preferences/Connection/GlobalDLLimit", -1).toInt();
}