Skip to content

Commit 0ff0688

Browse files
committed
qml: Add targetBlocks property to WalletQmlModel
This property will be used to set the target number of blocks for the standard fees listed in the UI drop down menu.
1 parent b4ade11 commit 0ff0688

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/qml/models/walletqmlmodel.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,3 +205,16 @@ std::vector<COutPoint> WalletQmlModel::listSelectedCoins() const
205205
{
206206
return m_coin_control.ListSelected();
207207
}
208+
209+
unsigned int WalletQmlModel::feeTargetBlocks() const
210+
{
211+
return m_coin_control.m_confirm_target.value_or(wallet::DEFAULT_TX_CONFIRM_TARGET);
212+
}
213+
214+
void WalletQmlModel::setFeeTargetBlocks(unsigned int target_blocks)
215+
{
216+
if (m_coin_control.m_confirm_target != target_blocks) {
217+
m_coin_control.m_confirm_target = target_blocks;
218+
Q_EMIT feeTargetBlocksChanged();
219+
}
220+
}

src/qml/models/walletqmlmodel.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class WalletQmlModel : public QObject
2828
Q_PROPERTY(CoinsListModel* coinsListModel READ coinsListModel CONSTANT)
2929
Q_PROPERTY(SendRecipient* sendRecipient READ sendRecipient CONSTANT)
3030
Q_PROPERTY(WalletQmlModelTransaction* currentTransaction READ currentTransaction NOTIFY currentTransactionChanged)
31+
Q_PROPERTY(unsigned int targetBlocks READ feeTargetBlocks WRITE setFeeTargetBlocks NOTIFY feeTargetBlocksChanged)
3132

3233
public:
3334
WalletQmlModel(std::unique_ptr<interfaces::Wallet> wallet, QObject* parent = nullptr);
@@ -63,11 +64,14 @@ class WalletQmlModel : public QObject
6364
void unselectCoin(const COutPoint& output);
6465
bool isSelectedCoin(const COutPoint& output);
6566
std::vector<COutPoint> listSelectedCoins() const;
67+
unsigned int feeTargetBlocks() const;
68+
void setFeeTargetBlocks(unsigned int target_blocks);
6669

6770
Q_SIGNALS:
6871
void nameChanged();
6972
void balanceChanged();
7073
void currentTransactionChanged();
74+
void feeTargetBlocksChanged();
7175

7276
private:
7377
std::unique_ptr<interfaces::Wallet> m_wallet;

0 commit comments

Comments
 (0)