mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-08 12:19:07 +02:00
Merge bitcoin-core/gui#390: Add SubFeeFromAmount to options
62b125fd197879f112322a1f67a318d6ab22e67a qt, refactor: Fix indentation (Prateek Sancheti) ad28b66e98c9bb3bc7af2545654842544a798601 qt: Add SubFeeFromAmount option (Prateek Sancheti) Pull request description: This PR adds **_SubFeeFromAmount_** option which lets the user select their preferred setting of whether fee for a transaction is to be subtracted from the amount or not for future transactions. The setting chosen by the user is remembered even when the GUI mode is turned off. **_Functionality and Usage:_** - Go to `Settings > Options > Wallet` on _Windows/Linux_ or `bitcoin-qt > Preferences > Wallet` on _macOS_. - The checkbox **Subtract Fee From Amount** corresponds to the added option **SubFeeFromAmount**. - The preferred setting intended to be the default for all future send transactions should be selected by the user. - Click on **OK**. - Go to the **Send** tab in the wallet. - You shall notice, any new Send transaction created will have the preferred setting as chosen by the user.<br> (Try clicking on Add recipient or even restarting the Node in GUI) Attaching ScreenRecordings to explain the added feature. > Master.mov: Master Branch https://user-images.githubusercontent.com/54016434/127763378-be91837d-d0ab-4ae5-87c0-d303fa70a336.mov > PR.mov: PullRequest https://user-images.githubusercontent.com/54016434/127763404-05b834c1-4082-4fbd-9b05-1528ac898a21.mov Close #386 ACKs for top commit: Talkless: tACK 62b125fd197879f112322a1f67a318d6ab22e67a, tested on Debian Sid with 5.15.2 and it works as described. hebasto: re-ACK 62b125fd197879f112322a1f67a318d6ab22e67a, only removed the unused `SubFeeFromAmountChanged` signal since my [previous](https://github.com/bitcoin-core/gui/pull/390#pullrequestreview-726531766) review. meshcollider: utACK 62b125fd197879f112322a1f67a318d6ab22e67a Tree-SHA512: 932ca89ae578a1e1c426561400d87cf005c231944feaf0f662ff8d88f32bdd65a927a090ea41510a15f8ec0ebcd5529672e9917720eb5ea85f413f081e45d5bb
This commit is contained in:
commit
9948f114f8
@ -51,20 +51,20 @@
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_Main_Prune">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="prune">
|
||||
<property name="toolTip">
|
||||
<string>Enabling pruning significantly reduces the disk space required to store transactions. All blocks are still fully validated. Reverting this setting requires re-downloading the entire blockchain.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Prune &block storage to</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="pruneSize"/>
|
||||
</item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_Main_Prune">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="prune">
|
||||
<property name="toolTip">
|
||||
<string>Enabling pruning significantly reduces the disk space required to store transactions. All blocks are still fully validated. Reverting this setting requires re-downloading the entire blockchain.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Prune &block storage to</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="pruneSize"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="pruneSizeUnitLabel">
|
||||
<property name="text">
|
||||
@ -200,6 +200,16 @@
|
||||
<string>W&allet</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_Wallet">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="subFeeFromAmount">
|
||||
<property name="toolTip">
|
||||
<string extracomment="Tooltip text for Options window setting that sets subtracting the fee from a sending amount as default.">Whether to set subtract fee from amount as default or not.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string extracomment="An Options window setting to set subtracting the fee from a sending amount as default.">Subtract &fee from amount by default</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
@ -235,27 +245,27 @@
|
||||
<string>External Signer (e.g. hardware wallet)</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayoutHww">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayoutHww">
|
||||
<item>
|
||||
<widget class="QLabel" name="externalSignerPathLabel">
|
||||
<property name="text">
|
||||
<string>&External signer script path</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>externalSignerPath</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="externalSignerPath">
|
||||
<property name="toolTip">
|
||||
<string>Full path to a Bitcoin Core compatible script (e.g. C:\Downloads\hwi.exe or /Users/you/Downloads/hwi.py). Beware: malware can steal your coins!</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayoutHww">
|
||||
<item>
|
||||
<widget class="QLabel" name="externalSignerPathLabel">
|
||||
<property name="text">
|
||||
<string>&External signer script path</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>externalSignerPath</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="externalSignerPath">
|
||||
<property name="toolTip">
|
||||
<string>Full path to a Bitcoin Core compatible script (e.g. C:\Downloads\hwi.exe or /Users/you/Downloads/hwi.py). Beware: malware can steal your coins!</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -239,6 +239,7 @@ void OptionsDialog::setMapper()
|
||||
/* Wallet */
|
||||
mapper->addMapping(ui->spendZeroConfChange, OptionsModel::SpendZeroConfChange);
|
||||
mapper->addMapping(ui->coinControlFeatures, OptionsModel::CoinControlFeatures);
|
||||
mapper->addMapping(ui->subFeeFromAmount, OptionsModel::SubFeeFromAmount);
|
||||
mapper->addMapping(ui->externalSignerPath, OptionsModel::ExternalSignerPath);
|
||||
|
||||
/* Network */
|
||||
|
@ -124,6 +124,11 @@ void OptionsModel::Init(bool resetSettings)
|
||||
if (!gArgs.SoftSetArg("-signer", settings.value("external_signer_path").toString().toStdString())) {
|
||||
addOverriddenOption("-signer");
|
||||
}
|
||||
|
||||
if (!settings.contains("SubFeeFromAmount")) {
|
||||
settings.setValue("SubFeeFromAmount", false);
|
||||
}
|
||||
m_sub_fee_from_amount = settings.value("SubFeeFromAmount", false).toBool();
|
||||
#endif
|
||||
|
||||
// Network
|
||||
@ -335,6 +340,8 @@ QVariant OptionsModel::data(const QModelIndex & index, int role) const
|
||||
return settings.value("bSpendZeroConfChange");
|
||||
case ExternalSignerPath:
|
||||
return settings.value("external_signer_path");
|
||||
case SubFeeFromAmount:
|
||||
return m_sub_fee_from_amount;
|
||||
#endif
|
||||
case DisplayUnit:
|
||||
return nDisplayUnit;
|
||||
@ -460,6 +467,10 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in
|
||||
setRestartRequired(true);
|
||||
}
|
||||
break;
|
||||
case SubFeeFromAmount:
|
||||
m_sub_fee_from_amount = value.toBool();
|
||||
settings.setValue("SubFeeFromAmount", m_sub_fee_from_amount);
|
||||
break;
|
||||
#endif
|
||||
case DisplayUnit:
|
||||
setDisplayUnit(value);
|
||||
|
@ -61,6 +61,7 @@ public:
|
||||
Language, // QString
|
||||
UseEmbeddedMonospacedFont, // bool
|
||||
CoinControlFeatures, // bool
|
||||
SubFeeFromAmount, // bool
|
||||
ThreadsScriptVerif, // int
|
||||
Prune, // bool
|
||||
PruneSize, // int
|
||||
@ -88,6 +89,7 @@ public:
|
||||
QString getThirdPartyTxUrls() const { return strThirdPartyTxUrls; }
|
||||
bool getUseEmbeddedMonospacedFont() const { return m_use_embedded_monospaced_font; }
|
||||
bool getCoinControlFeatures() const { return fCoinControlFeatures; }
|
||||
bool getSubFeeFromAmount() const { return m_sub_fee_from_amount; }
|
||||
const QString& getOverriddenByCommandLine() { return strOverriddenByCommandLine; }
|
||||
|
||||
/* Explicit setters */
|
||||
@ -112,6 +114,7 @@ private:
|
||||
QString strThirdPartyTxUrls;
|
||||
bool m_use_embedded_monospaced_font;
|
||||
bool fCoinControlFeatures;
|
||||
bool m_sub_fee_from_amount;
|
||||
/* settings that were overridden by command-line */
|
||||
QString strOverriddenByCommandLine;
|
||||
|
||||
|
@ -97,7 +97,9 @@ void SendCoinsEntry::clear()
|
||||
ui->payTo->clear();
|
||||
ui->addAsLabel->clear();
|
||||
ui->payAmount->clear();
|
||||
ui->checkboxSubtractFeeFromAmount->setCheckState(Qt::Unchecked);
|
||||
if (model && model->getOptionsModel()) {
|
||||
ui->checkboxSubtractFeeFromAmount->setChecked(model->getOptionsModel()->getSubFeeFromAmount());
|
||||
}
|
||||
ui->messageTextLabel->clear();
|
||||
ui->messageTextLabel->hide();
|
||||
ui->messageLabel->hide();
|
||||
|
Loading…
x
Reference in New Issue
Block a user