parent
2c99454565
commit
780a35fabe
@ -1 +1 @@
|
||||
Subproject commit a6bf6dbb8f1637ccffee1a30d2285324a3ce4d66
|
||||
Subproject commit 9ca5569f40a392b16946c5c3bda312eecfdcc9ab
|
@ -0,0 +1,61 @@
|
||||
#include "txproofwidget.h"
|
||||
#include "ui_txproofwidget.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <utility>
|
||||
|
||||
#include "utils/utils.h"
|
||||
|
||||
TxProofWidget::TxProofWidget(QWidget *parent, Wallet *wallet, TransactionInfo *txInfo)
|
||||
: QWidget(parent)
|
||||
, ui(new Ui::TxProofWidget)
|
||||
, m_wallet(wallet)
|
||||
, m_txid(txInfo->hash())
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
if (txInfo->direction() == TransactionInfo::Direction_Out) {
|
||||
for (auto const &d: txInfo->destinations()) {
|
||||
ui->comboBox_TxProofAddresses->addItem(d);
|
||||
}
|
||||
} else {
|
||||
ui->btn_copySpendProof->setEnabled(false);
|
||||
|
||||
for (auto const &s: txInfo->subaddrIndex()) {
|
||||
ui->comboBox_TxProofAddresses->addItem(wallet->address(txInfo->subaddrAccount(), s));
|
||||
}
|
||||
}
|
||||
|
||||
if (ui->comboBox_TxProofAddresses->count() == 0) {
|
||||
ui->btn_copyTxProof->setEnabled(false);
|
||||
}
|
||||
|
||||
connect(ui->btn_copySpendProof, &QPushButton::clicked, this, &TxProofWidget::copySpendProof);
|
||||
connect(ui->btn_copyTxProof, &QPushButton::clicked, this, &TxProofWidget::copyTxProof);
|
||||
}
|
||||
|
||||
void TxProofWidget::copySpendProof() {
|
||||
auto txproof = m_wallet->getSpendProof(m_txid, "");
|
||||
if (!txproof.error.isEmpty()) {
|
||||
QMessageBox::warning(this, "Copy SpendProof", QString("Failed to copy SpendProof").arg(txproof.error));
|
||||
return;
|
||||
}
|
||||
|
||||
Utils::copyToClipboard(txproof.proof);
|
||||
QMessageBox::information(this, "Copy SpendProof", "SpendProof copied to clipboard");
|
||||
}
|
||||
|
||||
void TxProofWidget::copyTxProof() {
|
||||
auto txproof = m_wallet->getTxProof(m_txid, ui->comboBox_TxProofAddresses->currentText(), "");
|
||||
if (!txproof.error.isEmpty()) {
|
||||
QMessageBox::warning(this, "Copy Transaction Proof", QString("Failed to copy transaction proof: %1").arg(txproof.error));
|
||||
return;
|
||||
}
|
||||
|
||||
Utils::copyToClipboard(txproof.proof);
|
||||
QMessageBox::information(this, "Copy Transaction Proof", "Transaction proof copied to clipboard");
|
||||
}
|
||||
|
||||
TxProofWidget::~TxProofWidget() {
|
||||
delete ui;
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
#ifndef FEATHER_TXPROOFWIDGET_H
|
||||
#define FEATHER_TXPROOFWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include "libwalletqt/Wallet.h"
|
||||
#include "libwalletqt/TransactionInfo.h"
|
||||
|
||||
namespace Ui {
|
||||
class TxProofWidget;
|
||||
}
|
||||
|
||||
class TxProofWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit TxProofWidget(QWidget *parent, Wallet *wallet, TransactionInfo *txid);
|
||||
~TxProofWidget() override;
|
||||
|
||||
private:
|
||||
void copySpendProof();
|
||||
void copyTxProof();
|
||||
|
||||
Ui::TxProofWidget *ui;
|
||||
QString m_txid;
|
||||
Wallet *m_wallet;
|
||||
};
|
||||
|
||||
#endif //FEATHER_TXPROOFWIDGET_H
|
@ -0,0 +1,103 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>TxProofWidget</class>
|
||||
<widget class="QWidget" name="TxProofWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>647</width>
|
||||
<height>79</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_copySpendProof">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Copy</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>SpendProof</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_copyTxProof">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Copy</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>In/OutProof</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox_TxProofAddresses">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
Loading…
Reference in new issue