Browse Source

TxInfoDialog: added a clickable icon to view transaction on block explorer

1.0.0
tobtoht 1 month ago
parent
commit
484f61759e
Signed by: tobtoht GPG Key ID: 1CADD27F41F45C3C
  1. 1
      src/assets.qrc
  2. 13
      src/dialog/TxInfoDialog.cpp
  3. 1
      src/dialog/TxInfoDialog.h
  4. 15
      src/dialog/TxInfoDialog.ui

1
src/assets.qrc

@ -34,6 +34,7 @@
<file>assets/images/copy.png</file>
<file>assets/images/cutexmrfox.png</file>
<file>assets/images/edit.png</file>
<file>assets/images/external-link.svg</file>
<file>assets/images/exchange.png</file>
<file>assets/images/exchange_white.png</file>
<file>assets/images/expired.png</file>

13
src/dialog/TxInfoDialog.cpp

@ -9,6 +9,7 @@
#include "appcontext.h"
#include "config.h"
#include "constants.h"
#include "libwalletqt/Coins.h"
#include "libwalletqt/CoinsInfo.h"
#include "libwalletqt/TransactionHistory.h"
@ -16,6 +17,7 @@
#include "libwalletqt/WalletManager.h"
#include "model/ModelUtils.h"
#include "Utils.h"
#include "utils/Icons.h"
TxInfoDialog::TxInfoDialog(QSharedPointer<AppContext> ctx, TransactionInfo *txInfo, QWidget *parent)
: QDialog(parent)
@ -26,6 +28,10 @@ TxInfoDialog::TxInfoDialog(QSharedPointer<AppContext> ctx, TransactionInfo *txIn
{
ui->setupUi(this);
ui->btn_viewOnBlockExplorer->setIcon(icons()->icon("external-link.svg"));
ui->btn_viewOnBlockExplorer->setToolTip("View on block explorer");
connect(ui->btn_viewOnBlockExplorer, &QPushButton::clicked, this, &TxInfoDialog::viewOnBlockExplorer);
m_txid = txInfo->hash();
ui->label_txid->setText(m_txid);
@ -85,6 +91,9 @@ TxInfoDialog::TxInfoDialog(QSharedPointer<AppContext> ctx, TransactionInfo *txIn
}
this->adjustSize();
// Don't autofocus any of the buttons. There is probably a better way for this.
ui->label_txid->setFocus();
}
void TxInfoDialog::adjustHeight(QTextEdit *textEdit, qreal docHeight) {
@ -168,4 +177,8 @@ void TxInfoDialog::createTxProof() {
m_txProofDialog->getTxKey();
}
void TxInfoDialog::viewOnBlockExplorer() {
Utils::externalLinkWarning(this, Utils::blockExplorerLink(config()->get(Config::blockExplorer).toString(), constants::networkType, m_txid));
}
TxInfoDialog::~TxInfoDialog() = default;

1
src/dialog/TxInfoDialog.h

@ -34,6 +34,7 @@ private:
void setData(TransactionInfo *tx);
void updateData();
void adjustHeight(QTextEdit *textEdit, qreal docHeight);
void viewOnBlockExplorer();
QScopedPointer<Ui::TxInfoDialog> ui;
QSharedPointer<AppContext> m_ctx;

15
src/dialog/TxInfoDialog.ui

@ -19,7 +19,7 @@
<property name="title">
<string>Transaction ID:</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_txid">
<property name="text">
@ -30,6 +30,19 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btn_viewOnBlockExplorer">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
</item>

Loading…
Cancel
Save