#include "appsettings.h"
#include <QDebug>
-#include <QNetworkProxy>
SettingsDialog::SettingsDialog(QWidget *aParent)
: QDialog(aParent)
// deserialize dialog data
address->setText(AppSettings::proxyAddress());
port->setValue(AppSettings::proxyPort());
+ const int proxyType = AppSettings::proxyType(); // QNetworkProxy::ProxyType
+ proxyTypeHTTP->setChecked(proxyType != 1); // HTTP=3, but we enable it by default, i.e. unless SOCKS5=1
+ proxyTypeSOCKS5->setChecked(proxyType == 1);
directConnection->setChecked(AppSettings::isDirectConnection());
proxyWidget->setDisabled(directConnection->isChecked());
}
// serialize dialog data
AppSettings::setProxyAddress(address->text());
AppSettings::setProxyPort(port->value());
- AppSettings::setProxyType(QNetworkProxy::HttpProxy); // TODO!!
+ AppSettings::setProxyType(proxyTypeHTTP->isChecked() ? 3 : proxyTypeSOCKS5->isChecked() ? 1 : 0);
AppSettings::setDirectConnection(directConnection->isChecked());
}
<x>0</x>
<y>0</y>
<width>500</width>
- <height>152</height>
+ <height>168</height>
</rect>
</property>
<property name="sizePolicy">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
- <string>HTTP proxy settings</string>
+ <string>Proxy settings</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
</item>
<item>
<widget class="QFrame" name="proxyWidget">
- <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <layout class="QVBoxLayout" name="verticalLayout_3">
<item>
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Address: </string>
- </property>
- </widget>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Address: </string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="address"/>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>Port:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="port">
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ <property name="minimum">
+ <number>1</number>
+ </property>
+ <property name="maximum">
+ <number>65535</number>
+ </property>
+ <property name="value">
+ <number>8080</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
<item>
- <widget class="QLineEdit" name="address"/>
- </item>
- <item>
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>Port:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QSpinBox" name="port">
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- <property name="minimum">
- <number>1</number>
- </property>
- <property name="maximum">
- <number>65535</number>
- </property>
- <property name="value">
- <number>8080</number>
- </property>
- </widget>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>Proxy type:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="proxyTypeHTTP">
+ <property name="text">
+ <string>HTTP proxy</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="proxyTypeSOCKS5">
+ <property name="text">
+ <string>SOCKS5 proxy</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
</layout>
</widget>