54c5c29a41dc738c8ab86a5ca269b41af68144ae
[toast/confclerk.git] / src / gui / proxysettingsdialog.cpp
1 #include "proxysettingsdialog.h"
2
3 #include <appsettings.h>
4 #include <QDebug>
5
6 ProxySettingsDialog::ProxySettingsDialog(QWidget *aParent)
7     : QDialog(aParent)
8 {
9     setupUi(this);
10
11     // deserialize dialog data
12     address->setText(AppSettings::proxyAddress());
13     port->setValue(AppSettings::proxyPort());
14     directConnection->setChecked(AppSettings::isDirectConnection());
15
16     connect(okButton, SIGNAL(clicked()), SLOT(saveDialogData()));
17     connect(directConnection, SIGNAL(clicked(bool)), SLOT(connectionTypeChanged(bool)));
18
19     if(directConnection->isChecked())
20         proxyWidget->hide();
21 }
22
23 void ProxySettingsDialog::connectionTypeChanged(bool aState)
24 {
25     aState ? proxyWidget->hide() : proxyWidget->show();
26 }
27
28 void ProxySettingsDialog::saveDialogData()
29 {
30     // serialize dialog data
31     AppSettings::setProxyAddress(address->text());
32     AppSettings::setProxyPort(port->value());
33     AppSettings::setDirectConnection(directConnection->isChecked());
34
35     close();
36 }
37