15 #define DESIRED_SAMPLES 800 31 timer =
new QTimer(
this);
51 int sampleCount = samples.size();
56 for(
int i = 0; i < sampleCount; ++i) {
58 int y =
YMARGIN + h - (int)(h * samples.at(i) /
fMax);
67 QPainter painter(
this);
68 painter.fillRect(rect(), Qt::black);
70 if(
fMax <= 0.0f)
return;
72 QColor axisCol(Qt::gray);
74 painter.setPen(axisCol);
78 int base = floor(log10(
fMax));
79 float val = pow(10.0f, base);
81 const QString units = tr(
"KB/s");
82 const float yMarginText = 2.0;
85 painter.setPen(axisCol);
86 painter.drawText(
XMARGIN,
YMARGIN + h - h * val /
fMax-yMarginText, QString(
"%1 %2").arg(val).arg(units));
87 for(
float y = val; y <
fMax; y += val) {
92 if(fMax / val <= 3.0f) {
93 axisCol = axisCol.darker();
94 val = pow(10.0f, base - 1);
95 painter.setPen(axisCol);
96 painter.drawText(
XMARGIN,
YMARGIN + h - h * val / fMax-yMarginText, QString(
"%1 %2").arg(val).arg(units));
98 for(
float y = val; y <
fMax; y += val, count++) {
110 painter.fillPath(p, QColor(0, 255, 0, 128));
111 painter.setPen(Qt::green);
117 painter.fillPath(p, QColor(255, 0, 0, 128));
118 painter.setPen(Qt::red);
145 if(f > tmax) tmax = f;
148 if(f > tmax) tmax = f;
159 timer->setInterval(msecsPerSample);
quint64 getTotalBytesSent() const
quint64 getTotalBytesRecv() const
Model for Raven network client.