22 #include <validation.h>    30 #include <boost/bind.hpp>    33 static int column_alignments[] = {
    34         Qt::AlignLeft|Qt::AlignVCenter, 
    35         Qt::AlignLeft|Qt::AlignVCenter, 
    36         Qt::AlignLeft|Qt::AlignVCenter, 
    37         Qt::AlignLeft|Qt::AlignVCenter, 
    38         Qt::AlignLeft|Qt::AlignVCenter, 
    39         Qt::AlignRight|Qt::AlignVCenter 
    80         qDebug() << 
"TransactionTablePriv::refreshWallet";
    98         qDebug() << 
"TransactionTablePriv::updateWallet: " + QString::fromStdString(hash.
ToString()) + 
" " + QString::number(status);
   101         QList<TransactionRecord>::iterator lower = qLowerBound(
   103         QList<TransactionRecord>::iterator upper = qUpperBound(
   107         bool inModel = (lower != upper);
   111             if(showTransaction && !inModel)
   113             if(!showTransaction && inModel)
   117         qDebug() << 
"    inModel=" + QString::number(inModel) +
   118                     " Index=" + QString::number(lowerIndex) + 
"-" + QString::number(upperIndex) +
   119                     " showTransaction=" + QString::number(showTransaction) + 
" derivedStatus=" + QString::number(status);
   126                 qWarning() << 
"TransactionTablePriv::updateWallet: Warning: Got CT_NEW, but transaction is already in model";
   135                     qWarning() << 
"TransactionTablePriv::updateWallet: Warning: Got CT_NEW, but transaction is not in wallet";
   139                 QList<TransactionRecord> toInsert =
   141                 if(!toInsert.isEmpty()) 
   143                     parent->beginInsertRows(QModelIndex(), lowerIndex, lowerIndex+toInsert.size()-1);
   144                     int insert_idx = lowerIndex;
   157                 qWarning() << 
"TransactionTablePriv::updateWallet: Warning: Got CT_DELETED, but transaction is not in model";
   161             parent->beginRemoveRows(QModelIndex(), lowerIndex, upperIndex-1);
   168             for (
int i = lowerIndex; i < upperIndex; i++) {
   196             int64_t adjustedTime;
   215             return QString::fromStdString(strHex);
   222         QAbstractTableModel(parent),
   225         fProcessingQueuedTransactions(false),
   226         platformStyle(_platformStyle)
   252     updated.
SetHex(hash.toStdString());
   292         status = tr(
"Unconfirmed");
   295         status = tr(
"Abandoned");
   301         status = tr(
"Confirmed (%1 confirmations)").arg(wtx->
status.
depth);
   304         status = tr(
"Conflicted");
   310         status = tr(
"Generated but not accepted");
   335         description += label;
   337     if(label.isEmpty() || tooltip)
   339         description += QString(
" (") + QString::fromStdString(address) + QString(
")");
   349         return tr(
"Received with");
   351         return tr(
"Received from");
   354         return tr(
"Sent to");
   356         return tr(
"Payment to yourself");
   369         return QIcon(
":/icons/tx_mined");
   372         return QIcon(
":/icons/tx_input");
   375         return QIcon(
":/icons/tx_output");
   377         return QIcon(
":/icons/tx_inout");
   383     QString watchAddress;
   386         watchAddress = wtx->
involvesWatchAddress ? QString(
" (") + tr(
"watch-only") + QString(
")") : 
"";
   392         return QString::fromStdString(wtx->
address) + watchAddress;
   398         return QString::fromStdString(wtx->
address) + watchAddress;
   401         return tr(
"(n/a)") + watchAddress;
   433             str = QString(
"[") + str + QString(
"]");
   447         return QIcon(
":/icons/transaction_0");
   449         return QIcon(
":/icons/transaction_abandoned");
   453         case 1: 
return QIcon(
":/icons/transaction_1");
   454         case 2: 
return QIcon(
":/icons/transaction_2");
   455         case 3: 
return QIcon(
":/icons/transaction_3");
   456         case 4: 
return QIcon(
":/icons/transaction_4");
   457         default: 
return QIcon(
":/icons/transaction_5");
   460         return QIcon(
":/icons/transaction_confirmed");
   462         return QIcon(
":/icons/transaction_conflicted");
   466         return QIcon(QString(
":/icons/transaction_%1").arg(part));
   469         return QIcon(
":/icons/transaction_0");
   478         return QIcon(
":/icons/eye");
   503         switch(
index.column())
   513     case Qt::DecorationRole:
   518     case Qt::DisplayRole:
   519         switch(
index.column())
   533         switch(
index.column())
   549     case Qt::ToolTipRole:
   551     case Qt::TextAlignmentRole:
   552         return column_alignments[
index.column()];
   553     case Qt::ForegroundRole:
   576         return QDateTime::fromTime_t(static_cast<uint>(rec->
time));
   584         return QString::fromStdString(rec->
address);
   596             QDateTime date = QDateTime::fromTime_t(static_cast<uint>(rec->
time));
   599             details.append(date.toString(
"M/d/yy HH:mm"));
   602             details.append(
". ");
   608                 if(txLabel.isEmpty())
   609                     details.append(tr(
"(no label)") + 
" ");
   612                     details.append(txLabel);
   613                     details.append(
") ");
   615                 details.append(QString::fromStdString(rec->
address));
   634     if(orientation == Qt::Horizontal)
   636         if(role == Qt::DisplayRole)
   640         else if (role == Qt::TextAlignmentRole)
   642             return column_alignments[section];
   643         } 
else if (role == Qt::ToolTipRole)
   648                 return tr(
"Transaction status. Hover over this field to show number of confirmations.");
   650                 return tr(
"Date and time that the transaction was received.");
   652                 return tr(
"Type of transaction.");
   654                 return tr(
"Whether or not a watch-only address is involved in this transaction.");
   656                 return tr(
"User-defined intent/purpose of the transaction.");
   658                 return tr(
"Amount removed from or added to balance.");
   673     return QModelIndex();
   693         QString strHash = QString::fromStdString(
hash.
GetHex());
   694         qDebug() << 
"NotifyTransactionChanged: " + strHash + 
" status= " + QString::number(
status);
   695         QMetaObject::invokeMethod(ttm, 
"updateTransaction", Qt::QueuedConnection,
   696                                   Q_ARG(QString, strHash),
   706 static bool fQueueNotifications = 
false;
   707 static std::vector< TransactionNotification > vQueueNotifications;
   717     if (fQueueNotifications)
   719         vQueueNotifications.push_back(notification);
   728         fQueueNotifications = 
true;
   730     if (nProgress == 100)
   732         fQueueNotifications = 
false;
   733         if (vQueueNotifications.size() > 10) 
   734             QMetaObject::invokeMethod(ttm, 
"setProcessingQueuedTransactions", Qt::QueuedConnection, Q_ARG(
bool, 
true));
   735         for (
unsigned int i = 0; i < vQueueNotifications.size(); ++i)
   737             if (vQueueNotifications.size() - i <= 10)
   738                 QMetaObject::invokeMethod(ttm, 
"setProcessingQueuedTransactions", Qt::QueuedConnection, Q_ARG(
bool, 
false));
   740             vQueueNotifications[i].invoke(ttm);
   742         std::vector<TransactionNotification >().swap(vQueueNotifications); 
 void updateWallet(interfaces::Wallet &wallet, const uint256 &hash, int status, bool showTransaction)
 
void updateAmountColumnTitle()
Updates the column title to "Amount (DisplayUnit)" and emits headerDataChanged() signal for table hea...
 
bool statusUpdateNeeded(int numBlocks) const
Return whether a status update is needed. 
 
virtual bool tryGetTxStatus(const uint256 &txid, WalletTxStatus &tx_status, int &num_blocks, int64_t &adjusted_time)=0
Try to get updated status for a particular transaction, if possible without blocking. 
 
Confirmed, but waiting for the recommended number of confirmations. 
 
interfaces::Wallet & wallet() const
 
QVariant txWatchonlyDecoration(const TransactionRecord *wtx) const
 
Transaction not yet final, waiting for block. 
 
Transaction status (TransactionRecord::Status) 
 
QString getTxHash() const
Return the unique identifier for this transaction (part) 
 
QString formatTxAmount(const TransactionRecord *wtx, bool showUnconfirmed=true, BitcoinUnits::SeparatorStyle separators=BitcoinUnits::separatorStandard) const
 
Generated (mined) transactions. 
 
QString formatTooltip(const TransactionRecord *rec) const
 
WalletModel * walletModel
 
virtual CTransactionRef getTx(const uint256 &txid)=0
Get a transaction. 
 
Have 6 or more confirmations (normal tx) or fully mature (mined tx) 
 
std::string sortKey
Sorting key based on status. 
 
void updateTransaction(const QString &hash, int status, bool showTransaction)
 
QString describe(interfaces::Node &node, interfaces::Wallet &wallet, TransactionRecord *rec, int unit)
 
QString dateTimeStr(const QDateTime &date)
 
TransactionTablePriv(TransactionTableModel *_parent)
 
static QList< TransactionRecord > decomposeTransaction(const interfaces::WalletTx &wtx)
 
void unsubscribeFromCoreSignals()
 
QVariant txStatusDecoration(const TransactionRecord *wtx) const
 
bool operator()(const TransactionRecord &a, const TransactionRecord &b) const
 
Not yet mined into a block. 
 
static QString toHTML(interfaces::Node &node, interfaces::Wallet &wallet, TransactionRecord *rec, int unit)
 
TransactionTableModel(const PlatformStyle *platformStyle, WalletModel *parent=0)
 
AddressTableModel * getAddressTableModel()
 
Transaction data, hex-encoded. 
 
TransactionTableModel * parent
 
Long description (HTML format) 
 
TransactionTablePriv * priv
 
virtual WalletTx getWalletTx(const uint256 &txid)=0
Get transaction information. 
 
int getDisplayUnit() const
 
static QString getAmountColumnTitle(int unit)
Gets title for amount column including current display unit if optionsModel reference available */...
 
bool operator()(const uint256 &a, const TransactionRecord &b) const
 
QList< TransactionRecord > cachedWallet
 
void updateStatus(const interfaces::WalletTxStatus &wtx, int numBlocks, int64_t adjustedTime)
Update status from core wallet tx. 
 
bool operator()(const TransactionRecord &a, const uint256 &b) const
 
virtual std::unique_ptr< Handler > handleTransactionChanged(TransactionChangedFn fn)=0
 
UI model for a transaction. 
 
TransactionStatus status
Status: can change with block chain update. 
 
QString formatTxType(const TransactionRecord *wtx) const
 
virtual std::unique_ptr< Handler > handleShowProgress(ShowProgressFn fn)=0
 
TransactionNotification()
 
Whole transaction as plain text. 
 
ChangeType
General change type (added, updated, removed). 
 
std::unique_ptr< interfaces::Handler > m_handler_transaction_changed
 
#define COLOR_TX_STATUS_DANGER
 
QString labelForAddress(const QString &address) const
Look up label for address in address book, if not found return empty string. 
 
Interface for accessing a wallet. 
 
Is transaction confirmed? 
 
TransactionNotification(uint256 _hash, ChangeType _status, bool _showTransaction)
 
bool countsForBalance
Transaction counts towards available balance. 
 
Date and time this transaction was created. 
 
std::string ToString() const
 
interfaces::Node & node() const
 
void displayUnitChanged(int unit)
 
UI model for the transaction table of a wallet. 
 
#define COLOR_UNCONFIRMED
 
void refreshWallet(interfaces::Wallet &wallet)
 
Normal (sent/received) transactions. 
 
QString lookupAddress(const std::string &address, bool tooltip) const
 
void subscribeToCoreSignals()
 
std::unique_ptr< interfaces::Handler > m_handler_show_progress
 
static bool showTransaction()
Decompose CWallet transaction to model transaction records. 
 
QVariant data(const QModelIndex &index, int role) const
 
Net amount of transaction. 
 
virtual std::vector< WalletTx > getWalletTxs()=0
Get list of all wallet transactions. 
 
QString formatTxToAddress(const TransactionRecord *wtx, bool tooltip) const
 
Conflicts with other transaction or mempool. 
 
Interface to Bitcoin wallet from Qt view code. 
 
int columnCount(const QModelIndex &parent) const
 
int rowCount(const QModelIndex &parent) const
 
bool involvesWatchAddress
Whether the transaction was sent/received with a watch-only address. 
 
QVariant headerData(int section, Qt::Orientation orientation, int role) const
 
std::string GetHex() const
 
QString getTxHex(interfaces::Wallet &wallet, TransactionRecord *rec)
 
std::string EncodeHexTx(const CTransaction &tx, const int serializeFlags=0)
 
Label of address related to transaction. 
 
QString formatTxStatus(const TransactionRecord *wtx) const
 
QVariant addressColor(const TransactionRecord *wtx) const
 
void invoke(QObject *ttm)
 
#define COLOR_TX_STATUS_OPENUNTILDATE
 
qint64 open_for
Timestamp if status==OpenUntilDate, otherwise number of additional blocks that need to be mined befor...
 
QVariant txAddressDecoration(const TransactionRecord *wtx) const
 
Formatted amount, without brackets when unconfirmed. 
 
void updateConfirmations()
 
void SetHex(const char *psz)
 
TransactionRecord * index(interfaces::Wallet &wallet, int idx)
 
Abandoned from the wallet. 
 
#define COLOR_BAREADDRESS
 
Top-level interface for a bitcoin node (bsha3d process). 
 
const PlatformStyle * platformStyle
 
Updated transaction status. 
 
static const int RecommendedNumConfirmations
Number of confirmation recommended for accepting a transaction. 
 
static QString format(int unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=separatorStandard)
Format as string. 
 
OptionsModel * getOptionsModel()
 
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
 
QString formatTxDate(const TransactionRecord *wtx) const