From: Emmanuel Granatello Date: Mon, 1 Mar 2010 14:42:47 +0000 (+0100) Subject: Piccole modifiche al codice X-Git-Url: http://git.maemo.org/git/?p=qmemory;a=commitdiff_plain;h=ce607ff361d22185bdc529b0c68d833c8c48a9be Piccole modifiche al codice --- diff --git a/mainwindow.cpp b/mainwindow.cpp index 3bdfb6d..6bdd621 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -9,9 +9,10 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { - bestScore=0; - readSettings(); ui->setupUi(this); + + bestScore=0; + readSettings(); statusLed = new QLed(ui->verticalLayoutWidget); ui->horizontalLayout_4->insertWidget(0,statusLed); @@ -25,7 +26,7 @@ MainWindow::MainWindow(QWidget *parent) : connect(&tread,SIGNAL(exit(int)),this,SLOT(sbagliato(int))); connect(&tread,SIGNAL(disableInterface()),this,SLOT(disableAll())); connect(&tread,SIGNAL(enableInterface()),this,SLOT(enableAll())); - connect(this,SIGNAL(cliccatoIlBottone(int)),&tread,SLOT(updateCaption(int))); + connect(this,SIGNAL(cliccatoIlBottone(int)),&tread,SLOT(addUserInput(int))); connect(ui->pushButton,SIGNAL(clicked()),this,SLOT(clickA())); connect(ui->pushButton_2,SIGNAL(clicked()),this,SLOT(clickB())); connect(ui->pushButton_3,SIGNAL(clicked()),this,SLOT(clickC())); @@ -58,6 +59,7 @@ MainWindow::MainWindow(QWidget *parent) : "padding-top: 15px;" "}"); //showMaximized(); + setWindowTitle(tr("QMemory")); } void MainWindow::sbagliato(int score){ diff --git a/testThread.cpp b/testThread.cpp index e3087e1..b41a56e 100644 --- a/testThread.cpp +++ b/testThread.cpp @@ -3,52 +3,51 @@ #include #include #include -TestThread::TestThread(QObject *parent):QThread(parent){ - colore=0; +TestThread::TestThread(QObject *parent):QThread(parent) +{ + colore=0; index=0; _score=0; - qsrand(QDateTime::currentDateTime().toTime_t()); } -TestThread::~TestThread(){ + +TestThread::~TestThread() +{ } void TestThread::run(){ sleep(1); - while(true){ - mutex.lock(); - qsrand(QDateTime::currentDateTime().toTime_t()); - sequenza.append(qrand()%9); - int i=0; - index=0; + forever{ + mutex.lock(); - emit disableInterface(); - while(i