From 6420fb2005db1490d77c6df45d0b97d7389ff609 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Mon, 30 May 2022 17:41:37 +0200 Subject: [PATCH 1/4] qt, refactor: Drop unused `QFrame`s in `SendCoinsEntry` --- src/qt/forms/sendcoinsentry.ui | 1039 -------------------------------- src/qt/sendcoinsentry.cpp | 25 +- 2 files changed, 2 insertions(+), 1062 deletions(-) diff --git a/src/qt/forms/sendcoinsentry.ui b/src/qt/forms/sendcoinsentry.ui index 934363af1f1..0e9abc17285 100644 --- a/src/qt/forms/sendcoinsentry.ui +++ b/src/qt/forms/sendcoinsentry.ui @@ -219,1041 +219,6 @@ - - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 127 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 191 - - - - - - - 127 - 127 - 63 - - - - - - - 170 - 170 - 84 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 127 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 191 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 127 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 191 - - - - - - - 127 - 127 - 63 - - - - - - - 170 - 170 - 84 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 127 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 191 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 127 - 127 - 63 - - - - - - - 255 - 255 - 127 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 191 - - - - - - - 127 - 127 - 63 - - - - - - - 170 - 170 - 84 - - - - - - - 127 - 127 - 63 - - - - - - - 255 - 255 - 255 - - - - - - - 127 - 127 - 63 - - - - - - - 255 - 255 - 127 - - - - - - - 255 - 255 - 127 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 127 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - This is an unauthenticated payment request. - - - true - - - QFrame::NoFrame - - - - 12 - - - - - Pay To: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - 0 - - - - - - - - Remove this entry - - - - - - - :/icons/remove:/icons/remove - - - - - - - - - Memo: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Qt::PlainText - - - - - - - A&mount: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - payAmount_is - - - - - - - false - - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - 140 - 232 - 119 - - - - - - - 230 - 255 - 224 - - - - - - - 185 - 243 - 171 - - - - - - - 70 - 116 - 59 - - - - - - - 93 - 155 - 79 - - - - - - - 0 - 0 - 0 - - - - - - - 155 - 255 - 147 - - - - - - - 0 - 0 - 0 - - - - - - - 119 - 255 - 233 - - - - - - - 140 - 232 - 119 - - - - - - - 0 - 0 - 0 - - - - - - - 197 - 243 - 187 - - - - - - - 125 - 194 - 122 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 0 - 0 - 0 - - - - - - - 140 - 232 - 119 - - - - - - - 230 - 255 - 224 - - - - - - - 185 - 243 - 171 - - - - - - - 70 - 116 - 59 - - - - - - - 93 - 155 - 79 - - - - - - - 0 - 0 - 0 - - - - - - - 155 - 255 - 147 - - - - - - - 0 - 0 - 0 - - - - - - - 119 - 255 - 233 - - - - - - - 140 - 232 - 119 - - - - - - - 0 - 0 - 0 - - - - - - - 197 - 243 - 187 - - - - - - - 125 - 194 - 122 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 70 - 116 - 59 - - - - - - - 140 - 232 - 119 - - - - - - - 230 - 255 - 224 - - - - - - - 185 - 243 - 171 - - - - - - - 70 - 116 - 59 - - - - - - - 93 - 155 - 79 - - - - - - - 70 - 116 - 59 - - - - - - - 155 - 255 - 147 - - - - - - - 70 - 116 - 59 - - - - - - - 140 - 232 - 119 - - - - - - - 140 - 232 - 119 - - - - - - - 0 - 0 - 0 - - - - - - - 140 - 232 - 119 - - - - - - - 125 - 194 - 122 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - This is an authenticated payment request. - - - true - - - QFrame::NoFrame - - - - 12 - - - - - Pay To: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - 0 - - - - - Qt::PlainText - - - - - - - Remove this entry - - - - - - - :/icons/remove:/icons/remove - - - - - - - - - Memo: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Qt::PlainText - - - - - - - A&mount: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - payAmount_s - - - - - - - false - - - - - @@ -1274,10 +239,6 @@ deleteButton addAsLabel payAmount - payAmount_is - deleteButton_is - payAmount_s - deleteButton_s diff --git a/src/qt/sendcoinsentry.cpp b/src/qt/sendcoinsentry.cpp index 339ac580d80..ba9af382a3f 100644 --- a/src/qt/sendcoinsentry.cpp +++ b/src/qt/sendcoinsentry.cpp @@ -30,25 +30,18 @@ SendCoinsEntry::SendCoinsEntry(const PlatformStyle *_platformStyle, QWidget *par ui->addressBookButton->setIcon(platformStyle->SingleColorIcon(":/icons/address-book")); ui->pasteButton->setIcon(platformStyle->SingleColorIcon(":/icons/editpaste")); ui->deleteButton->setIcon(platformStyle->SingleColorIcon(":/icons/remove")); - ui->deleteButton_is->setIcon(platformStyle->SingleColorIcon(":/icons/remove")); - ui->deleteButton_s->setIcon(platformStyle->SingleColorIcon(":/icons/remove")); setCurrentWidget(ui->SendCoins); if (platformStyle->getUseExtraSpacing()) ui->payToLayout->setSpacing(4); - // normal bitcoin address field GUIUtil::setupAddressWidget(ui->payTo, this); - // just a label for displaying bitcoin address(es) - ui->payTo_is->setFont(GUIUtil::fixedPitchFont()); // Connect signals connect(ui->payAmount, &BitcoinAmountField::valueChanged, this, &SendCoinsEntry::payAmountChanged); connect(ui->checkboxSubtractFeeFromAmount, &QCheckBox::toggled, this, &SendCoinsEntry::subtractFeeFromAmountChanged); connect(ui->deleteButton, &QPushButton::clicked, this, &SendCoinsEntry::deleteClicked); - connect(ui->deleteButton_is, &QPushButton::clicked, this, &SendCoinsEntry::deleteClicked); - connect(ui->deleteButton_s, &QPushButton::clicked, this, &SendCoinsEntry::deleteClicked); connect(ui->useAvailableBalanceButton, &QPushButton::clicked, this, &SendCoinsEntry::useAvailableBalanceClicked); } @@ -103,14 +96,6 @@ void SendCoinsEntry::clear() ui->messageTextLabel->clear(); ui->messageTextLabel->hide(); ui->messageLabel->hide(); - // clear UI elements for unauthenticated payment request - ui->payTo_is->clear(); - ui->memoTextLabel_is->clear(); - ui->payAmount_is->clear(); - // clear UI elements for authenticated payment request - ui->payTo_s->clear(); - ui->memoTextLabel_s->clear(); - ui->payAmount_s->clear(); // update the display unit, to not use the default ("BTC") updateDisplayUnit(); @@ -219,7 +204,7 @@ void SendCoinsEntry::setAmount(const CAmount &amount) bool SendCoinsEntry::isClear() { - return ui->payTo->text().isEmpty() && ui->payTo_is->text().isEmpty() && ui->payTo_s->text().isEmpty(); + return ui->payTo->text().isEmpty(); } void SendCoinsEntry::setFocus() @@ -229,12 +214,8 @@ void SendCoinsEntry::setFocus() void SendCoinsEntry::updateDisplayUnit() { - if(model && model->getOptionsModel()) - { - // Update payAmount with the current unit + if (model && model->getOptionsModel()) { ui->payAmount->setDisplayUnit(model->getOptionsModel()->getDisplayUnit()); - ui->payAmount_is->setDisplayUnit(model->getOptionsModel()->getDisplayUnit()); - ui->payAmount_s->setDisplayUnit(model->getOptionsModel()->getDisplayUnit()); } } @@ -244,8 +225,6 @@ void SendCoinsEntry::changeEvent(QEvent* e) ui->addressBookButton->setIcon(platformStyle->SingleColorIcon(QStringLiteral(":/icons/address-book"))); ui->pasteButton->setIcon(platformStyle->SingleColorIcon(QStringLiteral(":/icons/editpaste"))); ui->deleteButton->setIcon(platformStyle->SingleColorIcon(QStringLiteral(":/icons/remove"))); - ui->deleteButton_is->setIcon(platformStyle->SingleColorIcon(QStringLiteral(":/icons/remove"))); - ui->deleteButton_s->setIcon(platformStyle->SingleColorIcon(QStringLiteral(":/icons/remove"))); } QStackedWidget::changeEvent(e); From f3c76033295b8007c61eab7fcb23cf119d72b8b8 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Mon, 30 May 2022 18:58:25 +0200 Subject: [PATCH 2/4] qt, refactor: Convert `SendCoinsEntry` to a sub-`QWidget` It is no longer needed to derive the `SendCoinsEntry` class from the `QStackedWidget` one. --- src/qt/forms/sendcoinsentry.ui | 7 +------ src/qt/sendcoinsentry.cpp | 6 ++---- src/qt/sendcoinsentry.h | 6 ++---- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/src/qt/forms/sendcoinsentry.ui b/src/qt/forms/sendcoinsentry.ui index 0e9abc17285..efbfba9a20d 100644 --- a/src/qt/forms/sendcoinsentry.ui +++ b/src/qt/forms/sendcoinsentry.ui @@ -1,7 +1,7 @@ SendCoinsEntry - + 0 @@ -16,10 +16,6 @@ false - - - QFrame::NoFrame - 8 @@ -218,7 +214,6 @@ - diff --git a/src/qt/sendcoinsentry.cpp b/src/qt/sendcoinsentry.cpp index ba9af382a3f..af514d5a431 100644 --- a/src/qt/sendcoinsentry.cpp +++ b/src/qt/sendcoinsentry.cpp @@ -20,7 +20,7 @@ #include SendCoinsEntry::SendCoinsEntry(const PlatformStyle *_platformStyle, QWidget *parent) : - QStackedWidget(parent), + QWidget(parent), ui(new Ui::SendCoinsEntry), model(nullptr), platformStyle(_platformStyle) @@ -31,8 +31,6 @@ SendCoinsEntry::SendCoinsEntry(const PlatformStyle *_platformStyle, QWidget *par ui->pasteButton->setIcon(platformStyle->SingleColorIcon(":/icons/editpaste")); ui->deleteButton->setIcon(platformStyle->SingleColorIcon(":/icons/remove")); - setCurrentWidget(ui->SendCoins); - if (platformStyle->getUseExtraSpacing()) ui->payToLayout->setSpacing(4); @@ -227,7 +225,7 @@ void SendCoinsEntry::changeEvent(QEvent* e) ui->deleteButton->setIcon(platformStyle->SingleColorIcon(QStringLiteral(":/icons/remove"))); } - QStackedWidget::changeEvent(e); + QWidget::changeEvent(e); } bool SendCoinsEntry::updateLabel(const QString &address) diff --git a/src/qt/sendcoinsentry.h b/src/qt/sendcoinsentry.h index e8db1e3a5ce..ea9d58fbf86 100644 --- a/src/qt/sendcoinsentry.h +++ b/src/qt/sendcoinsentry.h @@ -7,7 +7,7 @@ #include -#include +#include class WalletModel; class PlatformStyle; @@ -22,10 +22,8 @@ namespace Ui { /** * A single entry in the dialog for sending bitcoins. - * Stacked widget, with different UIs for payment requests - * with a strong payee identity. */ -class SendCoinsEntry : public QStackedWidget +class SendCoinsEntry : public QWidget { Q_OBJECT From 32625421047951b9c9fad195be3aa40d6075d469 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Mon, 30 May 2022 19:15:49 +0200 Subject: [PATCH 3/4] qt, refactor: Fix `sendcoinsentry.ui` indentation --- src/qt/forms/sendcoinsentry.ui | 396 ++++++++++++++++----------------- 1 file changed, 198 insertions(+), 198 deletions(-) diff --git a/src/qt/forms/sendcoinsentry.ui b/src/qt/forms/sendcoinsentry.ui index efbfba9a20d..d2bb60d08d8 100644 --- a/src/qt/forms/sendcoinsentry.ui +++ b/src/qt/forms/sendcoinsentry.ui @@ -16,204 +16,204 @@ false - - - 8 - - - 4 - - - 12 - - - 8 - - - - - Pay &To: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - payTo - - - - - - - 0 - - - - - The Bitcoin address to send the payment to - - - - - - - Choose previously used address - - - - - - - :/icons/address-book:/icons/address-book - - - - 22 - 22 - - - - Alt+A - - - - - - - Paste address from clipboard - - - - - - - :/icons/editpaste:/icons/editpaste - - - - 22 - 22 - - - - Alt+P - - - - - - - Remove this entry - - - - - - - :/icons/remove:/icons/remove - - - - 22 - 22 - - - - - - - - - - &Label: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - addAsLabel - - - - - - - Enter a label for this address to add it to the list of used addresses - - - Enter a label for this address to add it to the list of used addresses - - - - - - - A&mount: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - payAmount - - - - - - - - - The amount to send in the selected unit - - - - - - - The fee will be deducted from the amount being sent. The recipient will receive less bitcoins than you enter in the amount field. If multiple recipients are selected, the fee is split equally. - - - S&ubtract fee from amount - - - - - - - Use available balance - - - - - - - - - Message: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - A message that was attached to the bitcoin: URI which will be stored with the transaction for your reference. Note: This message will not be sent over the Bitcoin network. - - - Qt::PlainText - - - - - - - Qt::Horizontal - - - - + + + 8 + + + 4 + + + 12 + + + 8 + + + + + Pay &To: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + payTo + + + + + + + 0 + + + + + The Bitcoin address to send the payment to + + + + + + + Choose previously used address + + + + + + + :/icons/address-book:/icons/address-book + + + + 22 + 22 + + + + Alt+A + + + + + + + Paste address from clipboard + + + + + + + :/icons/editpaste:/icons/editpaste + + + + 22 + 22 + + + + Alt+P + + + + + + + Remove this entry + + + + + + + :/icons/remove:/icons/remove + + + + 22 + 22 + + + + + + + + + + &Label: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + addAsLabel + + + + + + + Enter a label for this address to add it to the list of used addresses + + + Enter a label for this address to add it to the list of used addresses + + + + + + + A&mount: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + payAmount + + + + + + + + + The amount to send in the selected unit + + + + + + + The fee will be deducted from the amount being sent. The recipient will receive less bitcoins than you enter in the amount field. If multiple recipients are selected, the fee is split equally. + + + S&ubtract fee from amount + + + + + + + Use available balance + + + + + + + + + Message: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + A message that was attached to the bitcoin: URI which will be stored with the transaction for your reference. Note: This message will not be sent over the Bitcoin network. + + + Qt::PlainText + + + + + + + Qt::Horizontal + + + + From 7ab72b9d2a500420a1103221c3cbfac4cda1c43a Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Mon, 30 May 2022 19:26:48 +0200 Subject: [PATCH 4/4] qt: Fix `BitcoinAmountField`'s base widget --- src/qt/forms/sendcoinsentry.ui | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/qt/forms/sendcoinsentry.ui b/src/qt/forms/sendcoinsentry.ui index d2bb60d08d8..ffebc316b1d 100644 --- a/src/qt/forms/sendcoinsentry.ui +++ b/src/qt/forms/sendcoinsentry.ui @@ -161,7 +161,7 @@ - + The amount to send in the selected unit @@ -223,8 +223,9 @@ BitcoinAmountField - QLineEdit + QWidget
qt/bitcoinamountfield.h
+ 1