forked from Public/monero-gui
TransactionHistory: firstDateTime and lastDateTime properties
This commit is contained in:
@@ -28,13 +28,33 @@ QList<TransactionInfo *> TransactionHistory::getAll() const
|
||||
emit refreshStarted();
|
||||
qDeleteAll(m_tinfo);
|
||||
m_tinfo.clear();
|
||||
|
||||
QDateTime firstDateTime = QDateTime::currentDateTime();
|
||||
QDateTime lastDateTime = QDateTime(QDate(1970, 1, 1));
|
||||
|
||||
TransactionHistory * parent = const_cast<TransactionHistory*>(this);
|
||||
for (const auto i : m_pimpl->getAll()) {
|
||||
TransactionInfo * ti = new TransactionInfo(i, parent);
|
||||
qDebug() << ti->hash();
|
||||
m_tinfo.append(ti);
|
||||
// looking for transactions timestamp scope
|
||||
if (ti->timestamp() >= lastDateTime) {
|
||||
lastDateTime = ti->timestamp();
|
||||
}
|
||||
if (ti->timestamp() <= firstDateTime) {
|
||||
firstDateTime = ti->timestamp();
|
||||
}
|
||||
}
|
||||
emit refreshFinished();
|
||||
|
||||
if (m_firstDateTime != firstDateTime) {
|
||||
m_firstDateTime = firstDateTime;
|
||||
emit firstDateTimeChanged();
|
||||
}
|
||||
if (m_lastDateTime != lastDateTime) {
|
||||
m_lastDateTime = lastDateTime;
|
||||
emit lastDateTimeChanged();
|
||||
}
|
||||
|
||||
return m_tinfo;
|
||||
}
|
||||
|
||||
@@ -51,9 +71,20 @@ quint64 TransactionHistory::count() const
|
||||
return m_tinfo.count();
|
||||
}
|
||||
|
||||
QDateTime TransactionHistory::firstDateTime() const
|
||||
{
|
||||
return m_firstDateTime;
|
||||
}
|
||||
|
||||
QDateTime TransactionHistory::lastDateTime() const
|
||||
{
|
||||
return m_lastDateTime;
|
||||
}
|
||||
|
||||
|
||||
TransactionHistory::TransactionHistory(Bitmonero::TransactionHistory *pimpl, QObject *parent)
|
||||
: QObject(parent), m_pimpl(pimpl)
|
||||
{
|
||||
// this->refresh();
|
||||
m_firstDateTime = QDateTime(QDate(1970, 1, 1));
|
||||
m_lastDateTime = QDateTime::currentDateTime();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user