diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2013-10-18 13:45:11 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2013-10-23 09:15:25 +0200 |
commit | 8a7f37c7972504d25225c96f225503c329aaf6fa (patch) | |
tree | 877843917da5d2e1ba69d553272f33f58b75d940 /src | |
parent | 03535acd053fc0597a9e1fd76c5c7b1f54f5c1df (diff) |
qt: use SendCoinsRecipient for payment request information
This brings some symmetry into the design by using the same object
both for incoming URIs that are parsed as for outgoing URIs that
are formatted.
Diffstat (limited to 'src')
-rw-r--r-- | src/qt/receivecoinsdialog.cpp | 5 | ||||
-rw-r--r-- | src/qt/receiverequestdialog.cpp | 21 | ||||
-rw-r--r-- | src/qt/receiverequestdialog.h | 6 |
3 files changed, 18 insertions, 14 deletions
diff --git a/src/qt/receivecoinsdialog.cpp b/src/qt/receivecoinsdialog.cpp index 9e81c2cf7b..fff678d0c6 100644 --- a/src/qt/receivecoinsdialog.cpp +++ b/src/qt/receivecoinsdialog.cpp @@ -96,8 +96,9 @@ void ReceiveCoinsDialog::on_receiveButton_clicked() /* Generate new receiving address */ address = model->getAddressTableModel()->addRow(AddressTableModel::Receive, label, ""); } - ReceiveRequestDialog *dialog = new ReceiveRequestDialog(address, label, - ui->reqAmount->value(), ui->reqMessage->text(), this); + SendCoinsRecipient info(address, label, + ui->reqAmount->value(), ui->reqMessage->text()); + ReceiveRequestDialog *dialog = new ReceiveRequestDialog(info, this); dialog->setModel(model->getOptionsModel()); dialog->setAttribute(Qt::WA_DeleteOnClose); dialog->show(); diff --git a/src/qt/receiverequestdialog.cpp b/src/qt/receiverequestdialog.cpp index dd4f5f16f4..861458f8d8 100644 --- a/src/qt/receiverequestdialog.cpp +++ b/src/qt/receiverequestdialog.cpp @@ -5,6 +5,7 @@ #include "guiconstants.h" #include "guiutil.h" #include "optionsmodel.h" +#include "walletmodel.h" #include <QPixmap> #include <QClipboard> @@ -63,25 +64,25 @@ void QRImageWidget::copyImage() QApplication::clipboard()->setImage(exportImage()); } -ReceiveRequestDialog::ReceiveRequestDialog(const QString &addr, const QString &label, quint64 amount, const QString &message, QWidget *parent) : +ReceiveRequestDialog::ReceiveRequestDialog(const SendCoinsRecipient &info, QWidget *parent) : QDialog(parent), ui(new Ui::ReceiveRequestDialog), model(0), - address(addr) + info(info) { ui->setupUi(this); - QString target = label; + QString target = info.label; if(target.isEmpty()) - target = addr; + target = info.address; setWindowTitle(tr("Request payment to %1").arg(target)); - ui->lnAddress->setText(addr); - if(amount) - ui->lnReqAmount->setValue(amount); + ui->lnAddress->setText(info.address); + if(info.amount) + ui->lnReqAmount->setValue(info.amount); ui->lnReqAmount->setReadOnly(true); - ui->lnLabel->setText(label); - ui->lnMessage->setText(message); + ui->lnLabel->setText(info.label); + ui->lnMessage->setText(info.message); #ifndef USE_QRCODE ui->btnSaveAs->setVisible(false); @@ -146,7 +147,7 @@ void ReceiveRequestDialog::genCode() QString ReceiveRequestDialog::getURI() { - QString ret = QString("bitcoin:%1").arg(address); + QString ret = QString("bitcoin:%1").arg(info.address); int paramCount = 0; if (ui->lnReqAmount->validate()) diff --git a/src/qt/receiverequestdialog.h b/src/qt/receiverequestdialog.h index e560a24ff1..bfe50bde77 100644 --- a/src/qt/receiverequestdialog.h +++ b/src/qt/receiverequestdialog.h @@ -1,6 +1,8 @@ #ifndef QRCODEDIALOG_H #define QRCODEDIALOG_H +#include "walletmodel.h" + #include <QDialog> #include <QImage> #include <QLabel> @@ -34,7 +36,7 @@ class ReceiveRequestDialog : public QDialog Q_OBJECT public: - explicit ReceiveRequestDialog(const QString &addr, const QString &label, quint64 amount, const QString &message, QWidget *parent = 0); + explicit ReceiveRequestDialog(const SendCoinsRecipient &info, QWidget *parent = 0); ~ReceiveRequestDialog(); void setModel(OptionsModel *model); @@ -49,7 +51,7 @@ private slots: private: Ui::ReceiveRequestDialog *ui; OptionsModel *model; - QString address; + SendCoinsRecipient info; void genCode(); QString getURI(); |