690cb58f80
* Merge pull request #7154
a3c3ddb [Qt] add InMempool() info to transaction details (Jonas Schnelli)
* Merge pull request #7218
fa5769e [qt] Fix misleading translation (MarcoFalke)
fa8c8d7
torcontrol debug: Change to a blanket message that covers both cases (MarcoFalke)
* Merge pull request #7255
6fd0a07 Remove hardcoded fee from CoinControl ToolTip (fanquake)
5fdf32d Replace some instances of formatWithUnit with formatHtmlWithUnit (fanquake)
* Merge pull request #7263
a5a0831 Double semicolon cleanup. (21E14)
* Merge pull request #7334
fa989fb [qt] coincontrol workaround is still needed in qt5.4 (fixed in qt5.5) (MarcoFalke)
* Merge pull request #7329
9d263bd Typo fixes in comments (Chris Wheeler)
* Merge #7396: [Qt] Add option to increase/decrease font size in the console window
43abb02 [Qt] Add a new chevron/arrow icon for the console prompt line (Jonas Schnelli)
56c9e66 [Qt] keep scroll position in GUI console after changing font size (Jonas Schnelli)
3a3a927 [Qt] Add option to increase/decrease font size in the console window (Jonas Schnelli)
* Merge #7628: QT: Add 'copy full transaction details' option
b51ed40 QT: Add 'copy full transaction details' option (Eric Shaw)
* Merge #7668: Fix history deletion bug after font size change
21e45a0 Fix history deletion bug after font change (Andrew C)
* Copy/Move font size related icons into theme folders
* Use formatTxDate for date/time in TxPlainTextRole
121 lines
4.2 KiB
C++
121 lines
4.2 KiB
C++
// Copyright (c) 2011-2015 The Bitcoin Core developers
|
|
// Distributed under the MIT software license, see the accompanying
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
#ifndef BITCOIN_QT_TRANSACTIONTABLEMODEL_H
|
|
#define BITCOIN_QT_TRANSACTIONTABLEMODEL_H
|
|
|
|
#include "bitcoinunits.h"
|
|
|
|
#include <QAbstractTableModel>
|
|
#include <QStringList>
|
|
|
|
class PlatformStyle;
|
|
class TransactionRecord;
|
|
class TransactionTablePriv;
|
|
class WalletModel;
|
|
|
|
class CWallet;
|
|
|
|
/** UI model for the transaction table of a wallet.
|
|
*/
|
|
class TransactionTableModel : public QAbstractTableModel
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit TransactionTableModel(const PlatformStyle *platformStyle, CWallet* wallet, WalletModel *parent = 0);
|
|
~TransactionTableModel();
|
|
|
|
enum ColumnIndex {
|
|
Status = 0,
|
|
Watchonly = 1,
|
|
Date = 2,
|
|
Type = 3,
|
|
ToAddress = 4,
|
|
Amount = 5
|
|
};
|
|
|
|
/** Roles to get specific information from a transaction row.
|
|
These are independent of column.
|
|
*/
|
|
enum RoleIndex {
|
|
/** Type of transaction */
|
|
TypeRole = Qt::UserRole,
|
|
/** Date and time this transaction was created */
|
|
DateRole,
|
|
/** Watch-only boolean */
|
|
WatchonlyRole,
|
|
/** Watch-only icon */
|
|
WatchonlyDecorationRole,
|
|
/** Long description (HTML format) */
|
|
LongDescriptionRole,
|
|
/** Address of transaction */
|
|
AddressRole,
|
|
/** Label of address related to transaction */
|
|
LabelRole,
|
|
/** Net amount of transaction */
|
|
AmountRole,
|
|
/** Unique identifier */
|
|
TxIDRole,
|
|
/** Transaction hash */
|
|
TxHashRole,
|
|
/** Transaction data, hex-encoded */
|
|
TxHexRole,
|
|
/** Whole transaction as plain text */
|
|
TxPlainTextRole,
|
|
/** Is transaction confirmed? */
|
|
ConfirmedRole,
|
|
/** Formatted amount, without brackets when unconfirmed */
|
|
FormattedAmountRole,
|
|
/** Transaction status (TransactionRecord::Status) */
|
|
StatusRole,
|
|
/** Unprocessed icon */
|
|
RawDecorationRole,
|
|
};
|
|
|
|
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;
|
|
bool processingQueuedTransactions() { return fProcessingQueuedTransactions; }
|
|
|
|
private:
|
|
CWallet* wallet;
|
|
WalletModel *walletModel;
|
|
QStringList columns;
|
|
TransactionTablePriv *priv;
|
|
bool fProcessingQueuedTransactions;
|
|
const PlatformStyle *platformStyle;
|
|
|
|
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;
|
|
|
|
public Q_SLOTS:
|
|
/* New transaction, or transaction changed status */
|
|
void updateTransaction(const QString &hash, int status, bool showTransaction);
|
|
void updateConfirmations();
|
|
void updateDisplayUnit();
|
|
/** Updates the column title to "Amount (DisplayUnit)" and emits headerDataChanged() signal for table headers to react. */
|
|
void updateAmountColumnTitle();
|
|
/* Needed to update fProcessingQueuedTransactions through a QueuedConnection */
|
|
void setProcessingQueuedTransactions(bool value) { fProcessingQueuedTransactions = value; }
|
|
|
|
friend class TransactionTablePriv;
|
|
};
|
|
|
|
#endif // BITCOIN_QT_TRANSACTIONTABLEMODEL_H
|