FEATURE: Proxy can be disabled for peer connections

This commit is contained in:
Christophe Dumez
2011-05-01 11:22:17 +00:00
parent 18e08c319f
commit 65883317c3
39 changed files with 2354 additions and 2020 deletions

View File

@@ -151,7 +151,7 @@
</widget>
<widget class="QStackedWidget" name="tabOption">
<property name="currentIndex">
<number>0</number>
<number>2</number>
</property>
<widget class="QWidget" name="tabOptionPage1">
<layout class="QVBoxLayout" name="verticalLayout_10">
@@ -171,8 +171,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>465</width>
<height>476</height>
<width>496</width>
<height>557</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_9">
@@ -487,8 +487,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>465</width>
<height>811</height>
<width>516</width>
<height>930</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
@@ -956,9 +956,9 @@ QGroupBox {
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>465</width>
<height>426</height>
<y>-12</y>
<width>496</width>
<height>520</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_20">
@@ -1242,6 +1242,19 @@ QGroupBox {
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="checkProxyPeerConnecs">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Otherwise, the proxy server is only used for tracker connections</string>
</property>
<property name="text">
<string>Use proxy for peer connections</string>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="checkProxyAuth">
<property name="enabled">
@@ -1399,9 +1412,9 @@ QGroupBox {
<property name="geometry">
<rect>
<x>0</x>
<y>-78</y>
<width>465</width>
<height>396</height>
<y>0</y>
<width>496</width>
<height>454</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_33">
@@ -1811,9 +1824,9 @@ QGroupBox {
<property name="geometry">
<rect>
<x>0</x>
<y>-73</y>
<width>465</width>
<height>391</height>
<y>0</y>
<width>565</width>
<height>458</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_7">
@@ -2187,9 +2200,9 @@ QGroupBox {
<property name="geometry">
<rect>
<x>0</x>
<y>-43</y>
<width>465</width>
<height>361</height>
<y>0</y>
<width>496</width>
<height>419</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_23">
@@ -2434,8 +2447,8 @@ QGroupBox {
<rect>
<x>0</x>
<y>0</y>
<width>482</width>
<height>318</height>
<width>512</width>
<height>414</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_36"/>

View File

@@ -191,6 +191,7 @@ options_imp::options_imp(QWidget *parent):
connect(comboProxyType, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton()));
connect(textProxyIP, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
connect(spinProxyPort, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
connect(checkProxyPeerConnecs, SIGNAL(toggled(bool)), SLOT(enableApplyButton()));
connect(checkProxyAuth, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(textProxyUsername, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
connect(textProxyPassword, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
@@ -401,6 +402,7 @@ void options_imp::saveOptions(){
pref.setProxyType(getProxyType());
pref.setProxyIp(getProxyIp());
pref.setProxyPort(getProxyPort());
pref.setProxyPeerConnections(checkProxyPeerConnecs->isChecked());
pref.setProxyAuthEnabled(isProxyAuthEnabled());
pref.setProxyUsername(getProxyUsername());
pref.setProxyPassword(getProxyPassword());
@@ -614,6 +616,7 @@ void options_imp::loadOptions(){
// Proxy is enabled, save settings
textProxyIP->setText(pref.getProxyIp());
spinProxyPort->setValue(pref.getProxyPort());
checkProxyPeerConnecs->setChecked(pref.proxyPeerConnections());
checkProxyAuth->setChecked(pref.isProxyAuthEnabled());
textProxyUsername->setText(pref.getProxyUsername());
textProxyPassword->setText(pref.getProxyPassword());
@@ -880,6 +883,7 @@ void options_imp::enableProxy(int index){
textProxyIP->setEnabled(true);
lblProxyPort->setEnabled(true);
spinProxyPort->setEnabled(true);
checkProxyPeerConnecs->setEnabled(true);
if(index > 1) {
checkProxyAuth->setEnabled(true);
} else {
@@ -892,6 +896,7 @@ void options_imp::enableProxy(int index){
textProxyIP->setEnabled(false);
lblProxyPort->setEnabled(false);
spinProxyPort->setEnabled(false);
checkProxyPeerConnecs->setEnabled(false);
checkProxyAuth->setEnabled(false);
checkProxyAuth->setChecked(false);
}

View File

@@ -509,6 +509,14 @@ public:
setValue(QString::fromUtf8("Preferences/Connection/ProxyType"), type);
}
void setProxyPeerConnections(bool enabled) {
setValue(QString::fromUtf8("Preferences/Connection/ProxyPeerConnections"), enabled);
}
bool proxyPeerConnections() const {
return value(QString::fromUtf8("Preferences/Connection/ProxyPeerConnections"), false).toBool();
}
// Bittorrent options
int getMaxConnecs() const {
return value(QString::fromUtf8("Preferences/Bittorrent/MaxConnecs"), 500).toInt();