mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
UI setup for "Network settings" page
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
1dd79d412f
commit
b5e90d7c93
2 changed files with 24 additions and 0 deletions
|
@ -6,6 +6,7 @@
|
|||
#include <QMessageBox>
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <QShortcut>
|
||||
#include <QNetworkProxy>
|
||||
|
||||
PreferencesDialog *PreferencesDialog::instance()
|
||||
{
|
||||
|
@ -18,6 +19,12 @@ PreferencesDialog *PreferencesDialog::instance()
|
|||
PreferencesDialog::PreferencesDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
ui.proxyType->clear();
|
||||
ui.proxyType->addItem(tr("No proxy"), QNetworkProxy::NoProxy);
|
||||
ui.proxyType->addItem(tr("System proxy"), QNetworkProxy::DefaultProxy);
|
||||
ui.proxyType->addItem(tr("HTTP proxy"), QNetworkProxy::HttpProxy);
|
||||
ui.proxyType->addItem(tr("SOCKS proxy"), QNetworkProxy::Socks5Proxy);
|
||||
connect(ui.proxyType, SIGNAL(currentIndexChanged(int)), this, SLOT(on_proxyType_changed(int)));
|
||||
connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton *)), this, SLOT(buttonClicked(QAbstractButton *)));
|
||||
connect(ui.gflow, SIGNAL(valueChanged(int)), this, SLOT(gflowChanged(int)));
|
||||
connect(ui.gfhigh, SIGNAL(valueChanged(int)), this, SLOT(gfhighChanged(int)));
|
||||
|
@ -378,3 +385,19 @@ void PreferencesDialog::emitSettingsChanged()
|
|||
{
|
||||
emit settingsChanged();
|
||||
}
|
||||
|
||||
void PreferencesDialog::on_proxyType_changed(int idx)
|
||||
{
|
||||
if (idx == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
int proxyType = ui.proxyType->itemData(idx).toInt();
|
||||
bool hpEnabled = (proxyType == QNetworkProxy::Socks5Proxy || proxyType == QNetworkProxy::HttpProxy);
|
||||
ui.proxyHost->setEnabled(hpEnabled);
|
||||
ui.proxyPort->setEnabled(hpEnabled);
|
||||
ui.proxyAuthRequired->setEnabled(hpEnabled);
|
||||
ui.proxyUsername->setEnabled(hpEnabled & ui.proxyAuthRequired->isChecked());
|
||||
ui.proxyPassword->setEnabled(hpEnabled & ui.proxyAuthRequired->isChecked());
|
||||
ui.proxyAuthRequired->setChecked(ui.proxyAuthRequired->isChecked());
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ slots:
|
|||
void rememberPrefs();
|
||||
void gflowChanged(int gf);
|
||||
void gfhighChanged(int gf);
|
||||
void on_proxyType_changed(int idx);
|
||||
|
||||
private:
|
||||
explicit PreferencesDialog(QWidget *parent = 0, Qt::WindowFlags f = 0);
|
||||
|
|
Loading…
Add table
Reference in a new issue