Merge pull request #1649 from Diapolo/optionsdialog

small UX update for optionsdialog
This commit is contained in:
Wladimir J. van der Laan 2012-08-13 21:17:39 -07:00
commit 0825aee8f4
3 changed files with 23 additions and 12 deletions

View File

@ -432,12 +432,6 @@
<property name="autoDefault"> <property name="autoDefault">
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="default">
<bool>false</bool>
</property>
<property name="flat">
<bool>false</bool>
</property>
</widget> </widget>
</item> </item>
</layout> </layout>

View File

@ -87,10 +87,10 @@ OptionsDialog::OptionsDialog(QWidget *parent) :
mapper->setSubmitPolicy(QDataWidgetMapper::ManualSubmit); mapper->setSubmitPolicy(QDataWidgetMapper::ManualSubmit);
mapper->setOrientation(Qt::Vertical); mapper->setOrientation(Qt::Vertical);
/* enable save buttons when data modified */ /* enable apply button when data modified */
connect(mapper, SIGNAL(viewModified()), this, SLOT(enableSaveButtons())); connect(mapper, SIGNAL(viewModified()), this, SLOT(enableApplyButton()));
/* disable save buttons when new data loaded */ /* disable apply button when new data loaded */
connect(mapper, SIGNAL(currentIndexChanged(int)), this, SLOT(disableSaveButtons())); connect(mapper, SIGNAL(currentIndexChanged(int)), this, SLOT(disableApplyButton()));
/* setup/change UI elements when proxy IP is invalid/valid */ /* setup/change UI elements when proxy IP is invalid/valid */
connect(this, SIGNAL(proxyIpValid(QValidatedLineEdit *, bool)), this, SLOT(handleProxyIpValid(QValidatedLineEdit *, bool))); connect(this, SIGNAL(proxyIpValid(QValidatedLineEdit *, bool)), this, SLOT(handleProxyIpValid(QValidatedLineEdit *, bool)));
} }
@ -116,8 +116,11 @@ void OptionsDialog::setModel(OptionsModel *model)
/* update the display unit, to not use the default ("BTC") */ /* update the display unit, to not use the default ("BTC") */
updateDisplayUnit(); 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())); 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() void OptionsDialog::setMapper()
@ -147,6 +150,16 @@ void OptionsDialog::setMapper()
mapper->addMapping(ui->displayAddresses, OptionsModel::DisplayAddresses); mapper->addMapping(ui->displayAddresses, OptionsModel::DisplayAddresses);
} }
void OptionsDialog::enableApplyButton()
{
ui->applyButton->setEnabled(true);
}
void OptionsDialog::disableApplyButton()
{
ui->applyButton->setEnabled(false);
}
void OptionsDialog::enableSaveButtons() void OptionsDialog::enableSaveButtons()
{ {
/* prevent enabling of the save buttons when data modified, if there is an invalid proxy address present */ /* prevent enabling of the save buttons when data modified, if there is an invalid proxy address present */
@ -179,7 +192,7 @@ void OptionsDialog::on_cancelButton_clicked()
void OptionsDialog::on_applyButton_clicked() void OptionsDialog::on_applyButton_clicked()
{ {
mapper->submit(); mapper->submit();
ui->applyButton->setEnabled(false); disableApplyButton();
} }
void OptionsDialog::showRestartWarning_Proxy() void OptionsDialog::showRestartWarning_Proxy()

View File

@ -26,6 +26,10 @@ protected:
bool eventFilter(QObject *object, QEvent *event); bool eventFilter(QObject *object, QEvent *event);
private slots: private slots:
/* enable only apply button */
void enableApplyButton();
/* disable only apply button */
void disableApplyButton();
/* enable apply button and OK button */ /* enable apply button and OK button */
void enableSaveButtons(); void enableSaveButtons();
/* disable apply button and OK button */ /* disable apply button and OK button */