Master Core  v0.0.9 - 49a5c0d97abf09ef2911ddfe8d9551df59f9efd3-dirty
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Public Types | Public Slots | Public Member Functions | Private Member Functions | Private Attributes | Friends
TransactionTableModel Class Reference

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

#include <transactiontablemodel.h>

+ Inheritance diagram for TransactionTableModel:
+ Collaboration diagram for TransactionTableModel:

Public Types

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

Public Slots

void updateTransaction (const QString &hash, int status)
 
void updateConfirmations ()
 
void updateDisplayUnit ()
 

Public Member Functions

 TransactionTableModel (CWallet *wallet, WalletModel *parent=0)
 
 ~TransactionTableModel ()
 
int rowCount (const QModelIndex &parent) const
 
int columnCount (const QModelIndex &parent) const
 
QVariant data (const QModelIndex &index, int role) const
 
QVariant headerData (int section, Qt::Orientation orientation, int role) const
 
QModelIndex index (int row, int column, const QModelIndex &parent=QModelIndex()) const
 

Private Member Functions

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) const
 
QString formatTooltip (const TransactionRecord *rec) const
 
QVariant txStatusDecoration (const TransactionRecord *wtx) const
 
QVariant txAddressDecoration (const TransactionRecord *wtx) const
 

Private Attributes

CWalletwallet
 
WalletModelwalletModel
 
QStringList columns
 
TransactionTablePrivpriv
 

Friends

class TransactionTablePriv
 

Detailed Description

UI model for the transaction table of a wallet.

Definition at line 21 of file transactiontablemodel.h.

Member Enumeration Documentation

Enumerator
Status 
Date 
Type 
ToAddress 
Amount 

Definition at line 29 of file transactiontablemodel.h.

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.

LongDescriptionRole 

Long description (HTML format)

AddressRole 

Address of transaction.

LabelRole 

Label of address related to transaction.

AmountRole 

Net amount of transaction.

TxIDRole 

Unique identifier.

TxHashRole 

Transaction hash.

ConfirmedRole 

Is transaction confirmed?

FormattedAmountRole 

Formatted amount, without brackets when unconfirmed.

StatusRole 

Transaction status (TransactionRecord::Status)

Definition at line 40 of file transactiontablemodel.h.

Constructor & Destructor Documentation

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

Definition at line 277 of file transactiontablemodel.cpp.

References columns, WalletModel::getOptionsModel(), priv, TransactionTablePriv::refreshWallet(), updateDisplayUnit(), and walletModel.

+ Here is the call graph for this function:

TransactionTableModel::~TransactionTableModel ( )

Definition at line 290 of file transactiontablemodel.cpp.

References priv.

Member Function Documentation

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

Definition at line 452 of file transactiontablemodel.cpp.

References TransactionRecord::address, COLOR_BAREADDRESS, TransactionRecord::Generated, WalletModel::getAddressTableModel(), AddressTableModel::labelForAddress(), TransactionRecord::RecvWithAddress, TransactionRecord::SendToAddress, TransactionRecord::SendToSelf, TransactionRecord::type, and walletModel.

Referenced by data().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 319 of file transactiontablemodel.cpp.

References columns.

QVariant TransactionTableModel::data ( const QModelIndex &  index,
int  role 
) const
QString TransactionTableModel::formatTooltip ( const TransactionRecord rec) const
private

Definition at line 522 of file transactiontablemodel.cpp.

References formatTxStatus(), formatTxToAddress(), formatTxType(), TransactionRecord::RecvFromOther, TransactionRecord::RecvWithAddress, TransactionRecord::SendToAddress, TransactionRecord::SendToOther, and TransactionRecord::type.

Referenced by data().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

QString TransactionTableModel::formatTxAmount ( const TransactionRecord wtx,
bool  showUnconfirmed = true 
) const
private

Definition at line 473 of file transactiontablemodel.cpp.

References TransactionStatus::countsForBalance, TransactionRecord::credit, TransactionRecord::debit, BitcoinUnits::format(), OptionsModel::getDisplayUnit(), WalletModel::getOptionsModel(), TransactionRecord::status, and walletModel.

Referenced by data().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 366 of file transactiontablemodel.cpp.

References GUIUtil::dateTimeStr(), and TransactionRecord::time.

Referenced by data().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 325 of file transactiontablemodel.cpp.

References TransactionStatus::Confirmed, TransactionStatus::Confirming, TransactionStatus::Conflicted, GUIUtil::dateTimeStr(), TransactionStatus::depth, TransactionStatus::Immature, TransactionStatus::matures_in, TransactionStatus::MaturesWarning, TransactionStatus::NotAccepted, TransactionStatus::Offline, TransactionStatus::open_for, TransactionStatus::OpenUntilBlock, TransactionStatus::OpenUntilDate, TransactionRecord::RecommendedNumConfirmations, TransactionStatus::status, TransactionRecord::status, and TransactionStatus::Unconfirmed.

Referenced by formatTooltip().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

QString TransactionTableModel::formatTxToAddress ( const TransactionRecord wtx,
bool  tooltip 
) const
private

Definition at line 434 of file transactiontablemodel.cpp.

References TransactionRecord::address, TransactionRecord::Generated, lookupAddress(), TransactionRecord::RecvFromOther, TransactionRecord::RecvWithAddress, TransactionRecord::SendToAddress, TransactionRecord::SendToOther, TransactionRecord::SendToSelf, and TransactionRecord::type.

Referenced by data(), and formatTooltip().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 396 of file transactiontablemodel.cpp.

References TransactionRecord::Generated, TransactionRecord::RecvFromOther, TransactionRecord::RecvWithAddress, TransactionRecord::SendToAddress, TransactionRecord::SendToOther, TransactionRecord::SendToSelf, and TransactionRecord::type.

Referenced by data(), and formatTooltip().

+ Here is the caller graph for this function:

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

Definition at line 624 of file transactiontablemodel.cpp.

References Amount, columns, Date, Status, ToAddress, and Type.

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

Definition at line 655 of file transactiontablemodel.cpp.

References data(), TransactionTablePriv::index(), and priv.

Referenced by WalletView::processNewTransaction(), updateConfirmations(), and updateDisplayUnit().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 381 of file transactiontablemodel.cpp.

References WalletModel::getAddressTableModel(), OptionsModel::getDisplayAddresses(), WalletModel::getOptionsModel(), AddressTableModel::labelForAddress(), and walletModel.

Referenced by formatTxToAddress().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 313 of file transactiontablemodel.cpp.

References priv, and TransactionTablePriv::size().

+ Here is the call graph for this function:

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

Definition at line 416 of file transactiontablemodel.cpp.

References TransactionRecord::Generated, TransactionRecord::RecvFromOther, TransactionRecord::RecvWithAddress, TransactionRecord::SendToAddress, TransactionRecord::SendToOther, and TransactionRecord::type.

Referenced by data().

+ Here is the caller graph for this function:

QVariant TransactionTableModel::txStatusDecoration ( const TransactionRecord wtx) const
private
void TransactionTableModel::updateConfirmations ( )
slot

Definition at line 303 of file transactiontablemodel.cpp.

References index(), priv, TransactionTablePriv::size(), Status, and ToAddress.

Referenced by WalletModel::pollBalanceChanged().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void TransactionTableModel::updateDisplayUnit ( )
slot

Definition at line 669 of file transactiontablemodel.cpp.

References Amount, index(), priv, and TransactionTablePriv::size().

Referenced by TransactionTableModel().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 295 of file transactiontablemodel.cpp.

References priv, base_uint< BITS >::SetHex(), and TransactionTablePriv::updateWallet().

Referenced by WalletModel::updateTransaction().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Friends And Related Function Documentation

friend class TransactionTablePriv
friend

Definition at line 93 of file transactiontablemodel.h.

Field Documentation

QStringList TransactionTableModel::columns
private

Definition at line 74 of file transactiontablemodel.h.

Referenced by columnCount(), headerData(), and TransactionTableModel().

TransactionTablePriv* TransactionTableModel::priv
private
CWallet* TransactionTableModel::wallet
private

Definition at line 72 of file transactiontablemodel.h.

WalletModel* TransactionTableModel::walletModel
private

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