mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-12 04:42:36 -03:00
Merge #17597: qt: Fix height of QR-less ReceiveRequestDialog
73529f0859
qt: Rename slot to updateDisplayUnit() (Hennadii Stepanov)68288ef0c1
qt: Overhaul ReceiveRequestDialog (Hennadii Stepanov) Pull request description: If master (89a1f7a250
) is compiled without QR support, the "Request payment to..." dialog looks ugly: ![Screenshot from 2019-11-25 19-58-59](https://user-images.githubusercontent.com/32963518/69566647-3d9c1c80-0fc0-11ea-8ff6-183cea9372c5.png) With this PR: ![Screenshot from 2019-12-26 00-42-46](https://user-images.githubusercontent.com/32963518/71451226-221c6100-277a-11ea-94ae-c19a5c6256f7.png) ![Screenshot from 2019-12-26 00-44-34](https://user-images.githubusercontent.com/32963518/71451228-29436f00-277a-11ea-8ac5-1bafe6d73b5c.png) ![Screenshot from 2019-12-26 00-48-51](https://user-images.githubusercontent.com/32963518/71451230-2e082300-277a-11ea-8c4c-726ca7b776e7.png) Other minor changes: - "URI" abbreviation is not translated now - wallet name is shown if available ACKs for top commit: jonasschnelli: Tested ACK73529f0859
Tree-SHA512: 45f9a41d3c72978d78eb2e8ca98e274b8be5abf5352fd3e1f4f49514ce744994545fb3012e80600ded936ae41c6be4d4825a0c5f7bcb3db671d69e0299f0f65b
This commit is contained in:
commit
3431699981
4 changed files with 285 additions and 112 deletions
|
@ -6,68 +6,233 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>487</width>
|
<width>413</width>
|
||||||
<height>597</height>
|
<height>229</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
<property name="windowTitle">
|
||||||
<item>
|
<string>Request payment to ...</string>
|
||||||
<widget class="QRImageWidget" name="lblQRCode">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<layout class="QGridLayout" name="gridLayout" columnstretch="0,1">
|
||||||
<size>
|
<property name="sizeConstraint">
|
||||||
<width>300</width>
|
<enum>QLayout::SetFixedSize</enum>
|
||||||
<height>320</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<item row="0" column="0" colspan="2" alignment="Qt::AlignHCenter">
|
||||||
<string>QR Code</string>
|
<widget class="QRImageWidget" name="qr_code">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">QR image</string>
|
||||||
|
</property>
|
||||||
|
<property name="textInteractionFlags">
|
||||||
|
<set>Qt::NoTextInteraction</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0" colspan="2">
|
||||||
|
<widget class="QLabel" name="payment_header">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<weight>75</weight>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Payment information</string>
|
||||||
|
</property>
|
||||||
|
<property name="textInteractionFlags">
|
||||||
|
<set>Qt::NoTextInteraction</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0" alignment="Qt::AlignRight|Qt::AlignTop">
|
||||||
|
<widget class="QLabel" name="uri_tag">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<weight>75</weight>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">URI:</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="textFormat">
|
<property name="textFormat">
|
||||||
<enum>Qt::PlainText</enum>
|
<enum>Qt::PlainText</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="textInteractionFlags">
|
||||||
<set>Qt::AlignCenter</set>
|
<set>Qt::NoTextInteraction</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1" alignment="Qt::AlignTop">
|
||||||
|
<widget class="QLabel" name="uri_content">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">bitcoin:BC1...</string>
|
||||||
|
</property>
|
||||||
|
<property name="textFormat">
|
||||||
|
<enum>Qt::RichText</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="wordWrap">
|
<property name="wordWrap">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="textInteractionFlags">
|
||||||
|
<set>Qt::TextSelectableByMouse</set>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="3" column="0" alignment="Qt::AlignRight|Qt::AlignTop">
|
||||||
<widget class="QTextEdit" name="outUri">
|
<widget class="QLabel" name="address_tag">
|
||||||
<property name="sizePolicy">
|
<property name="font">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
<font>
|
||||||
<horstretch>0</horstretch>
|
<weight>75</weight>
|
||||||
<verstretch>0</verstretch>
|
<bold>true</bold>
|
||||||
</sizepolicy>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="text">
|
||||||
<size>
|
<string>Address:</string>
|
||||||
<width>0</width>
|
|
||||||
<height>50</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="frameShape">
|
<property name="textInteractionFlags">
|
||||||
<enum>QFrame::NoFrame</enum>
|
<set>Qt::NoTextInteraction</set>
|
||||||
</property>
|
</property>
|
||||||
<property name="frameShadow">
|
</widget>
|
||||||
<enum>QFrame::Plain</enum>
|
</item>
|
||||||
|
<item row="3" column="1" alignment="Qt::AlignTop">
|
||||||
|
<widget class="QLabel" name="address_content">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">bc1...</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="tabChangesFocus">
|
<property name="textFormat">
|
||||||
|
<enum>Qt::PlainText</enum>
|
||||||
|
</property>
|
||||||
|
<property name="textInteractionFlags">
|
||||||
|
<set>Qt::TextSelectableByMouse</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0" alignment="Qt::AlignRight|Qt::AlignTop">
|
||||||
|
<widget class="QLabel" name="amount_tag">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<weight>75</weight>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Amount:</string>
|
||||||
|
</property>
|
||||||
|
<property name="textInteractionFlags">
|
||||||
|
<set>Qt::NoTextInteraction</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="1" alignment="Qt::AlignTop">
|
||||||
|
<widget class="QLabel" name="amount_content">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">0.00000000 BTC</string>
|
||||||
|
</property>
|
||||||
|
<property name="textFormat">
|
||||||
|
<enum>Qt::PlainText</enum>
|
||||||
|
</property>
|
||||||
|
<property name="textInteractionFlags">
|
||||||
|
<set>Qt::TextSelectableByMouse</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="0" alignment="Qt::AlignRight|Qt::AlignTop">
|
||||||
|
<widget class="QLabel" name="label_tag">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<weight>75</weight>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Label:</string>
|
||||||
|
</property>
|
||||||
|
<property name="textInteractionFlags">
|
||||||
|
<set>Qt::NoTextInteraction</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="1" alignment="Qt::AlignTop">
|
||||||
|
<widget class="QLabel" name="label_content">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">label content</string>
|
||||||
|
</property>
|
||||||
|
<property name="textFormat">
|
||||||
|
<enum>Qt::PlainText</enum>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="textInteractionFlags">
|
<property name="textInteractionFlags">
|
||||||
<set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
<set>Qt::TextSelectableByMouse</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="6" column="0" alignment="Qt::AlignRight|Qt::AlignTop">
|
||||||
|
<widget class="QLabel" name="message_tag">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<weight>75</weight>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Message:</string>
|
||||||
|
</property>
|
||||||
|
<property name="textInteractionFlags">
|
||||||
|
<set>Qt::NoTextInteraction</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="1" alignment="Qt::AlignTop">
|
||||||
|
<widget class="QLabel" name="message_content">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">message content</string>
|
||||||
|
</property>
|
||||||
|
<property name="textFormat">
|
||||||
|
<enum>Qt::PlainText</enum>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="textInteractionFlags">
|
||||||
|
<set>Qt::TextSelectableByMouse</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="7" column="0" alignment="Qt::AlignRight|Qt::AlignTop">
|
||||||
|
<widget class="QLabel" name="wallet_tag">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<weight>75</weight>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Wallet:</string>
|
||||||
|
</property>
|
||||||
|
<property name="textInteractionFlags">
|
||||||
|
<set>Qt::NoTextInteraction</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="7" column="1" alignment="Qt::AlignTop">
|
||||||
|
<widget class="QLabel" name="wallet_content">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">wallet name</string>
|
||||||
|
</property>
|
||||||
|
<property name="textFormat">
|
||||||
|
<enum>Qt::PlainText</enum>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="textInteractionFlags">
|
||||||
|
<set>Qt::TextSelectableByMouse</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="8" column="0" colspan="2">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="btnCopyURI">
|
<widget class="QPushButton" name="btnCopyURI">
|
||||||
|
@ -114,8 +279,11 @@
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::StrongFocus</enum>
|
||||||
|
</property>
|
||||||
<property name="standardButtons">
|
<property name="standardButtons">
|
||||||
<set>QDialogButtonBox::Close</set>
|
<set>QDialogButtonBox::Ok</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -130,24 +298,14 @@
|
||||||
<header>qt/qrimagewidget.h</header>
|
<header>qt/qrimagewidget.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
|
<tabstops>
|
||||||
|
<tabstop>buttonBox</tabstop>
|
||||||
|
<tabstop>btnCopyURI</tabstop>
|
||||||
|
<tabstop>btnCopyAddress</tabstop>
|
||||||
|
<tabstop>btnSaveAs</tabstop>
|
||||||
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections>
|
<connections>
|
||||||
<connection>
|
|
||||||
<sender>buttonBox</sender>
|
|
||||||
<signal>rejected()</signal>
|
|
||||||
<receiver>ReceiveRequestDialog</receiver>
|
|
||||||
<slot>reject()</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>452</x>
|
|
||||||
<y>573</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>243</x>
|
|
||||||
<y>298</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
<connection>
|
||||||
<sender>buttonBox</sender>
|
<sender>buttonBox</sender>
|
||||||
<signal>accepted()</signal>
|
<signal>accepted()</signal>
|
||||||
|
@ -155,12 +313,12 @@
|
||||||
<slot>accept()</slot>
|
<slot>accept()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>452</x>
|
<x>135</x>
|
||||||
<y>573</y>
|
<y>230</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>243</x>
|
<x>135</x>
|
||||||
<y>298</y>
|
<y>126</y>
|
||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
|
|
|
@ -8,10 +8,11 @@
|
||||||
#include <qt/bitcoinunits.h>
|
#include <qt/bitcoinunits.h>
|
||||||
#include <qt/guiutil.h>
|
#include <qt/guiutil.h>
|
||||||
#include <qt/optionsmodel.h>
|
#include <qt/optionsmodel.h>
|
||||||
|
#include <qt/qrimagewidget.h>
|
||||||
#include <qt/walletmodel.h>
|
#include <qt/walletmodel.h>
|
||||||
|
|
||||||
#include <QClipboard>
|
#include <QDialog>
|
||||||
#include <QPixmap>
|
#include <QString>
|
||||||
|
|
||||||
#if defined(HAVE_CONFIG_H)
|
#if defined(HAVE_CONFIG_H)
|
||||||
#include <config/bitcoin-config.h> /* for USE_QRCODE */
|
#include <config/bitcoin-config.h> /* for USE_QRCODE */
|
||||||
|
@ -23,14 +24,6 @@ ReceiveRequestDialog::ReceiveRequestDialog(QWidget *parent) :
|
||||||
model(nullptr)
|
model(nullptr)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
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);
|
GUIUtil::handleCloseWindowShortcut(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +37,7 @@ void ReceiveRequestDialog::setModel(WalletModel *_model)
|
||||||
this->model = _model;
|
this->model = _model;
|
||||||
|
|
||||||
if (_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 the display unit if necessary
|
||||||
update();
|
update();
|
||||||
|
@ -53,40 +46,55 @@ void ReceiveRequestDialog::setModel(WalletModel *_model)
|
||||||
void ReceiveRequestDialog::setInfo(const SendCoinsRecipient &_info)
|
void ReceiveRequestDialog::setInfo(const SendCoinsRecipient &_info)
|
||||||
{
|
{
|
||||||
this->info = _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("<a href=\"" + uri + "\">" + GUIUtil::HtmlEscape(uri) + "</a>");
|
||||||
|
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)
|
if (!model) return;
|
||||||
return;
|
ui->amount_content->setText(BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), info.amount));
|
||||||
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><font face='verdana, arial, helvetica, sans-serif'>";
|
|
||||||
html += "<b>"+tr("Payment information")+"</b><br>";
|
|
||||||
html += "<b>"+tr("URI")+"</b>: ";
|
|
||||||
html += "<a href=\""+uri+"\">" + GUIUtil::HtmlEscape(uri) + "</a><br>";
|
|
||||||
html += "<b>"+tr("Address")+"</b>: " + GUIUtil::HtmlEscape(info.address) + "<br>";
|
|
||||||
if(info.amount)
|
|
||||||
html += "<b>"+tr("Amount")+"</b>: " + BitcoinUnits::formatHtmlWithUnit(model->getOptionsModel()->getDisplayUnit(), info.amount) + "<br>";
|
|
||||||
if(!info.label.isEmpty())
|
|
||||||
html += "<b>"+tr("Label")+"</b>: " + GUIUtil::HtmlEscape(info.label) + "<br>";
|
|
||||||
if(!info.message.isEmpty())
|
|
||||||
html += "<b>"+tr("Message")+"</b>: " + GUIUtil::HtmlEscape(info.message) + "<br>";
|
|
||||||
if(model->isMultiwallet()) {
|
|
||||||
html += "<b>"+tr("Wallet")+"</b>: " + GUIUtil::HtmlEscape(model->getWalletName()) + "<br>";
|
|
||||||
}
|
|
||||||
ui->outUri->setText(html);
|
|
||||||
|
|
||||||
if (ui->lblQRCode->setQR(uri, info.address)) {
|
|
||||||
ui->btnSaveAs->setEnabled(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReceiveRequestDialog::on_btnCopyURI_clicked()
|
void ReceiveRequestDialog::on_btnCopyURI_clicked()
|
||||||
|
|
|
@ -29,8 +29,7 @@ public:
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void on_btnCopyURI_clicked();
|
void on_btnCopyURI_clicked();
|
||||||
void on_btnCopyAddress_clicked();
|
void on_btnCopyAddress_clicked();
|
||||||
|
void updateDisplayUnit();
|
||||||
void update();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::ReceiveRequestDialog *ui;
|
Ui::ReceiveRequestDialog *ui;
|
||||||
|
|
|
@ -229,15 +229,23 @@ void TestGUI(interfaces::Node& node)
|
||||||
for (QWidget* widget : QApplication::topLevelWidgets()) {
|
for (QWidget* widget : QApplication::topLevelWidgets()) {
|
||||||
if (widget->inherits("ReceiveRequestDialog")) {
|
if (widget->inherits("ReceiveRequestDialog")) {
|
||||||
ReceiveRequestDialog* receiveRequestDialog = qobject_cast<ReceiveRequestDialog*>(widget);
|
ReceiveRequestDialog* receiveRequestDialog = qobject_cast<ReceiveRequestDialog*>(widget);
|
||||||
QTextEdit* rlist = receiveRequestDialog->QObject::findChild<QTextEdit*>("outUri");
|
QCOMPARE(receiveRequestDialog->QObject::findChild<QLabel*>("payment_header")->text(), QString("Payment information"));
|
||||||
QString paymentText = rlist->toPlainText();
|
QCOMPARE(receiveRequestDialog->QObject::findChild<QLabel*>("uri_tag")->text(), QString("URI:"));
|
||||||
QStringList paymentTextList = paymentText.split('\n');
|
QString uri = receiveRequestDialog->QObject::findChild<QLabel*>("uri_content")->text();
|
||||||
QCOMPARE(paymentTextList.at(0), QString("Payment information"));
|
QCOMPARE(uri.count("bitcoin:"), 2);
|
||||||
QVERIFY(paymentTextList.at(1).indexOf(QString("URI: bitcoin:")) != -1);
|
QCOMPARE(receiveRequestDialog->QObject::findChild<QLabel*>("address_tag")->text(), QString("Address:"));
|
||||||
QVERIFY(paymentTextList.at(2).indexOf(QString("Address:")) != -1);
|
|
||||||
QCOMPARE(paymentTextList.at(3), QString("Amount: 0.00000001 ") + QString::fromStdString(CURRENCY_UNIT));
|
QCOMPARE(uri.count("amount=0.00000001"), 2);
|
||||||
QCOMPARE(paymentTextList.at(4), QString("Label: TEST_LABEL_1"));
|
QCOMPARE(receiveRequestDialog->QObject::findChild<QLabel*>("amount_tag")->text(), QString("Amount:"));
|
||||||
QCOMPARE(paymentTextList.at(5), QString("Message: TEST_MESSAGE_1"));
|
QCOMPARE(receiveRequestDialog->QObject::findChild<QLabel*>("amount_content")->text(), QString("0.00000001 ") + QString::fromStdString(CURRENCY_UNIT));
|
||||||
|
|
||||||
|
QCOMPARE(uri.count("label=TEST_LABEL_1"), 2);
|
||||||
|
QCOMPARE(receiveRequestDialog->QObject::findChild<QLabel*>("label_tag")->text(), QString("Label:"));
|
||||||
|
QCOMPARE(receiveRequestDialog->QObject::findChild<QLabel*>("label_content")->text(), QString("TEST_LABEL_1"));
|
||||||
|
|
||||||
|
QCOMPARE(uri.count("message=TEST_MESSAGE_1"), 2);
|
||||||
|
QCOMPARE(receiveRequestDialog->QObject::findChild<QLabel*>("message_tag")->text(), QString("Message:"));
|
||||||
|
QCOMPARE(receiveRequestDialog->QObject::findChild<QLabel*>("message_content")->text(), QString("TEST_MESSAGE_1"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue