14 #define DESIRED_SAMPLES 800
30 timer =
new QTimer(
this);
51 int sampleCount = samples.size(), x =
XMARGIN + w, y;
54 for(
int i = 0; i < sampleCount; ++i) {
65 QPainter painter(
this);
66 painter.fillRect(rect(), Qt::black);
68 if(
fMax <= 0.0f)
return;
70 QColor axisCol(Qt::gray);
72 painter.setPen(axisCol);
76 int base = floor(log10(
fMax));
77 float val = pow(10.0f, base);
79 const QString units = tr(
"KB/s");
81 painter.setPen(axisCol);
82 painter.drawText(
XMARGIN,
YMARGIN + h - h * val /
fMax, QString(
"%1 %2").arg(val).arg(units));
83 for(
float y = val; y <
fMax; y += val) {
88 if(fMax / val <= 3.0f) {
89 axisCol = axisCol.darker();
90 val = pow(10.0f, base - 1);
91 painter.setPen(axisCol);
92 painter.drawText(
XMARGIN,
YMARGIN + h - h * val / fMax, QString(
"%1 %2").arg(val).arg(units));
94 for(
float y = val; y <
fMax; y += val, count++) {
106 painter.fillPath(p, QColor(0, 255, 0, 128));
107 painter.setPen(Qt::green);
113 painter.fillPath(p, QColor(255, 0, 0, 128));
114 painter.setPen(Qt::red);
141 if(f > tmax) tmax = f;
144 if(f > tmax) tmax = f;
155 timer->setInterval(msecsPerSample);
quint64 getTotalBytesRecv() const
Model for Bitcoin network client.
quint64 getTotalBytesSent() const