From 9b8b8075df8d041ba6b3115652b5a6f08972c23b Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Sat, 15 Feb 2014 10:38:06 +0100 Subject: [PATCH] qt: Add option to (not) spend unconfirmed change - Add a wallet tab to options dialog - Move fee setting to wallet tab - Add new setting to set -nospendzeroconfchange from UI Conflicts: src/qt/optionsmodel.cpp src/qt/optionsmodel.h Conflicts: src/qt/forms/optionsdialog.ui src/qt/optionsmodel.h Rebased-from: 391cf691d5eee2934ed0e2e2b59bd99987c394a5 0.8.x --- src/qt/forms/optionsdialog.ui | 107 +++++++++++++++++++++++----------- src/qt/optionsdialog.cpp | 5 +- src/qt/optionsmodel.cpp | 9 +++ src/qt/optionsmodel.h | 1 + 4 files changed, 86 insertions(+), 36 deletions(-) diff --git a/src/qt/forms/optionsdialog.ui b/src/qt/forms/optionsdialog.ui index bfa3354a6..f968f9c00 100644 --- a/src/qt/forms/optionsdialog.ui +++ b/src/qt/forms/optionsdialog.ui @@ -30,6 +30,66 @@ &Main + + + + Automatically start Litecoin after logging in to the system. + + + &Start Litecoin on system login + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Reset all client options to default. + + + &Reset Options + + + false + + + + + + + + + + W&allet + + @@ -77,17 +137,24 @@ - - - Automatically start Litecoin after logging in to the system. + + + If you disable the spending of unconfirmed change, the change from a transaction cannot be used until that transaction has at least one confirmation. This also affects how your balance is computed. + + true + + + + + - &Start Litecoin on system login + Spend unconfirmed change (experts only) - + Qt::Vertical @@ -99,36 +166,6 @@ - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Reset all client options to default. - - - &Reset Options - - - false - - - - - diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp index 76873fc7e..3b455b6b8 100644 --- a/src/qt/optionsdialog.cpp +++ b/src/qt/optionsdialog.cpp @@ -129,9 +129,12 @@ void OptionsDialog::setModel(OptionsModel *model) void OptionsDialog::setMapper() { /* Main */ - mapper->addMapping(ui->transactionFee, OptionsModel::Fee); mapper->addMapping(ui->bitcoinAtStartup, OptionsModel::StartAtStartup); + /* Wallet */ + mapper->addMapping(ui->transactionFee, OptionsModel::Fee); + mapper->addMapping(ui->spendZeroConfChange, OptionsModel::SpendZeroConfChange); + /* Network */ mapper->addMapping(ui->mapPortUpnp, OptionsModel::MapPortUPnP); diff --git a/src/qt/optionsmodel.cpp b/src/qt/optionsmodel.cpp index 38818e6e7..e9a474c62 100644 --- a/src/qt/optionsmodel.cpp +++ b/src/qt/optionsmodel.cpp @@ -51,6 +51,7 @@ void OptionsModel::Init() fMinimizeToTray = settings.value("fMinimizeToTray", false).toBool(); fMinimizeOnClose = settings.value("fMinimizeOnClose", false).toBool(); nTransactionFee = settings.value("nTransactionFee").toLongLong(); + bSpendZeroConfChange = settings.value("bSpendZeroConfChange").toBool(); language = settings.value("language", "").toString(); fCoinControlFeatures = settings.value("fCoinControlFeatures", false).toBool(); @@ -195,6 +196,8 @@ QVariant OptionsModel::data(const QModelIndex & index, int role) const } case Fee: return QVariant(nTransactionFee); + case SpendZeroConfChange: + return bSpendZeroConfChange; case DisplayUnit: return QVariant(nDisplayUnit); case DisplayAddresses: @@ -273,6 +276,12 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in settings.setValue("nTransactionFee", nTransactionFee); emit transactionFeeChanged(nTransactionFee); break; + case SpendZeroConfChange: + if (settings.value("bSpendZeroConfChange") != value) { + bSpendZeroConfChange = value.toBool(); + settings.setValue("bSpendZeroConfChange", value); + } + break; case DisplayUnit: nDisplayUnit = value.toInt(); settings.setValue("nDisplayUnit", nDisplayUnit); diff --git a/src/qt/optionsmodel.h b/src/qt/optionsmodel.h index dd900ad3f..91fc7e1b8 100644 --- a/src/qt/optionsmodel.h +++ b/src/qt/optionsmodel.h @@ -34,6 +34,7 @@ public: DisplayAddresses, // bool Language, // QString CoinControlFeatures, // bool + SpendZeroConfChange, // bool OptionIDRowCount, };