dash/src/qt/overviewpage.cpp

697 lines
31 KiB
C++
Raw Normal View History

// Copyright (c) 2011-2015 The Bitcoin Core developers
// Copyright (c) 2014-2021 The Dash 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.
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 <qt/overviewpage.h>
#include <qt/forms/ui_overviewpage.h>
#include <qt/bitcoinunits.h>
#include <qt/clientmodel.h>
#include <qt/guiutil.h>
#include <qt/optionsmodel.h>
#include <qt/transactionfilterproxy.h>
#include <qt/transactiontablemodel.h>
#include <qt/utilitydialog.h>
#include <qt/walletmodel.h>
#include <coinjoin/options.h>
2011-08-03 21:28:11 +02:00
#include <QAbstractItemDelegate>
#include <QPainter>
2015-07-04 15:29:21 +02:00
#include <QSettings>
2014-12-23 03:28:52 +01:00
#include <QTimer>
qt: Finetune OverviewPage (#3715) * qt: Adjust "Recent Transactions" in Overview tab Make sure they follow the same format as the transactions in TransactionsView. - Removed the transaction type representing arrows - Apply the same coloring like like in the transaction tab for the different transaction types (orange = internal, red = outgoing, green = incoming) * qt: Cleanup layout of OverviewPage in css * qt: Add three spacer (left, middle, right) and adjust layout stretch. This allows to have the elements on the screen aligned symetrically around the center independent from the window size/resizing. * qt: Inrease date/amount size for "Recent Transactions" in Overview tab * qt: Inrease number of "Recent Transactions" displayed in Overview tab Just to fill the empty space * qt: Make sure PS elements show as expected and adjust number of recent transactions based on PS * qt: Adjust transaction entry generation Co-Authored-By: UdjinM6 <UdjinM6@users.noreply.github.com> * qt: Adjust warning message box Co-Authored-By: UdjinM6 <UdjinM6@users.noreply.github.com> * Move tx list style to css * Fix tx list style for the traditional theme * Drop (no longer needed?) min height offset in SetupTransactionList Can't reproduce the tx list scrolling issue anymore * Avoid recreating transaction filter from scratch every time SetupTransactionList is called We call SetupTransactionList every second now (from privateSendStatus()) and this makes GUI unresponsive for huge wallets (I have ~400k txes in my testnet wallet) because of filter recreation/sorting. There is no need to go through all setup steps really, simply updating the limit works just fine and fixes the issue. * qt: Fix an `if` statement * qt: Just some refactoring * fix code style * bail out if `filter->rowCount() == nNumItems` * qt: Make sure number of transactions is always correct * Drop spacer to let recent tx list occupy max height available * TransactionFilterProxy::setLimit should emit signals to let coresponding layouts update themselves https://doc.qt.io/qt-5/qabstractitemmodel.html#layoutAboutToBeChanged https://doc.qt.io/qt-5/qabstractitemmodel.html#layoutChanged Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-09-25 18:04:53 +02:00
#define ITEM_HEIGHT 54
#define NUM_ITEMS_DISABLED 5
#define NUM_ITEMS_ENABLED_NORMAL 6
#define NUM_ITEMS_ENABLED_ADVANCED 8
2011-08-03 21:04:15 +02:00
Q_DECLARE_METATYPE(interfaces::WalletBalances)
2011-08-03 21:28:11 +02:00
class TxViewDelegate : public QAbstractItemDelegate
{
Q_OBJECT
public:
explicit TxViewDelegate(QObject* parent = nullptr) :
QAbstractItemDelegate(), unit(BitcoinUnits::DASH)
{
}
inline void paint(QPainter *painter, const QStyleOptionViewItem &option,
const QModelIndex &index ) const override
{
painter->save();
QRect mainRect = option.rect;
qt: Finetune OverviewPage (#3715) * qt: Adjust "Recent Transactions" in Overview tab Make sure they follow the same format as the transactions in TransactionsView. - Removed the transaction type representing arrows - Apply the same coloring like like in the transaction tab for the different transaction types (orange = internal, red = outgoing, green = incoming) * qt: Cleanup layout of OverviewPage in css * qt: Add three spacer (left, middle, right) and adjust layout stretch. This allows to have the elements on the screen aligned symetrically around the center independent from the window size/resizing. * qt: Inrease date/amount size for "Recent Transactions" in Overview tab * qt: Inrease number of "Recent Transactions" displayed in Overview tab Just to fill the empty space * qt: Make sure PS elements show as expected and adjust number of recent transactions based on PS * qt: Adjust transaction entry generation Co-Authored-By: UdjinM6 <UdjinM6@users.noreply.github.com> * qt: Adjust warning message box Co-Authored-By: UdjinM6 <UdjinM6@users.noreply.github.com> * Move tx list style to css * Fix tx list style for the traditional theme * Drop (no longer needed?) min height offset in SetupTransactionList Can't reproduce the tx list scrolling issue anymore * Avoid recreating transaction filter from scratch every time SetupTransactionList is called We call SetupTransactionList every second now (from privateSendStatus()) and this makes GUI unresponsive for huge wallets (I have ~400k txes in my testnet wallet) because of filter recreation/sorting. There is no need to go through all setup steps really, simply updating the limit works just fine and fixes the issue. * qt: Fix an `if` statement * qt: Just some refactoring * fix code style * bail out if `filter->rowCount() == nNumItems` * qt: Make sure number of transactions is always correct * Drop spacer to let recent tx list occupy max height available * TransactionFilterProxy::setLimit should emit signals to let coresponding layouts update themselves https://doc.qt.io/qt-5/qabstractitemmodel.html#layoutAboutToBeChanged https://doc.qt.io/qt-5/qabstractitemmodel.html#layoutChanged Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-09-25 18:04:53 +02:00
int xspace = 8;
int ypad = 8;
int halfheight = (mainRect.height() - 2*ypad)/2;
qt: Finetune OverviewPage (#3715) * qt: Adjust "Recent Transactions" in Overview tab Make sure they follow the same format as the transactions in TransactionsView. - Removed the transaction type representing arrows - Apply the same coloring like like in the transaction tab for the different transaction types (orange = internal, red = outgoing, green = incoming) * qt: Cleanup layout of OverviewPage in css * qt: Add three spacer (left, middle, right) and adjust layout stretch. This allows to have the elements on the screen aligned symetrically around the center independent from the window size/resizing. * qt: Inrease date/amount size for "Recent Transactions" in Overview tab * qt: Inrease number of "Recent Transactions" displayed in Overview tab Just to fill the empty space * qt: Make sure PS elements show as expected and adjust number of recent transactions based on PS * qt: Adjust transaction entry generation Co-Authored-By: UdjinM6 <UdjinM6@users.noreply.github.com> * qt: Adjust warning message box Co-Authored-By: UdjinM6 <UdjinM6@users.noreply.github.com> * Move tx list style to css * Fix tx list style for the traditional theme * Drop (no longer needed?) min height offset in SetupTransactionList Can't reproduce the tx list scrolling issue anymore * Avoid recreating transaction filter from scratch every time SetupTransactionList is called We call SetupTransactionList every second now (from privateSendStatus()) and this makes GUI unresponsive for huge wallets (I have ~400k txes in my testnet wallet) because of filter recreation/sorting. There is no need to go through all setup steps really, simply updating the limit works just fine and fixes the issue. * qt: Fix an `if` statement * qt: Just some refactoring * fix code style * bail out if `filter->rowCount() == nNumItems` * qt: Make sure number of transactions is always correct * Drop spacer to let recent tx list occupy max height available * TransactionFilterProxy::setLimit should emit signals to let coresponding layouts update themselves https://doc.qt.io/qt-5/qabstractitemmodel.html#layoutAboutToBeChanged https://doc.qt.io/qt-5/qabstractitemmodel.html#layoutChanged Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-09-25 18:04:53 +02:00
QRect rectTopHalf(mainRect.left() + xspace, mainRect.top() + ypad, mainRect.width() - xspace, halfheight);
QRect rectBottomHalf(mainRect.left() + xspace, mainRect.top() + ypad + halfheight + 5, mainRect.width() - xspace, halfheight);
QRect rectBounding;
QColor colorForeground;
qreal initialFontSize = painter->font().pointSizeF();
qt: Finetune OverviewPage (#3715) * qt: Adjust "Recent Transactions" in Overview tab Make sure they follow the same format as the transactions in TransactionsView. - Removed the transaction type representing arrows - Apply the same coloring like like in the transaction tab for the different transaction types (orange = internal, red = outgoing, green = incoming) * qt: Cleanup layout of OverviewPage in css * qt: Add three spacer (left, middle, right) and adjust layout stretch. This allows to have the elements on the screen aligned symetrically around the center independent from the window size/resizing. * qt: Inrease date/amount size for "Recent Transactions" in Overview tab * qt: Inrease number of "Recent Transactions" displayed in Overview tab Just to fill the empty space * qt: Make sure PS elements show as expected and adjust number of recent transactions based on PS * qt: Adjust transaction entry generation Co-Authored-By: UdjinM6 <UdjinM6@users.noreply.github.com> * qt: Adjust warning message box Co-Authored-By: UdjinM6 <UdjinM6@users.noreply.github.com> * Move tx list style to css * Fix tx list style for the traditional theme * Drop (no longer needed?) min height offset in SetupTransactionList Can't reproduce the tx list scrolling issue anymore * Avoid recreating transaction filter from scratch every time SetupTransactionList is called We call SetupTransactionList every second now (from privateSendStatus()) and this makes GUI unresponsive for huge wallets (I have ~400k txes in my testnet wallet) because of filter recreation/sorting. There is no need to go through all setup steps really, simply updating the limit works just fine and fixes the issue. * qt: Fix an `if` statement * qt: Just some refactoring * fix code style * bail out if `filter->rowCount() == nNumItems` * qt: Make sure number of transactions is always correct * Drop spacer to let recent tx list occupy max height available * TransactionFilterProxy::setLimit should emit signals to let coresponding layouts update themselves https://doc.qt.io/qt-5/qabstractitemmodel.html#layoutAboutToBeChanged https://doc.qt.io/qt-5/qabstractitemmodel.html#layoutChanged Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-09-25 18:04:53 +02:00
// Grab model indexes for desired data from TransactionTableModel
QModelIndex indexDate = index.sibling(index.row(), TransactionTableModel::Date);
QModelIndex indexAmount = index.sibling(index.row(), TransactionTableModel::Amount);
QModelIndex indexAddress = index.sibling(index.row(), TransactionTableModel::ToAddress);
// Draw first line (with slightly bigger font than the second line will get)
// Content: Date/Time, Optional IS indicator, Amount
painter->setFont(GUIUtil::getFont(GUIUtil::FontWeight::Normal, false, GUIUtil::getScaledFontSize(initialFontSize * 1.17)));
qt: Finetune OverviewPage (#3715) * qt: Adjust "Recent Transactions" in Overview tab Make sure they follow the same format as the transactions in TransactionsView. - Removed the transaction type representing arrows - Apply the same coloring like like in the transaction tab for the different transaction types (orange = internal, red = outgoing, green = incoming) * qt: Cleanup layout of OverviewPage in css * qt: Add three spacer (left, middle, right) and adjust layout stretch. This allows to have the elements on the screen aligned symetrically around the center independent from the window size/resizing. * qt: Inrease date/amount size for "Recent Transactions" in Overview tab * qt: Inrease number of "Recent Transactions" displayed in Overview tab Just to fill the empty space * qt: Make sure PS elements show as expected and adjust number of recent transactions based on PS * qt: Adjust transaction entry generation Co-Authored-By: UdjinM6 <UdjinM6@users.noreply.github.com> * qt: Adjust warning message box Co-Authored-By: UdjinM6 <UdjinM6@users.noreply.github.com> * Move tx list style to css * Fix tx list style for the traditional theme * Drop (no longer needed?) min height offset in SetupTransactionList Can't reproduce the tx list scrolling issue anymore * Avoid recreating transaction filter from scratch every time SetupTransactionList is called We call SetupTransactionList every second now (from privateSendStatus()) and this makes GUI unresponsive for huge wallets (I have ~400k txes in my testnet wallet) because of filter recreation/sorting. There is no need to go through all setup steps really, simply updating the limit works just fine and fixes the issue. * qt: Fix an `if` statement * qt: Just some refactoring * fix code style * bail out if `filter->rowCount() == nNumItems` * qt: Make sure number of transactions is always correct * Drop spacer to let recent tx list occupy max height available * TransactionFilterProxy::setLimit should emit signals to let coresponding layouts update themselves https://doc.qt.io/qt-5/qabstractitemmodel.html#layoutAboutToBeChanged https://doc.qt.io/qt-5/qabstractitemmodel.html#layoutChanged Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-09-25 18:04:53 +02:00
// Date/Time
colorForeground = qvariant_cast<QColor>(indexDate.data(Qt::ForegroundRole));
QString strDate = indexDate.data(Qt::DisplayRole).toString();
painter->setPen(colorForeground);
painter->drawText(rectTopHalf, Qt::AlignLeft | Qt::AlignVCenter, strDate, &rectBounding);
// Optional IS indicator
QIcon iconInstantSend = qvariant_cast<QIcon>(indexAddress.data(TransactionTableModel::RawDecorationRole));
QRect rectInstantSend(rectBounding.right() + 5, rectTopHalf.top(), 16, halfheight);
iconInstantSend.paint(painter, rectInstantSend);
// Amount
colorForeground = qvariant_cast<QColor>(indexAmount.data(Qt::ForegroundRole));
// Note: do NOT use Qt::DisplayRole, have format properly here
qint64 nAmount = index.data(TransactionTableModel::AmountRole).toLongLong();
QString strAmount = BitcoinUnits::floorWithUnit(unit, nAmount, true, BitcoinUnits::separatorAlways);
painter->setPen(colorForeground);
painter->drawText(rectTopHalf, Qt::AlignRight | Qt::AlignVCenter, strAmount);
// Draw second line (with the initial font)
// Content: Address/label, Optional Watchonly indicator
painter->setFont(GUIUtil::getFont(GUIUtil::FontWeight::Normal, false, GUIUtil::getScaledFontSize(initialFontSize)));
qt: Finetune OverviewPage (#3715) * qt: Adjust "Recent Transactions" in Overview tab Make sure they follow the same format as the transactions in TransactionsView. - Removed the transaction type representing arrows - Apply the same coloring like like in the transaction tab for the different transaction types (orange = internal, red = outgoing, green = incoming) * qt: Cleanup layout of OverviewPage in css * qt: Add three spacer (left, middle, right) and adjust layout stretch. This allows to have the elements on the screen aligned symetrically around the center independent from the window size/resizing. * qt: Inrease date/amount size for "Recent Transactions" in Overview tab * qt: Inrease number of "Recent Transactions" displayed in Overview tab Just to fill the empty space * qt: Make sure PS elements show as expected and adjust number of recent transactions based on PS * qt: Adjust transaction entry generation Co-Authored-By: UdjinM6 <UdjinM6@users.noreply.github.com> * qt: Adjust warning message box Co-Authored-By: UdjinM6 <UdjinM6@users.noreply.github.com> * Move tx list style to css * Fix tx list style for the traditional theme * Drop (no longer needed?) min height offset in SetupTransactionList Can't reproduce the tx list scrolling issue anymore * Avoid recreating transaction filter from scratch every time SetupTransactionList is called We call SetupTransactionList every second now (from privateSendStatus()) and this makes GUI unresponsive for huge wallets (I have ~400k txes in my testnet wallet) because of filter recreation/sorting. There is no need to go through all setup steps really, simply updating the limit works just fine and fixes the issue. * qt: Fix an `if` statement * qt: Just some refactoring * fix code style * bail out if `filter->rowCount() == nNumItems` * qt: Make sure number of transactions is always correct * Drop spacer to let recent tx list occupy max height available * TransactionFilterProxy::setLimit should emit signals to let coresponding layouts update themselves https://doc.qt.io/qt-5/qabstractitemmodel.html#layoutAboutToBeChanged https://doc.qt.io/qt-5/qabstractitemmodel.html#layoutChanged Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-09-25 18:04:53 +02:00
// Address/Label
colorForeground = qvariant_cast<QColor>(indexAddress.data(Qt::ForegroundRole));
QString address = indexAddress.data(Qt::DisplayRole).toString();
painter->setPen(colorForeground);
painter->drawText(rectBottomHalf, Qt::AlignLeft | Qt::AlignVCenter, address, &rectBounding);
// Optional Watchonly indicator
if (index.data(TransactionTableModel::WatchonlyRole).toBool())
{
QIcon iconWatchonly = qvariant_cast<QIcon>(index.data(TransactionTableModel::WatchonlyDecorationRole));
qt: Finetune OverviewPage (#3715) * qt: Adjust "Recent Transactions" in Overview tab Make sure they follow the same format as the transactions in TransactionsView. - Removed the transaction type representing arrows - Apply the same coloring like like in the transaction tab for the different transaction types (orange = internal, red = outgoing, green = incoming) * qt: Cleanup layout of OverviewPage in css * qt: Add three spacer (left, middle, right) and adjust layout stretch. This allows to have the elements on the screen aligned symetrically around the center independent from the window size/resizing. * qt: Inrease date/amount size for "Recent Transactions" in Overview tab * qt: Inrease number of "Recent Transactions" displayed in Overview tab Just to fill the empty space * qt: Make sure PS elements show as expected and adjust number of recent transactions based on PS * qt: Adjust transaction entry generation Co-Authored-By: UdjinM6 <UdjinM6@users.noreply.github.com> * qt: Adjust warning message box Co-Authored-By: UdjinM6 <UdjinM6@users.noreply.github.com> * Move tx list style to css * Fix tx list style for the traditional theme * Drop (no longer needed?) min height offset in SetupTransactionList Can't reproduce the tx list scrolling issue anymore * Avoid recreating transaction filter from scratch every time SetupTransactionList is called We call SetupTransactionList every second now (from privateSendStatus()) and this makes GUI unresponsive for huge wallets (I have ~400k txes in my testnet wallet) because of filter recreation/sorting. There is no need to go through all setup steps really, simply updating the limit works just fine and fixes the issue. * qt: Fix an `if` statement * qt: Just some refactoring * fix code style * bail out if `filter->rowCount() == nNumItems` * qt: Make sure number of transactions is always correct * Drop spacer to let recent tx list occupy max height available * TransactionFilterProxy::setLimit should emit signals to let coresponding layouts update themselves https://doc.qt.io/qt-5/qabstractitemmodel.html#layoutAboutToBeChanged https://doc.qt.io/qt-5/qabstractitemmodel.html#layoutChanged Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-09-25 18:04:53 +02:00
QRect rectWatchonly(rectBounding.right() + 5, rectBottomHalf.top(), 16, halfheight);
iconWatchonly.paint(painter, rectWatchonly);
2011-08-03 21:04:15 +02:00
}
painter->restore();
}
inline QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override
2011-08-03 21:28:11 +02:00
{
qt: Finetune OverviewPage (#3715) * qt: Adjust "Recent Transactions" in Overview tab Make sure they follow the same format as the transactions in TransactionsView. - Removed the transaction type representing arrows - Apply the same coloring like like in the transaction tab for the different transaction types (orange = internal, red = outgoing, green = incoming) * qt: Cleanup layout of OverviewPage in css * qt: Add three spacer (left, middle, right) and adjust layout stretch. This allows to have the elements on the screen aligned symetrically around the center independent from the window size/resizing. * qt: Inrease date/amount size for "Recent Transactions" in Overview tab * qt: Inrease number of "Recent Transactions" displayed in Overview tab Just to fill the empty space * qt: Make sure PS elements show as expected and adjust number of recent transactions based on PS * qt: Adjust transaction entry generation Co-Authored-By: UdjinM6 <UdjinM6@users.noreply.github.com> * qt: Adjust warning message box Co-Authored-By: UdjinM6 <UdjinM6@users.noreply.github.com> * Move tx list style to css * Fix tx list style for the traditional theme * Drop (no longer needed?) min height offset in SetupTransactionList Can't reproduce the tx list scrolling issue anymore * Avoid recreating transaction filter from scratch every time SetupTransactionList is called We call SetupTransactionList every second now (from privateSendStatus()) and this makes GUI unresponsive for huge wallets (I have ~400k txes in my testnet wallet) because of filter recreation/sorting. There is no need to go through all setup steps really, simply updating the limit works just fine and fixes the issue. * qt: Fix an `if` statement * qt: Just some refactoring * fix code style * bail out if `filter->rowCount() == nNumItems` * qt: Make sure number of transactions is always correct * Drop spacer to let recent tx list occupy max height available * TransactionFilterProxy::setLimit should emit signals to let coresponding layouts update themselves https://doc.qt.io/qt-5/qabstractitemmodel.html#layoutAboutToBeChanged https://doc.qt.io/qt-5/qabstractitemmodel.html#layoutChanged Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-09-25 18:04:53 +02:00
return QSize(ITEM_HEIGHT, ITEM_HEIGHT);
2011-08-03 21:28:11 +02:00
}
int unit;
};
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 <qt/overviewpage.moc>
OverviewPage::OverviewPage(QWidget* parent) :
QWidget(parent),
timer(nullptr),
ui(new Ui::OverviewPage),
clientModel(nullptr),
walletModel(nullptr),
cachedNumISLocks(-1),
txdelegate(new TxViewDelegate(this))
{
ui->setupUi(this);
GUIUtil::setFont({ui->label_4,
ui->label_5,
ui->labelCoinJoinHeader
}, GUIUtil::FontWeight::Bold, 16);
GUIUtil::setFont({ui->labelTotalText,
ui->labelWatchTotal,
ui->labelTotal
}, GUIUtil::FontWeight::Bold, 14);
GUIUtil::setFont({ui->labelBalanceText,
ui->labelPendingText,
ui->labelImmatureText,
ui->labelWatchonly,
ui->labelSpendable
}, GUIUtil::FontWeight::Bold);
qt: Fix font size and scaling issues (#3734) * qt: Make sure font size in MasternodeList gets scaled as expected * qt: Make sure font size in ShutdownWindow gets scaled as expected * qt: Drop obsolete application font updates * qt: Scale QMenu and QMessageBox globally To make sure non-custom context menus + QMessageBox instances createy by static calls like QMessageBox::critical are scaled also. * qt: Avoid redundant scaling for tooltips and menus * qt: Only update widget's font if required * qt: Merge GUIUtil::mapFontSizeUpdates into GUIUtil::mapNormalFontUpdates * qt: Remove obsolete setFixedPitchFont call * qt: Use setFixedPitchFont in SendCoinsEntry * qt: Scale font size in increments of 0.25 * qt: Properly scale network traffic stats depending on font metrics * qt: Update min/max width of OptionsDialog depending on buttons width * qt: Emit a signal whenever any attribute of AppearanceWidget changed * qt: Update OptionsDialog width if the appearance changed * qt: Calculate the initial wide right after the window showed up Make sure the visibility state of the widgets is correct before width calculations. * qt: Call parent class showEvent + override it explicit Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com> * qt: Let OptionsDialog emit a signal if appearance gets changed * qt: Resize main toolbar depending on visible buttons / font attributes * qt: Reset max width after it has been set to still allow window resizing * qt: Properly update the weight of widgets with default font attributes * qt: Handle updates to the font attributes * qt: Use resize() instead of setMaximumWidth() Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com> * qt: Call GUIUtil::updateFonts in ModalOverlay constructor * qt: Make sure default fonts are stored properly for the related widget * qt: Ignore some low level classes in GUIUtil::updateFont * rpc: Remove obsolete `.arg()` call * qt: Drop fixedPitchFont * qt: Avoid redundant font updates. Let GUIUtil::updateFont handle them * qt: Scale recent transactions on OverviewPage They were scaled by font inheritance before * qt: Ignore QListView in GUIUtil::updateFonts Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-09-29 01:15:20 +02:00
GUIUtil::updateFonts();
m_balances.balance = -1;
// Recent transactions
ui->listTransactions->setItemDelegate(txdelegate);
// Note: minimum height of listTransactions will be set later in updateAdvancedCJUI() to reflect actual settings
ui->listTransactions->setAttribute(Qt::WA_MacShowFocusRect, false);
connect(ui->listTransactions, &QListView::clicked, this, &OverviewPage::handleTransactionClicked);
// init "out of sync" warning labels
ui->labelWalletStatus->setText("(" + tr("out of sync") + ")");
ui->labelCoinJoinSyncStatus->setText("(" + tr("out of sync") + ")");
ui->labelTransactionsStatus->setText("(" + tr("out of sync") + ")");
QString strCoinJoinName = QString::fromStdString(gCoinJoinName);
ui->labelCoinJoinHeader->setText(strCoinJoinName);
ui->labelAnonymizedText->setText(tr("%1 Balance").arg(strCoinJoinName));
// hide PS frame (helps to preserve saved size)
// we'll setup and make it visible in coinJoinStatus() later
ui->frameCoinJoin->setVisible(false);
// start with displaying the "out of sync" warnings
showOutOfSyncWarning(true);
qt: Add PrivateSend tab in OptionsDialog, allow to show/hide PS UI (#3717) * qt: Add PrivateSend tab in OptionsDialog, allow to show/hide PS UI * qt: Decrease height of OptionsDialog * Apply suggestions from code review Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com> * qt: Remove obsolete visibility adjustments Not longer needed since the page is just not reachable if the button is hidden. * qt: Make sure PrivateSend related parts are always initialized properly Not only if its enabled on startup.. * qt: Make updatePrivateSendVisibility a slot to fix the signal connection * qt: Fix UI updates on OverviewPage if PrivateSend enabled gets toggled Other way of connecting the slot with true as parameter didn't work.. * qt: Only update and emit the signal for advanced PS UI if required * qt: Update fPrivateSendEnabled in OptionsModel instead of OptionsDialog * qt: Recover the PrivateSend enabled state if OptionsDialog gets rejected * qt: Enable PrivateSend UI by default * qt: Add some brackets * qt: Add a comment * qt: Add a linebreak to the "Enable PrivateSend features" tooltip * qt: Remove obsolete comment Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com> * qt: Move comment * qt: Properly reset the previous PS state if OptionsDialog gets rejected Handle all reject reasons not only the cancle button. Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com> Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
2020-09-28 09:41:19 +02:00
timer = new QTimer(this);
connect(timer, &QTimer::timeout, [this]{ coinJoinStatus(); });
}
void OverviewPage::handleTransactionClicked(const QModelIndex &index)
{
if(filter)
Q_EMIT transactionClicked(filter->mapToSource(index));
}
Backport Bitcoin Qt/Gui changes up to 0.14.x part 2 (#1615) * Merge #7506: Use CCoinControl selection in CWallet::FundTransaction d6cc6a1 Use CCoinControl selection in CWallet::FundTransaction (João Barbosa) * Merge #7732: [Qt] Debug window: replace "Build date" with "Datadir" fc737d1 [Qt] remove unused formatBuildDate method (Jonas Schnelli) 4856f1d [Qt] Debug window: replace "Build date" with "Datadir" (Jonas Schnelli) * Merge #7707: [RPC][QT] UI support for abandoned transactions 8efed3b [Qt] Support for abandoned/abandoning transactions (Jonas Schnelli) * Merge #7688: List solvability in listunspent output and improve help c3932b3 List solvability in listunspent output and improve help (Pieter Wuille) * Merge #8006: Qt: Add option to disable the system tray icon 8b0e497 Qt: Add option to hide the system tray icon (Tyler Hardin) * Merge #8073: qt: askpassphrasedialog: Clear pass fields on accept 02ce2a3 qt: askpassphrasedialog: Clear pass fields on accept (Pavel Vasin) * Merge #8231: [Qt] fix a bug where the SplashScreen will not be hidden during startup b3e1348 [Qt] fix a bug where the SplashScreen will not be hidden during startup (Jonas Schnelli) * Merge #8257: Do not ask a UI question from bitcoind 1acf1db Do not ask a UI question from bitcoind (Pieter Wuille) * Merge #8463: [qt] Remove Priority from coincontrol dialog fa8dd78 [qt] Remove Priority from coincontrol dialog (MarcoFalke) * Merge #8678: [Qt][CoinControl] fix UI bug that could result in paying unexpected fee 0480293 [Qt][CoinControl] fix UI bug that could result in paying unexpected fee (Jonas Schnelli) * Merge #8672: Qt: Show transaction size in transaction details window c015634 qt: Adding transaction size to transaction details window (Hampus Sjöberg) \-- merge fix for s/size/total size/ fdf82fb Adding method GetTotalSize() to CTransaction (Hampus Sjöberg) * Merge #8371: [Qt] Add out-of-sync modal info layer 08827df [Qt] modalinfolayer: removed unused comments, renamed signal, code style overhaul (Jonas Schnelli) d8b062e [Qt] only update "amount of blocks left" when the header chain is in-sync (Jonas Schnelli) e3245b4 [Qt] add out-of-sync modal info layer (Jonas Schnelli) e47052f [Qt] ClientModel add method to get the height of the header chain (Jonas Schnelli) a001f18 [Qt] Always pass the numBlocksChanged signal for headers tip changed (Jonas Schnelli) bd44a04 [Qt] make Out-Of-Sync warning icon clickable (Jonas Schnelli) 0904c3c [Refactor] refactor function that forms human readable text out of a timeoffset (Jonas Schnelli) * Merge #8805: Trivial: Grammar and capitalization c9ce17b Trivial: Grammar and capitalization (Derek Miller) * Merge #8885: gui: fix ban from qt console cb78c60 gui: fix ban from qt console (Cory Fields) * Merge #8821: [qt] sync-overlay: Don't block during reindex fa85e86 [qt] sync-overlay: Don't show estimated number of headers left (MarcoFalke) faa4de2 [qt] sync-overlay: Don't block during reindex (MarcoFalke) * Support themes for new transaction_abandoned icon * Fix constructor call to COutput * Merge #7842: RPC: do not print minping time in getpeerinfo when no ping received yet 62a6486 RPC: do not print ping info in getpeerinfo when no ping received yet, fix help (Pavel Janík) * Merge #8918: Qt: Add "Copy URI" to payment request context menu 21f5a63 Qt: Add "Copy URI" to payment request context menu (Luke Dashjr) * Merge #8925: qt: Display minimum ping in debug window. 1724a40 Display minimum ping in debug window. (R E Broadley) * Merge #8972: [Qt] make warnings label selectable (jonasschnelli) ef0c9ee [Qt] make warnings label selectable (Jonas Schnelli) * Make background of warning icon transparent in modaloverlay * Merge #9088: Reduce ambiguity of warning message 77cbbd9 Make warning message about wallet balance possibly being incorrect less ambiguous. (R E Broadley) * Replace Bitcoin with Dash in modal overlay * Remove clicked signals from labelWalletStatus and labelTransactionsStatus As both are really just labels, clicking on those is not possible. This is different in Bitcoin, where these labels are actually buttons. * Pull out modaloverlay show/hide into it's own if/else block and switch to time based check Also don't use masternodeSync.IsBlockchainSynced() for now as it won't report the blockchain being synced before the first block (or other MN data?) arrives. This would otherwise give the impression that sync is being stuck.
2017-09-09 09:04:02 +02:00
void OverviewPage::handleOutOfSyncWarningClicks()
{
Q_EMIT outOfSyncWarningClicked();
}
OverviewPage::~OverviewPage()
{
delete ui;
}
void OverviewPage::setBalance(const interfaces::WalletBalances& balances)
{
int unit = walletModel->getOptionsModel()->getDisplayUnit();
m_balances = balances;
ui->labelBalance->setText(BitcoinUnits::floorHtmlWithUnit(unit, balances.balance, false, BitcoinUnits::separatorAlways));
ui->labelUnconfirmed->setText(BitcoinUnits::floorHtmlWithUnit(unit, balances.unconfirmed_balance, false, BitcoinUnits::separatorAlways));
ui->labelImmature->setText(BitcoinUnits::floorHtmlWithUnit(unit, balances.immature_balance, false, BitcoinUnits::separatorAlways));
ui->labelAnonymized->setText(BitcoinUnits::floorHtmlWithUnit(unit, balances.anonymized_balance, false, BitcoinUnits::separatorAlways));
ui->labelTotal->setText(BitcoinUnits::floorHtmlWithUnit(unit, balances.balance + balances.unconfirmed_balance + balances.immature_balance, false, BitcoinUnits::separatorAlways));
ui->labelWatchAvailable->setText(BitcoinUnits::floorHtmlWithUnit(unit, balances.watch_only_balance, false, BitcoinUnits::separatorAlways));
ui->labelWatchPending->setText(BitcoinUnits::floorHtmlWithUnit(unit, balances.unconfirmed_watch_only_balance, false, BitcoinUnits::separatorAlways));
ui->labelWatchImmature->setText(BitcoinUnits::floorHtmlWithUnit(unit, balances.immature_watch_only_balance, false, BitcoinUnits::separatorAlways));
ui->labelWatchTotal->setText(BitcoinUnits::floorHtmlWithUnit(unit, balances.watch_only_balance + balances.unconfirmed_watch_only_balance + balances.immature_watch_only_balance, false, BitcoinUnits::separatorAlways));
// only show immature (newly mined) balance if it's non-zero, so as not to complicate things
// for the non-mining users
bool fDebugUI = gArgs.GetBoolArg("-debug-ui", false);
bool showImmature = fDebugUI || balances.immature_balance != 0;
bool showWatchOnlyImmature = fDebugUI || balances.immature_watch_only_balance != 0;
// for symmetry reasons also show immature label when the watch-only one is shown
ui->labelImmature->setVisible(showImmature || showWatchOnlyImmature);
ui->labelImmatureText->setVisible(showImmature || showWatchOnlyImmature);
ui->labelWatchImmature->setVisible(showWatchOnlyImmature); // show watch-only immature balance
2015-02-02 16:04:09 +01:00
updateCoinJoinProgress();
if (walletModel) {
int numISLocks = walletModel->getNumISLocks();
if(cachedNumISLocks != numISLocks) {
cachedNumISLocks = numISLocks;
ui->listTransactions->update();
}
2015-02-02 16:04:09 +01:00
}
}
// show/hide watch-only labels
void OverviewPage::updateWatchOnlyLabels(bool showWatchOnly)
{
ui->labelSpendable->setVisible(showWatchOnly); // show spendable label (only when watch-only is active)
ui->labelWatchonly->setVisible(showWatchOnly); // show watch-only label
ui->lineWatchBalance->setVisible(showWatchOnly); // show watch-only balance separator line
ui->labelWatchAvailable->setVisible(showWatchOnly); // show watch-only available balance
ui->labelWatchPending->setVisible(showWatchOnly); // show watch-only pending balance
ui->labelWatchTotal->setVisible(showWatchOnly); // show watch-only total balance
2015-07-31 08:40:06 +02:00
if (!showWatchOnly){
ui->labelWatchImmature->hide();
2015-07-31 08:40:06 +02:00
}
else{
ui->labelBalance->setIndent(20);
ui->labelUnconfirmed->setIndent(20);
ui->labelImmature->setIndent(20);
ui->labelTotal->setIndent(20);
}
}
void OverviewPage::setClientModel(ClientModel *model)
{
this->clientModel = model;
if(model)
{
// Show warning if this is a prerelease version
connect(model, &ClientModel::alertsChanged, this, &OverviewPage::updateAlerts);
updateAlerts(model->getStatusBarWarnings());
}
}
void OverviewPage::setWalletModel(WalletModel *model)
{
this->walletModel = model;
if(model && model->getOptionsModel())
2011-11-08 21:18:36 +01:00
{
// update the display unit, to not use the default ("DASH")
updateDisplayUnit();
2011-11-08 21:18:36 +01:00
// Keep up to date with wallet
interfaces::Wallet& wallet = model->wallet();
interfaces::WalletBalances balances = wallet.getBalances();
setBalance(balances);
connect(model, &WalletModel::balanceChanged, this, &OverviewPage::setBalance);
connect(model->getOptionsModel(), &OptionsModel::displayUnitChanged, this, &OverviewPage::updateDisplayUnit);
updateWatchOnlyLabels(wallet.haveWatchOnly() || gArgs.GetBoolArg("-debug-ui", false));
connect(model, &WalletModel::notifyWatchonlyChanged, this, &OverviewPage::updateWatchOnlyLabels);
// explicitly update PS frame and transaction list to reflect actual settings
updateAdvancedCJUI(model->getOptionsModel()->getShowAdvancedCJUI());
connect(model->getOptionsModel(), &OptionsModel::coinJoinRoundsChanged, this, &OverviewPage::updateCoinJoinProgress);
connect(model->getOptionsModel(), &OptionsModel::coinJoinAmountChanged, this, &OverviewPage::updateCoinJoinProgress);
connect(model->getOptionsModel(), &OptionsModel::AdvancedCJUIChanged, this, &OverviewPage::updateAdvancedCJUI);
connect(model->getOptionsModel(), &OptionsModel::coinJoinEnabledChanged, [=]() {
coinJoinStatus(true);
qt: Add PrivateSend tab in OptionsDialog, allow to show/hide PS UI (#3717) * qt: Add PrivateSend tab in OptionsDialog, allow to show/hide PS UI * qt: Decrease height of OptionsDialog * Apply suggestions from code review Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com> * qt: Remove obsolete visibility adjustments Not longer needed since the page is just not reachable if the button is hidden. * qt: Make sure PrivateSend related parts are always initialized properly Not only if its enabled on startup.. * qt: Make updatePrivateSendVisibility a slot to fix the signal connection * qt: Fix UI updates on OverviewPage if PrivateSend enabled gets toggled Other way of connecting the slot with true as parameter didn't work.. * qt: Only update and emit the signal for advanced PS UI if required * qt: Update fPrivateSendEnabled in OptionsModel instead of OptionsDialog * qt: Recover the PrivateSend enabled state if OptionsDialog gets rejected * qt: Enable PrivateSend UI by default * qt: Add some brackets * qt: Add a comment * qt: Add a linebreak to the "Enable PrivateSend features" tooltip * qt: Remove obsolete comment Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com> * qt: Move comment * qt: Properly reset the previous PS state if OptionsDialog gets rejected Handle all reject reasons not only the cancle button. Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com> Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
2020-09-28 09:41:19 +02:00
});
// Disable coinJoinClient builtin support for automatic backups while we are in GUI,
// we'll handle automatic backups and user warnings in coinJoinStatus()
walletModel->coinJoin().disableAutobackups();
connect(ui->toggleCoinJoin, &QPushButton::clicked, this, &OverviewPage::toggleCoinJoin);
// coinjoin buttons will not react to spacebar must be clicked on
ui->toggleCoinJoin->setFocusPolicy(Qt::NoFocus);
2011-11-08 21:18:36 +01:00
}
}
void OverviewPage::updateDisplayUnit()
{
if(walletModel && walletModel->getOptionsModel())
{
nDisplayUnit = walletModel->getOptionsModel()->getDisplayUnit();
if (m_balances.balance != -1) {
setBalance(m_balances);
}
// Update txdelegate->unit with the current unit
txdelegate->unit = nDisplayUnit;
ui->listTransactions->update();
}
}
void OverviewPage::updateAlerts(const QString &warnings)
{
this->ui->labelAlerts->setVisible(!warnings.isEmpty());
this->ui->labelAlerts->setText(warnings);
}
void OverviewPage::showOutOfSyncWarning(bool fShow)
{
ui->labelWalletStatus->setVisible(fShow);
ui->labelCoinJoinSyncStatus->setVisible(fShow);
ui->labelTransactionsStatus->setVisible(fShow);
}
2014-12-23 03:28:52 +01:00
void OverviewPage::updateCoinJoinProgress()
{
if (!walletModel || !clientModel || clientModel->node().shutdownRequested() || !clientModel->masternodeSync().isBlockchainSynced()) return;
QString strAmountAndRounds;
QString strCoinJoinAmount = BitcoinUnits::formatHtmlWithUnit(nDisplayUnit, clientModel->coinJoinOptions().getAmount() * COIN, false, BitcoinUnits::separatorAlways);
if(m_balances.balance == 0)
{
ui->coinJoinProgress->setValue(0);
ui->coinJoinProgress->setToolTip(tr("No inputs detected"));
// when balance is zero just show info from settings
strCoinJoinAmount = strCoinJoinAmount.remove(strCoinJoinAmount.indexOf("."), BitcoinUnits::decimals(nDisplayUnit) + 1);
strAmountAndRounds = strCoinJoinAmount + " / " + tr("%n Rounds", "", clientModel->coinJoinOptions().getRounds());
2014-12-23 03:28:52 +01:00
ui->labelAmountRounds->setToolTip(tr("No inputs detected"));
ui->labelAmountRounds->setText(strAmountAndRounds);
return;
}
CAmount nAnonymizableBalance = walletModel->wallet().getAnonymizableBalance(false, false);
CAmount nMaxToAnonymize = nAnonymizableBalance + m_balances.anonymized_balance;
// If it's more than the anon threshold, limit to that.
if (nMaxToAnonymize > clientModel->coinJoinOptions().getAmount() * COIN) nMaxToAnonymize = clientModel->coinJoinOptions().getAmount() * COIN;
if(nMaxToAnonymize == 0) return;
if (nMaxToAnonymize >= clientModel->coinJoinOptions().getAmount() * COIN) {
ui->labelAmountRounds->setToolTip(tr("Found enough compatible inputs to mix %1")
.arg(strCoinJoinAmount));
strCoinJoinAmount = strCoinJoinAmount.remove(strCoinJoinAmount.indexOf("."), BitcoinUnits::decimals(nDisplayUnit) + 1);
strAmountAndRounds = strCoinJoinAmount + " / " + tr("%n Rounds", "", clientModel->coinJoinOptions().getRounds());
} else {
QString strMaxToAnonymize = BitcoinUnits::formatHtmlWithUnit(nDisplayUnit, nMaxToAnonymize, false, BitcoinUnits::separatorAlways);
ui->labelAmountRounds->setToolTip(tr("Not enough compatible inputs to mix <span style='%1'>%2</span>,<br>"
"will mix <span style='%1'>%3</span> instead")
.arg(GUIUtil::getThemedStyleQString(GUIUtil::ThemedStyle::TS_ERROR))
.arg(strCoinJoinAmount)
.arg(strMaxToAnonymize));
strMaxToAnonymize = strMaxToAnonymize.remove(strMaxToAnonymize.indexOf("."), BitcoinUnits::decimals(nDisplayUnit) + 1);
strAmountAndRounds = "<span style='" + GUIUtil::getThemedStyleQString(GUIUtil::ThemedStyle::TS_ERROR) + "'>" +
QString(BitcoinUnits::factor(nDisplayUnit) == 1 ? "" : "~") + strMaxToAnonymize +
" / " + tr("%n Rounds", "", clientModel->coinJoinOptions().getRounds()) + "</span>";
}
ui->labelAmountRounds->setText(strAmountAndRounds);
if (!fShowAdvancedCJUI) return;
CAmount nDenominatedConfirmedBalance;
CAmount nDenominatedUnconfirmedBalance;
CAmount nNormalizedAnonymizedBalance;
float nAverageAnonymizedRounds;
nDenominatedConfirmedBalance = walletModel->wallet().getDenominatedBalance(false);
nDenominatedUnconfirmedBalance = walletModel->wallet().getDenominatedBalance(true);
nNormalizedAnonymizedBalance = walletModel->wallet().getNormalizedAnonymizedBalance();
nAverageAnonymizedRounds = walletModel->wallet().getAverageAnonymizedRounds();
// calculate parts of the progress, each of them shouldn't be higher than 1
// progress of denominating
float denomPart = 0;
// mixing progress of denominated balance
2015-07-12 18:18:03 +02:00
float anonNormPart = 0;
// completeness of full amount anonymization
2015-07-12 18:18:03 +02:00
float anonFullPart = 0;
CAmount denominatedBalance = nDenominatedConfirmedBalance + nDenominatedUnconfirmedBalance;
denomPart = (float)denominatedBalance / nMaxToAnonymize;
denomPart = denomPart > 1 ? 1 : denomPart;
denomPart *= 100;
anonNormPart = (float)nNormalizedAnonymizedBalance / nMaxToAnonymize;
2015-07-12 18:18:03 +02:00
anonNormPart = anonNormPart > 1 ? 1 : anonNormPart;
anonNormPart *= 100;
2015-07-12 18:18:03 +02:00
anonFullPart = (float)m_balances.anonymized_balance / nMaxToAnonymize;
2015-07-12 18:18:03 +02:00
anonFullPart = anonFullPart > 1 ? 1 : anonFullPart;
anonFullPart *= 100;
// apply some weights to them ...
float denomWeight = 1;
float anonNormWeight = clientModel->coinJoinOptions().getRounds();
float anonFullWeight = 2;
float fullWeight = denomWeight + anonNormWeight + anonFullWeight;
// ... and calculate the whole progress
float denomPartCalc = ceilf((denomPart * denomWeight / fullWeight) * 100) / 100;
float anonNormPartCalc = ceilf((anonNormPart * anonNormWeight / fullWeight) * 100) / 100;
float anonFullPartCalc = ceilf((anonFullPart * anonFullWeight / fullWeight) * 100) / 100;
float progress = denomPartCalc + anonNormPartCalc + anonFullPartCalc;
if(progress >= 100) progress = 100;
ui->coinJoinProgress->setValue(progress);
QString strToolPip = ("<b>" + tr("Overall progress") + ": %1%</b><br/>" +
tr("Denominated") + ": %2%<br/>" +
tr("Partially mixed") + ": %3%<br/>" +
tr("Mixed") + ": %4%<br/>" +
tr("Denominated inputs have %5 of %n rounds on average", "", clientModel->coinJoinOptions().getRounds()))
.arg(progress).arg(denomPart).arg(anonNormPart).arg(anonFullPart)
.arg(nAverageAnonymizedRounds);
ui->coinJoinProgress->setToolTip(strToolPip);
2014-12-23 03:28:52 +01:00
}
void OverviewPage::updateAdvancedCJUI(bool fShowAdvancedCJUI)
{
if (!walletModel || !clientModel) return;
this->fShowAdvancedCJUI = fShowAdvancedCJUI;
coinJoinStatus(true);
}
2014-12-23 03:28:52 +01:00
void OverviewPage::coinJoinStatus(bool fForce)
2014-12-23 03:28:52 +01:00
{
if (!walletModel || !clientModel) return;
2016-02-20 20:03:19 +01:00
if (!fForce && (clientModel->node().shutdownRequested() || !clientModel->masternodeSync().isBlockchainSynced())) return;
qt: Add PrivateSend tab in OptionsDialog, allow to show/hide PS UI (#3717) * qt: Add PrivateSend tab in OptionsDialog, allow to show/hide PS UI * qt: Decrease height of OptionsDialog * Apply suggestions from code review Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com> * qt: Remove obsolete visibility adjustments Not longer needed since the page is just not reachable if the button is hidden. * qt: Make sure PrivateSend related parts are always initialized properly Not only if its enabled on startup.. * qt: Make updatePrivateSendVisibility a slot to fix the signal connection * qt: Fix UI updates on OverviewPage if PrivateSend enabled gets toggled Other way of connecting the slot with true as parameter didn't work.. * qt: Only update and emit the signal for advanced PS UI if required * qt: Update fPrivateSendEnabled in OptionsModel instead of OptionsDialog * qt: Recover the PrivateSend enabled state if OptionsDialog gets rejected * qt: Enable PrivateSend UI by default * qt: Add some brackets * qt: Add a comment * qt: Add a linebreak to the "Enable PrivateSend features" tooltip * qt: Remove obsolete comment Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com> * qt: Move comment * qt: Properly reset the previous PS state if OptionsDialog gets rejected Handle all reject reasons not only the cancle button. Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com> Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
2020-09-28 09:41:19 +02:00
// Disable any PS UI for masternode or when autobackup is disabled or failed for whatever reason
if (fMasternodeMode || nWalletBackups <= 0) {
DisableCoinJoinCompletely();
qt: Add PrivateSend tab in OptionsDialog, allow to show/hide PS UI (#3717) * qt: Add PrivateSend tab in OptionsDialog, allow to show/hide PS UI * qt: Decrease height of OptionsDialog * Apply suggestions from code review Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com> * qt: Remove obsolete visibility adjustments Not longer needed since the page is just not reachable if the button is hidden. * qt: Make sure PrivateSend related parts are always initialized properly Not only if its enabled on startup.. * qt: Make updatePrivateSendVisibility a slot to fix the signal connection * qt: Fix UI updates on OverviewPage if PrivateSend enabled gets toggled Other way of connecting the slot with true as parameter didn't work.. * qt: Only update and emit the signal for advanced PS UI if required * qt: Update fPrivateSendEnabled in OptionsModel instead of OptionsDialog * qt: Recover the PrivateSend enabled state if OptionsDialog gets rejected * qt: Enable PrivateSend UI by default * qt: Add some brackets * qt: Add a comment * qt: Add a linebreak to the "Enable PrivateSend features" tooltip * qt: Remove obsolete comment Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com> * qt: Move comment * qt: Properly reset the previous PS state if OptionsDialog gets rejected Handle all reject reasons not only the cancle button. Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com> Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
2020-09-28 09:41:19 +02:00
if (nWalletBackups <= 0) {
ui->labelCoinJoinEnabled->setToolTip(tr("Automatic backups are disabled, no mixing available!"));
qt: Add PrivateSend tab in OptionsDialog, allow to show/hide PS UI (#3717) * qt: Add PrivateSend tab in OptionsDialog, allow to show/hide PS UI * qt: Decrease height of OptionsDialog * Apply suggestions from code review Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com> * qt: Remove obsolete visibility adjustments Not longer needed since the page is just not reachable if the button is hidden. * qt: Make sure PrivateSend related parts are always initialized properly Not only if its enabled on startup.. * qt: Make updatePrivateSendVisibility a slot to fix the signal connection * qt: Fix UI updates on OverviewPage if PrivateSend enabled gets toggled Other way of connecting the slot with true as parameter didn't work.. * qt: Only update and emit the signal for advanced PS UI if required * qt: Update fPrivateSendEnabled in OptionsModel instead of OptionsDialog * qt: Recover the PrivateSend enabled state if OptionsDialog gets rejected * qt: Enable PrivateSend UI by default * qt: Add some brackets * qt: Add a comment * qt: Add a linebreak to the "Enable PrivateSend features" tooltip * qt: Remove obsolete comment Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com> * qt: Move comment * qt: Properly reset the previous PS state if OptionsDialog gets rejected Handle all reject reasons not only the cancle button. Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com> Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
2020-09-28 09:41:19 +02:00
}
return;
}
bool fIsEnabled = clientModel->coinJoinOptions().isEnabled();
ui->frameCoinJoin->setVisible(fIsEnabled);
qt: Finetune OverviewPage (#3715) * qt: Adjust "Recent Transactions" in Overview tab Make sure they follow the same format as the transactions in TransactionsView. - Removed the transaction type representing arrows - Apply the same coloring like like in the transaction tab for the different transaction types (orange = internal, red = outgoing, green = incoming) * qt: Cleanup layout of OverviewPage in css * qt: Add three spacer (left, middle, right) and adjust layout stretch. This allows to have the elements on the screen aligned symetrically around the center independent from the window size/resizing. * qt: Inrease date/amount size for "Recent Transactions" in Overview tab * qt: Inrease number of "Recent Transactions" displayed in Overview tab Just to fill the empty space * qt: Make sure PS elements show as expected and adjust number of recent transactions based on PS * qt: Adjust transaction entry generation Co-Authored-By: UdjinM6 <UdjinM6@users.noreply.github.com> * qt: Adjust warning message box Co-Authored-By: UdjinM6 <UdjinM6@users.noreply.github.com> * Move tx list style to css * Fix tx list style for the traditional theme * Drop (no longer needed?) min height offset in SetupTransactionList Can't reproduce the tx list scrolling issue anymore * Avoid recreating transaction filter from scratch every time SetupTransactionList is called We call SetupTransactionList every second now (from privateSendStatus()) and this makes GUI unresponsive for huge wallets (I have ~400k txes in my testnet wallet) because of filter recreation/sorting. There is no need to go through all setup steps really, simply updating the limit works just fine and fixes the issue. * qt: Fix an `if` statement * qt: Just some refactoring * fix code style * bail out if `filter->rowCount() == nNumItems` * qt: Make sure number of transactions is always correct * Drop spacer to let recent tx list occupy max height available * TransactionFilterProxy::setLimit should emit signals to let coresponding layouts update themselves https://doc.qt.io/qt-5/qabstractitemmodel.html#layoutAboutToBeChanged https://doc.qt.io/qt-5/qabstractitemmodel.html#layoutChanged Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-09-25 18:04:53 +02:00
if (!fIsEnabled) {
SetupTransactionList(NUM_ITEMS_DISABLED);
qt: Add PrivateSend tab in OptionsDialog, allow to show/hide PS UI (#3717) * qt: Add PrivateSend tab in OptionsDialog, allow to show/hide PS UI * qt: Decrease height of OptionsDialog * Apply suggestions from code review Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com> * qt: Remove obsolete visibility adjustments Not longer needed since the page is just not reachable if the button is hidden. * qt: Make sure PrivateSend related parts are always initialized properly Not only if its enabled on startup.. * qt: Make updatePrivateSendVisibility a slot to fix the signal connection * qt: Fix UI updates on OverviewPage if PrivateSend enabled gets toggled Other way of connecting the slot with true as parameter didn't work.. * qt: Only update and emit the signal for advanced PS UI if required * qt: Update fPrivateSendEnabled in OptionsModel instead of OptionsDialog * qt: Recover the PrivateSend enabled state if OptionsDialog gets rejected * qt: Enable PrivateSend UI by default * qt: Add some brackets * qt: Add a comment * qt: Add a linebreak to the "Enable PrivateSend features" tooltip * qt: Remove obsolete comment Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com> * qt: Move comment * qt: Properly reset the previous PS state if OptionsDialog gets rejected Handle all reject reasons not only the cancle button. Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com> Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
2020-09-28 09:41:19 +02:00
if (timer != nullptr) {
timer->stop();
}
qt: Finetune OverviewPage (#3715) * qt: Adjust "Recent Transactions" in Overview tab Make sure they follow the same format as the transactions in TransactionsView. - Removed the transaction type representing arrows - Apply the same coloring like like in the transaction tab for the different transaction types (orange = internal, red = outgoing, green = incoming) * qt: Cleanup layout of OverviewPage in css * qt: Add three spacer (left, middle, right) and adjust layout stretch. This allows to have the elements on the screen aligned symetrically around the center independent from the window size/resizing. * qt: Inrease date/amount size for "Recent Transactions" in Overview tab * qt: Inrease number of "Recent Transactions" displayed in Overview tab Just to fill the empty space * qt: Make sure PS elements show as expected and adjust number of recent transactions based on PS * qt: Adjust transaction entry generation Co-Authored-By: UdjinM6 <UdjinM6@users.noreply.github.com> * qt: Adjust warning message box Co-Authored-By: UdjinM6 <UdjinM6@users.noreply.github.com> * Move tx list style to css * Fix tx list style for the traditional theme * Drop (no longer needed?) min height offset in SetupTransactionList Can't reproduce the tx list scrolling issue anymore * Avoid recreating transaction filter from scratch every time SetupTransactionList is called We call SetupTransactionList every second now (from privateSendStatus()) and this makes GUI unresponsive for huge wallets (I have ~400k txes in my testnet wallet) because of filter recreation/sorting. There is no need to go through all setup steps really, simply updating the limit works just fine and fixes the issue. * qt: Fix an `if` statement * qt: Just some refactoring * fix code style * bail out if `filter->rowCount() == nNumItems` * qt: Make sure number of transactions is always correct * Drop spacer to let recent tx list occupy max height available * TransactionFilterProxy::setLimit should emit signals to let coresponding layouts update themselves https://doc.qt.io/qt-5/qabstractitemmodel.html#layoutAboutToBeChanged https://doc.qt.io/qt-5/qabstractitemmodel.html#layoutChanged Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-09-25 18:04:53 +02:00
return;
}
qt: Add PrivateSend tab in OptionsDialog, allow to show/hide PS UI (#3717) * qt: Add PrivateSend tab in OptionsDialog, allow to show/hide PS UI * qt: Decrease height of OptionsDialog * Apply suggestions from code review Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com> * qt: Remove obsolete visibility adjustments Not longer needed since the page is just not reachable if the button is hidden. * qt: Make sure PrivateSend related parts are always initialized properly Not only if its enabled on startup.. * qt: Make updatePrivateSendVisibility a slot to fix the signal connection * qt: Fix UI updates on OverviewPage if PrivateSend enabled gets toggled Other way of connecting the slot with true as parameter didn't work.. * qt: Only update and emit the signal for advanced PS UI if required * qt: Update fPrivateSendEnabled in OptionsModel instead of OptionsDialog * qt: Recover the PrivateSend enabled state if OptionsDialog gets rejected * qt: Enable PrivateSend UI by default * qt: Add some brackets * qt: Add a comment * qt: Add a linebreak to the "Enable PrivateSend features" tooltip * qt: Remove obsolete comment Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com> * qt: Move comment * qt: Properly reset the previous PS state if OptionsDialog gets rejected Handle all reject reasons not only the cancle button. Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com> Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
2020-09-28 09:41:19 +02:00
if (timer != nullptr && !timer->isActive()) {
timer->start(1000);
}
// Wrap all coinjoin related widgets we want to show/hide state based.
qt: Finetune OverviewPage (#3715) * qt: Adjust "Recent Transactions" in Overview tab Make sure they follow the same format as the transactions in TransactionsView. - Removed the transaction type representing arrows - Apply the same coloring like like in the transaction tab for the different transaction types (orange = internal, red = outgoing, green = incoming) * qt: Cleanup layout of OverviewPage in css * qt: Add three spacer (left, middle, right) and adjust layout stretch. This allows to have the elements on the screen aligned symetrically around the center independent from the window size/resizing. * qt: Inrease date/amount size for "Recent Transactions" in Overview tab * qt: Inrease number of "Recent Transactions" displayed in Overview tab Just to fill the empty space * qt: Make sure PS elements show as expected and adjust number of recent transactions based on PS * qt: Adjust transaction entry generation Co-Authored-By: UdjinM6 <UdjinM6@users.noreply.github.com> * qt: Adjust warning message box Co-Authored-By: UdjinM6 <UdjinM6@users.noreply.github.com> * Move tx list style to css * Fix tx list style for the traditional theme * Drop (no longer needed?) min height offset in SetupTransactionList Can't reproduce the tx list scrolling issue anymore * Avoid recreating transaction filter from scratch every time SetupTransactionList is called We call SetupTransactionList every second now (from privateSendStatus()) and this makes GUI unresponsive for huge wallets (I have ~400k txes in my testnet wallet) because of filter recreation/sorting. There is no need to go through all setup steps really, simply updating the limit works just fine and fixes the issue. * qt: Fix an `if` statement * qt: Just some refactoring * fix code style * bail out if `filter->rowCount() == nNumItems` * qt: Make sure number of transactions is always correct * Drop spacer to let recent tx list occupy max height available * TransactionFilterProxy::setLimit should emit signals to let coresponding layouts update themselves https://doc.qt.io/qt-5/qabstractitemmodel.html#layoutAboutToBeChanged https://doc.qt.io/qt-5/qabstractitemmodel.html#layoutChanged Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-09-25 18:04:53 +02:00
// Value of the map contains a flag if this widget belongs to the advanced
// CoinJoin UI option or not. True if it does, false if not.
std::map<QWidget*, bool> coinJoinWidgets = {
qt: Finetune OverviewPage (#3715) * qt: Adjust "Recent Transactions" in Overview tab Make sure they follow the same format as the transactions in TransactionsView. - Removed the transaction type representing arrows - Apply the same coloring like like in the transaction tab for the different transaction types (orange = internal, red = outgoing, green = incoming) * qt: Cleanup layout of OverviewPage in css * qt: Add three spacer (left, middle, right) and adjust layout stretch. This allows to have the elements on the screen aligned symetrically around the center independent from the window size/resizing. * qt: Inrease date/amount size for "Recent Transactions" in Overview tab * qt: Inrease number of "Recent Transactions" displayed in Overview tab Just to fill the empty space * qt: Make sure PS elements show as expected and adjust number of recent transactions based on PS * qt: Adjust transaction entry generation Co-Authored-By: UdjinM6 <UdjinM6@users.noreply.github.com> * qt: Adjust warning message box Co-Authored-By: UdjinM6 <UdjinM6@users.noreply.github.com> * Move tx list style to css * Fix tx list style for the traditional theme * Drop (no longer needed?) min height offset in SetupTransactionList Can't reproduce the tx list scrolling issue anymore * Avoid recreating transaction filter from scratch every time SetupTransactionList is called We call SetupTransactionList every second now (from privateSendStatus()) and this makes GUI unresponsive for huge wallets (I have ~400k txes in my testnet wallet) because of filter recreation/sorting. There is no need to go through all setup steps really, simply updating the limit works just fine and fixes the issue. * qt: Fix an `if` statement * qt: Just some refactoring * fix code style * bail out if `filter->rowCount() == nNumItems` * qt: Make sure number of transactions is always correct * Drop spacer to let recent tx list occupy max height available * TransactionFilterProxy::setLimit should emit signals to let coresponding layouts update themselves https://doc.qt.io/qt-5/qabstractitemmodel.html#layoutAboutToBeChanged https://doc.qt.io/qt-5/qabstractitemmodel.html#layoutChanged Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-09-25 18:04:53 +02:00
{ui->labelCompletitionText, true},
{ui->coinJoinProgress, true},
qt: Finetune OverviewPage (#3715) * qt: Adjust "Recent Transactions" in Overview tab Make sure they follow the same format as the transactions in TransactionsView. - Removed the transaction type representing arrows - Apply the same coloring like like in the transaction tab for the different transaction types (orange = internal, red = outgoing, green = incoming) * qt: Cleanup layout of OverviewPage in css * qt: Add three spacer (left, middle, right) and adjust layout stretch. This allows to have the elements on the screen aligned symetrically around the center independent from the window size/resizing. * qt: Inrease date/amount size for "Recent Transactions" in Overview tab * qt: Inrease number of "Recent Transactions" displayed in Overview tab Just to fill the empty space * qt: Make sure PS elements show as expected and adjust number of recent transactions based on PS * qt: Adjust transaction entry generation Co-Authored-By: UdjinM6 <UdjinM6@users.noreply.github.com> * qt: Adjust warning message box Co-Authored-By: UdjinM6 <UdjinM6@users.noreply.github.com> * Move tx list style to css * Fix tx list style for the traditional theme * Drop (no longer needed?) min height offset in SetupTransactionList Can't reproduce the tx list scrolling issue anymore * Avoid recreating transaction filter from scratch every time SetupTransactionList is called We call SetupTransactionList every second now (from privateSendStatus()) and this makes GUI unresponsive for huge wallets (I have ~400k txes in my testnet wallet) because of filter recreation/sorting. There is no need to go through all setup steps really, simply updating the limit works just fine and fixes the issue. * qt: Fix an `if` statement * qt: Just some refactoring * fix code style * bail out if `filter->rowCount() == nNumItems` * qt: Make sure number of transactions is always correct * Drop spacer to let recent tx list occupy max height available * TransactionFilterProxy::setLimit should emit signals to let coresponding layouts update themselves https://doc.qt.io/qt-5/qabstractitemmodel.html#layoutAboutToBeChanged https://doc.qt.io/qt-5/qabstractitemmodel.html#layoutChanged Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-09-25 18:04:53 +02:00
{ui->labelSubmittedDenomText, true},
{ui->labelSubmittedDenom, true},
{ui->labelAmountAndRoundsText, false},
{ui->labelAmountRounds, false}
};
qt: General qt/c++ related fixes and updates (#3562) * qt: Draw a border around net traffic graph * qt: ReceiveRequestDialog - Improve QR code image - Fix issue with bluriness - Refine sizing/layout of QR code and address - Adjust coloring to match the themes * qt: Give the TransactionView's instantsendWidget a name Required to access it in css * qt: Rename conflicting label in SendCoinsDialog - Was named the same as the the label in EditAddressDialog so it couldn't be accessed properly in css * qt: Give the TransactionView's search field the first focus on startup * qt: Some updates to the PrivateSend widget on the OverviewPage - Hide denom labels if inactive - Enable wordwrap for denom label - Add some spacer - Make sure it gets its basic initialization on startup * qt: Fix some layout issues in SendCoinsDialog's UI file. - Added some margins for fee selection radio buttons to align them centered to their options - Removed a weird placed spacer * qt: Fix vertical alignment of the two balance labels in SendCoinsDialog * qt: Add newline in textedit of receiverequest * qt: OptionsDialog - Hide override hint if there is nothing overridden * qt: Allow stylesheet modifications for auto completition popup - Inheritance doesn't work here obviously because of QCompleter is parent of the popup - QStyledItemDelegate delegate is required. Without its not possible to access `::item` selectors from css. * qt: Make the progress label in the status bar accessible in css * qt: Update weekend colors of QCalendarWidget on style changes Its obviously not possible to do this in stylesheets thats why i added this as workaround. * qt: Load stylesheets for Intro This is the datadir selection dialog. * Drop labelPrivateSendLastMessage * Add a space Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com> Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com> Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
2020-07-20 17:01:11 +02:00
auto setWidgetsVisible = [&](bool fVisible) {
qt: Finetune OverviewPage (#3715) * qt: Adjust "Recent Transactions" in Overview tab Make sure they follow the same format as the transactions in TransactionsView. - Removed the transaction type representing arrows - Apply the same coloring like like in the transaction tab for the different transaction types (orange = internal, red = outgoing, green = incoming) * qt: Cleanup layout of OverviewPage in css * qt: Add three spacer (left, middle, right) and adjust layout stretch. This allows to have the elements on the screen aligned symetrically around the center independent from the window size/resizing. * qt: Inrease date/amount size for "Recent Transactions" in Overview tab * qt: Inrease number of "Recent Transactions" displayed in Overview tab Just to fill the empty space * qt: Make sure PS elements show as expected and adjust number of recent transactions based on PS * qt: Adjust transaction entry generation Co-Authored-By: UdjinM6 <UdjinM6@users.noreply.github.com> * qt: Adjust warning message box Co-Authored-By: UdjinM6 <UdjinM6@users.noreply.github.com> * Move tx list style to css * Fix tx list style for the traditional theme * Drop (no longer needed?) min height offset in SetupTransactionList Can't reproduce the tx list scrolling issue anymore * Avoid recreating transaction filter from scratch every time SetupTransactionList is called We call SetupTransactionList every second now (from privateSendStatus()) and this makes GUI unresponsive for huge wallets (I have ~400k txes in my testnet wallet) because of filter recreation/sorting. There is no need to go through all setup steps really, simply updating the limit works just fine and fixes the issue. * qt: Fix an `if` statement * qt: Just some refactoring * fix code style * bail out if `filter->rowCount() == nNumItems` * qt: Make sure number of transactions is always correct * Drop spacer to let recent tx list occupy max height available * TransactionFilterProxy::setLimit should emit signals to let coresponding layouts update themselves https://doc.qt.io/qt-5/qabstractitemmodel.html#layoutAboutToBeChanged https://doc.qt.io/qt-5/qabstractitemmodel.html#layoutChanged Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-09-25 18:04:53 +02:00
static bool fInitial{true};
static bool fLastVisible{false};
static bool fLastShowAdvanced{false};
// Only update the widget's visibility if something changed since the last call of setWidgetsVisible
if (fLastShowAdvanced == fShowAdvancedCJUI && fLastVisible == fVisible) {
qt: Finetune OverviewPage (#3715) * qt: Adjust "Recent Transactions" in Overview tab Make sure they follow the same format as the transactions in TransactionsView. - Removed the transaction type representing arrows - Apply the same coloring like like in the transaction tab for the different transaction types (orange = internal, red = outgoing, green = incoming) * qt: Cleanup layout of OverviewPage in css * qt: Add three spacer (left, middle, right) and adjust layout stretch. This allows to have the elements on the screen aligned symetrically around the center independent from the window size/resizing. * qt: Inrease date/amount size for "Recent Transactions" in Overview tab * qt: Inrease number of "Recent Transactions" displayed in Overview tab Just to fill the empty space * qt: Make sure PS elements show as expected and adjust number of recent transactions based on PS * qt: Adjust transaction entry generation Co-Authored-By: UdjinM6 <UdjinM6@users.noreply.github.com> * qt: Adjust warning message box Co-Authored-By: UdjinM6 <UdjinM6@users.noreply.github.com> * Move tx list style to css * Fix tx list style for the traditional theme * Drop (no longer needed?) min height offset in SetupTransactionList Can't reproduce the tx list scrolling issue anymore * Avoid recreating transaction filter from scratch every time SetupTransactionList is called We call SetupTransactionList every second now (from privateSendStatus()) and this makes GUI unresponsive for huge wallets (I have ~400k txes in my testnet wallet) because of filter recreation/sorting. There is no need to go through all setup steps really, simply updating the limit works just fine and fixes the issue. * qt: Fix an `if` statement * qt: Just some refactoring * fix code style * bail out if `filter->rowCount() == nNumItems` * qt: Make sure number of transactions is always correct * Drop spacer to let recent tx list occupy max height available * TransactionFilterProxy::setLimit should emit signals to let coresponding layouts update themselves https://doc.qt.io/qt-5/qabstractitemmodel.html#layoutAboutToBeChanged https://doc.qt.io/qt-5/qabstractitemmodel.html#layoutChanged Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-09-25 18:04:53 +02:00
if (fInitial) {
fInitial = false;
} else {
return;
}
qt: General qt/c++ related fixes and updates (#3562) * qt: Draw a border around net traffic graph * qt: ReceiveRequestDialog - Improve QR code image - Fix issue with bluriness - Refine sizing/layout of QR code and address - Adjust coloring to match the themes * qt: Give the TransactionView's instantsendWidget a name Required to access it in css * qt: Rename conflicting label in SendCoinsDialog - Was named the same as the the label in EditAddressDialog so it couldn't be accessed properly in css * qt: Give the TransactionView's search field the first focus on startup * qt: Some updates to the PrivateSend widget on the OverviewPage - Hide denom labels if inactive - Enable wordwrap for denom label - Add some spacer - Make sure it gets its basic initialization on startup * qt: Fix some layout issues in SendCoinsDialog's UI file. - Added some margins for fee selection radio buttons to align them centered to their options - Removed a weird placed spacer * qt: Fix vertical alignment of the two balance labels in SendCoinsDialog * qt: Add newline in textedit of receiverequest * qt: OptionsDialog - Hide override hint if there is nothing overridden * qt: Allow stylesheet modifications for auto completition popup - Inheritance doesn't work here obviously because of QCompleter is parent of the popup - QStyledItemDelegate delegate is required. Without its not possible to access `::item` selectors from css. * qt: Make the progress label in the status bar accessible in css * qt: Update weekend colors of QCalendarWidget on style changes Its obviously not possible to do this in stylesheets thats why i added this as workaround. * qt: Load stylesheets for Intro This is the datadir selection dialog. * Drop labelPrivateSendLastMessage * Add a space Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com> Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com> Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
2020-07-20 17:01:11 +02:00
}
qt: Finetune OverviewPage (#3715) * qt: Adjust "Recent Transactions" in Overview tab Make sure they follow the same format as the transactions in TransactionsView. - Removed the transaction type representing arrows - Apply the same coloring like like in the transaction tab for the different transaction types (orange = internal, red = outgoing, green = incoming) * qt: Cleanup layout of OverviewPage in css * qt: Add three spacer (left, middle, right) and adjust layout stretch. This allows to have the elements on the screen aligned symetrically around the center independent from the window size/resizing. * qt: Inrease date/amount size for "Recent Transactions" in Overview tab * qt: Inrease number of "Recent Transactions" displayed in Overview tab Just to fill the empty space * qt: Make sure PS elements show as expected and adjust number of recent transactions based on PS * qt: Adjust transaction entry generation Co-Authored-By: UdjinM6 <UdjinM6@users.noreply.github.com> * qt: Adjust warning message box Co-Authored-By: UdjinM6 <UdjinM6@users.noreply.github.com> * Move tx list style to css * Fix tx list style for the traditional theme * Drop (no longer needed?) min height offset in SetupTransactionList Can't reproduce the tx list scrolling issue anymore * Avoid recreating transaction filter from scratch every time SetupTransactionList is called We call SetupTransactionList every second now (from privateSendStatus()) and this makes GUI unresponsive for huge wallets (I have ~400k txes in my testnet wallet) because of filter recreation/sorting. There is no need to go through all setup steps really, simply updating the limit works just fine and fixes the issue. * qt: Fix an `if` statement * qt: Just some refactoring * fix code style * bail out if `filter->rowCount() == nNumItems` * qt: Make sure number of transactions is always correct * Drop spacer to let recent tx list occupy max height available * TransactionFilterProxy::setLimit should emit signals to let coresponding layouts update themselves https://doc.qt.io/qt-5/qabstractitemmodel.html#layoutAboutToBeChanged https://doc.qt.io/qt-5/qabstractitemmodel.html#layoutChanged Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-09-25 18:04:53 +02:00
// Set visible if: fVisible and not advanced UI element or advanced ui element and advanced ui active
for (const auto& it : coinJoinWidgets) {
it.first->setVisible(fVisible && (!it.second || it.second == fShowAdvancedCJUI));
qt: Finetune OverviewPage (#3715) * qt: Adjust "Recent Transactions" in Overview tab Make sure they follow the same format as the transactions in TransactionsView. - Removed the transaction type representing arrows - Apply the same coloring like like in the transaction tab for the different transaction types (orange = internal, red = outgoing, green = incoming) * qt: Cleanup layout of OverviewPage in css * qt: Add three spacer (left, middle, right) and adjust layout stretch. This allows to have the elements on the screen aligned symetrically around the center independent from the window size/resizing. * qt: Inrease date/amount size for "Recent Transactions" in Overview tab * qt: Inrease number of "Recent Transactions" displayed in Overview tab Just to fill the empty space * qt: Make sure PS elements show as expected and adjust number of recent transactions based on PS * qt: Adjust transaction entry generation Co-Authored-By: UdjinM6 <UdjinM6@users.noreply.github.com> * qt: Adjust warning message box Co-Authored-By: UdjinM6 <UdjinM6@users.noreply.github.com> * Move tx list style to css * Fix tx list style for the traditional theme * Drop (no longer needed?) min height offset in SetupTransactionList Can't reproduce the tx list scrolling issue anymore * Avoid recreating transaction filter from scratch every time SetupTransactionList is called We call SetupTransactionList every second now (from privateSendStatus()) and this makes GUI unresponsive for huge wallets (I have ~400k txes in my testnet wallet) because of filter recreation/sorting. There is no need to go through all setup steps really, simply updating the limit works just fine and fixes the issue. * qt: Fix an `if` statement * qt: Just some refactoring * fix code style * bail out if `filter->rowCount() == nNumItems` * qt: Make sure number of transactions is always correct * Drop spacer to let recent tx list occupy max height available * TransactionFilterProxy::setLimit should emit signals to let coresponding layouts update themselves https://doc.qt.io/qt-5/qabstractitemmodel.html#layoutAboutToBeChanged https://doc.qt.io/qt-5/qabstractitemmodel.html#layoutChanged Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-09-25 18:04:53 +02:00
}
fLastVisible = fVisible;
fLastShowAdvanced = fShowAdvancedCJUI;
qt: General qt/c++ related fixes and updates (#3562) * qt: Draw a border around net traffic graph * qt: ReceiveRequestDialog - Improve QR code image - Fix issue with bluriness - Refine sizing/layout of QR code and address - Adjust coloring to match the themes * qt: Give the TransactionView's instantsendWidget a name Required to access it in css * qt: Rename conflicting label in SendCoinsDialog - Was named the same as the the label in EditAddressDialog so it couldn't be accessed properly in css * qt: Give the TransactionView's search field the first focus on startup * qt: Some updates to the PrivateSend widget on the OverviewPage - Hide denom labels if inactive - Enable wordwrap for denom label - Add some spacer - Make sure it gets its basic initialization on startup * qt: Fix some layout issues in SendCoinsDialog's UI file. - Added some margins for fee selection radio buttons to align them centered to their options - Removed a weird placed spacer * qt: Fix vertical alignment of the two balance labels in SendCoinsDialog * qt: Add newline in textedit of receiverequest * qt: OptionsDialog - Hide override hint if there is nothing overridden * qt: Allow stylesheet modifications for auto completition popup - Inheritance doesn't work here obviously because of QCompleter is parent of the popup - QStyledItemDelegate delegate is required. Without its not possible to access `::item` selectors from css. * qt: Make the progress label in the status bar accessible in css * qt: Update weekend colors of QCalendarWidget on style changes Its obviously not possible to do this in stylesheets thats why i added this as workaround. * qt: Load stylesheets for Intro This is the datadir selection dialog. * Drop labelPrivateSendLastMessage * Add a space Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com> Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com> Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
2020-07-20 17:01:11 +02:00
};
static int64_t nLastDSProgressBlockTime = 0;
int nBestHeight = clientModel->node().getNumBlocks();
2014-12-23 03:28:52 +01:00
// We are processing more than 1 block per second, we'll just leave
if (nBestHeight > walletModel->coinJoin().getCachedBlocks() && GetTime() - nLastDSProgressBlockTime <= 1) return;
nLastDSProgressBlockTime = GetTime();
2014-12-23 03:28:52 +01:00
QString strKeysLeftText(tr("keys left: %1").arg(walletModel->getKeysLeftSinceAutoBackup()));
if(walletModel->getKeysLeftSinceAutoBackup() < COINJOIN_KEYS_THRESHOLD_WARNING) {
strKeysLeftText = "<span style='" + GUIUtil::getThemedStyleQString(GUIUtil::ThemedStyle::TS_ERROR) + "'>" + strKeysLeftText + "</span>";
}
ui->labelCoinJoinEnabled->setToolTip(strKeysLeftText);
QString strCoinJoinName = QString::fromStdString(gCoinJoinName);
if (!walletModel->coinJoin().isMixing()) {
if (nBestHeight != walletModel->coinJoin().getCachedBlocks()) {
walletModel->coinJoin().setCachedBlocks(nBestHeight);
updateCoinJoinProgress();
}
qt: General qt/c++ related fixes and updates (#3562) * qt: Draw a border around net traffic graph * qt: ReceiveRequestDialog - Improve QR code image - Fix issue with bluriness - Refine sizing/layout of QR code and address - Adjust coloring to match the themes * qt: Give the TransactionView's instantsendWidget a name Required to access it in css * qt: Rename conflicting label in SendCoinsDialog - Was named the same as the the label in EditAddressDialog so it couldn't be accessed properly in css * qt: Give the TransactionView's search field the first focus on startup * qt: Some updates to the PrivateSend widget on the OverviewPage - Hide denom labels if inactive - Enable wordwrap for denom label - Add some spacer - Make sure it gets its basic initialization on startup * qt: Fix some layout issues in SendCoinsDialog's UI file. - Added some margins for fee selection radio buttons to align them centered to their options - Removed a weird placed spacer * qt: Fix vertical alignment of the two balance labels in SendCoinsDialog * qt: Add newline in textedit of receiverequest * qt: OptionsDialog - Hide override hint if there is nothing overridden * qt: Allow stylesheet modifications for auto completition popup - Inheritance doesn't work here obviously because of QCompleter is parent of the popup - QStyledItemDelegate delegate is required. Without its not possible to access `::item` selectors from css. * qt: Make the progress label in the status bar accessible in css * qt: Update weekend colors of QCalendarWidget on style changes Its obviously not possible to do this in stylesheets thats why i added this as workaround. * qt: Load stylesheets for Intro This is the datadir selection dialog. * Drop labelPrivateSendLastMessage * Add a space Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com> Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com> Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
2020-07-20 17:01:11 +02:00
setWidgetsVisible(false);
ui->toggleCoinJoin->setText(tr("Start %1").arg(strCoinJoinName));
QString strEnabled = tr("Disabled");
// Show how many keys left in advanced PS UI mode only
if (fShowAdvancedCJUI) strEnabled += ", " + strKeysLeftText;
ui->labelCoinJoinEnabled->setText(strEnabled);
qt: Finetune OverviewPage (#3715) * qt: Adjust "Recent Transactions" in Overview tab Make sure they follow the same format as the transactions in TransactionsView. - Removed the transaction type representing arrows - Apply the same coloring like like in the transaction tab for the different transaction types (orange = internal, red = outgoing, green = incoming) * qt: Cleanup layout of OverviewPage in css * qt: Add three spacer (left, middle, right) and adjust layout stretch. This allows to have the elements on the screen aligned symetrically around the center independent from the window size/resizing. * qt: Inrease date/amount size for "Recent Transactions" in Overview tab * qt: Inrease number of "Recent Transactions" displayed in Overview tab Just to fill the empty space * qt: Make sure PS elements show as expected and adjust number of recent transactions based on PS * qt: Adjust transaction entry generation Co-Authored-By: UdjinM6 <UdjinM6@users.noreply.github.com> * qt: Adjust warning message box Co-Authored-By: UdjinM6 <UdjinM6@users.noreply.github.com> * Move tx list style to css * Fix tx list style for the traditional theme * Drop (no longer needed?) min height offset in SetupTransactionList Can't reproduce the tx list scrolling issue anymore * Avoid recreating transaction filter from scratch every time SetupTransactionList is called We call SetupTransactionList every second now (from privateSendStatus()) and this makes GUI unresponsive for huge wallets (I have ~400k txes in my testnet wallet) because of filter recreation/sorting. There is no need to go through all setup steps really, simply updating the limit works just fine and fixes the issue. * qt: Fix an `if` statement * qt: Just some refactoring * fix code style * bail out if `filter->rowCount() == nNumItems` * qt: Make sure number of transactions is always correct * Drop spacer to let recent tx list occupy max height available * TransactionFilterProxy::setLimit should emit signals to let coresponding layouts update themselves https://doc.qt.io/qt-5/qabstractitemmodel.html#layoutAboutToBeChanged https://doc.qt.io/qt-5/qabstractitemmodel.html#layoutChanged Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-09-25 18:04:53 +02:00
// If mixing isn't active always show the lower number of txes because there are
// anyway the most PS widgets hidden.
SetupTransactionList(NUM_ITEMS_ENABLED_NORMAL);
return;
qt: Finetune OverviewPage (#3715) * qt: Adjust "Recent Transactions" in Overview tab Make sure they follow the same format as the transactions in TransactionsView. - Removed the transaction type representing arrows - Apply the same coloring like like in the transaction tab for the different transaction types (orange = internal, red = outgoing, green = incoming) * qt: Cleanup layout of OverviewPage in css * qt: Add three spacer (left, middle, right) and adjust layout stretch. This allows to have the elements on the screen aligned symetrically around the center independent from the window size/resizing. * qt: Inrease date/amount size for "Recent Transactions" in Overview tab * qt: Inrease number of "Recent Transactions" displayed in Overview tab Just to fill the empty space * qt: Make sure PS elements show as expected and adjust number of recent transactions based on PS * qt: Adjust transaction entry generation Co-Authored-By: UdjinM6 <UdjinM6@users.noreply.github.com> * qt: Adjust warning message box Co-Authored-By: UdjinM6 <UdjinM6@users.noreply.github.com> * Move tx list style to css * Fix tx list style for the traditional theme * Drop (no longer needed?) min height offset in SetupTransactionList Can't reproduce the tx list scrolling issue anymore * Avoid recreating transaction filter from scratch every time SetupTransactionList is called We call SetupTransactionList every second now (from privateSendStatus()) and this makes GUI unresponsive for huge wallets (I have ~400k txes in my testnet wallet) because of filter recreation/sorting. There is no need to go through all setup steps really, simply updating the limit works just fine and fixes the issue. * qt: Fix an `if` statement * qt: Just some refactoring * fix code style * bail out if `filter->rowCount() == nNumItems` * qt: Make sure number of transactions is always correct * Drop spacer to let recent tx list occupy max height available * TransactionFilterProxy::setLimit should emit signals to let coresponding layouts update themselves https://doc.qt.io/qt-5/qabstractitemmodel.html#layoutAboutToBeChanged https://doc.qt.io/qt-5/qabstractitemmodel.html#layoutChanged Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-09-25 18:04:53 +02:00
} else {
SetupTransactionList(fShowAdvancedCJUI ? NUM_ITEMS_ENABLED_ADVANCED : NUM_ITEMS_ENABLED_NORMAL);
}
// Warn user that wallet is running out of keys
// NOTE: we do NOT warn user and do NOT create autobackups if mixing is not running
if (nWalletBackups > 0 && walletModel->getKeysLeftSinceAutoBackup() < COINJOIN_KEYS_THRESHOLD_WARNING) {
QSettings settings;
if(settings.value("fLowKeysWarning").toBool()) {
QString strWarn = tr("Very low number of keys left since last automatic backup!") + "<br><br>" +
tr("We are about to create a new automatic backup for you, however "
"<span style='%1'> you should always make sure you have backups "
"saved in some safe place</span>!").arg(GUIUtil::getThemedStyleQString(GUIUtil::ThemedStyle::TS_COMMAND)) + "<br><br>" +
tr("Note: You can turn this message off in options.");
ui->labelCoinJoinEnabled->setToolTip(strWarn);
LogPrint(BCLog::COINJOIN, "OverviewPage::coinJoinStatus -- Very low number of keys left since last automatic backup, warning user and trying to create new backup...\n");
QMessageBox::warning(this, strCoinJoinName, strWarn, QMessageBox::Ok, QMessageBox::Ok);
2016-09-05 18:09:25 +02:00
} else {
LogPrint(BCLog::COINJOIN, "OverviewPage::coinJoinStatus -- Very low number of keys left since last automatic backup, skipping warning and trying to create new backup...\n");
2016-09-05 18:09:25 +02:00
}
QString strBackupWarning;
QString strBackupError;
if(!walletModel->autoBackupWallet(strBackupWarning, strBackupError)) {
if (!strBackupWarning.isEmpty()) {
// It's still more or less safe to continue but warn user anyway
LogPrint(BCLog::COINJOIN, "OverviewPage::coinJoinStatus -- WARNING! Something went wrong on automatic backup: %s\n", strBackupWarning.toStdString());
QMessageBox::warning(this, strCoinJoinName,
tr("WARNING! Something went wrong on automatic backup") + ":<br><br>" + strBackupWarning,
QMessageBox::Ok, QMessageBox::Ok);
}
if (!strBackupError.isEmpty()) {
// Things are really broken, warn user and stop mixing immediately
LogPrint(BCLog::COINJOIN, "OverviewPage::coinJoinStatus -- ERROR! Failed to create automatic backup: %s\n", strBackupError.toStdString());
QMessageBox::warning(this, strCoinJoinName,
tr("ERROR! Failed to create automatic backup") + ":<br><br>" + strBackupError + "<br>" +
tr("Mixing is disabled, please close your wallet and fix the issue!"),
QMessageBox::Ok, QMessageBox::Ok);
}
}
}
QString strEnabled = walletModel->coinJoin().isMixing() ? tr("Enabled") : tr("Disabled");
// Show how many keys left in advanced PS UI mode only
if(fShowAdvancedCJUI) strEnabled += ", " + strKeysLeftText;
ui->labelCoinJoinEnabled->setText(strEnabled);
if(nWalletBackups == -1) {
// Automatic backup failed, nothing else we can do until user fixes the issue manually
DisableCoinJoinCompletely();
QString strError = tr("ERROR! Failed to create automatic backup") + ", " +
tr("see debug.log for details.") + "<br><br>" +
tr("Mixing is disabled, please close your wallet and fix the issue!");
ui->labelCoinJoinEnabled->setToolTip(strError);
return;
} else if(nWalletBackups == -2) {
// We were able to create automatic backup but keypool was not replenished because wallet is locked.
QString strWarning = tr("WARNING! Failed to replenish keypool, please unlock your wallet to do so.");
ui->labelCoinJoinEnabled->setToolTip(strWarning);
}
// check coinjoin status and unlock if needed
if(nBestHeight != walletModel->coinJoin().getCachedBlocks()) {
2014-12-23 03:28:52 +01:00
// Balance and number of transactions might have changed
walletModel->coinJoin().setCachedBlocks(nBestHeight);
updateCoinJoinProgress();
2014-12-23 03:28:52 +01:00
}
qt: General qt/c++ related fixes and updates (#3562) * qt: Draw a border around net traffic graph * qt: ReceiveRequestDialog - Improve QR code image - Fix issue with bluriness - Refine sizing/layout of QR code and address - Adjust coloring to match the themes * qt: Give the TransactionView's instantsendWidget a name Required to access it in css * qt: Rename conflicting label in SendCoinsDialog - Was named the same as the the label in EditAddressDialog so it couldn't be accessed properly in css * qt: Give the TransactionView's search field the first focus on startup * qt: Some updates to the PrivateSend widget on the OverviewPage - Hide denom labels if inactive - Enable wordwrap for denom label - Add some spacer - Make sure it gets its basic initialization on startup * qt: Fix some layout issues in SendCoinsDialog's UI file. - Added some margins for fee selection radio buttons to align them centered to their options - Removed a weird placed spacer * qt: Fix vertical alignment of the two balance labels in SendCoinsDialog * qt: Add newline in textedit of receiverequest * qt: OptionsDialog - Hide override hint if there is nothing overridden * qt: Allow stylesheet modifications for auto completition popup - Inheritance doesn't work here obviously because of QCompleter is parent of the popup - QStyledItemDelegate delegate is required. Without its not possible to access `::item` selectors from css. * qt: Make the progress label in the status bar accessible in css * qt: Update weekend colors of QCalendarWidget on style changes Its obviously not possible to do this in stylesheets thats why i added this as workaround. * qt: Load stylesheets for Intro This is the datadir selection dialog. * Drop labelPrivateSendLastMessage * Add a space Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com> Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com> Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
2020-07-20 17:01:11 +02:00
setWidgetsVisible(true);
2014-12-23 03:28:52 +01:00
ui->labelSubmittedDenom->setText(QString(walletModel->coinJoin().getSessionDenoms().c_str()));
2014-12-23 03:28:52 +01:00
}
void OverviewPage::toggleCoinJoin(){
2015-07-04 15:29:21 +02:00
QSettings settings;
// Popup some information on first mixing
QString hasMixed = settings.value("hasMixed").toString();
QString strCoinJoinName = QString::fromStdString(gCoinJoinName);
2015-07-04 15:29:21 +02:00
if(hasMixed.isEmpty()){
QMessageBox::information(this, strCoinJoinName,
tr("If you don't want to see internal %1 fees/transactions select \"Most Common\" as Type on the \"Transactions\" tab.").arg(strCoinJoinName),
2015-07-04 15:29:21 +02:00
QMessageBox::Ok, QMessageBox::Ok);
settings.setValue("hasMixed", "hasMixed");
}
2020-07-16 14:23:58 +02:00
if (!walletModel->coinJoin().isMixing()) {
auto& options = walletModel->node().coinJoinOptions();
const CAmount nMinAmount = options.getSmallestDenomination() + options.getMaxCollateralAmount();
if(m_balances.balance < nMinAmount) {
QString strMinAmount(BitcoinUnits::formatWithUnit(nDisplayUnit, nMinAmount));
QMessageBox::warning(this, strCoinJoinName,
tr("%1 requires at least %2 to use.").arg(strCoinJoinName).arg(strMinAmount),
2014-12-26 04:58:39 +01:00
QMessageBox::Ok, QMessageBox::Ok);
return;
}
// if wallet is locked, ask for a passphrase
if (walletModel && walletModel->getEncryptionStatus() == WalletModel::Locked)
{
WalletModel::UnlockContext ctx(walletModel->requestUnlock(true));
if(!ctx.isValid())
{
//unlock was cancelled
walletModel->coinJoin().resetCachedBlocks();
QMessageBox::warning(this, strCoinJoinName,
tr("Wallet is locked and user declined to unlock. Disabling %1.").arg(strCoinJoinName),
QMessageBox::Ok, QMessageBox::Ok);
LogPrint(BCLog::COINJOIN, "OverviewPage::toggleCoinJoin -- Wallet is locked and user declined to unlock. Disabling CoinJoin.\n");
return;
}
}
2014-12-23 03:28:52 +01:00
}
walletModel->coinJoin().resetCachedBlocks();
2014-12-23 03:28:52 +01:00
if (walletModel->coinJoin().isMixing()) {
ui->toggleCoinJoin->setText(tr("Start %1").arg(strCoinJoinName));
walletModel->coinJoin().resetPool();
walletModel->coinJoin().stopMixing();
2014-12-23 03:28:52 +01:00
} else {
ui->toggleCoinJoin->setText(tr("Stop %1").arg(strCoinJoinName));
walletModel->coinJoin().startMixing();
2014-12-23 03:28:52 +01:00
}
}
qt: Finetune OverviewPage (#3715) * qt: Adjust "Recent Transactions" in Overview tab Make sure they follow the same format as the transactions in TransactionsView. - Removed the transaction type representing arrows - Apply the same coloring like like in the transaction tab for the different transaction types (orange = internal, red = outgoing, green = incoming) * qt: Cleanup layout of OverviewPage in css * qt: Add three spacer (left, middle, right) and adjust layout stretch. This allows to have the elements on the screen aligned symetrically around the center independent from the window size/resizing. * qt: Inrease date/amount size for "Recent Transactions" in Overview tab * qt: Inrease number of "Recent Transactions" displayed in Overview tab Just to fill the empty space * qt: Make sure PS elements show as expected and adjust number of recent transactions based on PS * qt: Adjust transaction entry generation Co-Authored-By: UdjinM6 <UdjinM6@users.noreply.github.com> * qt: Adjust warning message box Co-Authored-By: UdjinM6 <UdjinM6@users.noreply.github.com> * Move tx list style to css * Fix tx list style for the traditional theme * Drop (no longer needed?) min height offset in SetupTransactionList Can't reproduce the tx list scrolling issue anymore * Avoid recreating transaction filter from scratch every time SetupTransactionList is called We call SetupTransactionList every second now (from privateSendStatus()) and this makes GUI unresponsive for huge wallets (I have ~400k txes in my testnet wallet) because of filter recreation/sorting. There is no need to go through all setup steps really, simply updating the limit works just fine and fixes the issue. * qt: Fix an `if` statement * qt: Just some refactoring * fix code style * bail out if `filter->rowCount() == nNumItems` * qt: Make sure number of transactions is always correct * Drop spacer to let recent tx list occupy max height available * TransactionFilterProxy::setLimit should emit signals to let coresponding layouts update themselves https://doc.qt.io/qt-5/qabstractitemmodel.html#layoutAboutToBeChanged https://doc.qt.io/qt-5/qabstractitemmodel.html#layoutChanged Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-09-25 18:04:53 +02:00
void OverviewPage::SetupTransactionList(int nNumItems)
{
if (walletModel == nullptr || walletModel->getTransactionTableModel() == nullptr) {
return;
}
qt: Finetune OverviewPage (#3715) * qt: Adjust "Recent Transactions" in Overview tab Make sure they follow the same format as the transactions in TransactionsView. - Removed the transaction type representing arrows - Apply the same coloring like like in the transaction tab for the different transaction types (orange = internal, red = outgoing, green = incoming) * qt: Cleanup layout of OverviewPage in css * qt: Add three spacer (left, middle, right) and adjust layout stretch. This allows to have the elements on the screen aligned symetrically around the center independent from the window size/resizing. * qt: Inrease date/amount size for "Recent Transactions" in Overview tab * qt: Inrease number of "Recent Transactions" displayed in Overview tab Just to fill the empty space * qt: Make sure PS elements show as expected and adjust number of recent transactions based on PS * qt: Adjust transaction entry generation Co-Authored-By: UdjinM6 <UdjinM6@users.noreply.github.com> * qt: Adjust warning message box Co-Authored-By: UdjinM6 <UdjinM6@users.noreply.github.com> * Move tx list style to css * Fix tx list style for the traditional theme * Drop (no longer needed?) min height offset in SetupTransactionList Can't reproduce the tx list scrolling issue anymore * Avoid recreating transaction filter from scratch every time SetupTransactionList is called We call SetupTransactionList every second now (from privateSendStatus()) and this makes GUI unresponsive for huge wallets (I have ~400k txes in my testnet wallet) because of filter recreation/sorting. There is no need to go through all setup steps really, simply updating the limit works just fine and fixes the issue. * qt: Fix an `if` statement * qt: Just some refactoring * fix code style * bail out if `filter->rowCount() == nNumItems` * qt: Make sure number of transactions is always correct * Drop spacer to let recent tx list occupy max height available * TransactionFilterProxy::setLimit should emit signals to let coresponding layouts update themselves https://doc.qt.io/qt-5/qabstractitemmodel.html#layoutAboutToBeChanged https://doc.qt.io/qt-5/qabstractitemmodel.html#layoutChanged Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-09-25 18:04:53 +02:00
// Set up transaction list
if (filter == nullptr) {
Backport Bitcoin Qt/Gui changes up to 0.14.x part 3 (#1617) * Merge #8996: Network activity toggle 19f46f1 Qt: New network_disabled icon (Luke Dashjr) 54cf997 RPC/Net: Use boolean consistently for networkactive, and remove from getinfo (Luke Dashjr) b2b33d9 Overhaul network activity toggle (Jonas Schnelli) 32efa79 Qt: Add GUI feedback and control of network activity state. (Jon Lund Steffensen) e38993b RPC: Add "togglenetwork" method to toggle network activity temporarily (Jon Lund Steffensen) 7c9a98a Allow network activity to be temporarily suspended. (Jon Lund Steffensen) * Revert on-click behavior of network status icon to showing peers list Stay with the way Dash handled clicking on the status icon * Add theme support for network disabled icon * Merge #8874: Multiple Selection for peer and ban tables 1077577 Fix auto-deselection of peers (Andrew Chow) addfdeb Multiple Selection for peer and ban tables (Andrew Chow) * Merge #9190: qt: Plug many memory leaks ed998ea qt: Avoid OpenSSL certstore-related memory leak (Wladimir J. van der Laan) 5204598 qt: Avoid shutdownwindow-related memory leak (Wladimir J. van der Laan) e4f126a qt: Avoid splash-screen related memory leak (Wladimir J. van der Laan) 693384e qt: Prevent thread/memory leak on exiting RPCConsole (Wladimir J. van der Laan) 47db075 qt: Plug many memory leaks (Wladimir J. van der Laan) * Merge #9218: qt: Show progress overlay when clicking spinner icon 042f9fa qt: Show progress overlay when clicking spinner icon (Wladimir J. van der Laan) 827d9a3 qt: Replace NetworkToggleStatusBarControl with generic ClickableLabel (Wladimir J. van der Laan) * Merge #9266: Bugfix: Qt/RPCConsole: Put column enum in the right places df17fe0 Bugfix: Qt/RPCConsole: Put column enum in the right places (Luke Dashjr) * Merge #9255: qt: layoutAboutToChange signal is called layoutAboutToBeChanged f36349e qt: Remove on_toggleNetworkActiveButton_clicked from RPCConsole (Wladimir J. van der Laan) 297cc20 qt: layoutAboutToChange signal is called layoutAboutToBeChanged (Wladimir J. van der Laan) * Use UniValue until bitcoin PR #8788 is backported Network active toggle was already based on "[RPC] Give RPC commands more information about the RPC request" We need to use the old UniValue style until that one is backported * Merge #8906: [qt] sync-overlay: Don't show progress twice fafeec3 [qt] sync-overlay: Don't show progress twice (MarcoFalke) * Merge #8985: Use pindexBestHeader instead of setBlockIndexCandidates for NotifyHeaderTip() 3154d6e [Qt] use NotifyHeaderTip's height and date for the progress update (Jonas Schnelli) 0a261b6 Use pindexBestHeader instead of setBlockIndexCandidates for NotifyHeaderTip() (Jonas Schnelli) * Merge #9280: [Qt] Show ModalOverlay by pressing the progress bar, allow hiding 89a3723 [Qt] Show ModalOverlay by pressing the progress bar, disabled show() in sync mode (Jonas Schnelli) * Merge #9461: [Qt] Improve progress display during headers-sync and peer-finding 40ec7c7 [Qt] Improve progress display during headers-sync and peer-finding (Jonas Schnelli) * Merge #9588: qt: Use nPowTargetSpacing constant fa4d478 qt: Use nPowTargetSpacing constant (MarcoFalke) * Hide modal overlay forever when syncing has catched up Don't allow to open it again by clicking on the progress bar and spinner icon. Currently the overlay does not show meaningful information about masternode sync and it gives the impression of being stuck after the block chain sync is done. * Don't include chainparams.h in sendcoinsdialog.cpp This was just a remainder of a backported PR which meant to change some calculation in this file which does not apply to Dash. * Also check for fNetworkActive in ConnectNode * Merge #9528: [qt] Rename formateNiceTimeOffset(qint64) to formatNiceTimeOffset(qint64) 988d300 [qt] Rename formateNiceTimeOffset(qint64) to formatNiceTimeOffset(qint64) (practicalswift) * Merge #11237: qt: Fixing division by zero in time remaining c8d38abd6 Refactor tipUpdate as per style guide (MeshCollider) 3b69a08c5 Fix division by zero in time remaining (MeshCollider) Pull request description: Fixes https://github.com/bitcoin/bitcoin/issues/10291, https://github.com/bitcoin/bitcoin/issues/11265 progressDelta may be 0 (or even negative according to 11265), this checks for that and prints unknown if it is, because we cannot calculate an estimate for the time remaining (would be infinite or negative). Tree-SHA512: bc5708e5ed6e4670d008219558c5fbb25709bd99a32c98ec39bb74f94a0b7fa058f3d03389ccdd39e6723e6b5b48e34b13ceee7c051c2db631e51d8ec3e1d68c
2017-09-11 15:38:14 +02:00
filter.reset(new TransactionFilterProxy());
filter->setSourceModel(walletModel->getTransactionTableModel());
filter->setDynamicSortFilter(true);
filter->setSortRole(Qt::EditRole);
filter->setShowInactive(false);
filter->sort(TransactionTableModel::Date, Qt::DescendingOrder);
Backport Bitcoin Qt/Gui changes up to 0.14.x part 3 (#1617) * Merge #8996: Network activity toggle 19f46f1 Qt: New network_disabled icon (Luke Dashjr) 54cf997 RPC/Net: Use boolean consistently for networkactive, and remove from getinfo (Luke Dashjr) b2b33d9 Overhaul network activity toggle (Jonas Schnelli) 32efa79 Qt: Add GUI feedback and control of network activity state. (Jon Lund Steffensen) e38993b RPC: Add "togglenetwork" method to toggle network activity temporarily (Jon Lund Steffensen) 7c9a98a Allow network activity to be temporarily suspended. (Jon Lund Steffensen) * Revert on-click behavior of network status icon to showing peers list Stay with the way Dash handled clicking on the status icon * Add theme support for network disabled icon * Merge #8874: Multiple Selection for peer and ban tables 1077577 Fix auto-deselection of peers (Andrew Chow) addfdeb Multiple Selection for peer and ban tables (Andrew Chow) * Merge #9190: qt: Plug many memory leaks ed998ea qt: Avoid OpenSSL certstore-related memory leak (Wladimir J. van der Laan) 5204598 qt: Avoid shutdownwindow-related memory leak (Wladimir J. van der Laan) e4f126a qt: Avoid splash-screen related memory leak (Wladimir J. van der Laan) 693384e qt: Prevent thread/memory leak on exiting RPCConsole (Wladimir J. van der Laan) 47db075 qt: Plug many memory leaks (Wladimir J. van der Laan) * Merge #9218: qt: Show progress overlay when clicking spinner icon 042f9fa qt: Show progress overlay when clicking spinner icon (Wladimir J. van der Laan) 827d9a3 qt: Replace NetworkToggleStatusBarControl with generic ClickableLabel (Wladimir J. van der Laan) * Merge #9266: Bugfix: Qt/RPCConsole: Put column enum in the right places df17fe0 Bugfix: Qt/RPCConsole: Put column enum in the right places (Luke Dashjr) * Merge #9255: qt: layoutAboutToChange signal is called layoutAboutToBeChanged f36349e qt: Remove on_toggleNetworkActiveButton_clicked from RPCConsole (Wladimir J. van der Laan) 297cc20 qt: layoutAboutToChange signal is called layoutAboutToBeChanged (Wladimir J. van der Laan) * Use UniValue until bitcoin PR #8788 is backported Network active toggle was already based on "[RPC] Give RPC commands more information about the RPC request" We need to use the old UniValue style until that one is backported * Merge #8906: [qt] sync-overlay: Don't show progress twice fafeec3 [qt] sync-overlay: Don't show progress twice (MarcoFalke) * Merge #8985: Use pindexBestHeader instead of setBlockIndexCandidates for NotifyHeaderTip() 3154d6e [Qt] use NotifyHeaderTip's height and date for the progress update (Jonas Schnelli) 0a261b6 Use pindexBestHeader instead of setBlockIndexCandidates for NotifyHeaderTip() (Jonas Schnelli) * Merge #9280: [Qt] Show ModalOverlay by pressing the progress bar, allow hiding 89a3723 [Qt] Show ModalOverlay by pressing the progress bar, disabled show() in sync mode (Jonas Schnelli) * Merge #9461: [Qt] Improve progress display during headers-sync and peer-finding 40ec7c7 [Qt] Improve progress display during headers-sync and peer-finding (Jonas Schnelli) * Merge #9588: qt: Use nPowTargetSpacing constant fa4d478 qt: Use nPowTargetSpacing constant (MarcoFalke) * Hide modal overlay forever when syncing has catched up Don't allow to open it again by clicking on the progress bar and spinner icon. Currently the overlay does not show meaningful information about masternode sync and it gives the impression of being stuck after the block chain sync is done. * Don't include chainparams.h in sendcoinsdialog.cpp This was just a remainder of a backported PR which meant to change some calculation in this file which does not apply to Dash. * Also check for fNetworkActive in ConnectNode * Merge #9528: [qt] Rename formateNiceTimeOffset(qint64) to formatNiceTimeOffset(qint64) 988d300 [qt] Rename formateNiceTimeOffset(qint64) to formatNiceTimeOffset(qint64) (practicalswift) * Merge #11237: qt: Fixing division by zero in time remaining c8d38abd6 Refactor tipUpdate as per style guide (MeshCollider) 3b69a08c5 Fix division by zero in time remaining (MeshCollider) Pull request description: Fixes https://github.com/bitcoin/bitcoin/issues/10291, https://github.com/bitcoin/bitcoin/issues/11265 progressDelta may be 0 (or even negative according to 11265), this checks for that and prints unknown if it is, because we cannot calculate an estimate for the time remaining (would be infinite or negative). Tree-SHA512: bc5708e5ed6e4670d008219558c5fbb25709bd99a32c98ec39bb74f94a0b7fa058f3d03389ccdd39e6723e6b5b48e34b13ceee7c051c2db631e51d8ec3e1d68c
2017-09-11 15:38:14 +02:00
ui->listTransactions->setModel(filter.get());
}
qt: Finetune OverviewPage (#3715) * qt: Adjust "Recent Transactions" in Overview tab Make sure they follow the same format as the transactions in TransactionsView. - Removed the transaction type representing arrows - Apply the same coloring like like in the transaction tab for the different transaction types (orange = internal, red = outgoing, green = incoming) * qt: Cleanup layout of OverviewPage in css * qt: Add three spacer (left, middle, right) and adjust layout stretch. This allows to have the elements on the screen aligned symetrically around the center independent from the window size/resizing. * qt: Inrease date/amount size for "Recent Transactions" in Overview tab * qt: Inrease number of "Recent Transactions" displayed in Overview tab Just to fill the empty space * qt: Make sure PS elements show as expected and adjust number of recent transactions based on PS * qt: Adjust transaction entry generation Co-Authored-By: UdjinM6 <UdjinM6@users.noreply.github.com> * qt: Adjust warning message box Co-Authored-By: UdjinM6 <UdjinM6@users.noreply.github.com> * Move tx list style to css * Fix tx list style for the traditional theme * Drop (no longer needed?) min height offset in SetupTransactionList Can't reproduce the tx list scrolling issue anymore * Avoid recreating transaction filter from scratch every time SetupTransactionList is called We call SetupTransactionList every second now (from privateSendStatus()) and this makes GUI unresponsive for huge wallets (I have ~400k txes in my testnet wallet) because of filter recreation/sorting. There is no need to go through all setup steps really, simply updating the limit works just fine and fixes the issue. * qt: Fix an `if` statement * qt: Just some refactoring * fix code style * bail out if `filter->rowCount() == nNumItems` * qt: Make sure number of transactions is always correct * Drop spacer to let recent tx list occupy max height available * TransactionFilterProxy::setLimit should emit signals to let coresponding layouts update themselves https://doc.qt.io/qt-5/qabstractitemmodel.html#layoutAboutToBeChanged https://doc.qt.io/qt-5/qabstractitemmodel.html#layoutChanged Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-09-25 18:04:53 +02:00
if (filter->rowCount() == nNumItems) {
return;
}
filter->setLimit(nNumItems);
ui->listTransactions->setMinimumHeight(nNumItems * ITEM_HEIGHT);
}
void OverviewPage::DisableCoinJoinCompletely()
{
if (walletModel == nullptr) {
return;
}
ui->toggleCoinJoin->setText("(" + tr("Disabled") + ")");
ui->frameCoinJoin->setEnabled(false);
if (nWalletBackups <= 0) {
ui->labelCoinJoinEnabled->setText("<span style='" + GUIUtil::getThemedStyleQString(GUIUtil::ThemedStyle::TS_ERROR) + "'>(" + tr("Disabled") + ")</span>");
}
walletModel->coinJoin().stopMixing();
}