const QString PROXY_ADDRESS_SETTING ("proxyAddress");
const QString PROXY_PORT_SETTING ("proxyPort");
const QString PROXY_TYPE_SETTING ("proxyType");
+const QString PROXY_USERNAME_SETTING ("proxyUsername");
+const QString PROXY_PASSWORD_SETTING ("proxyPassword");
const QString PROXY_ISDIRECT_SETTING ("proxyIsDirectConnection");
QSettings AppSettings::mSettings("Toastfreeware", "ConfClerk");
return QNetworkProxy::ProxyType(proxyType);
}
+QString AppSettings::proxyUsername()
+{
+ return mSettings.value(PROXY_USERNAME_SETTING).toString();
+}
+
+QString AppSettings::proxyPassword()
+{
+ return mSettings.value(PROXY_PASSWORD_SETTING).toString();
+}
+
bool AppSettings::isDirectConnection()
{
return mSettings.value(PROXY_ISDIRECT_SETTING).toBool();
mSettings.setValue(PROXY_TYPE_SETTING, aProxyType);
}
+void AppSettings::setProxyUsername(const QString &aUsername)
+{
+ mSettings.setValue(PROXY_USERNAME_SETTING, aUsername);
+}
+
+void AppSettings::setProxyPassword(const QString &aPassword)
+{
+ mSettings.setValue(PROXY_PASSWORD_SETTING, aPassword);
+}
+
void AppSettings::setDirectConnection(bool aDirectConnection)
{
mSettings.setValue(PROXY_ISDIRECT_SETTING, aDirectConnection);
static QString proxyAddress();
static quint16 proxyPort();
static QNetworkProxy::ProxyType proxyType();
+ static QString proxyUsername();
+ static QString proxyPassword();
static bool isDirectConnection();
static void setProxyAddress(const QString &aAddress);
static void setProxyPort(const quint16 aPort);
static void setProxyType(QNetworkProxy::ProxyType aProxyType);
+ static void setProxyUsername(const QString &aUsername);
+ static void setProxyPassword(const QString &aPassword);
static void setDirectConnection(bool aDirectConnection);
static int preEventAlarmSec() {return 60*15;} ///< seconds that alarm should ring before an event starts
};
#include "tabcontainer.h"
#include "appsettings.h"
-const QString PROXY_USERNAME;
-const QString PROXY_PASSWD;
-
MainWindow::MainWindow(QWidget* parent): QMainWindow(parent) {
setupUi(this);
AppSettings::isDirectConnection() ? QNetworkProxy::NoProxy : (QNetworkProxy::ProxyType)AppSettings::proxyType(),
AppSettings::proxyAddress(),
AppSettings::proxyPort(),
- PROXY_USERNAME,
- PROXY_PASSWD);
+ AppSettings::proxyUsername(),
+ AppSettings::proxyPassword());
QNetworkProxy::setApplicationProxy(proxy);
// event details have changed
AppSettings::isDirectConnection() ? QNetworkProxy::NoProxy : (QNetworkProxy::ProxyType)AppSettings::proxyType(),
AppSettings::proxyAddress(),
AppSettings::proxyPort(),
- PROXY_USERNAME,
- PROXY_PASSWD);
+ AppSettings::proxyUsername(),
+ AppSettings::proxyPassword());
QNetworkProxy::setApplicationProxy(proxy);
}
}
const QNetworkProxy::ProxyType proxyType = AppSettings::proxyType();
proxyTypeHTTP->setChecked(proxyType != QNetworkProxy::Socks5Proxy); // we enable QNetworkProxy::HttpProxy by default unless we have QNetworkProxy::Socks5Proxy
proxyTypeSOCKS5->setChecked(proxyType == QNetworkProxy::Socks5Proxy);
+ username->setText(AppSettings::proxyUsername());
+ password->setText(AppSettings::proxyPassword());
directConnection->setChecked(AppSettings::isDirectConnection());
proxyWidget->setDisabled(directConnection->isChecked());
}
AppSettings::setProxyAddress(address->text());
AppSettings::setProxyPort(port->value());
AppSettings::setProxyType(proxyTypeHTTP->isChecked() ? QNetworkProxy::HttpProxy : proxyTypeSOCKS5->isChecked() ? QNetworkProxy::Socks5Proxy : QNetworkProxy::DefaultProxy);
+ AppSettings::setProxyUsername(username->text());
+ AppSettings::setProxyPassword(password->text());
AppSettings::setDirectConnection(directConnection->isChecked());
}
</item>
</layout>
</item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <widget class="QLabel" name="label_4">
+ <property name="text">
+ <string>Optional: Username:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="username">
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_5">
+ <property name="text">
+ <string>Password:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="password">
+ <property name="echoMode">
+ <enum>QLineEdit::Password</enum>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
</layout>
</widget>
</item>