dash/src/qt/coincontroldialog.h

117 lines
2.8 KiB
C
Raw Normal View History

// Copyright (c) 2011-2020 The Bitcoin Core developers
2014-12-13 05:09:33 +01:00
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
2014-11-03 16:16:40 +01:00
#ifndef BITCOIN_QT_COINCONTROLDIALOG_H
#define BITCOIN_QT_COINCONTROLDIALOG_H
2013-08-12 17:03:03 +02:00
Backport 11651 (#3358) * scripted-diff: Replace #include "" with #include <> (ryanofsky) -BEGIN VERIFY SCRIPT- for f in \ src/*.cpp \ src/*.h \ src/bench/*.cpp \ src/bench/*.h \ src/compat/*.cpp \ src/compat/*.h \ src/consensus/*.cpp \ src/consensus/*.h \ src/crypto/*.cpp \ src/crypto/*.h \ src/crypto/ctaes/*.h \ src/policy/*.cpp \ src/policy/*.h \ src/primitives/*.cpp \ src/primitives/*.h \ src/qt/*.cpp \ src/qt/*.h \ src/qt/test/*.cpp \ src/qt/test/*.h \ src/rpc/*.cpp \ src/rpc/*.h \ src/script/*.cpp \ src/script/*.h \ src/support/*.cpp \ src/support/*.h \ src/support/allocators/*.h \ src/test/*.cpp \ src/test/*.h \ src/wallet/*.cpp \ src/wallet/*.h \ src/wallet/test/*.cpp \ src/wallet/test/*.h \ src/zmq/*.cpp \ src/zmq/*.h do base=${f%/*}/ relbase=${base#src/} sed -i "s:#include \"\(.*\)\"\(.*\):if test -e \$base'\\1'; then echo \"#include <\"\$relbase\"\\1>\\2\"; else echo \"#include <\\1>\\2\"; fi:e" $f done -END VERIFY SCRIPT- Signed-off-by: Pasta <pasta@dashboost.org> * scripted-diff: Replace #include "" with #include <> (Dash Specific) -BEGIN VERIFY SCRIPT- for f in \ src/bls/*.cpp \ src/bls/*.h \ src/evo/*.cpp \ src/evo/*.h \ src/governance/*.cpp \ src/governance/*.h \ src/llmq/*.cpp \ src/llmq/*.h \ src/masternode/*.cpp \ src/masternode/*.h \ src/privatesend/*.cpp \ src/privatesend/*.h do base=${f%/*}/ relbase=${base#src/} sed -i "s:#include \"\(.*\)\"\(.*\):if test -e \$base'\\1'; then echo \"#include <\"\$relbase\"\\1>\\2\"; else echo \"#include <\\1>\\2\"; fi:e" $f done -END VERIFY SCRIPT- Signed-off-by: Pasta <pasta@dashboost.org> * build: Remove -I for everything but project root Remove -I from build system for everything but the project root, and built-in dependencies. Signed-off-by: Pasta <pasta@dashboost.org> # Conflicts: # src/Makefile.test.include * qt: refactor: Use absolute include paths in .ui files * qt: refactor: Changes to make include paths absolute This makes all include paths in the GUI absolute. Many changes are involved as every single source file in src/qt/ assumes to be able to use relative includes. Signed-off-by: Pasta <pasta@dashboost.org> # Conflicts: # src/qt/dash.cpp # src/qt/optionsmodel.cpp # src/qt/test/rpcnestedtests.cpp * test: refactor: Use absolute include paths for test data files * Recommend #include<> syntax in developer notes * refactor: Include obj/build.h instead of build.h * END BACKPORT #11651 Remove trailing whitespace causing travis failure * fix backport 11651 Signed-off-by: Pasta <pasta@dashboost.org> * More of 11651 * fix blockchain.cpp Signed-off-by: pasta <pasta@dashboost.org> * Add missing "qt/" in includes * Add missing "test/" in includes * Fix trailing whitespaces Co-authored-by: Wladimir J. van der Laan <laanwj@gmail.com> Co-authored-by: Russell Yanofsky <russ@yanofsky.org> Co-authored-by: MeshCollider <dobsonsa68@gmail.com> Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-03-19 23:46:56 +01:00
#include <amount.h>
2013-08-12 17:03:03 +02:00
#include <QAbstractButton>
#include <QAction>
#include <QDialog>
#include <QList>
#include <QMenu>
#include <QPoint>
#include <QString>
#include <QTreeWidgetItem>
class WalletModel;
2013-08-12 17:03:03 +02:00
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;
};
2013-08-12 17:03:03 +02:00
class CoinControlDialog : public QDialog
{
Q_OBJECT
public:
Backport 18894: gui: Fix manual coin control with multiple wallets loaded (#3777) * Merge #18894: gui: Fix manual coin control with multiple wallets loaded a8b5f1b133d4f23975a3fbfb7a415b17261466ee 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: utACK a8b5f1b133d4f23975a3fbfb7a415b17261466ee ryanofsky: Code review ACK a8b5f1b133d4f23975a3fbfb7a415b17261466ee. 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: ACK a8b5f1b133d4f23975a3fbfb7a415b17261466ee Sjors: tACK a8b5f1b133d4f23975a3fbfb7a415b17261466ee Tree-SHA512: 3ad9c51bab6f28ec0e90efbd6f43fa510c81dafb2eff0b8c3724efcee3e030054a10be013e27cefe35763374c5f6d7af8c02658736964f733d7e38b646b5df65 * Update src/qt/coincontroldialog.cpp Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com> Co-authored-by: Jonas Schnelli <dev@jonasschnelli.ch> Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
2020-11-09 22:57:20 +01:00
explicit CoinControlDialog(CCoinControl& coin_control, WalletModel* model, QWidget *parent = nullptr);
2013-08-12 17:03:03 +02:00
~CoinControlDialog();
// static because also called from sendcoinsdialog
Backport 18894: gui: Fix manual coin control with multiple wallets loaded (#3777) * Merge #18894: gui: Fix manual coin control with multiple wallets loaded a8b5f1b133d4f23975a3fbfb7a415b17261466ee 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: utACK a8b5f1b133d4f23975a3fbfb7a415b17261466ee ryanofsky: Code review ACK a8b5f1b133d4f23975a3fbfb7a415b17261466ee. 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: ACK a8b5f1b133d4f23975a3fbfb7a415b17261466ee Sjors: tACK a8b5f1b133d4f23975a3fbfb7a415b17261466ee Tree-SHA512: 3ad9c51bab6f28ec0e90efbd6f43fa510c81dafb2eff0b8c3724efcee3e030054a10be013e27cefe35763374c5f6d7af8c02658736964f733d7e38b646b5df65 * Update src/qt/coincontroldialog.cpp Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com> Co-authored-by: Jonas Schnelli <dev@jonasschnelli.ch> Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
2020-11-09 22:57:20 +01:00
static void updateLabels(CCoinControl& m_coin_control, WalletModel*, QDialog*);
2013-08-12 17:03:03 +02:00
2014-04-23 00:46:19 +02:00
static QList<CAmount> payAmounts;
static bool fSubtractFeeFromAmount;
2013-08-12 17:03:03 +02:00
private:
Ui::CoinControlDialog *ui;
Backport 18894: gui: Fix manual coin control with multiple wallets loaded (#3777) * Merge #18894: gui: Fix manual coin control with multiple wallets loaded a8b5f1b133d4f23975a3fbfb7a415b17261466ee 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: utACK a8b5f1b133d4f23975a3fbfb7a415b17261466ee ryanofsky: Code review ACK a8b5f1b133d4f23975a3fbfb7a415b17261466ee. 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: ACK a8b5f1b133d4f23975a3fbfb7a415b17261466ee Sjors: tACK a8b5f1b133d4f23975a3fbfb7a415b17261466ee Tree-SHA512: 3ad9c51bab6f28ec0e90efbd6f43fa510c81dafb2eff0b8c3724efcee3e030054a10be013e27cefe35763374c5f6d7af8c02658736964f733d7e38b646b5df65 * Update src/qt/coincontroldialog.cpp Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com> Co-authored-by: Jonas Schnelli <dev@jonasschnelli.ch> Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
2020-11-09 22:57:20 +01:00
CCoinControl& m_coin_control;
2013-08-12 17:03:03 +02:00
WalletModel *model;
int sortColumn;
Qt::SortOrder sortOrder;
QMenu *contextMenu;
QTreeWidgetItem *contextMenuItem;
QAction *copyTransactionHashAction;
QAction *lockAction;
QAction *unlockAction;
qt: Finetune CoinControlDialog + bitcoin#14828 (#3701) * qt: Add min-height for CoinControlTreeWidget#treeWidget::item The rows resize without it if they get locked and the lock icon appears besides the checkbox. Looks weird.. and especially if you press the lock all button its just not nice. * qt: Set background transparency for CoinControl item::hover * Merge #14828: qt: Remove hidden columns in coin control dialog 1c28feb7d qt: Remove hidden columns in coin control dialog (João Barbosa) Pull request description: Instead of having hidden columns, store the data in specific roles. Overlaps with #14817, fixes #11811. Tree-SHA512: e86e9ca426b9146ac28997ca1920dbae6cc4e2e494ff94fe131d605cd6c013183fc5de10036c886a4d6dcae497ac4067de3791be0ef9c88f7ce9f57f7bd97422 * qt: Add border-bottom for tree items in CoinControl * qt: Stretch address column in CoinControlDialog * Adjust column width for a couple of columns * qt: Hide PrivateSend rounds column for normal Send tab's CoinControl * qt: Hide unrelated coins in CoinControl based on active mode. Still allow to show them. * qt: Hide empty top level items in CoinControlDialog's tree mode * qt: Hide tree/list radio buttons and default to list for PrivateSend * qt: Hide address/label column in CoinControl for PrivateSend * qt: Remove obsolete empty columns * qt: Rename column "PS Rounds" to "Mixing Rounds" * qt: Move border-bottom in already existing css selector * Reveal all PS related coins in coincontrol while in PS mode, not only ones with rounds>=1 Also tweak button text * qt: Only moving a statement a bit * qt: Hide the "hideButton" in CoinControlDialog if PrivatSend is disabled And make it default to show all coins in that case.. Co-authored-by: Jonas Schnelli <dev@jonasschnelli.ch> Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-09-23 09:31:50 +02:00
bool fHideAdditional{true};
2013-08-12 17:03:03 +02:00
void sortView(int, Qt::SortOrder);
void updateView();
enum
{
COLUMN_CHECKBOX = 0,
2013-08-12 17:03:03 +02:00
COLUMN_AMOUNT,
COLUMN_LABEL,
COLUMN_ADDRESS,
COLUMN_COINJOIN_ROUNDS,
2013-08-12 17:03:03 +02:00
COLUMN_DATE,
COLUMN_CONFIRMATIONS,
};
qt: Finetune CoinControlDialog + bitcoin#14828 (#3701) * qt: Add min-height for CoinControlTreeWidget#treeWidget::item The rows resize without it if they get locked and the lock icon appears besides the checkbox. Looks weird.. and especially if you press the lock all button its just not nice. * qt: Set background transparency for CoinControl item::hover * Merge #14828: qt: Remove hidden columns in coin control dialog 1c28feb7d qt: Remove hidden columns in coin control dialog (João Barbosa) Pull request description: Instead of having hidden columns, store the data in specific roles. Overlaps with #14817, fixes #11811. Tree-SHA512: e86e9ca426b9146ac28997ca1920dbae6cc4e2e494ff94fe131d605cd6c013183fc5de10036c886a4d6dcae497ac4067de3791be0ef9c88f7ce9f57f7bd97422 * qt: Add border-bottom for tree items in CoinControl * qt: Stretch address column in CoinControlDialog * Adjust column width for a couple of columns * qt: Hide PrivateSend rounds column for normal Send tab's CoinControl * qt: Hide unrelated coins in CoinControl based on active mode. Still allow to show them. * qt: Hide empty top level items in CoinControlDialog's tree mode * qt: Hide tree/list radio buttons and default to list for PrivateSend * qt: Hide address/label column in CoinControl for PrivateSend * qt: Remove obsolete empty columns * qt: Rename column "PS Rounds" to "Mixing Rounds" * qt: Move border-bottom in already existing css selector * Reveal all PS related coins in coincontrol while in PS mode, not only ones with rounds>=1 Also tweak button text * qt: Only moving a statement a bit * qt: Hide the "hideButton" in CoinControlDialog if PrivatSend is disabled And make it default to show all coins in that case.. Co-authored-by: Jonas Schnelli <dev@jonasschnelli.ch> Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-09-23 09:31:50 +02:00
enum
{
TxHashRole = Qt::UserRole,
VOutRole
};
friend class CCoinControlWidgetItem;
2014-03-03 04:16:42 +01:00
private Q_SLOTS:
2013-08-12 17:03:03 +02:00
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 buttonToggleLockClicked();
2013-08-12 17:03:03 +02:00
void updateLabelLocked();
qt: Finetune CoinControlDialog + bitcoin#14828 (#3701) * qt: Add min-height for CoinControlTreeWidget#treeWidget::item The rows resize without it if they get locked and the lock icon appears besides the checkbox. Looks weird.. and especially if you press the lock all button its just not nice. * qt: Set background transparency for CoinControl item::hover * Merge #14828: qt: Remove hidden columns in coin control dialog 1c28feb7d qt: Remove hidden columns in coin control dialog (João Barbosa) Pull request description: Instead of having hidden columns, store the data in specific roles. Overlaps with #14817, fixes #11811. Tree-SHA512: e86e9ca426b9146ac28997ca1920dbae6cc4e2e494ff94fe131d605cd6c013183fc5de10036c886a4d6dcae497ac4067de3791be0ef9c88f7ce9f57f7bd97422 * qt: Add border-bottom for tree items in CoinControl * qt: Stretch address column in CoinControlDialog * Adjust column width for a couple of columns * qt: Hide PrivateSend rounds column for normal Send tab's CoinControl * qt: Hide unrelated coins in CoinControl based on active mode. Still allow to show them. * qt: Hide empty top level items in CoinControlDialog's tree mode * qt: Hide tree/list radio buttons and default to list for PrivateSend * qt: Hide address/label column in CoinControl for PrivateSend * qt: Remove obsolete empty columns * qt: Rename column "PS Rounds" to "Mixing Rounds" * qt: Move border-bottom in already existing css selector * Reveal all PS related coins in coincontrol while in PS mode, not only ones with rounds>=1 Also tweak button text * qt: Only moving a statement a bit * qt: Hide the "hideButton" in CoinControlDialog if PrivatSend is disabled And make it default to show all coins in that case.. Co-authored-by: Jonas Schnelli <dev@jonasschnelli.ch> Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-09-23 09:31:50 +02:00
void on_hideButton_clicked();
2013-08-12 17:03:03 +02:00
};
2014-11-03 16:16:40 +01:00
#endif // BITCOIN_QT_COINCONTROLDIALOG_H