nesca/ActivityDrawerTh_HorNet.cpp

37 lines
823 B
C++
Raw Normal View History

2014-08-08 23:14:49 +00:00
#include "ActivityDrawerTh_HorNet.h"
#include "STh.h"
2014-09-07 02:46:28 +00:00
void ActivityDrawerTh_HorNet::doEmitDrawActivityLine(QString data)
2014-08-08 23:14:49 +00:00
{
2014-09-07 02:46:28 +00:00
emit adtHN->sDrawActivityLine(data);
2014-08-08 23:14:49 +00:00
};
void ActivityDrawerTh_HorNet::doEmitDrawGrid()
{
emit adtHN->sDrawGrid();
};
void makeActLine(int val)
{
if(actLst.size() < 50) actLst.push_back(val);
else
{
actLst.pop_front();
actLst.push_back(val);
};
};
void ActivityDrawerTh_HorNet::run()
{
adtHN->doEmitDrawGrid();
int maxAct = Activity + 1;
2014-09-07 02:46:28 +00:00
int nm = 0;
2014-08-08 23:14:49 +00:00
while(true)
{
if(maxAct < Activity) maxAct = Activity;
2014-09-07 02:46:28 +00:00
if(maxAct > 1000) nm = maxAct-=1000;
else if(maxAct > 10) nm = maxAct-=10;
2014-08-08 23:14:49 +00:00
makeActLine(((float)Activity/(nm != 0 ? nm : 1)) * 10);
2014-09-07 02:46:28 +00:00
adtHN->doEmitDrawActivityLine(QString::number(Activity) + "b");
2014-08-08 23:14:49 +00:00
Activity = 0;
msleep(130);
};
};