From: Philipp Spitzer Date: Wed, 13 Jul 2011 19:42:48 +0000 (+0000) Subject: The cancel button on the settings dialog works now (ticket #14) and the layout of... X-Git-Tag: 0.5.1~5 X-Git-Url: https://git.toastfreeware.priv.at/toast/confclerk.git/commitdiff_plain/a4ed73e08e3e4fd70d4947d10786156dd296dcda The cancel button on the settings dialog works now (ticket #14) and the layout of the settings dialog is stable now (ticket #15). --- diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index e006e80..1e612da 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -221,15 +221,17 @@ void MainWindow::unsetConference() void MainWindow::setup() { SettingsDialog dialog; - dialog.exec(); - - QNetworkProxy proxy( - AppSettings::isDirectConnection() ? QNetworkProxy::NoProxy : QNetworkProxy::HttpProxy, - AppSettings::proxyAddress(), - AppSettings::proxyPort(), - PROXY_USERNAME, - PROXY_PASSWD); - QNetworkProxy::setApplicationProxy(proxy); + dialog.loadDialogData(); + if (dialog.exec() == QDialog::Accepted) { + dialog.saveDialogData(); + QNetworkProxy proxy( + AppSettings::isDirectConnection() ? QNetworkProxy::NoProxy : QNetworkProxy::HttpProxy, + AppSettings::proxyAddress(), + AppSettings::proxyPort(), + PROXY_USERNAME, + PROXY_PASSWD); + QNetworkProxy::setApplicationProxy(proxy); + } } /** Create and run ConferenceEditor dialog, making required connections for it. diff --git a/src/gui/settingsdialog.cpp b/src/gui/settingsdialog.cpp index 36dbf4e..82ba0d0 100644 --- a/src/gui/settingsdialog.cpp +++ b/src/gui/settingsdialog.cpp @@ -26,23 +26,19 @@ SettingsDialog::SettingsDialog(QWidget *aParent) : QDialog(aParent) { setupUi(this); + connect(directConnection, SIGNAL(clicked(bool)), SLOT(connectionTypeChanged(bool))); +} + +void SettingsDialog::loadDialogData() +{ // deserialize dialog data address->setText(AppSettings::proxyAddress()); port->setValue(AppSettings::proxyPort()); directConnection->setChecked(AppSettings::isDirectConnection()); - - connect(buttonBox, SIGNAL(accepted()), SLOT(saveDialogData())); - connect(directConnection, SIGNAL(clicked(bool)), SLOT(connectionTypeChanged(bool))); - - if(directConnection->isChecked()) - proxyWidget->hide(); + proxyWidget->setDisabled(directConnection->isChecked()); } -void SettingsDialog::connectionTypeChanged(bool aState) -{ - aState ? proxyWidget->hide() : proxyWidget->show(); -} void SettingsDialog::saveDialogData() { @@ -50,7 +46,12 @@ void SettingsDialog::saveDialogData() AppSettings::setProxyAddress(address->text()); AppSettings::setProxyPort(port->value()); AppSettings::setDirectConnection(directConnection->isChecked()); +} + - close(); +void SettingsDialog::connectionTypeChanged(bool aState) +{ + proxyWidget->setDisabled(aState); } + diff --git a/src/gui/settingsdialog.h b/src/gui/settingsdialog.h index 0863479..4e4ba9d 100644 --- a/src/gui/settingsdialog.h +++ b/src/gui/settingsdialog.h @@ -29,9 +29,10 @@ class SettingsDialog : public QDialog, Ui::SettingsDialog public: SettingsDialog(QWidget *aParent = NULL); ~SettingsDialog() {} + void loadDialogData(); + void saveDialogData(); private slots: void connectionTypeChanged(bool aState); - void saveDialogData(); }; #endif /* PROXYSETTINGSDIALOG_H */ diff --git a/src/gui/settingsdialog.ui b/src/gui/settingsdialog.ui index 940b03c..05829f6 100644 --- a/src/gui/settingsdialog.ui +++ b/src/gui/settingsdialog.ui @@ -2,6 +2,14 @@ SettingsDialog + + + 0 + 0 + 500 + 152 + + 0 @@ -35,7 +43,7 @@ - + @@ -83,5 +91,38 @@ - + + + buttonBox + accepted() + SettingsDialog + accept() + + + 288 + 128 + + + 325 + 147 + + + + + buttonBox + rejected() + SettingsDialog + reject() + + + 202 + 130 + + + 226 + 147 + + + +