Mercurial > hg > easaier-soundaccess
view widgets/ConnectionSettings.cpp @ 282:d9319859a4cf tip
(none)
author | benoitrigolleau |
---|---|
date | Fri, 31 Oct 2008 11:00:24 +0000 |
parents | f1602cb4cd0b |
children |
line wrap: on
line source
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ /* Sound Access EASAIER client application. Silogic 2007. Laure Bajard. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. See the file COPYING included with this distribution for more information. */ #include "ConnectionSettings.h" #include <QPushButton> #include <QHBoxLayout> #include <QLabel> ConnectionSettings::ConnectionSettings(HttpClient * httpClient) : QDialog(), m_httpClient(httpClient) { m_proxyBox = new QGroupBox(tr("Use Proxy")); m_proxyBox->setCheckable(true); m_proxyBox->setChecked(m_httpClient->useProxy()); if (useProxy()) { m_proxy.setText(m_httpClient->getProxy()); m_proxyPort.setText(QString::number(m_httpClient->getProxyPort())); m_userProxyId.setText(m_httpClient->getUserProxyId()); m_pwdProxyId.setText(m_httpClient->getPwdProxyId()); } m_pwdProxyId.setEchoMode(QLineEdit::Password); QGroupBox *hostBox = new QGroupBox(tr("Database host")); m_host.setText(m_httpClient->getHost()); m_hostPort.setText(QString::number(m_httpClient->getHostPort())); QPushButton* ok = new QPushButton(tr("Ok")); QPushButton* cancel = new QPushButton(tr("Cancel")); QHBoxLayout *proxyLayout = new QHBoxLayout; proxyLayout->addStretch(1); proxyLayout->addWidget(new QLabel(tr("Proxy : "))); proxyLayout->addWidget(&m_proxy); proxyLayout->addWidget(new QLabel(tr("Port : "))); proxyLayout->addWidget(&m_proxyPort); QHBoxLayout *userLayout = new QHBoxLayout; userLayout->addWidget(new QLabel(tr("User name:"))); userLayout->addWidget(&m_userProxyId); QHBoxLayout *pwdLayout = new QHBoxLayout; pwdLayout->addWidget(new QLabel(tr("Password:"))); pwdLayout->addWidget(&m_pwdProxyId); QVBoxLayout *proxyBoxLayout = new QVBoxLayout; proxyBoxLayout->addLayout(proxyLayout); proxyBoxLayout->addLayout(userLayout); proxyBoxLayout->addLayout(pwdLayout); m_proxyBox->setLayout(proxyBoxLayout); QHBoxLayout *hostLayout = new QHBoxLayout; hostLayout->addWidget(new QLabel(tr("Host :"))); hostLayout->addWidget(&m_host); hostLayout->addWidget(new QLabel(tr("Port :"))); hostLayout->addWidget(&m_hostPort); hostBox->setLayout(hostLayout); QHBoxLayout *buttonLayout = new QHBoxLayout; buttonLayout->addStretch(1); buttonLayout->addWidget(ok); buttonLayout->addWidget(cancel); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addWidget(m_proxyBox); mainLayout->addSpacing(5); mainLayout->addWidget(hostBox); mainLayout->addLayout(buttonLayout); setLayout(mainLayout); connect(ok, SIGNAL(clicked()), this, SLOT(valuesChanged())); connect(cancel, SIGNAL(clicked()), this, SLOT(close())); setWindowTitle(tr("Connection settings")); show(); } ConnectionSettings::~ConnectionSettings() { } void ConnectionSettings::valuesChanged() { m_httpClient->valuesChanged(this); close(); }