mirror of
				https://git.wownero.com/wowlet/wowlet.git
				synced 2024-08-15 01:03:14 +00:00 
			
		
		
		
	Merge pull request 'TransactionInfoDialog: add tx key' (#96) from tobtoht/feather:tx_key into master
Reviewed-on: https://git.wownero.com/feather/feather/pulls/96 Reviewed-by: dsc <dsc@noreply.gitgud.wownero.nl>
This commit is contained in:
		
						commit
						49f072eea4
					
				
					 6 changed files with 53 additions and 35 deletions
				
			
		| 
						 | 
				
			
			@ -8,16 +8,23 @@
 | 
			
		|||
#include "libwalletqt/WalletManager.h"
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
 | 
			
		||||
TransactionInfoDialog::TransactionInfoDialog(Coins *coins, TransactionInfo *txInfo, QWidget *parent)
 | 
			
		||||
TransactionInfoDialog::TransactionInfoDialog(Wallet *wallet, TransactionInfo *txInfo, QWidget *parent)
 | 
			
		||||
        : QDialog(parent)
 | 
			
		||||
        , ui(new Ui::TransactionInfoDialog)
 | 
			
		||||
        , m_coins(coins)
 | 
			
		||||
        , m_wallet(wallet)
 | 
			
		||||
        , m_txInfo(txInfo)
 | 
			
		||||
{
 | 
			
		||||
    ui->setupUi(this);
 | 
			
		||||
 | 
			
		||||
    ui->txid->setText(QString(txInfo->hash()));
 | 
			
		||||
    ui->txid->setCursorPosition(0);
 | 
			
		||||
    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);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    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")));
 | 
			
		||||
| 
						 | 
				
			
			@ -30,7 +37,7 @@ TransactionInfoDialog::TransactionInfoDialog(Coins *coins, TransactionInfo *txIn
 | 
			
		|||
    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()));
 | 
			
		||||
 | 
			
		||||
    qDebug() << m_coins->coins_from_txid(txInfo->hash());
 | 
			
		||||
    qDebug() << m_wallet->coins()->coins_from_txid(txInfo->hash());
 | 
			
		||||
 | 
			
		||||
    QString destinations = txInfo->destinations_formatted();
 | 
			
		||||
    if (destinations.isEmpty()) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,6 +8,7 @@
 | 
			
		|||
#include <QtSvg/QSvgWidget>
 | 
			
		||||
#include "libwalletqt/Coins.h"
 | 
			
		||||
#include "libwalletqt/TransactionInfo.h"
 | 
			
		||||
#include "libwalletqt/Wallet.h"
 | 
			
		||||
 | 
			
		||||
namespace Ui {
 | 
			
		||||
    class TransactionInfoDialog;
 | 
			
		||||
| 
						 | 
				
			
			@ -18,14 +19,14 @@ class TransactionInfoDialog : public QDialog
 | 
			
		|||
Q_OBJECT
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
    explicit TransactionInfoDialog(Coins *coins, TransactionInfo *txInfo, QWidget *parent = nullptr);
 | 
			
		||||
    explicit TransactionInfoDialog(Wallet *wallet, TransactionInfo *txInfo, QWidget *parent = nullptr);
 | 
			
		||||
    ~TransactionInfoDialog() override;
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    Ui::TransactionInfoDialog *ui;
 | 
			
		||||
 | 
			
		||||
    TransactionInfo *m_txInfo;
 | 
			
		||||
    Coins *m_coins;
 | 
			
		||||
    Wallet *m_wallet;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif //FEATHER_TRANSACTIONINFODIALOG_H
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,7 +7,7 @@
 | 
			
		|||
    <x>0</x>
 | 
			
		||||
    <y>0</y>
 | 
			
		||||
    <width>547</width>
 | 
			
		||||
    <height>332</height>
 | 
			
		||||
    <height>436</height>
 | 
			
		||||
   </rect>
 | 
			
		||||
  </property>
 | 
			
		||||
  <property name="windowTitle">
 | 
			
		||||
| 
						 | 
				
			
			@ -15,32 +15,41 @@
 | 
			
		|||
  </property>
 | 
			
		||||
  <layout class="QVBoxLayout" name="verticalLayout_4">
 | 
			
		||||
   <item>
 | 
			
		||||
    <widget class="QLabel" name="label">
 | 
			
		||||
     <property name="text">
 | 
			
		||||
    <widget class="QGroupBox" name="groupBox">
 | 
			
		||||
     <property name="title">
 | 
			
		||||
      <string>Transaction ID:</string>
 | 
			
		||||
     </property>
 | 
			
		||||
     <layout class="QVBoxLayout" name="verticalLayout">
 | 
			
		||||
      <item>
 | 
			
		||||
       <widget class="QLabel" name="label_txid">
 | 
			
		||||
        <property name="text">
 | 
			
		||||
         <string>txid</string>
 | 
			
		||||
        </property>
 | 
			
		||||
        <property name="textInteractionFlags">
 | 
			
		||||
         <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
 | 
			
		||||
        </property>
 | 
			
		||||
       </widget>
 | 
			
		||||
      </item>
 | 
			
		||||
     </layout>
 | 
			
		||||
    </widget>
 | 
			
		||||
   </item>
 | 
			
		||||
   <item>
 | 
			
		||||
    <widget class="QLineEdit" name="txid">
 | 
			
		||||
     <property name="sizePolicy">
 | 
			
		||||
      <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
 | 
			
		||||
       <horstretch>0</horstretch>
 | 
			
		||||
       <verstretch>0</verstretch>
 | 
			
		||||
      </sizepolicy>
 | 
			
		||||
     </property>
 | 
			
		||||
     <property name="minimumSize">
 | 
			
		||||
      <size>
 | 
			
		||||
       <width>525</width>
 | 
			
		||||
       <height>0</height>
 | 
			
		||||
      </size>
 | 
			
		||||
     </property>
 | 
			
		||||
     <property name="text">
 | 
			
		||||
      <string>txid</string>
 | 
			
		||||
     </property>
 | 
			
		||||
     <property name="readOnly">
 | 
			
		||||
      <bool>true</bool>
 | 
			
		||||
    <widget class="QGroupBox" name="txKey">
 | 
			
		||||
     <property name="title">
 | 
			
		||||
      <string>Transaction key:</string>
 | 
			
		||||
     </property>
 | 
			
		||||
     <layout class="QVBoxLayout" name="verticalLayout_5">
 | 
			
		||||
      <item>
 | 
			
		||||
       <widget class="QLabel" name="label_txKey">
 | 
			
		||||
        <property name="text">
 | 
			
		||||
         <string>txKey</string>
 | 
			
		||||
        </property>
 | 
			
		||||
        <property name="textInteractionFlags">
 | 
			
		||||
         <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
 | 
			
		||||
        </property>
 | 
			
		||||
       </widget>
 | 
			
		||||
      </item>
 | 
			
		||||
     </layout>
 | 
			
		||||
    </widget>
 | 
			
		||||
   </item>
 | 
			
		||||
   <item>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -45,11 +45,11 @@ HistoryWidget::HistoryWidget(QWidget *parent)
 | 
			
		|||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void HistoryWidget::setModel(Coins *coins, TransactionHistoryProxyModel *model, TransactionHistory *txHistory)
 | 
			
		||||
void HistoryWidget::setModel(TransactionHistoryProxyModel *model, Wallet *wallet)
 | 
			
		||||
{
 | 
			
		||||
    m_coins = coins;
 | 
			
		||||
    m_model = model;
 | 
			
		||||
    m_txHistory = txHistory;
 | 
			
		||||
    m_wallet = wallet;
 | 
			
		||||
    m_txHistory = m_wallet->history();
 | 
			
		||||
    ui->history->setModel(m_model);
 | 
			
		||||
 | 
			
		||||
    ui->history->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
 | 
			
		||||
| 
						 | 
				
			
			@ -66,7 +66,7 @@ void HistoryWidget::showTxDetails() {
 | 
			
		|||
    });
 | 
			
		||||
 | 
			
		||||
    if (i != nullptr) {
 | 
			
		||||
        auto * dialog = new TransactionInfoDialog(m_coins, i, this);
 | 
			
		||||
        auto * dialog = new TransactionInfoDialog(m_wallet, i, this);
 | 
			
		||||
        dialog->exec();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,6 +7,7 @@
 | 
			
		|||
#include "model/TransactionHistoryModel.h"
 | 
			
		||||
#include "model/TransactionHistoryProxyModel.h"
 | 
			
		||||
#include "libwalletqt/Coins.h"
 | 
			
		||||
#include "libwalletqt/Wallet.h"
 | 
			
		||||
 | 
			
		||||
#include <QWidget>
 | 
			
		||||
#include <QMenu>
 | 
			
		||||
| 
						 | 
				
			
			@ -21,7 +22,7 @@ Q_OBJECT
 | 
			
		|||
 | 
			
		||||
public:
 | 
			
		||||
    explicit HistoryWidget(QWidget *parent = nullptr);
 | 
			
		||||
    void setModel(Coins * coins, TransactionHistoryProxyModel * model, TransactionHistory * txHistory);
 | 
			
		||||
    void setModel(TransactionHistoryProxyModel *model, Wallet *wallet);
 | 
			
		||||
    ~HistoryWidget() override;
 | 
			
		||||
 | 
			
		||||
public slots:
 | 
			
		||||
| 
						 | 
				
			
			@ -51,7 +52,7 @@ private:
 | 
			
		|||
    QMenu *m_copyMenu;
 | 
			
		||||
    TransactionHistory *m_txHistory;
 | 
			
		||||
    TransactionHistoryProxyModel *m_model;
 | 
			
		||||
    Coins *m_coins;
 | 
			
		||||
    Wallet *m_wallet = nullptr;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif //FEATHER_HISTORYWIDGET_H
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -604,7 +604,7 @@ void MainWindow::onWalletOpened() {
 | 
			
		|||
 | 
			
		||||
    // history page
 | 
			
		||||
    m_ctx->currentWallet->history()->refresh(m_ctx->currentWallet->currentSubaddressAccount());
 | 
			
		||||
    ui->historyWidget->setModel(m_ctx->currentWallet->coins(), m_ctx->currentWallet->historyModel(), m_ctx->currentWallet->history());
 | 
			
		||||
    ui->historyWidget->setModel(m_ctx->currentWallet->historyModel(), m_ctx->currentWallet);
 | 
			
		||||
    connect(m_ctx->currentWallet->history(), &TransactionHistory::txNoteChanged, [this]{
 | 
			
		||||
        m_ctx->storeWallet();
 | 
			
		||||
    });
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue