changeset 3304:d20fbaf52bf9 draft

Merge pull request #1649 from Diapolo/optionsdialog small UX update for optionsdialog
author Wladimir J. van der Laan <laanwj@gmail.com>
date Mon, 13 Aug 2012 21:17:39 -0700
parents 561a6fa8fe80 (current diff) 958f0e408a89 (diff)
children f33e5da76788 4b71248c251b 696279455f05 989e16ff16cc 527f6d468912
files
diffstat 3 files changed, 23 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/qt/forms/optionsdialog.ui
+++ b/src/qt/forms/optionsdialog.ui
@@ -432,12 +432,6 @@
        <property name="autoDefault">
         <bool>false</bool>
        </property>
-       <property name="default">
-        <bool>false</bool>
-       </property>
-       <property name="flat">
-        <bool>false</bool>
-       </property>
       </widget>
      </item>
     </layout>
--- a/src/qt/optionsdialog.cpp
+++ b/src/qt/optionsdialog.cpp
@@ -87,10 +87,10 @@
     mapper->setSubmitPolicy(QDataWidgetMapper::ManualSubmit);
     mapper->setOrientation(Qt::Vertical);
 
-    /* enable save buttons when data modified */
-    connect(mapper, SIGNAL(viewModified()), this, SLOT(enableSaveButtons()));
-    /* disable save buttons when new data loaded */
-    connect(mapper, SIGNAL(currentIndexChanged(int)), this, SLOT(disableSaveButtons()));
+    /* enable apply button when data modified */
+    connect(mapper, SIGNAL(viewModified()), this, SLOT(enableApplyButton()));
+    /* disable apply button when new data loaded */
+    connect(mapper, SIGNAL(currentIndexChanged(int)), this, SLOT(disableApplyButton()));
     /* setup/change UI elements when proxy IP is invalid/valid */
     connect(this, SIGNAL(proxyIpValid(QValidatedLineEdit *, bool)), this, SLOT(handleProxyIpValid(QValidatedLineEdit *, bool)));
 }
@@ -116,8 +116,11 @@
     /* update the display unit, to not use the default ("BTC") */
     updateDisplayUnit();
 
-    /* warn only when language selection changes (placed here so init of ui->lang via mapper doesn't trigger this) */
+    /* warn only when language selection changes by user action (placed here so init via mapper doesn't trigger this) */
     connect(ui->lang, SIGNAL(valueChanged()), this, SLOT(showRestartWarning_Lang()));
+
+    /* disable apply button after settings are loaded as there is nothing to save */
+    disableApplyButton();
 }
 
 void OptionsDialog::setMapper()
@@ -147,6 +150,16 @@
     mapper->addMapping(ui->displayAddresses, OptionsModel::DisplayAddresses);
 }
 
+void OptionsDialog::enableApplyButton()
+{
+    ui->applyButton->setEnabled(true);
+}
+
+void OptionsDialog::disableApplyButton()
+{
+    ui->applyButton->setEnabled(false);
+}
+
 void OptionsDialog::enableSaveButtons()
 {
     /* prevent enabling of the save buttons when data modified, if there is an invalid proxy address present */
@@ -179,7 +192,7 @@
 void OptionsDialog::on_applyButton_clicked()
 {
     mapper->submit();
-    ui->applyButton->setEnabled(false);
+    disableApplyButton();
 }
 
 void OptionsDialog::showRestartWarning_Proxy()
--- a/src/qt/optionsdialog.h
+++ b/src/qt/optionsdialog.h
@@ -26,6 +26,10 @@
     bool eventFilter(QObject *object, QEvent *event);
 
 private slots:
+    /* enable only apply button */
+    void enableApplyButton();
+    /* disable only apply button */
+    void disableApplyButton();
     /* enable apply button and OK button */
     void enableSaveButtons();
     /* disable apply button and OK button */