The cancel button on the settings dialog works now (ticket #14) and the layout of...
authorPhilipp Spitzer <philipp@spitzer.priv.at>
Wed, 13 Jul 2011 19:42:48 +0000 (19:42 +0000)
committerPhilipp Spitzer <philipp@spitzer.priv.at>
Wed, 13 Jul 2011 19:42:48 +0000 (19:42 +0000)
src/gui/mainwindow.cpp
src/gui/settingsdialog.cpp
src/gui/settingsdialog.h
src/gui/settingsdialog.ui

index e006e80..1e612da 100644 (file)
@@ -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.
index 36dbf4e..82ba0d0 100644 (file)
@@ -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);
 }
 
+
index 0863479..4e4ba9d 100644 (file)
@@ -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 */  
index 940b03c..05829f6 100644 (file)
@@ -2,6 +2,14 @@
 <ui version="4.0">
  <class>SettingsDialog</class>
  <widget class="QDialog" name="SettingsDialog">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>500</width>
+    <height>152</height>
+   </rect>
+  </property>
   <property name="sizePolicy">
    <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
     <horstretch>0</horstretch>
@@ -35,7 +43,7 @@
        </widget>
       </item>
       <item>
-       <widget class="QWidget" name="proxyWidget" native="true">
+       <widget class="QFrame" name="proxyWidget">
         <layout class="QHBoxLayout" name="horizontalLayout_3">
          <item>
           <widget class="QLabel" name="label">
   </layout>
  </widget>
  <resources/>
- <connections/>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>SettingsDialog</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>288</x>
+     <y>128</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>325</x>
+     <y>147</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>SettingsDialog</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>202</x>
+     <y>130</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>226</x>
+     <y>147</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
 </ui>