2020-10-07 10:36:04 +00:00
|
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
// Copyright (c) 2020, The Monero Project.
|
|
|
|
|
|
|
|
#include "transactioninfodialog.h"
|
|
|
|
#include "ui_transactioninfodialog.h"
|
|
|
|
|
|
|
|
#include "libwalletqt/CoinsInfo.h"
|
|
|
|
#include "libwalletqt/WalletManager.h"
|
2020-11-08 11:08:15 +00:00
|
|
|
#include "utils.h"
|
|
|
|
|
|
|
|
#include <QMessageBox>
|
2020-10-07 10:36:04 +00:00
|
|
|
|
2020-10-19 23:05:42 +00:00
|
|
|
TransactionInfoDialog::TransactionInfoDialog(Wallet *wallet, TransactionInfo *txInfo, QWidget *parent)
|
2020-10-07 10:36:04 +00:00
|
|
|
: QDialog(parent)
|
|
|
|
, ui(new Ui::TransactionInfoDialog)
|
2020-10-19 23:05:42 +00:00
|
|
|
, m_wallet(wallet)
|
2020-10-07 10:36:04 +00:00
|
|
|
, m_txInfo(txInfo)
|
|
|
|
{
|
|
|
|
ui->setupUi(this);
|
|
|
|
|
2020-11-08 11:08:15 +00:00
|
|
|
m_txProofWidget = new TxProofWidget(this, wallet, txInfo);
|
|
|
|
|
2020-10-19 23:05:42 +00:00
|
|
|
ui->label_txid->setText(QString(txInfo->hash()));
|
|
|
|
|
|
|
|
if (txInfo->direction() == TransactionInfo::Direction_In) {
|
|
|
|
ui->txKey->hide();
|
|
|
|
} else {
|
|
|
|
QString txKey = m_wallet->getTxKey(txInfo->hash());
|
|
|
|
txKey = txKey.isEmpty() ? "unknown" : txKey;
|
|
|
|
ui->label_txKey->setText(txKey);
|
|
|
|
}
|
2020-10-07 10:36:04 +00:00
|
|
|
|
|
|
|
ui->label_status->setText(QString("Status: %1 confirmations").arg(txInfo->confirmations()));
|
|
|
|
ui->label_date->setText(QString("Date: %1").arg(txInfo->timestamp().toString("yyyy-MM-dd HH:mm")));
|
|
|
|
ui->label_blockHeight->setText(QString("Block height: %1").arg(txInfo->blockHeight()));
|
|
|
|
|
|
|
|
QString direction = txInfo->direction() == TransactionInfo::Direction_In ? "received" : "sent";
|
|
|
|
ui->label_amount->setText(QString("Amount %1: %2").arg(direction, txInfo->displayAmount()));
|
|
|
|
|
|
|
|
QString fee = txInfo->fee().isEmpty() ? "n/a" : txInfo->fee();
|
|
|
|
ui->label_fee->setText(QString("Fee: %1").arg(txInfo->isCoinbase() ? WalletManager::displayAmount(0) : fee));
|
|
|
|
ui->label_unlockTime->setText(QString("Unlock time: %1 (height)").arg(txInfo->unlockTime()));
|
|
|
|
|
2020-10-19 23:05:42 +00:00
|
|
|
qDebug() << m_wallet->coins()->coins_from_txid(txInfo->hash());
|
2020-10-07 10:36:04 +00:00
|
|
|
|
|
|
|
QString destinations = txInfo->destinations_formatted();
|
|
|
|
if (destinations.isEmpty()) {
|
|
|
|
ui->destinations->setHidden(true);
|
|
|
|
ui->label_destinations->setHidden(true);
|
|
|
|
ui->line_2->setHidden(true);
|
|
|
|
} else {
|
|
|
|
ui->destinations->setText(destinations);
|
|
|
|
}
|
|
|
|
|
2020-11-08 11:08:15 +00:00
|
|
|
ui->txProofWidget->addWidget(m_txProofWidget);
|
|
|
|
|
2020-10-07 10:36:04 +00:00
|
|
|
this->adjustSize();
|
|
|
|
}
|
|
|
|
|
|
|
|
TransactionInfoDialog::~TransactionInfoDialog() {
|
|
|
|
delete ui;
|
|
|
|
}
|