nesca/ActivityDrawerTh_HorNet.cpp

41 lines
804 B
C++
Raw Normal View History

2015-02-24 14:00:19 +00:00
#include "ActivityDrawerTh_HorNet.h"
#include "externData.h"
void ActivityDrawerTh_HorNet::doEmitDrawActivityLine(QString data)
{
emit adtHN->sDrawActivityLine(data);
2015-03-10 14:35:50 +00:00
}
2015-02-24 14:00:19 +00:00
void ActivityDrawerTh_HorNet::doEmitDrawGrid()
{
emit adtHN->sDrawGrid();
2015-03-10 14:35:50 +00:00
}
2015-02-24 14:00:19 +00:00
void makeActLine(int val)
{
if(actLst.size() < 50) actLst.push_back(val);
else
{
actLst.pop_front();
actLst.push_back(val);
};
2015-03-10 14:35:50 +00:00
}
2015-02-24 14:00:19 +00:00
void ActivityDrawerTh_HorNet::run()
{
adtHN->doEmitDrawGrid();
int maxAct = Activity + 1;
int nm = 0;
2015-04-04 12:43:22 +00:00
while (true)
2015-02-24 14:00:19 +00:00
{
2015-04-04 12:43:22 +00:00
if (maxAct < Activity) maxAct = Activity;
if (maxAct > 1000) nm = maxAct -= 1000;
else if (maxAct > 10) nm = maxAct -= 10;
makeActLine(((float)Activity / (nm != 0 ? nm : 1)) * 10);
2015-02-24 14:00:19 +00:00
adtHN->doEmitDrawActivityLine(QString::number(Activity) + "b");
Activity = 0;
2015-08-21 21:27:13 +00:00
msleep(200);
2015-02-24 14:00:19 +00:00
};
2015-03-10 14:35:50 +00:00
}