PIVX Core  5.6.99
P2P Digital Currency
Public Types | Public Slots | Signals | Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
TransactionTableModel Class Reference

UI model for the transaction table of a wallet. More...

#include <transactiontablemodel.h>

Inheritance diagram for TransactionTableModel:
[legend]
Collaboration diagram for TransactionTableModel:
[legend]

Public Types

enum  ColumnIndex {
  Status = 0 , Watchonly = 1 , Date = 2 , Type = 3 ,
  ToAddress = 4 , Amount = 5
}
 
enum  RoleIndex {
  TypeRole = Qt::UserRole , DateRole , WatchonlyRole , WatchonlyDecorationRole ,
  AddressRole , LabelRole , AmountRole , TxHashRole ,
  ConfirmedRole , FormattedAmountRole , StatusRole , ShieldedCreditAmountRole ,
  SizeRole
}
 Roles to get specific information from a transaction row. More...
 

Public Slots

void updateTransaction (const QString &hash, int status, bool showTransaction)
 
void updateConfirmations ()
 
void updateDisplayUnit ()
 
void updateAmountColumnTitle ()
 Updates the column title to "Amount (DisplayUnit)" and emits headerDataChanged() signal for table headers to react. More...
 
void setProcessingQueuedTransactions (bool value)
 

Signals

void txLoaded (const QString &hash, const int txType, const int txStatus)
 
void txArrived (const QString &hash, const bool isCoinStake, const bool isMNReward, const bool isCSAnyType)
 

Public Member Functions

 TransactionTableModel (CWallet *wallet, WalletModel *parent=nullptr)
 
 ~TransactionTableModel () override
 
void init ()
 
int rowCount (const QModelIndex &parent) const override
 
int columnCount (const QModelIndex &parent) const override
 
int size () const
 
QVariant data (const QModelIndex &index, int role) const override
 
QVariant headerData (int section, Qt::Orientation orientation, int role) const override
 
QModelIndex index (int row, int column, const QModelIndex &parent=QModelIndex()) const override
 
bool processingQueuedTransactions () const
 

Private Member Functions

void subscribeToCoreSignals ()
 
void unsubscribeFromCoreSignals ()
 
QString lookupAddress (const std::string &address, bool tooltip) const
 
QVariant addressColor (const TransactionRecord *wtx) const
 
QString formatTxStatus (const TransactionRecord *wtx) const
 
QString formatTxDate (const TransactionRecord *wtx) const
 
QString formatTxType (const TransactionRecord *wtx) const
 
QString formatTxToAddress (const TransactionRecord *wtx, bool tooltip) const
 
QString formatTxAmount (const TransactionRecord *wtx, bool showUnconfirmed=true, BitcoinUnits::SeparatorStyle separators=BitcoinUnits::separatorStandard) const
 
QString formatTooltip (const TransactionRecord *rec) const
 
QVariant txStatusDecoration (const TransactionRecord *wtx) const
 
QVariant txWatchonlyDecoration (const TransactionRecord *wtx) const
 
QVariant txAddressDecoration (const TransactionRecord *wtx) const
 

Private Attributes

std::unique_ptr< interfaces::Handlerm_handler_transaction_changed
 
std::unique_ptr< interfaces::Handlerm_handler_show_progress
 
CWalletwallet {nullptr}
 
WalletModelwalletModel {nullptr}
 
QStringList columns {}
 
TransactionTablePrivpriv {nullptr}
 
bool fProcessingQueuedTransactions {false}
 

Friends

class TransactionTablePriv
 

Detailed Description

UI model for the transaction table of a wallet.

Definition at line 28 of file transactiontablemodel.h.

Member Enumeration Documentation

◆ ColumnIndex

Enumerator
Status 
Watchonly 
Date 
Type 
ToAddress 
Amount 

Definition at line 37 of file transactiontablemodel.h.

◆ RoleIndex

Roles to get specific information from a transaction row.

These are independent of column.

Enumerator
TypeRole 

Type of transaction.

DateRole 

Date and time this transaction was created.

WatchonlyRole 

Watch-only boolean.

WatchonlyDecorationRole 

Watch-only icon.

AddressRole 

Address of transaction.

LabelRole 

Label of address related to transaction.

AmountRole 

Net amount of transaction.

TxHashRole 

Transaction hash.

ConfirmedRole 

Is transaction confirmed?

FormattedAmountRole 

Formatted amount, without brackets when unconfirmed.

StatusRole 

Transaction status (TransactionRecord::Status)

ShieldedCreditAmountRole 

Credit amount of transaction.

SizeRole 

Transaction size in bytes.

Definition at line 49 of file transactiontablemodel.h.

Constructor & Destructor Documentation

◆ TransactionTableModel()

TransactionTableModel::TransactionTableModel ( CWallet wallet,
WalletModel parent = nullptr 
)
explicit

Definition at line 305 of file transactiontablemodel.cpp.

Here is the call graph for this function:

◆ ~TransactionTableModel()

TransactionTableModel::~TransactionTableModel ( )
override

Definition at line 322 of file transactiontablemodel.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ addressColor()

QVariant TransactionTableModel::addressColor ( const TransactionRecord wtx) const
private

Definition at line 575 of file transactiontablemodel.cpp.

Here is the call graph for this function:

◆ columnCount()

int TransactionTableModel::columnCount ( const QModelIndex &  parent) const
override

Definition at line 363 of file transactiontablemodel.cpp.

◆ data()

QVariant TransactionTableModel::data ( const QModelIndex &  index,
int  role 
) const
override

Definition at line 656 of file transactiontablemodel.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ formatTooltip()

QString TransactionTableModel::formatTooltip ( const TransactionRecord rec) const
private

Definition at line 651 of file transactiontablemodel.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ formatTxAmount()

QString TransactionTableModel::formatTxAmount ( const TransactionRecord wtx,
bool  showUnconfirmed = true,
BitcoinUnits::SeparatorStyle  separators = BitcoinUnits::separatorStandard 
) const
private

Definition at line 595 of file transactiontablemodel.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ formatTxDate()

QString TransactionTableModel::formatTxDate ( const TransactionRecord wtx) const
private

Definition at line 407 of file transactiontablemodel.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ formatTxStatus()

QString TransactionTableModel::formatTxStatus ( const TransactionRecord wtx) const
private

Definition at line 373 of file transactiontablemodel.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ formatTxToAddress()

QString TransactionTableModel::formatTxToAddress ( const TransactionRecord wtx,
bool  tooltip 
) const
private
Todo:
: add addressbook support for shielded addresses.
Todo:
: add addressbook for shielded addr

Definition at line 515 of file transactiontablemodel.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ formatTxType()

QString TransactionTableModel::formatTxType ( const TransactionRecord wtx) const
private

Definition at line 431 of file transactiontablemodel.cpp.

Here is the caller graph for this function:

◆ headerData()

QVariant TransactionTableModel::headerData ( int  section,
Qt::Orientation  orientation,
int  role 
) const
override

Definition at line 765 of file transactiontablemodel.cpp.

◆ index()

QModelIndex TransactionTableModel::index ( int  row,
int  column,
const QModelIndex &  parent = QModelIndex() 
) const
override

Definition at line 792 of file transactiontablemodel.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ init()

void TransactionTableModel::init ( )

Definition at line 316 of file transactiontablemodel.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lookupAddress()

QString TransactionTableModel::lookupAddress ( const std::string &  address,
bool  tooltip 
) const
private

Definition at line 418 of file transactiontablemodel.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ processingQueuedTransactions()

bool TransactionTableModel::processingQueuedTransactions ( ) const
inline

Definition at line 84 of file transactiontablemodel.h.

Here is the caller graph for this function:

◆ rowCount()

int TransactionTableModel::rowCount ( const QModelIndex &  parent) const
override

Definition at line 357 of file transactiontablemodel.cpp.

Here is the call graph for this function:

◆ setProcessingQueuedTransactions

void TransactionTableModel::setProcessingQueuedTransactions ( bool  value)
inlineslot

Definition at line 126 of file transactiontablemodel.h.

◆ size()

int TransactionTableModel::size ( ) const

Definition at line 369 of file transactiontablemodel.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ subscribeToCoreSignals()

void TransactionTableModel::subscribeToCoreSignals ( )
private

Definition at line 867 of file transactiontablemodel.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ txAddressDecoration()

QVariant TransactionTableModel::txAddressDecoration ( const TransactionRecord wtx) const
private

Definition at line 493 of file transactiontablemodel.cpp.

Here is the caller graph for this function:

◆ txArrived

void TransactionTableModel::txArrived ( const QString &  hash,
const bool  isCoinStake,
const bool  isMNReward,
const bool  isCSAnyType 
)
signal
Here is the caller graph for this function:

◆ txLoaded

void TransactionTableModel::txLoaded ( const QString &  hash,
const int  txType,
const int  txStatus 
)
signal
Here is the caller graph for this function:

◆ txStatusDecoration()

QVariant TransactionTableModel::txStatusDecoration ( const TransactionRecord wtx) const
private

Definition at line 606 of file transactiontablemodel.cpp.

Here is the caller graph for this function:

◆ txWatchonlyDecoration()

QVariant TransactionTableModel::txWatchonlyDecoration ( const TransactionRecord wtx) const
private

Definition at line 643 of file transactiontablemodel.cpp.

Here is the caller graph for this function:

◆ unsubscribeFromCoreSignals()

void TransactionTableModel::unsubscribeFromCoreSignals ( )
private

Definition at line 874 of file transactiontablemodel.cpp.

Here is the caller graph for this function:

◆ updateAmountColumnTitle

void TransactionTableModel::updateAmountColumnTitle ( )
slot

Updates the column title to "Amount (DisplayUnit)" and emits headerDataChanged() signal for table headers to react.

Definition at line 329 of file transactiontablemodel.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateConfirmations

void TransactionTableModel::updateConfirmations ( )
slot

Definition at line 347 of file transactiontablemodel.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateDisplayUnit

void TransactionTableModel::updateDisplayUnit ( )
slot

Definition at line 804 of file transactiontablemodel.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateTransaction

void TransactionTableModel::updateTransaction ( const QString &  hash,
int  status,
bool  showTransaction 
)
slot

Definition at line 335 of file transactiontablemodel.cpp.

Here is the call graph for this function:

Friends And Related Function Documentation

◆ TransactionTablePriv

friend class TransactionTablePriv
friend

Definition at line 128 of file transactiontablemodel.h.

Member Data Documentation

◆ columns

QStringList TransactionTableModel::columns {}
private

Definition at line 99 of file transactiontablemodel.h.

◆ fProcessingQueuedTransactions

bool TransactionTableModel::fProcessingQueuedTransactions {false}
private

Definition at line 101 of file transactiontablemodel.h.

◆ m_handler_show_progress

std::unique_ptr<interfaces::Handler> TransactionTableModel::m_handler_show_progress
private

Definition at line 95 of file transactiontablemodel.h.

◆ m_handler_transaction_changed

std::unique_ptr<interfaces::Handler> TransactionTableModel::m_handler_transaction_changed
private

Definition at line 94 of file transactiontablemodel.h.

◆ priv

TransactionTablePriv* TransactionTableModel::priv {nullptr}
private

Definition at line 100 of file transactiontablemodel.h.

◆ wallet

CWallet* TransactionTableModel::wallet {nullptr}
private

Definition at line 97 of file transactiontablemodel.h.

◆ walletModel

WalletModel* TransactionTableModel::walletModel {nullptr}
private

Definition at line 98 of file transactiontablemodel.h.


The documentation for this class was generated from the following files: