2015-04-19 18:17:47 +03:00
|
|
|
#ifndef STATISTICS_H
|
|
|
|
#define STATISTICS_H
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QTimer>
|
|
|
|
|
2017-09-07 03:00:04 +03:00
|
|
|
namespace BitTorrent
|
|
|
|
{
|
|
|
|
class Session;
|
|
|
|
}
|
2015-04-19 18:17:47 +03:00
|
|
|
|
|
|
|
class Statistics : QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
Q_DISABLE_COPY(Statistics)
|
|
|
|
|
|
|
|
public:
|
|
|
|
Statistics(BitTorrent::Session *session);
|
|
|
|
~Statistics();
|
|
|
|
|
|
|
|
quint64 getAlltimeDL() const;
|
|
|
|
quint64 getAlltimeUL() const;
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void gather();
|
|
|
|
|
|
|
|
private:
|
|
|
|
void save() const;
|
|
|
|
void load();
|
|
|
|
|
|
|
|
private:
|
|
|
|
BitTorrent::Session *m_session;
|
|
|
|
// Will overflow at 15.9 EiB
|
|
|
|
quint64 m_alltimeUL;
|
|
|
|
quint64 m_alltimeDL;
|
2017-04-29 14:52:28 +03:00
|
|
|
quint64 m_sessionUL;
|
|
|
|
quint64 m_sessionDL;
|
2015-04-19 18:17:47 +03:00
|
|
|
mutable qint64 m_lastWrite;
|
|
|
|
mutable bool m_dirty;
|
|
|
|
|
|
|
|
QTimer m_timer;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // STATISTICS_H
|