Rabbit Remote Control 0.1.0-de
Loading...
Searching...
No Matches
Stats.cpp
1// Author: Kang Lin <kl222@126.com>
2#include "Stats.h"
3
4CStats::CStats(CParameterOperate *parent, const QString &szPrefix)
5 : CParameterOperate{parent}
6{}
7
8QString CStats::Convertbytes(quint64 bytes)
9{
10 QString szBytes;
11 if(1024 >= bytes)
12 szBytes = QString::number(bytes) + " " + tr("B");
13 else if(1024* 1024 >= bytes)
14 szBytes = QString::number(bytes / 1024.0, 'f', 2) + " " + tr("KB");
15 else if(1024 * 1024 * 1024 >= bytes)
16 szBytes = QString::number(bytes / (1024.0 * 1024.0), 'f', 2) + " " + tr("MB");
17 else
18 szBytes = QString::number(bytes / (1024.0 * 1024.0 * 1024.0), 'f', 2) + " " + tr(" GB");
19 return szBytes;
20}
21
22void CStats::AddSends(quint64 size)
23{
24 m_TotalSends += size;
25}
26
27void CStats::AddReceives(quint64 size)
28{
29 m_TotalReceives += size;
30}
31
32int CStats::OnLoad(QSettings &set)
33{
34 return 0;
35}
36
37int CStats::OnSave(QSettings &set)
38{
39 return 0;
40}
Operational parameter interface.