diff --git a/src/qt/forms/receiverequestdialog.ui b/src/qt/forms/receiverequestdialog.ui
index 9f896ee3b1..f6d4723465 100644
--- a/src/qt/forms/receiverequestdialog.ui
+++ b/src/qt/forms/receiverequestdialog.ui
@@ -6,68 +6,233 @@
0
0
- 487
- 597
+ 413
+ 229
-
- -
-
-
-
- 0
- 0
-
+
+ Request payment to ...
+
+
+
+ QLayout::SetFixedSize
+
+
-
+
+
+ QR image
-
-
- 300
- 320
-
+
+ Qt::NoTextInteraction
-
- QR Code
+
+
+ -
+
+
+
+ 75
+ true
+
+
+
+ Payment information
+
+
+ Qt::NoTextInteraction
+
+
+
+ -
+
+
+
+ 75
+ true
+
+
+
+ URI:
Qt::PlainText
-
- Qt::AlignCenter
+
+ Qt::NoTextInteraction
+
+
+
+ -
+
+
+ bitcoin:BC1...
+
+
+ Qt::RichText
true
+
+ Qt::TextSelectableByMouse
+
- -
-
-
-
- 0
- 0
-
+
-
+
+
+
+ 75
+ true
+
-
-
- 0
- 50
-
+
+ Address:
-
- QFrame::NoFrame
+
+ Qt::NoTextInteraction
-
- QFrame::Plain
+
+
+ -
+
+
+ bc1...
-
+
+ Qt::PlainText
+
+
+ Qt::TextSelectableByMouse
+
+
+
+ -
+
+
+
+ 75
+ true
+
+
+
+ Amount:
+
+
+ Qt::NoTextInteraction
+
+
+
+ -
+
+
+ 0.00000000 BTC
+
+
+ Qt::PlainText
+
+
+ Qt::TextSelectableByMouse
+
+
+
+ -
+
+
+
+ 75
+ true
+
+
+
+ Label:
+
+
+ Qt::NoTextInteraction
+
+
+
+ -
+
+
+ label content
+
+
+ Qt::PlainText
+
+
true
- Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse
+ Qt::TextSelectableByMouse
- -
+
-
+
+
+
+ 75
+ true
+
+
+
+ Message:
+
+
+ Qt::NoTextInteraction
+
+
+
+ -
+
+
+ message content
+
+
+ Qt::PlainText
+
+
+ true
+
+
+ Qt::TextSelectableByMouse
+
+
+
+ -
+
+
+
+ 75
+ true
+
+
+
+ Wallet:
+
+
+ Qt::NoTextInteraction
+
+
+
+ -
+
+
+ wallet name
+
+
+ Qt::PlainText
+
+
+ true
+
+
+ Qt::TextSelectableByMouse
+
+
+
+ -
-
@@ -114,8 +279,11 @@
-
+
+ Qt::StrongFocus
+
- QDialogButtonBox::Close
+ QDialogButtonBox::Ok
@@ -130,24 +298,14 @@
+
+ buttonBox
+ btnCopyURI
+ btnCopyAddress
+ btnSaveAs
+
-
- buttonBox
- rejected()
- ReceiveRequestDialog
- reject()
-
-
- 452
- 573
-
-
- 243
- 298
-
-
-
buttonBox
accepted()
@@ -155,12 +313,12 @@
accept()
- 452
- 573
+ 135
+ 230
- 243
- 298
+ 135
+ 126
diff --git a/src/qt/receiverequestdialog.cpp b/src/qt/receiverequestdialog.cpp
index 30bd5c6a5a..d385c42821 100644
--- a/src/qt/receiverequestdialog.cpp
+++ b/src/qt/receiverequestdialog.cpp
@@ -8,10 +8,11 @@
#include
#include
#include
+#include
#include
-#include
-#include
+#include
+#include
#if defined(HAVE_CONFIG_H)
#include /* for USE_QRCODE */
@@ -23,14 +24,6 @@ ReceiveRequestDialog::ReceiveRequestDialog(QWidget *parent) :
model(nullptr)
{
ui->setupUi(this);
-
-#ifndef USE_QRCODE
- ui->btnSaveAs->setVisible(false);
- ui->lblQRCode->setVisible(false);
-#endif
-
- connect(ui->btnSaveAs, &QPushButton::clicked, ui->lblQRCode, &QRImageWidget::saveImage);
-
GUIUtil::handleCloseWindowShortcut(this);
}
@@ -44,7 +37,7 @@ void ReceiveRequestDialog::setModel(WalletModel *_model)
this->model = _model;
if (_model)
- connect(_model->getOptionsModel(), &OptionsModel::displayUnitChanged, this, &ReceiveRequestDialog::update);
+ connect(_model->getOptionsModel(), &OptionsModel::displayUnitChanged, this, &ReceiveRequestDialog::updateDisplayUnit);
// update the display unit if necessary
update();
@@ -53,40 +46,55 @@ void ReceiveRequestDialog::setModel(WalletModel *_model)
void ReceiveRequestDialog::setInfo(const SendCoinsRecipient &_info)
{
this->info = _info;
- update();
+ setWindowTitle(tr("Request payment to %1").arg(info.label.isEmpty() ? info.address : info.label));
+ QString uri = GUIUtil::formatBitcoinURI(info);
+
+#ifdef USE_QRCODE
+ if (ui->qr_code->setQR(uri, info.address)) {
+ connect(ui->btnSaveAs, &QPushButton::clicked, ui->qr_code, &QRImageWidget::saveImage);
+ } else {
+ ui->btnSaveAs->setEnabled(false);
+ }
+#else
+ ui->btnSaveAs->hide();
+ ui->qr_code->hide();
+#endif
+
+ ui->uri_content->setText("" + GUIUtil::HtmlEscape(uri) + "");
+ ui->address_content->setText(info.address);
+
+ if (!info.amount) {
+ ui->amount_tag->hide();
+ ui->amount_content->hide();
+ } // Amount is set in updateDisplayUnit() slot.
+ updateDisplayUnit();
+
+ if (!info.label.isEmpty()) {
+ ui->label_content->setText(info.label);
+ } else {
+ ui->label_tag->hide();
+ ui->label_content->hide();
+ }
+
+ if (!info.message.isEmpty()) {
+ ui->message_content->setText(info.message);
+ } else {
+ ui->message_tag->hide();
+ ui->message_content->hide();
+ }
+
+ if (!model->getWalletName().isEmpty()) {
+ ui->wallet_content->setText(model->getWalletName());
+ } else {
+ ui->wallet_tag->hide();
+ ui->wallet_content->hide();
+ }
}
-void ReceiveRequestDialog::update()
+void ReceiveRequestDialog::updateDisplayUnit()
{
- if(!model)
- return;
- QString target = info.label;
- if(target.isEmpty())
- target = info.address;
- setWindowTitle(tr("Request payment to %1").arg(target));
-
- QString uri = GUIUtil::formatBitcoinURI(info);
- ui->btnSaveAs->setEnabled(false);
- QString html;
- html += "";
- html += ""+tr("Payment information")+"
";
- html += ""+tr("URI")+": ";
- html += "" + GUIUtil::HtmlEscape(uri) + "
";
- html += ""+tr("Address")+": " + GUIUtil::HtmlEscape(info.address) + "
";
- if(info.amount)
- html += ""+tr("Amount")+": " + BitcoinUnits::formatHtmlWithUnit(model->getOptionsModel()->getDisplayUnit(), info.amount) + "
";
- if(!info.label.isEmpty())
- html += ""+tr("Label")+": " + GUIUtil::HtmlEscape(info.label) + "
";
- if(!info.message.isEmpty())
- html += ""+tr("Message")+": " + GUIUtil::HtmlEscape(info.message) + "
";
- if(model->isMultiwallet()) {
- html += ""+tr("Wallet")+": " + GUIUtil::HtmlEscape(model->getWalletName()) + "
";
- }
- ui->outUri->setText(html);
-
- if (ui->lblQRCode->setQR(uri, info.address)) {
- ui->btnSaveAs->setEnabled(true);
- }
+ if (!model) return;
+ ui->amount_content->setText(BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), info.amount));
}
void ReceiveRequestDialog::on_btnCopyURI_clicked()
diff --git a/src/qt/receiverequestdialog.h b/src/qt/receiverequestdialog.h
index 40e3d5ffa8..846478643d 100644
--- a/src/qt/receiverequestdialog.h
+++ b/src/qt/receiverequestdialog.h
@@ -29,8 +29,7 @@ public:
private Q_SLOTS:
void on_btnCopyURI_clicked();
void on_btnCopyAddress_clicked();
-
- void update();
+ void updateDisplayUnit();
private:
Ui::ReceiveRequestDialog *ui;
diff --git a/src/qt/test/wallettests.cpp b/src/qt/test/wallettests.cpp
index 31feca3253..8da0250e57 100644
--- a/src/qt/test/wallettests.cpp
+++ b/src/qt/test/wallettests.cpp
@@ -229,15 +229,23 @@ void TestGUI(interfaces::Node& node)
for (QWidget* widget : QApplication::topLevelWidgets()) {
if (widget->inherits("ReceiveRequestDialog")) {
ReceiveRequestDialog* receiveRequestDialog = qobject_cast(widget);
- QTextEdit* rlist = receiveRequestDialog->QObject::findChild("outUri");
- QString paymentText = rlist->toPlainText();
- QStringList paymentTextList = paymentText.split('\n');
- QCOMPARE(paymentTextList.at(0), QString("Payment information"));
- QVERIFY(paymentTextList.at(1).indexOf(QString("URI: bitcoin:")) != -1);
- QVERIFY(paymentTextList.at(2).indexOf(QString("Address:")) != -1);
- QCOMPARE(paymentTextList.at(3), QString("Amount: 0.00000001 ") + QString::fromStdString(CURRENCY_UNIT));
- QCOMPARE(paymentTextList.at(4), QString("Label: TEST_LABEL_1"));
- QCOMPARE(paymentTextList.at(5), QString("Message: TEST_MESSAGE_1"));
+ QCOMPARE(receiveRequestDialog->QObject::findChild("payment_header")->text(), QString("Payment information"));
+ QCOMPARE(receiveRequestDialog->QObject::findChild("uri_tag")->text(), QString("URI:"));
+ QString uri = receiveRequestDialog->QObject::findChild("uri_content")->text();
+ QCOMPARE(uri.count("bitcoin:"), 2);
+ QCOMPARE(receiveRequestDialog->QObject::findChild("address_tag")->text(), QString("Address:"));
+
+ QCOMPARE(uri.count("amount=0.00000001"), 2);
+ QCOMPARE(receiveRequestDialog->QObject::findChild("amount_tag")->text(), QString("Amount:"));
+ QCOMPARE(receiveRequestDialog->QObject::findChild("amount_content")->text(), QString("0.00000001 ") + QString::fromStdString(CURRENCY_UNIT));
+
+ QCOMPARE(uri.count("label=TEST_LABEL_1"), 2);
+ QCOMPARE(receiveRequestDialog->QObject::findChild("label_tag")->text(), QString("Label:"));
+ QCOMPARE(receiveRequestDialog->QObject::findChild("label_content")->text(), QString("TEST_LABEL_1"));
+
+ QCOMPARE(uri.count("message=TEST_MESSAGE_1"), 2);
+ QCOMPARE(receiveRequestDialog->QObject::findChild("message_tag")->text(), QString("Message:"));
+ QCOMPARE(receiveRequestDialog->QObject::findChild("message_content")->text(), QString("TEST_MESSAGE_1"));
}
}