15 #define DESIRED_SAMPLES 800
31 timer =
new QTimer(
this);
52 int sampleCount = samples.size(), x =
XMARGIN + w, y;
55 for(
int i = 0; i < sampleCount; ++i) {
66 QPainter painter(
this);
67 painter.fillRect(rect(), Qt::black);
69 if(
fMax <= 0.0f)
return;
71 QColor axisCol(Qt::gray);
73 painter.setPen(axisCol);
77 int base = floor(log10(
fMax));
78 float val = pow(10.0f, base);
80 const QString units = tr(
"KB/s");
82 painter.setPen(axisCol);
83 painter.drawText(
XMARGIN,
YMARGIN + h - h * val /
fMax, QString(
"%1 %2").arg(val).arg(units));
84 for(
float y = val; y <
fMax; y += val) {
89 if(fMax / val <= 3.0f) {
90 axisCol = axisCol.darker();
91 val = pow(10.0f, base - 1);
92 painter.setPen(axisCol);
93 painter.drawText(
XMARGIN,
YMARGIN + h - h * val / fMax, QString(
"%1 %2").arg(val).arg(units));
95 for(
float y = val; y <
fMax; y += val, count++) {
107 painter.fillPath(p, QColor(0, 255, 0, 128));
108 painter.setPen(Qt::green);
114 painter.fillPath(p, QColor(255, 0, 0, 128));
115 painter.setPen(Qt::red);
142 if(f > tmax) tmax = f;
145 if(f > tmax) tmax = f;
156 timer->setInterval(msecsPerSample);
quint64 getTotalBytesRecv() const
Model for Anoncoin network client.
quint64 getTotalBytesSent() const