1 #include "testThread.h"
6 TestThread::TestThread(QObject *parent):QThread(parent){
8 attendiInputUtente=false;
13 qsrand(QDateTime::currentDateTime().toTime_t());
16 TestThread::~TestThread(){
19 void TestThread::run()
23 qsrand(QDateTime::currentDateTime().toTime_t());
24 sequenza.append(qrand()%9);
27 qDebug()<<"Init Emission";
28 emit disableInterface();
29 while(i<sequenza.size())
31 qDebug()<<"Init Generate";
32 emit generate(sequenza.at(i));
33 qDebug()<<sequenza.at(i);
34 msleep(500 - (_score*5));
35 emit generate(sequenza.at(i));
36 msleep(500 - (_score*5));
40 attendiInputUtente=true;
41 emit enableInterface();
43 while(attendiInputUtente){
51 void TestThread::updateCaption(int inputUser)
53 qDebug()<<"Entro in update Caption ="<< inputUser<< " valore aspettato" << sequenza.at(index);
54 if (attendiInputUtente){
56 if(sequenza.at(index) == inputUser)
58 if(index == sequenza.size() - 1){
59 qDebug()<<"Entro in if if ="<< inputUser<< " valore aspettato" << sequenza.at(index);
60 attendiInputUtente=false;
73 attendiInputUtente=true;
78 void TestThread::genera()
80 attendiInputUtente=false;