}
void TestThread::run(){
- sleep(2);
+ sleep(1);
forever{
mutex.lock();
-
qsrand(QDateTime::currentDateTime().toTime_t());
sequenza.append(qrand()%9);
int i=0;
index=0;
-
emit disableInterface();
while(i<sequenza.size())
{
msleep(500 - (_score*2));
i++;
}
+
i=0;
emit enableInterface();
attendiInputUtente.wait(&mutex);
-
mutex.unlock();
-
}
-
-
}
void TestThread::addUserInput(int inputUser){
index++;
_score++;
emit score(_score);
- if(index==sequenza.size()){
- sleep(1);
- attendiInputUtente.wakeAll();
+ if(index==sequenza.size()){
+ msleep(300);
+ attendiInputUtente.wakeAll();
}
}
else{
emit exit(_score);
- _score=0;
- sequenza.clear();
- index=0;
- attendiInputUtente.wakeAll();
}
}
void TestThread::genera()
{
-
+ sequenza.clear();
+ index=0;
+ _score=0;
+ emit score(_score);
attendiInputUtente.wakeAll();
-
}