mirror of
https://github.com/monero-project/monero-gui.git
synced 2026-04-04 06:47:25 -04:00
Add estimated time countdown for locked balance
This commit is contained in:
@@ -31,7 +31,9 @@ QList<TransactionInfo *> TransactionHistory::getAll() const
|
||||
|
||||
QDateTime firstDateTime = QDateTime(QDate(2014, 4, 18)); // the genesis block
|
||||
QDateTime lastDateTime = QDateTime::currentDateTime().addDays(1); // tomorrow (guard against jitter and timezones)
|
||||
|
||||
quint64 lastTxHeight = 0;
|
||||
m_locked = false;
|
||||
m_minutesToUnlock = 0;
|
||||
TransactionHistory * parent = const_cast<TransactionHistory*>(this);
|
||||
for (const auto i : m_pimpl->getAll()) {
|
||||
TransactionInfo * ti = new TransactionInfo(i, parent);
|
||||
@@ -43,6 +45,14 @@ QList<TransactionInfo *> TransactionHistory::getAll() const
|
||||
if (ti->timestamp() <= firstDateTime) {
|
||||
firstDateTime = ti->timestamp();
|
||||
}
|
||||
// store last tx height
|
||||
if (ti->confirmations() < 10 && ti->blockHeight() >= lastTxHeight ){
|
||||
lastTxHeight = ti->blockHeight();
|
||||
// TODO: Fetch block time and confirmations needed from wallet2?
|
||||
m_minutesToUnlock = (10 - ti->confirmations()) * 2;
|
||||
m_locked = true;
|
||||
}
|
||||
|
||||
}
|
||||
emit refreshFinished();
|
||||
|
||||
@@ -81,9 +91,19 @@ QDateTime TransactionHistory::lastDateTime() const
|
||||
return m_lastDateTime;
|
||||
}
|
||||
|
||||
quint64 TransactionHistory::minutesToUnlock() const
|
||||
{
|
||||
return m_minutesToUnlock;
|
||||
}
|
||||
|
||||
bool TransactionHistory::TransactionHistory::locked() const
|
||||
{
|
||||
return m_locked;
|
||||
}
|
||||
|
||||
|
||||
TransactionHistory::TransactionHistory(Monero::TransactionHistory *pimpl, QObject *parent)
|
||||
: QObject(parent), m_pimpl(pimpl)
|
||||
: QObject(parent), m_pimpl(pimpl), m_minutesToUnlock(0), m_locked(false)
|
||||
{
|
||||
m_firstDateTime = QDateTime(QDate(2014, 4, 18)); // the genesis block
|
||||
m_lastDateTime = QDateTime::currentDateTime().addDays(1); // tomorrow (guard against jitter and timezones)
|
||||
|
||||
@@ -17,6 +17,8 @@ class TransactionHistory : public QObject
|
||||
Q_PROPERTY(int count READ count)
|
||||
Q_PROPERTY(QDateTime firstDateTime READ firstDateTime NOTIFY firstDateTimeChanged)
|
||||
Q_PROPERTY(QDateTime lastDateTime READ lastDateTime NOTIFY lastDateTimeChanged)
|
||||
Q_PROPERTY(int minutesToUnlock READ minutesToUnlock)
|
||||
Q_PROPERTY(bool locked READ locked)
|
||||
|
||||
public:
|
||||
Q_INVOKABLE TransactionInfo *transaction(int index);
|
||||
@@ -26,6 +28,8 @@ public:
|
||||
quint64 count() const;
|
||||
QDateTime firstDateTime() const;
|
||||
QDateTime lastDateTime() const;
|
||||
quint64 minutesToUnlock() const;
|
||||
bool locked() const;
|
||||
|
||||
signals:
|
||||
void refreshStarted() const;
|
||||
@@ -45,6 +49,9 @@ private:
|
||||
mutable QList<TransactionInfo*> m_tinfo;
|
||||
mutable QDateTime m_firstDateTime;
|
||||
mutable QDateTime m_lastDateTime;
|
||||
mutable int m_minutesToUnlock;
|
||||
// history contains locked transfers
|
||||
mutable bool m_locked;
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user