From 08291806a0567edfa6537a1535f71f01d9e617f9 Mon Sep 17 00:00:00 2001 From: Jarol Rodriguez Date: Mon, 27 Sep 2021 02:44:52 -0400 Subject: [PATCH] qt: move third-party tx URL setting from Display to Wallet options tab Out of all the settings in the Display tab, the 'Third-party transaction URLs' is the odd one out. All other settings here affect the way the GUI is displayed. This action affects what context menu actions are available when wallet functionality is enabled, and we have a transaction. As such, it is a better fit for this to be in the Wallet tab. --- src/qt/forms/optionsdialog.ui | 56 +++++++++++++++++------------------ src/qt/optionsdialog.cpp | 4 +-- src/qt/optionsmodel.cpp | 20 ++++++------- 3 files changed, 40 insertions(+), 40 deletions(-) diff --git a/src/qt/forms/optionsdialog.ui b/src/qt/forms/optionsdialog.ui index 1c221246169..369945ef0db 100644 --- a/src/qt/forms/optionsdialog.ui +++ b/src/qt/forms/optionsdialog.ui @@ -189,7 +189,7 @@ - This allows you or a third party tool to communicate with the node through command-line and JSON-RPC commands. + This allows you or a third-party tool to communicate with the node through command-line and JSON-RPC commands. Enable RPC &server @@ -226,6 +226,33 @@ + + + + + + Third-party URLs (e.g. a block explorer) that appear in the transactions tab as context menu items. "%s" in the URL is replaced by the transaction hash. Multiple URLs are separated by a vertical bar |. + + + &Third-party transaction URLs + + + thirdPartyTxUrls + + + + + + + Third-party URLs (e.g. a block explorer) that appear in the transactions tab as context menu items. "%s" in the URL is replaced by the transaction hash. Multiple URLs are separated by a vertical bar |. + + + https://example.com/tx/%s + + + + + @@ -734,33 +761,6 @@ - - - - - - Third-party URLs (e.g. a block explorer) that appear in the transactions tab as context menu items. %s in the URL is replaced by transaction hash. Multiple URLs are separated by vertical bar |. - - - &Third-party transaction URLs - - - thirdPartyTxUrls - - - - - - - Third-party URLs (e.g. a block explorer) that appear in the transactions tab as context menu items. %s in the URL is replaced by transaction hash. Multiple URLs are separated by vertical bar |. - - - https://example.com/tx/%s - - - - - diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp index 0cc2d61df61..c11be076df5 100644 --- a/src/qt/optionsdialog.cpp +++ b/src/qt/optionsdialog.cpp @@ -207,6 +207,7 @@ void OptionsDialog::setModel(OptionsModel *_model) connect(ui->externalSignerPath, &QLineEdit::textChanged, [this]{ showRestartWarning(); }); connect(ui->threadsScriptVerif, qOverload(&QSpinBox::valueChanged), this, &OptionsDialog::showRestartWarning); /* Wallet */ + connect(ui->thirdPartyTxUrls, &QLineEdit::textChanged, [this] { showRestartWarning(); }); connect(ui->spendZeroConfChange, &QCheckBox::clicked, this, &OptionsDialog::showRestartWarning); /* Network */ connect(ui->allowIncoming, &QCheckBox::clicked, this, &OptionsDialog::showRestartWarning); @@ -215,7 +216,6 @@ void OptionsDialog::setModel(OptionsModel *_model) connect(ui->connectSocksTor, &QCheckBox::clicked, this, &OptionsDialog::showRestartWarning); /* Display */ connect(ui->lang, qOverload<>(&QValueComboBox::valueChanged), [this]{ showRestartWarning(); }); - connect(ui->thirdPartyTxUrls, &QLineEdit::textChanged, [this]{ showRestartWarning(); }); } void OptionsDialog::setCurrentTab(OptionsDialog::Tab tab) @@ -241,6 +241,7 @@ void OptionsDialog::setMapper() mapper->addMapping(ui->spendZeroConfChange, OptionsModel::SpendZeroConfChange); mapper->addMapping(ui->coinControlFeatures, OptionsModel::CoinControlFeatures); mapper->addMapping(ui->subFeeFromAmount, OptionsModel::SubFeeFromAmount); + mapper->addMapping(ui->thirdPartyTxUrls, OptionsModel::ThirdPartyTxUrls); mapper->addMapping(ui->externalSignerPath, OptionsModel::ExternalSignerPath); /* Network */ @@ -269,7 +270,6 @@ void OptionsDialog::setMapper() /* Display */ 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); } diff --git a/src/qt/optionsmodel.cpp b/src/qt/optionsmodel.cpp index 9e2f38f7ec6..1772ace177c 100644 --- a/src/qt/optionsmodel.cpp +++ b/src/qt/optionsmodel.cpp @@ -75,10 +75,6 @@ void OptionsModel::Init(bool resetSettings) settings.setValue("nDisplayUnit", BitcoinUnits::BTC); nDisplayUnit = settings.value("nDisplayUnit").toInt(); - if (!settings.contains("strThirdPartyTxUrls")) - settings.setValue("strThirdPartyTxUrls", ""); - strThirdPartyTxUrls = settings.value("strThirdPartyTxUrls", "").toString(); - if (!settings.contains("fCoinControlFeatures")) settings.setValue("fCoinControlFeatures", false); fCoinControlFeatures = settings.value("fCoinControlFeatures", false).toBool(); @@ -129,6 +125,10 @@ void OptionsModel::Init(bool resetSettings) settings.setValue("SubFeeFromAmount", false); } m_sub_fee_from_amount = settings.value("SubFeeFromAmount", false).toBool(); + + if (!settings.contains("strThirdPartyTxUrls")) + settings.setValue("strThirdPartyTxUrls", ""); + strThirdPartyTxUrls = settings.value("strThirdPartyTxUrls", "").toString(); #endif // Network @@ -349,11 +349,11 @@ QVariant OptionsModel::data(const QModelIndex & index, int role) const return settings.value("external_signer_path"); case SubFeeFromAmount: return m_sub_fee_from_amount; + case ThirdPartyTxUrls: + return strThirdPartyTxUrls; #endif case DisplayUnit: return nDisplayUnit; - case ThirdPartyTxUrls: - return strThirdPartyTxUrls; case Language: return settings.value("language"); case UseEmbeddedMonospacedFont: @@ -480,10 +480,6 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in m_sub_fee_from_amount = value.toBool(); settings.setValue("SubFeeFromAmount", m_sub_fee_from_amount); break; -#endif - case DisplayUnit: - setDisplayUnit(value); - break; case ThirdPartyTxUrls: if (strThirdPartyTxUrls != value.toString()) { strThirdPartyTxUrls = value.toString(); @@ -491,6 +487,10 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in setRestartRequired(true); } break; +#endif + case DisplayUnit: + setDisplayUnit(value); + break; case Language: if (settings.value("language") != value) { settings.setValue("language", value);