Some proxy work.
This commit is contained in:
parent
1ee933e2be
commit
f1eb5daf7f
@ -1,5 +1,6 @@
|
||||
#include <QMessageBox>
|
||||
#include <QProcess>
|
||||
#include <QNetworkProxy>
|
||||
|
||||
#include "gui/formsettings.h"
|
||||
#include "gui/themefactory.h"
|
||||
@ -36,11 +37,14 @@ FormSettings::FormSettings(QWidget *parent) : QDialog(parent), m_ui(new Ui::Form
|
||||
|
||||
// Establish needed connections.
|
||||
connect(this, &FormSettings::accepted, this, &FormSettings::saveSettings);
|
||||
connect(m_ui->m_cmbProxyType, static_cast<void (QComboBox::*)(int index)>(&QComboBox::currentIndexChanged),
|
||||
this, &FormSettings::onProxyTypeChanged);
|
||||
|
||||
// Load all settings.
|
||||
loadGeneral();
|
||||
loadShortcuts();
|
||||
loadInterface();
|
||||
loadProxy();
|
||||
loadLanguage();
|
||||
}
|
||||
|
||||
@ -53,11 +57,38 @@ void FormSettings::saveSettings() {
|
||||
saveGeneral();
|
||||
saveShortcuts();
|
||||
saveInterface();
|
||||
saveProxy();
|
||||
saveLanguage();
|
||||
|
||||
Settings::getInstance()->checkSettings();
|
||||
}
|
||||
|
||||
void FormSettings::onProxyTypeChanged(int index) {
|
||||
QNetworkProxy::ProxyType selected_type = static_cast<QNetworkProxy::ProxyType>(m_ui->m_cmbProxyType->itemData(index).toInt());
|
||||
bool is_proxy_selected = selected_type != QNetworkProxy::NoProxy;
|
||||
|
||||
m_ui->m_txtProxyHost->setVisible(is_proxy_selected);
|
||||
m_ui->m_txtProxyPassword->setVisible(is_proxy_selected);
|
||||
m_ui->m_txtProxyUsername->setVisible(is_proxy_selected);
|
||||
m_ui->m_spinProxyPort->setVisible(is_proxy_selected);
|
||||
m_ui->m_lblProxyHost->setVisible(is_proxy_selected);
|
||||
m_ui->m_lblProxyInfo->setVisible(is_proxy_selected);
|
||||
m_ui->m_lblProxyPassword->setVisible(is_proxy_selected);
|
||||
m_ui->m_lblProxyPort->setVisible(is_proxy_selected);
|
||||
m_ui->m_lblProxyUsername->setVisible(is_proxy_selected);
|
||||
m_ui->m_checkShowPassword->setVisible(is_proxy_selected);
|
||||
}
|
||||
|
||||
void FormSettings::loadProxy() {
|
||||
m_ui->m_cmbProxyType->addItem(tr("No proxy"), QNetworkProxy::NoProxy);
|
||||
m_ui->m_cmbProxyType->addItem(tr("Socks5"), QNetworkProxy::Socks5Proxy);
|
||||
m_ui->m_cmbProxyType->addItem(tr("Http"), QNetworkProxy::HttpProxy);
|
||||
}
|
||||
|
||||
void FormSettings::saveProxy() {
|
||||
|
||||
}
|
||||
|
||||
void FormSettings::loadLanguage() {
|
||||
QList<Language> languages = Localization::getInstalledLanguages();
|
||||
|
||||
|
@ -33,6 +33,11 @@ class FormSettings : public QDialog {
|
||||
|
||||
void loadShortcuts();
|
||||
void saveShortcuts();
|
||||
|
||||
void loadProxy();
|
||||
void saveProxy();
|
||||
|
||||
void onProxyTypeChanged(int index);
|
||||
|
||||
private:
|
||||
Ui::FormSettings *m_ui;
|
||||
|
@ -45,12 +45,27 @@
|
||||
<string>Language</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Proxy</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QDialogButtonBox" name="m_buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QStackedWidget" name="m_stackedSettings">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
<number>4</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="m_pageGeneral">
|
||||
<layout class="QFormLayout" name="formLayout_5">
|
||||
@ -298,16 +313,145 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QDialogButtonBox" name="m_buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
<widget class="QWidget" name="m_pageProxy">
|
||||
<layout class="QFormLayout" name="formLayout_6">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="m_lblProxyType">
|
||||
<property name="text">
|
||||
<string>Type</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="m_cmbProxyType"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="m_lblProxyHost">
|
||||
<property name="text">
|
||||
<string>Host</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="m_txtProxyHost">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>Hostname or IP of your proxy server</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="m_lblProxyPort">
|
||||
<property name="text">
|
||||
<string>Port</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="m_spinProxyPort">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>65535</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>80</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="m_lblProxyUsername">
|
||||
<property name="text">
|
||||
<string>Username</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="m_txtProxyUsername">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>Your username for proxy server authentication</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="m_lblProxyPassword">
|
||||
<property name="text">
|
||||
<string>Password</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="m_txtProxyPassword">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>Your password for proxy server authentication</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QCheckBox" name="m_checkShowPassword">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Display password</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLabel" name="m_lblProxyInfo">
|
||||
<property name="text">
|
||||
<string>Password is stored in plain string in RSS Guard configuration file.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
Loading…
x
Reference in New Issue
Block a user