Skip to content

Commit

Permalink
move-only: Define TransactionNotification before TransactionTablePriv
Browse files Browse the repository at this point in the history
Summary:
This is needed because next commit moves `vQueueNotifications` to `TransactionTablePriv` member.

This is a backport of [[bitcoin-core/gui#120 | core-gui#120]]  [1/2]
bitcoin-core/gui@7b3b230

Test Plan: `ninja all check-all`

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D10730
  • Loading branch information
PiRK committed Dec 23, 2021
1 parent 6294e47 commit f2c2099
Showing 1 changed file with 28 additions and 28 deletions.
56 changes: 28 additions & 28 deletions src/qt/transactiontablemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,34 @@ struct TxLessThan {
}
};

// queue notifications to show a non freezing progress dialog e.g. for rescan
struct TransactionNotification {
public:
TransactionNotification() {}
TransactionNotification(TxId _txid, ChangeType _status,
bool _showTransaction)
: txid(_txid), status(_status), showTransaction(_showTransaction) {}

void invoke(QObject *ttm) {
QString strHash = QString::fromStdString(txid.GetHex());
qDebug() << "NotifyTransactionChanged: " + strHash +
" status= " + QString::number(status);
bool invoked = QMetaObject::invokeMethod(
ttm, "updateTransaction", Qt::QueuedConnection,
Q_ARG(QString, strHash), Q_ARG(int, status),
Q_ARG(bool, showTransaction));
assert(invoked);
}

private:
TxId txid;
ChangeType status;
bool showTransaction;
};

static bool fQueueNotifications = false;
static std::vector<TransactionNotification> vQueueNotifications;

// Private implementation
class TransactionTablePriv {
public:
Expand Down Expand Up @@ -685,34 +713,6 @@ void TransactionTableModel::updateDisplayUnit() {
Q_EMIT dataChanged(index(0, Amount), index(priv->size() - 1, Amount));
}

// queue notifications to show a non freezing progress dialog e.g. for rescan
struct TransactionNotification {
public:
TransactionNotification() {}
TransactionNotification(TxId _txid, ChangeType _status,
bool _showTransaction)
: txid(_txid), status(_status), showTransaction(_showTransaction) {}

void invoke(QObject *ttm) {
QString strHash = QString::fromStdString(txid.GetHex());
qDebug() << "NotifyTransactionChanged: " + strHash +
" status= " + QString::number(status);
bool invoked = QMetaObject::invokeMethod(
ttm, "updateTransaction", Qt::QueuedConnection,
Q_ARG(QString, strHash), Q_ARG(int, status),
Q_ARG(bool, showTransaction));
assert(invoked);
}

private:
TxId txid;
ChangeType status;
bool showTransaction;
};

static bool fQueueNotifications = false;
static std::vector<TransactionNotification> vQueueNotifications;

static void NotifyTransactionChanged(TransactionTableModel *ttm,
const TxId &txid, ChangeType status) {
// Find transaction in wallet
Expand Down

0 comments on commit f2c2099

Please sign in to comment.