qt: Move transaction notification to transaction table model
Move transaction new/update notification to TransactionTableModel. This moves the concerns to where they're actually handled. No need to bounce this through wallet model. - Do wallet transaction preprocessing on signal handler side; avoids locking cs_main/cs_wallet on notification in GUI thread (except for new transactions)
This commit is contained in:
@@ -72,12 +72,17 @@ public:
|
||||
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;
|
||||
|
||||
void subscribeToCoreSignals();
|
||||
void unsubscribeFromCoreSignals();
|
||||
|
||||
QString lookupAddress(const std::string &address, bool tooltip) const;
|
||||
QVariant addressColor(const TransactionRecord *wtx) const;
|
||||
@@ -92,11 +97,14 @@ private:
|
||||
QVariant txAddressDecoration(const TransactionRecord *wtx) const;
|
||||
|
||||
public slots:
|
||||
void updateTransaction(const QString &hash, int status);
|
||||
/* 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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user