mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-01-17 18:40:09 +00:00
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.
This commit is contained in:
parent
03535acd05
commit
8a7f37c797
@ -96,8 +96,9 @@ void ReceiveCoinsDialog::on_receiveButton_clicked()
|
|||||||
/* Generate new receiving address */
|
/* Generate new receiving address */
|
||||||
address = model->getAddressTableModel()->addRow(AddressTableModel::Receive, label, "");
|
address = model->getAddressTableModel()->addRow(AddressTableModel::Receive, label, "");
|
||||||
}
|
}
|
||||||
ReceiveRequestDialog *dialog = new ReceiveRequestDialog(address, label,
|
SendCoinsRecipient info(address, label,
|
||||||
ui->reqAmount->value(), ui->reqMessage->text(), this);
|
ui->reqAmount->value(), ui->reqMessage->text());
|
||||||
|
ReceiveRequestDialog *dialog = new ReceiveRequestDialog(info, this);
|
||||||
dialog->setModel(model->getOptionsModel());
|
dialog->setModel(model->getOptionsModel());
|
||||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
dialog->show();
|
dialog->show();
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include "guiconstants.h"
|
#include "guiconstants.h"
|
||||||
#include "guiutil.h"
|
#include "guiutil.h"
|
||||||
#include "optionsmodel.h"
|
#include "optionsmodel.h"
|
||||||
|
#include "walletmodel.h"
|
||||||
|
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
@ -63,25 +64,25 @@ void QRImageWidget::copyImage()
|
|||||||
QApplication::clipboard()->setImage(exportImage());
|
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),
|
QDialog(parent),
|
||||||
ui(new Ui::ReceiveRequestDialog),
|
ui(new Ui::ReceiveRequestDialog),
|
||||||
model(0),
|
model(0),
|
||||||
address(addr)
|
info(info)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
QString target = label;
|
QString target = info.label;
|
||||||
if(target.isEmpty())
|
if(target.isEmpty())
|
||||||
target = addr;
|
target = info.address;
|
||||||
setWindowTitle(tr("Request payment to %1").arg(target));
|
setWindowTitle(tr("Request payment to %1").arg(target));
|
||||||
|
|
||||||
ui->lnAddress->setText(addr);
|
ui->lnAddress->setText(info.address);
|
||||||
if(amount)
|
if(info.amount)
|
||||||
ui->lnReqAmount->setValue(amount);
|
ui->lnReqAmount->setValue(info.amount);
|
||||||
ui->lnReqAmount->setReadOnly(true);
|
ui->lnReqAmount->setReadOnly(true);
|
||||||
ui->lnLabel->setText(label);
|
ui->lnLabel->setText(info.label);
|
||||||
ui->lnMessage->setText(message);
|
ui->lnMessage->setText(info.message);
|
||||||
|
|
||||||
#ifndef USE_QRCODE
|
#ifndef USE_QRCODE
|
||||||
ui->btnSaveAs->setVisible(false);
|
ui->btnSaveAs->setVisible(false);
|
||||||
@ -146,7 +147,7 @@ void ReceiveRequestDialog::genCode()
|
|||||||
|
|
||||||
QString ReceiveRequestDialog::getURI()
|
QString ReceiveRequestDialog::getURI()
|
||||||
{
|
{
|
||||||
QString ret = QString("bitcoin:%1").arg(address);
|
QString ret = QString("bitcoin:%1").arg(info.address);
|
||||||
int paramCount = 0;
|
int paramCount = 0;
|
||||||
|
|
||||||
if (ui->lnReqAmount->validate())
|
if (ui->lnReqAmount->validate())
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#ifndef QRCODEDIALOG_H
|
#ifndef QRCODEDIALOG_H
|
||||||
#define QRCODEDIALOG_H
|
#define QRCODEDIALOG_H
|
||||||
|
|
||||||
|
#include "walletmodel.h"
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QImage>
|
#include <QImage>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
@ -34,7 +36,7 @@ class ReceiveRequestDialog : public QDialog
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
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();
|
~ReceiveRequestDialog();
|
||||||
|
|
||||||
void setModel(OptionsModel *model);
|
void setModel(OptionsModel *model);
|
||||||
@ -49,7 +51,7 @@ private slots:
|
|||||||
private:
|
private:
|
||||||
Ui::ReceiveRequestDialog *ui;
|
Ui::ReceiveRequestDialog *ui;
|
||||||
OptionsModel *model;
|
OptionsModel *model;
|
||||||
QString address;
|
SendCoinsRecipient info;
|
||||||
|
|
||||||
void genCode();
|
void genCode();
|
||||||
QString getURI();
|
QString getURI();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user