diff options
author | Luke Dashjr <luke-jr+git@utopios.org> | 2021-12-02 16:59:46 +0000 |
---|---|---|
committer | Luke Dashjr <luke-jr+git@utopios.org> | 2023-07-21 17:45:36 +0000 |
commit | 98e9ac51992b2332587d87f25351988bf4863238 (patch) | |
tree | 4e971c4bbfeab4cadcf14e426d756bb2b3da0e16 /src/qt/optionsdialog.cpp | |
parent | 3a6757eed9a24e91e7d800d8026cc3a5c4840141 (diff) | |
download | bitcoin-98e9ac51992b2332587d87f25351988bf4863238.tar.xz |
GUI: Use FontChoice type in OptionsModel settings abstraction
Diffstat (limited to 'src/qt/optionsdialog.cpp')
-rw-r--r-- | src/qt/optionsdialog.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp index 6dec4b2e42..fcc9aced09 100644 --- a/src/qt/optionsdialog.cpp +++ b/src/qt/optionsdialog.cpp @@ -198,6 +198,15 @@ void OptionsDialog::setModel(OptionsModel *_model) setMapper(); mapper->toFirst(); + const auto& font_for_money = _model->data(_model->index(OptionsModel::FontForMoney, 0), Qt::EditRole).value<OptionsModel::FontChoice>(); + if (std::holds_alternative<OptionsModel::FontChoiceAbstract>(font_for_money)) { + ui->embeddedFont_radioButton->setChecked(font_for_money != OptionsModel::UseBestSystemFont); + ui->systemFont_radioButton->setChecked(font_for_money == OptionsModel::UseBestSystemFont); + } else { + ui->embeddedFont_radioButton->setChecked(false); + ui->systemFont_radioButton->setChecked(false); + } + updateDefaultProxyNets(); } @@ -275,7 +284,6 @@ void OptionsDialog::setMapper() mapper->addMapping(ui->lang, OptionsModel::Language); mapper->addMapping(ui->unit, OptionsModel::DisplayUnit); mapper->addMapping(ui->thirdPartyTxUrls, OptionsModel::ThirdPartyTxUrls); - mapper->addMapping(ui->embeddedFont_radioButton, OptionsModel::UseEmbeddedMonospacedFont); } void OptionsDialog::setOkButtonState(bool fState) @@ -337,6 +345,12 @@ void OptionsDialog::on_openBitcoinConfButton_clicked() void OptionsDialog::on_okButton_clicked() { + if (ui->embeddedFont_radioButton->isChecked()) { + model->setData(model->index(OptionsModel::FontForMoney, 0), QVariant::fromValue(OptionsModel::FontChoice{OptionsModel::FontChoiceAbstract::EmbeddedFont})); + } else if (ui->systemFont_radioButton->isChecked()) { + model->setData(model->index(OptionsModel::FontForMoney, 0), QVariant::fromValue(OptionsModel::FontChoice{OptionsModel::FontChoiceAbstract::BestSystemFont})); + } + mapper->submit(); accept(); updateDefaultProxyNets(); |