From 210ef1e980e0887c5675b66bcd5cbccd00aceec6 Mon Sep 17 00:00:00 2001 From: Sebastian Falbesoner Date: Mon, 13 Mar 2023 23:26:35 +0100 Subject: [PATCH 1/2] qt: remove confusing "Dust" label from coincontrol / sendcoins dialog In contrast to to all other labels on the coin selection dialog, the displayed dust information has nothing to do with the selected coins. All that this label shows is whether at least one of the _outputs_ qualify as dust, but the outputs are set in a different dialog. (Even worse, the dust check is currently simply wrong because it only looks at an output's nValue and just assumes a P2PKH script size.) As the label clearly doesn't help the user and is, quite the contrary, rather increasing confusion/misguidance, it seems sensible to remove it. Also, remove the label from the sendcoins dialog with the same rationale. --- src/qt/coincontroldialog.cpp | 34 ++---------------------------- src/qt/coincontroldialog.h | 1 - src/qt/forms/coincontroldialog.ui | 35 ------------------------------- src/qt/forms/sendcoinsdialog.ui | 29 ------------------------- src/qt/sendcoinsdialog.cpp | 9 -------- src/qt/sendcoinsdialog.h | 1 - 6 files changed, 2 insertions(+), 107 deletions(-) diff --git a/src/qt/coincontroldialog.cpp b/src/qt/coincontroldialog.cpp index e1b1ae12e98..998ef2ef3d7 100644 --- a/src/qt/coincontroldialog.cpp +++ b/src/qt/coincontroldialog.cpp @@ -70,7 +70,6 @@ CoinControlDialog::CoinControlDialog(CCoinControl& coin_control, WalletModel* _m QAction *clipboardFeeAction = new QAction(tr("Copy fee"), this); QAction *clipboardAfterFeeAction = new QAction(tr("Copy after fee"), this); QAction *clipboardBytesAction = new QAction(tr("Copy bytes"), this); - QAction *clipboardLowOutputAction = new QAction(tr("Copy dust"), this); QAction *clipboardChangeAction = new QAction(tr("Copy change"), this); connect(clipboardQuantityAction, &QAction::triggered, this, &CoinControlDialog::clipboardQuantity); @@ -78,7 +77,6 @@ CoinControlDialog::CoinControlDialog(CCoinControl& coin_control, WalletModel* _m connect(clipboardFeeAction, &QAction::triggered, this, &CoinControlDialog::clipboardFee); connect(clipboardAfterFeeAction, &QAction::triggered, this, &CoinControlDialog::clipboardAfterFee); connect(clipboardBytesAction, &QAction::triggered, this, &CoinControlDialog::clipboardBytes); - connect(clipboardLowOutputAction, &QAction::triggered, this, &CoinControlDialog::clipboardLowOutput); connect(clipboardChangeAction, &QAction::triggered, this, &CoinControlDialog::clipboardChange); ui->labelCoinControlQuantity->addAction(clipboardQuantityAction); @@ -86,7 +84,6 @@ CoinControlDialog::CoinControlDialog(CCoinControl& coin_control, WalletModel* _m ui->labelCoinControlFee->addAction(clipboardFeeAction); ui->labelCoinControlAfterFee->addAction(clipboardAfterFeeAction); ui->labelCoinControlBytes->addAction(clipboardBytesAction); - ui->labelCoinControlLowOutput->addAction(clipboardLowOutputAction); ui->labelCoinControlChange->addAction(clipboardChangeAction); // toggle tree/list mode @@ -294,12 +291,6 @@ void CoinControlDialog::clipboardBytes() GUIUtil::setClipboard(ui->labelCoinControlBytes->text().replace(ASYMP_UTF8, "")); } -// copy label "Dust" to clipboard -void CoinControlDialog::clipboardLowOutput() -{ - GUIUtil::setClipboard(ui->labelCoinControlLowOutput->text()); -} - // copy label "Change" to clipboard void CoinControlDialog::clipboardChange() { @@ -390,17 +381,8 @@ void CoinControlDialog::updateLabels(CCoinControl& m_coin_control, WalletModel * // nPayAmount CAmount nPayAmount = 0; - bool fDust = false; - for (const CAmount &amount : CoinControlDialog::payAmounts) - { + for (const CAmount &amount : CoinControlDialog::payAmounts) { nPayAmount += amount; - - if (amount > 0) - { - // Assumes a p2pkh script size - CTxOut txout(amount, CScript() << std::vector(24, 0)); - fDust |= IsDust(txout, model->node().getDustRelayFee()); - } } CAmount nAmount = 0; @@ -516,12 +498,9 @@ void CoinControlDialog::updateLabels(CCoinControl& m_coin_control, WalletModel * QLabel *l3 = dialog->findChild("labelCoinControlFee"); QLabel *l4 = dialog->findChild("labelCoinControlAfterFee"); QLabel *l5 = dialog->findChild("labelCoinControlBytes"); - QLabel *l7 = dialog->findChild("labelCoinControlLowOutput"); QLabel *l8 = dialog->findChild("labelCoinControlChange"); - // enable/disable "dust" and "change" - dialog->findChild("labelCoinControlLowOutputText")->setEnabled(nPayAmount > 0); - dialog->findChild("labelCoinControlLowOutput") ->setEnabled(nPayAmount > 0); + // enable/disable "change" dialog->findChild("labelCoinControlChangeText") ->setEnabled(nPayAmount > 0); dialog->findChild("labelCoinControlChange") ->setEnabled(nPayAmount > 0); @@ -531,7 +510,6 @@ void CoinControlDialog::updateLabels(CCoinControl& m_coin_control, WalletModel * l3->setText(BitcoinUnits::formatWithUnit(nDisplayUnit, nPayFee)); // Fee l4->setText(BitcoinUnits::formatWithUnit(nDisplayUnit, nAfterFee)); // After Fee l5->setText(((nBytes > 0) ? ASYMP_UTF8 : "") + QString::number(nBytes)); // Bytes - l7->setText(fDust ? tr("yes") : tr("no")); // Dust l8->setText(BitcoinUnits::formatWithUnit(nDisplayUnit, nChange)); // Change if (nPayFee > 0) { @@ -541,12 +519,6 @@ void CoinControlDialog::updateLabels(CCoinControl& m_coin_control, WalletModel * l8->setText(ASYMP_UTF8 + l8->text()); } - // turn label red when dust - l7->setStyleSheet((fDust) ? "color:red;" : ""); - - // tool tips - QString toolTipDust = tr("This label turns red if any recipient receives an amount smaller than the current dust threshold."); - // how many satoshis the estimated fee can vary per byte we guess wrong double dFeeVary = (nBytes != 0) ? (double)nPayFee / nBytes : 0; @@ -554,12 +526,10 @@ void CoinControlDialog::updateLabels(CCoinControl& m_coin_control, WalletModel * l3->setToolTip(toolTip4); l4->setToolTip(toolTip4); - l7->setToolTip(toolTipDust); l8->setToolTip(toolTip4); dialog->findChild("labelCoinControlFeeText") ->setToolTip(l3->toolTip()); dialog->findChild("labelCoinControlAfterFeeText") ->setToolTip(l4->toolTip()); dialog->findChild("labelCoinControlBytesText") ->setToolTip(l5->toolTip()); - dialog->findChild("labelCoinControlLowOutputText")->setToolTip(l7->toolTip()); dialog->findChild("labelCoinControlChangeText") ->setToolTip(l8->toolTip()); // Insufficient funds diff --git a/src/qt/coincontroldialog.h b/src/qt/coincontroldialog.h index ccceff10e86..5fc2cdca9b7 100644 --- a/src/qt/coincontroldialog.h +++ b/src/qt/coincontroldialog.h @@ -105,7 +105,6 @@ private Q_SLOTS: void clipboardFee(); void clipboardAfterFee(); void clipboardBytes(); - void clipboardLowOutput(); void clipboardChange(); void radioTreeMode(bool); void radioListMode(bool); diff --git a/src/qt/forms/coincontroldialog.ui b/src/qt/forms/coincontroldialog.ui index 5ce469ee963..bb166b06421 100644 --- a/src/qt/forms/coincontroldialog.ui +++ b/src/qt/forms/coincontroldialog.ui @@ -139,41 +139,6 @@ - - - - false - - - - 75 - true - - - - Dust: - - - - - - - false - - - IBeamCursor - - - Qt::ActionsContextMenu - - - no - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - diff --git a/src/qt/forms/sendcoinsdialog.ui b/src/qt/forms/sendcoinsdialog.ui index 37da6feddad..077a8fc6937 100644 --- a/src/qt/forms/sendcoinsdialog.ui +++ b/src/qt/forms/sendcoinsdialog.ui @@ -331,35 +331,6 @@ - - - - - 75 - true - - - - Dust: - - - - - - - IBeamCursor - - - Qt::ActionsContextMenu - - - no - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp index 89dd0ada629..41fc8db7713 100644 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -97,21 +97,18 @@ SendCoinsDialog::SendCoinsDialog(const PlatformStyle *_platformStyle, QWidget *p QAction *clipboardFeeAction = new QAction(tr("Copy fee"), this); QAction *clipboardAfterFeeAction = new QAction(tr("Copy after fee"), this); QAction *clipboardBytesAction = new QAction(tr("Copy bytes"), this); - QAction *clipboardLowOutputAction = new QAction(tr("Copy dust"), this); QAction *clipboardChangeAction = new QAction(tr("Copy change"), this); connect(clipboardQuantityAction, &QAction::triggered, this, &SendCoinsDialog::coinControlClipboardQuantity); connect(clipboardAmountAction, &QAction::triggered, this, &SendCoinsDialog::coinControlClipboardAmount); connect(clipboardFeeAction, &QAction::triggered, this, &SendCoinsDialog::coinControlClipboardFee); connect(clipboardAfterFeeAction, &QAction::triggered, this, &SendCoinsDialog::coinControlClipboardAfterFee); connect(clipboardBytesAction, &QAction::triggered, this, &SendCoinsDialog::coinControlClipboardBytes); - connect(clipboardLowOutputAction, &QAction::triggered, this, &SendCoinsDialog::coinControlClipboardLowOutput); connect(clipboardChangeAction, &QAction::triggered, this, &SendCoinsDialog::coinControlClipboardChange); ui->labelCoinControlQuantity->addAction(clipboardQuantityAction); ui->labelCoinControlAmount->addAction(clipboardAmountAction); ui->labelCoinControlFee->addAction(clipboardFeeAction); ui->labelCoinControlAfterFee->addAction(clipboardAfterFeeAction); ui->labelCoinControlBytes->addAction(clipboardBytesAction); - ui->labelCoinControlLowOutput->addAction(clipboardLowOutputAction); ui->labelCoinControlChange->addAction(clipboardChangeAction); // init transaction fee section @@ -904,12 +901,6 @@ void SendCoinsDialog::coinControlClipboardBytes() GUIUtil::setClipboard(ui->labelCoinControlBytes->text().replace(ASYMP_UTF8, "")); } -// Coin Control: copy label "Dust" to clipboard -void SendCoinsDialog::coinControlClipboardLowOutput() -{ - GUIUtil::setClipboard(ui->labelCoinControlLowOutput->text()); -} - // Coin Control: copy label "Change" to clipboard void SendCoinsDialog::coinControlClipboardChange() { diff --git a/src/qt/sendcoinsdialog.h b/src/qt/sendcoinsdialog.h index 2fcdf5b32af..0e6607b060a 100644 --- a/src/qt/sendcoinsdialog.h +++ b/src/qt/sendcoinsdialog.h @@ -108,7 +108,6 @@ private Q_SLOTS: void coinControlClipboardFee(); void coinControlClipboardAfterFee(); void coinControlClipboardBytes(); - void coinControlClipboardLowOutput(); void coinControlClipboardChange(); void updateFeeSectionControls(); void updateNumberOfBlocks(int count, const QDateTime& blockDate, double nVerificationProgress, SyncType synctype, SynchronizationState sync_state); From a582b4141f0756faa3793fb1c772898a984c83e4 Mon Sep 17 00:00:00 2001 From: furszy Date: Sun, 19 Mar 2023 19:56:26 -0300 Subject: [PATCH 2/2] gui: send, left alignment for "bytes" and "change" label --- src/qt/forms/coincontroldialog.ui | 6 ++++++ src/qt/forms/sendcoinsdialog.ui | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/src/qt/forms/coincontroldialog.ui b/src/qt/forms/coincontroldialog.ui index bb166b06421..f053adba0f0 100644 --- a/src/qt/forms/coincontroldialog.ui +++ b/src/qt/forms/coincontroldialog.ui @@ -24,6 +24,9 @@ + + Qt::AlignLeft|Qt::AlignVCenter + 10 @@ -188,6 +191,9 @@ + + Qt::AlignLeft|Qt::AlignVCenter + 10 diff --git a/src/qt/forms/sendcoinsdialog.ui b/src/qt/forms/sendcoinsdialog.ui index 077a8fc6937..1ca92440c8a 100644 --- a/src/qt/forms/sendcoinsdialog.ui +++ b/src/qt/forms/sendcoinsdialog.ui @@ -201,6 +201,9 @@ + + Qt::AlignLeft|Qt::AlignVCenter + 10 @@ -386,6 +389,9 @@ + + Qt::AlignLeft|Qt::AlignVCenter + 10