Changeset View
Changeset View
Standalone View
Standalone View
src/qt/transactiontablemodel.cpp
Show First 20 Lines • Show All 692 Lines • ▼ Show 20 Lines | public: | ||||
TransactionNotification(TxId _txid, ChangeType _status, | TransactionNotification(TxId _txid, ChangeType _status, | ||||
bool _showTransaction) | bool _showTransaction) | ||||
: txid(_txid), status(_status), showTransaction(_showTransaction) {} | : txid(_txid), status(_status), showTransaction(_showTransaction) {} | ||||
void invoke(QObject *ttm) { | void invoke(QObject *ttm) { | ||||
QString strHash = QString::fromStdString(txid.GetHex()); | QString strHash = QString::fromStdString(txid.GetHex()); | ||||
qDebug() << "NotifyTransactionChanged: " + strHash + | qDebug() << "NotifyTransactionChanged: " + strHash + | ||||
" status= " + QString::number(status); | " status= " + QString::number(status); | ||||
QMetaObject::invokeMethod(ttm, "updateTransaction", | bool invoked = QMetaObject::invokeMethod( | ||||
Qt::QueuedConnection, Q_ARG(QString, strHash), | ttm, "updateTransaction", Qt::QueuedConnection, | ||||
Q_ARG(int, status), | Q_ARG(QString, strHash), Q_ARG(int, status), | ||||
Q_ARG(bool, showTransaction)); | Q_ARG(bool, showTransaction)); | ||||
assert(invoked); | |||||
} | } | ||||
private: | private: | ||||
TxId txid; | TxId txid; | ||||
ChangeType status; | ChangeType status; | ||||
bool showTransaction; | bool showTransaction; | ||||
}; | }; | ||||
Show All 21 Lines | static void ShowProgress(TransactionTableModel *ttm, const std::string &title, | ||||
if (nProgress == 0) { | if (nProgress == 0) { | ||||
fQueueNotifications = true; | fQueueNotifications = true; | ||||
} | } | ||||
if (nProgress == 100) { | if (nProgress == 100) { | ||||
fQueueNotifications = false; | fQueueNotifications = false; | ||||
if (vQueueNotifications.size() > 10) { | if (vQueueNotifications.size() > 10) { | ||||
// prevent balloon spam, show maximum 10 balloons | // prevent balloon spam, show maximum 10 balloons | ||||
QMetaObject::invokeMethod(ttm, "setProcessingQueuedTransactions", | bool invoked = QMetaObject::invokeMethod( | ||||
Qt::QueuedConnection, Q_ARG(bool, true)); | ttm, "setProcessingQueuedTransactions", Qt::QueuedConnection, | ||||
Q_ARG(bool, true)); | |||||
assert(invoked); | |||||
} | } | ||||
for (size_t i = 0; i < vQueueNotifications.size(); ++i) { | for (size_t i = 0; i < vQueueNotifications.size(); ++i) { | ||||
if (vQueueNotifications.size() - i <= 10) { | if (vQueueNotifications.size() - i <= 10) { | ||||
QMetaObject::invokeMethod( | bool invoked = QMetaObject::invokeMethod( | ||||
ttm, "setProcessingQueuedTransactions", | ttm, "setProcessingQueuedTransactions", | ||||
Qt::QueuedConnection, Q_ARG(bool, false)); | Qt::QueuedConnection, Q_ARG(bool, false)); | ||||
assert(invoked); | |||||
} | } | ||||
vQueueNotifications[i].invoke(ttm); | vQueueNotifications[i].invoke(ttm); | ||||
} | } | ||||
// clear | // clear | ||||
std::vector<TransactionNotification>().swap(vQueueNotifications); | std::vector<TransactionNotification>().swap(vQueueNotifications); | ||||
} | } | ||||
Show All 18 Lines |