mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-11-19 18:41:29 +00:00
History: Show num of confirmations + unconfirmed payments
history: refresh on new block
This commit is contained in:
parent
593839a374
commit
205bfcdd7b
8 changed files with 43 additions and 3 deletions
|
@ -263,9 +263,18 @@ ListView {
|
||||||
//elide: Text.ElideRight
|
//elide: Text.ElideRight
|
||||||
font.family: "Arial"
|
font.family: "Arial"
|
||||||
font.pixelSize: 13
|
font.pixelSize: 13
|
||||||
font.letterSpacing: -1
|
color: (confirmations < 10)? "#FF6C3C" : "#545454"
|
||||||
color: "#545454"
|
text: {
|
||||||
text: (typeof blockHeight != "undefined")? blockHeight : qsTr("Pending") + translationManager.emptyString
|
if (!isPending)
|
||||||
|
if(confirmations < 10)
|
||||||
|
return blockHeight + " " + qsTr("(%1/10 confirmations)").arg(confirmations)
|
||||||
|
else
|
||||||
|
return blockHeight
|
||||||
|
if (!isOut)
|
||||||
|
return qsTr("UNCONFIRMED") + translationManager.emptyString
|
||||||
|
return qsTr("PENDING") + translationManager.emptyString
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
11
main.qml
11
main.qml
|
@ -208,6 +208,7 @@ ApplicationWindow {
|
||||||
currentWallet.newBlock.disconnect(onWalletNewBlock)
|
currentWallet.newBlock.disconnect(onWalletNewBlock)
|
||||||
currentWallet.moneySpent.disconnect(onWalletMoneySent)
|
currentWallet.moneySpent.disconnect(onWalletMoneySent)
|
||||||
currentWallet.moneyReceived.disconnect(onWalletMoneyReceived)
|
currentWallet.moneyReceived.disconnect(onWalletMoneyReceived)
|
||||||
|
currentWallet.unconfirmedMoneyReceived.disconnect(onWalletUnconfirmedMoneyReceived)
|
||||||
currentWallet.transactionCreated.disconnect(onTransactionCreated)
|
currentWallet.transactionCreated.disconnect(onTransactionCreated)
|
||||||
currentWallet.connectionStatusChanged.disconnect(onWalletConnectionStatusChanged)
|
currentWallet.connectionStatusChanged.disconnect(onWalletConnectionStatusChanged)
|
||||||
middlePanel.paymentClicked.disconnect(handlePayment);
|
middlePanel.paymentClicked.disconnect(handlePayment);
|
||||||
|
@ -229,6 +230,7 @@ ApplicationWindow {
|
||||||
currentWallet.newBlock.connect(onWalletNewBlock)
|
currentWallet.newBlock.connect(onWalletNewBlock)
|
||||||
currentWallet.moneySpent.connect(onWalletMoneySent)
|
currentWallet.moneySpent.connect(onWalletMoneySent)
|
||||||
currentWallet.moneyReceived.connect(onWalletMoneyReceived)
|
currentWallet.moneyReceived.connect(onWalletMoneyReceived)
|
||||||
|
currentWallet.unconfirmedMoneyReceived.connect(onWalletUnconfirmedMoneyReceived)
|
||||||
currentWallet.transactionCreated.connect(onTransactionCreated)
|
currentWallet.transactionCreated.connect(onTransactionCreated)
|
||||||
currentWallet.connectionStatusChanged.connect(onWalletConnectionStatusChanged)
|
currentWallet.connectionStatusChanged.connect(onWalletConnectionStatusChanged)
|
||||||
middlePanel.paymentClicked.connect(handlePayment);
|
middlePanel.paymentClicked.connect(handlePayment);
|
||||||
|
@ -378,6 +380,10 @@ ApplicationWindow {
|
||||||
splashCounter = currHeight
|
splashCounter = currHeight
|
||||||
leftPanel.progressBar.updateProgress(currHeight,currentWallet.daemonBlockChainTargetHeight());
|
leftPanel.progressBar.updateProgress(currHeight,currentWallet.daemonBlockChainTargetHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update num of confirmations on history page
|
||||||
|
// TODO: check performance on big wallets. Maybe no need to refresh full history?
|
||||||
|
currentWallet.history.refresh()
|
||||||
}
|
}
|
||||||
|
|
||||||
function onWalletMoneyReceived(txId, amount) {
|
function onWalletMoneyReceived(txId, amount) {
|
||||||
|
@ -386,6 +392,11 @@ ApplicationWindow {
|
||||||
currentWallet.history.refresh() // this will refresh model
|
currentWallet.history.refresh() // this will refresh model
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onWalletUnconfirmedMoneyReceived(txId, amount) {
|
||||||
|
// refresh history
|
||||||
|
currentWallet.history.refresh()
|
||||||
|
}
|
||||||
|
|
||||||
function onWalletMoneySent(txId, amount) {
|
function onWalletMoneySent(txId, amount) {
|
||||||
// refresh transaction history here
|
// refresh transaction history here
|
||||||
currentWallet.refresh()
|
currentWallet.refresh()
|
||||||
|
|
|
@ -46,6 +46,11 @@ quint64 TransactionInfo::blockHeight() const
|
||||||
return m_pimpl->blockHeight();
|
return m_pimpl->blockHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
quint64 TransactionInfo::confirmations() const
|
||||||
|
{
|
||||||
|
return m_pimpl->confirmations();
|
||||||
|
}
|
||||||
|
|
||||||
QString TransactionInfo::hash() const
|
QString TransactionInfo::hash() const
|
||||||
{
|
{
|
||||||
return QString::fromStdString(m_pimpl->hash());
|
return QString::fromStdString(m_pimpl->hash());
|
||||||
|
|
|
@ -18,6 +18,7 @@ class TransactionInfo : public QObject
|
||||||
Q_PROPERTY(QString displayAmount READ displayAmount)
|
Q_PROPERTY(QString displayAmount READ displayAmount)
|
||||||
Q_PROPERTY(QString fee READ fee)
|
Q_PROPERTY(QString fee READ fee)
|
||||||
Q_PROPERTY(quint64 blockHeight READ blockHeight)
|
Q_PROPERTY(quint64 blockHeight READ blockHeight)
|
||||||
|
Q_PROPERTY(quint64 confirmations READ confirmations)
|
||||||
Q_PROPERTY(QString hash READ hash)
|
Q_PROPERTY(QString hash READ hash)
|
||||||
Q_PROPERTY(QDateTime timestamp READ timestamp)
|
Q_PROPERTY(QDateTime timestamp READ timestamp)
|
||||||
Q_PROPERTY(QString date READ date)
|
Q_PROPERTY(QString date READ date)
|
||||||
|
@ -42,6 +43,7 @@ public:
|
||||||
QString displayAmount() const;
|
QString displayAmount() const;
|
||||||
QString fee() const;
|
QString fee() const;
|
||||||
quint64 blockHeight() const;
|
quint64 blockHeight() const;
|
||||||
|
quint64 confirmations() const;
|
||||||
//! transaction_id
|
//! transaction_id
|
||||||
QString hash() const;
|
QString hash() const;
|
||||||
QDateTime timestamp() const;
|
QDateTime timestamp() const;
|
||||||
|
|
|
@ -44,6 +44,12 @@ public:
|
||||||
emit m_wallet->moneyReceived(QString::fromStdString(txId), amount);
|
emit m_wallet->moneyReceived(QString::fromStdString(txId), amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void unconfirmedMoneyReceived(const std::string &txId, uint64_t amount)
|
||||||
|
{
|
||||||
|
qDebug() << __FUNCTION__;
|
||||||
|
emit m_wallet->unconfirmedMoneyReceived(QString::fromStdString(txId), amount);
|
||||||
|
}
|
||||||
|
|
||||||
virtual void newBlock(uint64_t height)
|
virtual void newBlock(uint64_t height)
|
||||||
{
|
{
|
||||||
// qDebug() << __FUNCTION__;
|
// qDebug() << __FUNCTION__;
|
||||||
|
|
|
@ -206,6 +206,7 @@ signals:
|
||||||
|
|
||||||
void moneySpent(const QString &txId, quint64 amount);
|
void moneySpent(const QString &txId, quint64 amount);
|
||||||
void moneyReceived(const QString &txId, quint64 amount);
|
void moneyReceived(const QString &txId, quint64 amount);
|
||||||
|
void unconfirmedMoneyReceived(const QString &txId, quint64 amount);
|
||||||
void newBlock(quint64 height);
|
void newBlock(quint64 height);
|
||||||
void historyModelChanged() const;
|
void historyModelChanged() const;
|
||||||
|
|
||||||
|
|
|
@ -81,6 +81,10 @@ QVariant TransactionHistoryModel::data(const QModelIndex &index, int role) const
|
||||||
result = tInfo->blockHeight();
|
result = tInfo->blockHeight();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case TransactionConfirmationsRole:
|
||||||
|
result = tInfo->confirmations();
|
||||||
|
break;
|
||||||
case TransactionHashRole:
|
case TransactionHashRole:
|
||||||
result = tInfo->hash();
|
result = tInfo->hash();
|
||||||
break;
|
break;
|
||||||
|
@ -125,6 +129,7 @@ QHash<int, QByteArray> TransactionHistoryModel::roleNames() const
|
||||||
roleNames.insert(TransactionAtomicAmountRole, "atomicAmount");
|
roleNames.insert(TransactionAtomicAmountRole, "atomicAmount");
|
||||||
roleNames.insert(TransactionFeeRole, "fee");
|
roleNames.insert(TransactionFeeRole, "fee");
|
||||||
roleNames.insert(TransactionBlockHeightRole, "blockHeight");
|
roleNames.insert(TransactionBlockHeightRole, "blockHeight");
|
||||||
|
roleNames.insert(TransactionConfirmationsRole, "confirmations");
|
||||||
roleNames.insert(TransactionHashRole, "hash");
|
roleNames.insert(TransactionHashRole, "hash");
|
||||||
roleNames.insert(TransactionTimeStampRole, "timeStamp");
|
roleNames.insert(TransactionTimeStampRole, "timeStamp");
|
||||||
roleNames.insert(TransactionPaymentIdRole, "paymentId");
|
roleNames.insert(TransactionPaymentIdRole, "paymentId");
|
||||||
|
|
|
@ -25,6 +25,7 @@ public:
|
||||||
TransactionDisplayAmountRole,
|
TransactionDisplayAmountRole,
|
||||||
TransactionFeeRole,
|
TransactionFeeRole,
|
||||||
TransactionBlockHeightRole,
|
TransactionBlockHeightRole,
|
||||||
|
TransactionConfirmationsRole,
|
||||||
TransactionHashRole,
|
TransactionHashRole,
|
||||||
TransactionTimeStampRole,
|
TransactionTimeStampRole,
|
||||||
TransactionPaymentIdRole,
|
TransactionPaymentIdRole,
|
||||||
|
|
Loading…
Reference in a new issue