nesca/DrawerTh_ME2Scanner.cpp

163 lines
2.8 KiB
C++
Raw Normal View History

2015-02-24 14:00:19 +00:00
#include "DrawerTh_ME2Scanner.h"
#include "STh.h"
#include "externData.h"
2015-03-05 14:29:05 +00:00
#include <WebformWorker.h>
2015-02-24 14:00:19 +00:00
2015-03-07 17:31:48 +00:00
QList<QGraphicsPathItem*> DrawerTh_ME2Scanner::itmList;
QVector<QPointF> DrawerTh_ME2Scanner::polyVect;
2015-02-24 14:00:19 +00:00
void DrawerTh_ME2Scanner::doEmitDrawTextPlacers()
{
emit dtME2->sDrawTextPlacers();
2015-03-02 14:27:38 +00:00
}
2015-02-24 14:00:19 +00:00
void DrawerTh_ME2Scanner::doEmitionAddPolyLine()
{
emit dtME2->sAddPolyLine();
2015-03-02 14:27:38 +00:00
}
2015-02-24 14:00:19 +00:00
void MakePolygonLine(int gWidth)
{
2015-03-07 17:31:48 +00:00
DrawerTh_ME2Scanner::polyVect.clear();
2015-02-24 14:00:19 +00:00
int x = 0;
int tx = 0;
int xtx = 0;
2015-03-07 17:31:48 +00:00
QPointF qp(0, ME2YPOS);
DrawerTh_ME2Scanner::polyVect.append(qp);
2015-02-24 14:00:19 +00:00
int fact1 = 0,
fact2 = 0,
fact3 = 0,
fact4 = 0,
fact5 = 0,
fact6 = 0,
fact7 = 0;
bool state = stt->isRunning();
for(int i = 1; i < 130; ++i)
{
x = qrand() % 4 + 2 + i;
xtx = x + tx;
if(xtx > 1 && xtx < 31)
{
2015-03-07 17:31:48 +00:00
qp = QPointF(xtx, state ? qrand() % 3 - 3 + ME2YPOS - AnomC1 * 2 - fact1 : ME2YPOS);
2015-02-24 14:00:19 +00:00
if(AnomC1 > 0)
{
if(xtx < 16 ) fact1+=2;
else fact1-=2;
};
}
if(xtx > 34 && xtx < 72)
{
2015-03-07 17:31:48 +00:00
qp = QPointF(xtx, state ? qrand() % 3 - 3 + ME2YPOS - WF * 2 - fact2 : ME2YPOS);
2015-02-24 14:00:19 +00:00
if(WF > 0)
{
if(xtx < 52 ) fact2+=2;
else fact2-=2;
};
}
if(xtx > 74 && xtx < 112)
{
2015-03-07 17:31:48 +00:00
qp = QPointF(xtx, state ? qrand() % 3 - 3 + ME2YPOS - BA * 2 - fact3 : ME2YPOS);
2015-02-24 14:00:19 +00:00
if(BA > 0)
{
if(xtx < 92 ) fact3+=2;
else fact3-=2;
};
}
if(xtx > 114 && xtx < 152)
{
2015-03-07 17:31:48 +00:00
qp = QPointF(xtx, state ? qrand() % 3 - 3 + ME2YPOS - Susp * 2 - fact4 : ME2YPOS);
2015-02-24 14:00:19 +00:00
if(Susp > 0)
{
if(xtx < 132 ) fact4+=2;
else fact4-=2;
};
}
if(xtx > 154 && xtx < 192)
{
2015-03-07 17:31:48 +00:00
qp = QPointF(xtx, state ? qrand() % 3 - 3 + ME2YPOS - Overl * 2 - fact5 : ME2YPOS);
2015-02-24 14:00:19 +00:00
if(Overl > 0)
{
if(xtx < 172 ) fact5+=2;
else fact5-=2;
};
}
if(xtx > 194 && xtx < 232)
{
2015-03-07 17:31:48 +00:00
qp = QPointF(xtx, state ? qrand() % 3 - 3 + ME2YPOS - Lowl * 2 - fact6 : ME2YPOS);
2015-02-24 14:00:19 +00:00
if(Lowl > 0)
{
if(xtx < 212 ) fact6+=2;
else fact6-=2;
};
}
if(xtx > 234 && xtx < 269)
{
2015-03-07 17:31:48 +00:00
qp = QPointF(xtx, state ? qrand() % 3 - 3 + ME2YPOS - Alive * 2 - fact7 : ME2YPOS);
2015-02-24 14:00:19 +00:00
if(Alive > 0)
{
if(xtx < 252 ) fact7+=2;
else fact7-=2;
};
};
2015-03-07 17:31:48 +00:00
DrawerTh_ME2Scanner::polyVect.append(qp);
2015-02-24 14:00:19 +00:00
tx = x;
};
2015-03-07 17:31:48 +00:00
2015-02-24 14:00:19 +00:00
AnomC1 = 0;
WF = 0;
BA = 0;
Filt = 0;
Overl = 0;
Lowl = 0;
Alive = 0;
Susp = 0;
2015-03-07 17:31:48 +00:00
DrawerTh_ME2Scanner::polyVect.append(QPointF(gWidth, ME2YPOS));
2015-03-02 14:27:38 +00:00
}
2015-02-24 14:00:19 +00:00
void DrawerTh_ME2Scanner::run()
{
int gWidth = ui->graphicLog->width();
dtME2->doEmitDrawTextPlacers();
2015-03-07 17:31:48 +00:00
2015-02-24 14:00:19 +00:00
while(ME2ScanFlag)
{
2015-03-07 17:31:48 +00:00
if (widgetIsHidden == false && tray->isVisible() == false)
2015-02-24 14:00:19 +00:00
{
2015-03-07 17:31:48 +00:00
if (itmList.count() < 39) {
MakePolygonLine(gWidth);
dtME2->doEmitionAddPolyLine();
}
2015-02-24 14:00:19 +00:00
}
else
{
msleep(1000);
AnomC1 = 0;
WF = 0;
BA = 0;
Filt = 0;
Overl = 0;
Lowl = 0;
Alive = 0;
Susp = 0;
};
2015-03-07 17:31:48 +00:00
msleep(100);
2015-02-24 14:00:19 +00:00
};
2015-03-07 17:31:48 +00:00
itmList.clear();
2015-03-02 14:27:38 +00:00
}