mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-05 10:17:30 -05:00
246e878e78
a8b5f1b133
gui: Fix manual coin control with multiple wallets loaded (João Barbosa) Pull request description: This PR ensures each loaded wallet has a dedicated coin control in the send view which is manipulated by the coin control dialog. This is an alternative to #17457. Two main differences are: - scope reduced - no unnecessary changes unrelated to the fix; - approach taken - coin control instance now belongs to the send view. All problems raised in #17457 reviews no longer apply due to the approach taken - https://github.com/bitcoin/bitcoin/pull/17457#pullrequestreview-319297589 and https://github.com/bitcoin/bitcoin/pull/17457#issuecomment-555920829) No change in behavior if only one wallet is loaded. Closes #15725. ACKs for top commit: jonasschnelli: utACKa8b5f1b133
ryanofsky: Code review ACKa8b5f1b133
. Code changes are very straightforward, just replacing global CCoinControl object with SendCoinsDialog member. Not sure if this means coin control settings are reset between payments. It would be good to note in the PR description or release notes if single wallet behavior is affected hebasto: ACKa8b5f1b133
Sjors: tACKa8b5f1b133
Tree-SHA512: 3ad9c51bab6f28ec0e90efbd6f43fa510c81dafb2eff0b8c3724efcee3e030054a10be013e27cefe35763374c5f6d7af8c02658736964f733d7e38b646b5df65
114 lines
2.7 KiB
C++
114 lines
2.7 KiB
C++
// Copyright (c) 2011-2018 The Bitcoin Core developers
|
|
// Distributed under the MIT software license, see the accompanying
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
#ifndef BITCOIN_QT_COINCONTROLDIALOG_H
|
|
#define BITCOIN_QT_COINCONTROLDIALOG_H
|
|
|
|
#include <amount.h>
|
|
|
|
#include <QAbstractButton>
|
|
#include <QAction>
|
|
#include <QDialog>
|
|
#include <QList>
|
|
#include <QMenu>
|
|
#include <QPoint>
|
|
#include <QString>
|
|
#include <QTreeWidgetItem>
|
|
|
|
class PlatformStyle;
|
|
class WalletModel;
|
|
|
|
class CCoinControl;
|
|
|
|
namespace Ui {
|
|
class CoinControlDialog;
|
|
}
|
|
|
|
#define ASYMP_UTF8 "\xE2\x89\x88"
|
|
|
|
class CCoinControlWidgetItem : public QTreeWidgetItem
|
|
{
|
|
public:
|
|
explicit CCoinControlWidgetItem(QTreeWidget *parent, int type = Type) : QTreeWidgetItem(parent, type) {}
|
|
explicit CCoinControlWidgetItem(QTreeWidgetItem *parent, int type = Type) : QTreeWidgetItem(parent, type) {}
|
|
|
|
bool operator<(const QTreeWidgetItem &other) const override;
|
|
};
|
|
|
|
|
|
class CoinControlDialog : public QDialog
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit CoinControlDialog(CCoinControl& coin_control, WalletModel* model, const PlatformStyle *platformStyle, QWidget *parent = nullptr);
|
|
~CoinControlDialog();
|
|
|
|
// static because also called from sendcoinsdialog
|
|
static void updateLabels(CCoinControl& m_coin_control, WalletModel*, QDialog*);
|
|
|
|
static QList<CAmount> payAmounts;
|
|
static bool fSubtractFeeFromAmount;
|
|
|
|
private:
|
|
Ui::CoinControlDialog *ui;
|
|
CCoinControl& m_coin_control;
|
|
WalletModel *model;
|
|
int sortColumn;
|
|
Qt::SortOrder sortOrder;
|
|
|
|
QMenu *contextMenu;
|
|
QTreeWidgetItem *contextMenuItem;
|
|
QAction *copyTransactionHashAction;
|
|
QAction *lockAction;
|
|
QAction *unlockAction;
|
|
|
|
const PlatformStyle *platformStyle;
|
|
|
|
void sortView(int, Qt::SortOrder);
|
|
void updateView();
|
|
|
|
enum
|
|
{
|
|
COLUMN_CHECKBOX = 0,
|
|
COLUMN_AMOUNT,
|
|
COLUMN_LABEL,
|
|
COLUMN_ADDRESS,
|
|
COLUMN_DATE,
|
|
COLUMN_CONFIRMATIONS,
|
|
};
|
|
|
|
enum
|
|
{
|
|
TxHashRole = Qt::UserRole,
|
|
VOutRole
|
|
};
|
|
|
|
friend class CCoinControlWidgetItem;
|
|
|
|
private Q_SLOTS:
|
|
void showMenu(const QPoint &);
|
|
void copyAmount();
|
|
void copyLabel();
|
|
void copyAddress();
|
|
void copyTransactionHash();
|
|
void lockCoin();
|
|
void unlockCoin();
|
|
void clipboardQuantity();
|
|
void clipboardAmount();
|
|
void clipboardFee();
|
|
void clipboardAfterFee();
|
|
void clipboardBytes();
|
|
void clipboardLowOutput();
|
|
void clipboardChange();
|
|
void radioTreeMode(bool);
|
|
void radioListMode(bool);
|
|
void viewItemChanged(QTreeWidgetItem*, int);
|
|
void headerSectionClicked(int);
|
|
void buttonBoxClicked(QAbstractButton*);
|
|
void buttonSelectAllClicked();
|
|
void updateLabelLocked();
|
|
};
|
|
|
|
#endif // BITCOIN_QT_COINCONTROLDIALOG_H
|