From 06a7dabc6c41f79397c03f4cc67a07beb7f20f80 Mon Sep 17 00:00:00 2001 From: Emmanuel Granatello Date: Fri, 26 Feb 2010 17:07:15 +0100 Subject: [PATCH 1/1] Inizio Progetto Inserimento sotto comfigurazione del progetto Memory --- Memory.pro | 13 ++++ crazybutton.cpp | 40 ++++++++++++ crazybutton.h | 28 +++++++++ main.cpp | 10 +++ mainwindow.cpp | 170 +++++++++++++++++++++++++++++++++++++++++++++++++++ mainwindow.h | 42 +++++++++++++ mainwindow.ui | 170 +++++++++++++++++++++++++++++++++++++++++++++++++++ moc_crazybutton.cpp | 79 ++++++++++++++++++++++++ moc_mainwindow.cpp | 118 +++++++++++++++++++++++++++++++++++ moc_testThread.cpp | 128 ++++++++++++++++++++++++++++++++++++++ testThread.cpp | 82 +++++++++++++++++++++++++ testThread.h | 35 +++++++++++ ui_mainwindow.h | 107 ++++++++++++++++++++++++++++++++ 13 files changed, 1022 insertions(+) create mode 100644 Memory.pro create mode 100644 crazybutton.cpp create mode 100644 crazybutton.h create mode 100644 main.cpp create mode 100644 mainwindow.cpp create mode 100644 mainwindow.h create mode 100644 mainwindow.ui create mode 100644 moc_crazybutton.cpp create mode 100644 moc_mainwindow.cpp create mode 100644 moc_testThread.cpp create mode 100644 testThread.cpp create mode 100644 testThread.h create mode 100644 ui_mainwindow.h diff --git a/Memory.pro b/Memory.pro new file mode 100644 index 0000000..7bd6d4a --- /dev/null +++ b/Memory.pro @@ -0,0 +1,13 @@ +# ------------------------------------------------- +# Project created by QtCreator 2010-02-18T12:16:41 +# ------------------------------------------------- +TARGET = Memory +TEMPLATE = app +SOURCES += main.cpp \ + mainwindow.cpp \ + crazybutton.cpp \ + testThread.cpp +HEADERS += mainwindow.h \ + crazybutton.h \ + testThread.h +FORMS += mainwindow.ui diff --git a/crazybutton.cpp b/crazybutton.cpp new file mode 100644 index 0000000..abc81ee --- /dev/null +++ b/crazybutton.cpp @@ -0,0 +1,40 @@ +#include "crazybutton.h" +#include + +CrazyButton::CrazyButton(QWidget *p): QPushButton(p) +{ + + //this->setStyleSheet("background-color:white;"); + col=true; + +} +void CrazyButton::changeColor(){ + QPalette palettea; + if(col){ + + this->setStyleSheet("background-color:green;"); + col=false; + } + else{ + this->setStyleSheet("background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #88d, stop: 0.1 #99e, stop: 0.49 #77c, stop: 0.5 #66b, stop: 1 #77c);"); + col=true; + } + this->setPalette(palettea); +} +void CrazyButton::mousePressEvent(QMouseEvent *e) +{ + //this->setStyleSheet("background-color:green;"); + QPushButton::mousePressEvent(e); + +} +void CrazyButton::mouseReleaseEvent(QMouseEvent *e) +{ + //this->setStyleSheet("background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #88d, stop: 0.1 #99e, stop: 0.49 #77c, stop: 0.5 #66b, stop: 1 #77c);"); + QPushButton::mouseReleaseEvent(e); +} +/* +void CrazyButton::focusInEvent(QFocusEvent *) +{} +void CrazyButton::focusOutEvent(QFocusEvent *) +{} +*/ diff --git a/crazybutton.h b/crazybutton.h new file mode 100644 index 0000000..d32310d --- /dev/null +++ b/crazybutton.h @@ -0,0 +1,28 @@ +#ifndef CRAZYBUTTON_H +#define CRAZYBUTTON_H + +#include +#include + + +class CrazyButton : public QPushButton +{ + Q_OBJECT +public: + CrazyButton(QWidget *parent=0); + +public slots: + void changeColor(); +protected: + void mousePressEvent(QMouseEvent *e); + void mouseReleaseEvent(QMouseEvent *e); + /* + void focusInEvent(QFocusEvent *); + void focusOutEvent(QFocusEvent *); + */ +private: + bool col; + +}; + +#endif // CRAZYBUTTON_H diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..6e7efd9 --- /dev/null +++ b/main.cpp @@ -0,0 +1,10 @@ +#include +#include "mainwindow.h" + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + MainWindow w; + w.show(); + return a.exec(); +} diff --git a/mainwindow.cpp b/mainwindow.cpp new file mode 100644 index 0000000..62027d7 --- /dev/null +++ b/mainwindow.cpp @@ -0,0 +1,170 @@ +#include "mainwindow.h" +#include "ui_mainwindow.h" +#include +#include + +MainWindow::MainWindow(QWidget *parent) : + QMainWindow(parent), + ui(new Ui::MainWindow) +{ + + ui->setupUi(this); + connect(&tread,SIGNAL(generate(int)),this,SLOT(cliccaBottone(int))); + connect(&tread,SIGNAL(score(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(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())); + connect(ui->pushButton_4,SIGNAL(clicked()),this,SLOT(clickD())); + connect(ui->pushButton_5,SIGNAL(clicked()),this,SLOT(clickE())); + connect(ui->pushButton_6,SIGNAL(clicked()),this,SLOT(clickF())); + connect(ui->pushButton_7,SIGNAL(clicked()),this,SLOT(clickG())); + connect(ui->pushButton_8,SIGNAL(clicked()),this,SLOT(clickH())); + connect(ui->pushButton_9,SIGNAL(clicked()),this,SLOT(clickI())); + + tread.start(); + + setStyleSheet("QPushButton {" + "color: white;" + "background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #88d, stop: 0.1 #99e, stop: 0.49 #77c, stop: 0.5 #66b, stop: 1 #77c);" + "border-width: 1px;" + "border-color: #339;" + "border-style: solid;" + "border-radius: 7;" + "padding: 3px;" + "font-size: 50px;" + "padding-left: 5px;" + "padding-right: 5px;" + "min-width: 150px;" + "max-width: 150px;" + "min-height: 113px;" + "max-height: 113px;" + "}" + "QPushButton:pressed {" + "padding-top: 15px;" + "}"); + //showMaximized(); +} +void MainWindow::sbagliato(int score){ + QString sscore("Score:"); + sscore.append(QString::number(score)); + + + QMessageBox::warning(this, tr("Sbagliato"),sscore,QMessageBox::Escape); + tread.genera(); +} +void MainWindow::disableAll(){ + ui->pushButton->setEnabled(false); + ui->pushButton_2->setEnabled(false); + ui->pushButton_3->setEnabled(false); + ui->pushButton_4->setEnabled(false); + ui->pushButton_5->setEnabled(false); + ui->pushButton_6->setEnabled(false); + ui->pushButton_7->setEnabled(false); + ui->pushButton_8->setEnabled(false); + ui->pushButton_9->setEnabled(false); +} + +void MainWindow::enableAll(){ + ui->pushButton->setEnabled(true); + ui->pushButton_2->setEnabled(true); + ui->pushButton_3->setEnabled(true); + ui->pushButton_4->setEnabled(true); + ui->pushButton_5->setEnabled(true); + ui->pushButton_6->setEnabled(true); + ui->pushButton_7->setEnabled(true); + ui->pushButton_8->setEnabled(true); + ui->pushButton_9->setEnabled(true); +} + + +void MainWindow::cliccaBottone(int id) +{ + switch(id){ + case 0: + ui->pushButton->changeColor(); + break; + case 1: + ui->pushButton_2->changeColor(); + break; + case 2: + ui->pushButton_3->changeColor(); + break; + case 3: + ui->pushButton_4->changeColor(); + break; + case 4: + ui->pushButton_5->changeColor(); + break; + case 5: + ui->pushButton_6->changeColor(); + break; + case 6: + ui->pushButton_7->changeColor(); + break; + case 7: + ui->pushButton_8->changeColor(); + break; + case 8: + ui->pushButton_9->changeColor(); + break; + } +} + +MainWindow::~MainWindow() +{ + delete ui; +} +void MainWindow::clickA(){ + emit cliccatoIlBottone(0); + qDebug()<< "Click 1"; +} + +void MainWindow::clickB(){ + emit cliccatoIlBottone(1); + qDebug()<< "Click 2"; +} +void MainWindow::clickC(){ + emit cliccatoIlBottone(2); + qDebug()<< "Click 3"; +} +void MainWindow::clickD(){ + emit cliccatoIlBottone(3); + qDebug()<< "Click 4"; +} +void MainWindow::clickE(){ + emit cliccatoIlBottone(4); + qDebug()<< "Click 5"; +} +void MainWindow::clickF(){ + emit cliccatoIlBottone(5); + qDebug()<< "Click 6"; +} +void MainWindow::clickG(){ + emit cliccatoIlBottone(6); + qDebug()<< "Click 7"; +} +void MainWindow::clickH(){ + emit cliccatoIlBottone(7); + qDebug()<< "Click 8"; +} +void MainWindow::clickI(){ + emit cliccatoIlBottone(8); + qDebug()<< "Click 9"; +} + + +void MainWindow::changeEvent(QEvent *e) +{ + QMainWindow::changeEvent(e); + switch (e->type()) { + case QEvent::LanguageChange: + ui->retranslateUi(this); + break; + default: + break; + } +} + diff --git a/mainwindow.h b/mainwindow.h new file mode 100644 index 0000000..fa4bd1a --- /dev/null +++ b/mainwindow.h @@ -0,0 +1,42 @@ +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include +#include "testThread.h" + +namespace Ui { + class MainWindow; +} + +class MainWindow : public QMainWindow { + Q_OBJECT +public: + MainWindow(QWidget *parent = 0); + ~MainWindow(); +public slots: + void cliccaBottone(int id); + void clickA(); + void clickB(); + void clickC(); + void clickD(); + void clickE(); + void clickF(); + void clickG(); + void clickH(); + void clickI(); + void sbagliato(int); + void disableAll(); + void enableAll(); + + +signals: + void cliccatoIlBottone(int button); +protected: + void changeEvent(QEvent *e); + + Ui::MainWindow *ui; + QList sequenza; + TestThread tread; +}; + +#endif // MAINWINDOW_H diff --git a/mainwindow.ui b/mainwindow.ui new file mode 100644 index 0000000..0fef0bf --- /dev/null +++ b/mainwindow.ui @@ -0,0 +1,170 @@ + + + MainWindow + + + + 0 + 0 + 800 + 480 + + + + MainWindow + + + true + + + + + + 330 + 40 + 100 + 100 + + + + + 16777215 + 16777215 + + + + 2 + + + + + + 510 + 40 + 100 + 100 + + + + 3 + + + + + + 150 + 180 + 100 + 100 + + + + 4 + + + + + + 330 + 180 + 100 + 100 + + + + 5 + + + + + + 510 + 180 + 100 + 100 + + + + 6 + + + + + + 150 + 320 + 100 + 100 + + + + 7 + + + + + + 330 + 320 + 100 + 100 + + + + 8 + + + + + + 510 + 320 + 100 + 100 + + + + 9 + + + + + + 150 + 40 + 101 + 100 + + + + + 0 + 100 + + + + + + + 1 + + + + + + + + CrazyButton + QPushButton +
crazybutton.h
+ + changeColor(bool) + +
+
+ + + + generate(bool) + +
diff --git a/moc_crazybutton.cpp b/moc_crazybutton.cpp new file mode 100644 index 0000000..453a3fd --- /dev/null +++ b/moc_crazybutton.cpp @@ -0,0 +1,79 @@ +/**************************************************************************** +** Meta object code from reading C++ file 'crazybutton.h' +** +** Created: Fri Feb 26 16:31:33 2010 +** by: The Qt Meta Object Compiler version 62 (Qt 4.6.1) +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +#include "crazybutton.h" +#if !defined(Q_MOC_OUTPUT_REVISION) +#error "The header file 'crazybutton.h' doesn't include ." +#elif Q_MOC_OUTPUT_REVISION != 62 +#error "This file was generated using the moc from 4.6.1. It" +#error "cannot be used with the include files from this version of Qt." +#error "(The moc has changed too much.)" +#endif + +QT_BEGIN_MOC_NAMESPACE +static const uint qt_meta_data_CrazyButton[] = { + + // content: + 4, // revision + 0, // classname + 0, 0, // classinfo + 1, 14, // methods + 0, 0, // properties + 0, 0, // enums/sets + 0, 0, // constructors + 0, // flags + 0, // signalCount + + // slots: signature, parameters, type, tag, flags + 13, 12, 12, 12, 0x0a, + + 0 // eod +}; + +static const char qt_meta_stringdata_CrazyButton[] = { + "CrazyButton\0\0changeColor()\0" +}; + +const QMetaObject CrazyButton::staticMetaObject = { + { &QPushButton::staticMetaObject, qt_meta_stringdata_CrazyButton, + qt_meta_data_CrazyButton, 0 } +}; + +#ifdef Q_NO_DATA_RELOCATION +const QMetaObject &CrazyButton::getStaticMetaObject() { return staticMetaObject; } +#endif //Q_NO_DATA_RELOCATION + +const QMetaObject *CrazyButton::metaObject() const +{ + return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject; +} + +void *CrazyButton::qt_metacast(const char *_clname) +{ + if (!_clname) return 0; + if (!strcmp(_clname, qt_meta_stringdata_CrazyButton)) + return static_cast(const_cast< CrazyButton*>(this)); + return QPushButton::qt_metacast(_clname); +} + +int CrazyButton::qt_metacall(QMetaObject::Call _c, int _id, void **_a) +{ + _id = QPushButton::qt_metacall(_c, _id, _a); + if (_id < 0) + return _id; + if (_c == QMetaObject::InvokeMetaMethod) { + switch (_id) { + case 0: changeColor(); break; + default: ; + } + _id -= 1; + } + return _id; +} +QT_END_MOC_NAMESPACE diff --git a/moc_mainwindow.cpp b/moc_mainwindow.cpp new file mode 100644 index 0000000..162f4d6 --- /dev/null +++ b/moc_mainwindow.cpp @@ -0,0 +1,118 @@ +/**************************************************************************** +** Meta object code from reading C++ file 'mainwindow.h' +** +** Created: Fri Feb 26 16:31:33 2010 +** by: The Qt Meta Object Compiler version 62 (Qt 4.6.1) +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +#include "mainwindow.h" +#if !defined(Q_MOC_OUTPUT_REVISION) +#error "The header file 'mainwindow.h' doesn't include ." +#elif Q_MOC_OUTPUT_REVISION != 62 +#error "This file was generated using the moc from 4.6.1. It" +#error "cannot be used with the include files from this version of Qt." +#error "(The moc has changed too much.)" +#endif + +QT_BEGIN_MOC_NAMESPACE +static const uint qt_meta_data_MainWindow[] = { + + // content: + 4, // revision + 0, // classname + 0, 0, // classinfo + 14, 14, // methods + 0, 0, // properties + 0, 0, // enums/sets + 0, 0, // constructors + 0, // flags + 1, // signalCount + + // signals: signature, parameters, type, tag, flags + 19, 12, 11, 11, 0x05, + + // slots: signature, parameters, type, tag, flags + 45, 42, 11, 11, 0x0a, + 64, 11, 11, 11, 0x0a, + 73, 11, 11, 11, 0x0a, + 82, 11, 11, 11, 0x0a, + 91, 11, 11, 11, 0x0a, + 100, 11, 11, 11, 0x0a, + 109, 11, 11, 11, 0x0a, + 118, 11, 11, 11, 0x0a, + 127, 11, 11, 11, 0x0a, + 136, 11, 11, 11, 0x0a, + 145, 11, 11, 11, 0x0a, + 160, 11, 11, 11, 0x0a, + 173, 11, 11, 11, 0x0a, + + 0 // eod +}; + +static const char qt_meta_stringdata_MainWindow[] = { + "MainWindow\0\0button\0cliccatoIlBottone(int)\0" + "id\0cliccaBottone(int)\0clickA()\0clickB()\0" + "clickC()\0clickD()\0clickE()\0clickF()\0" + "clickG()\0clickH()\0clickI()\0sbagliato(int)\0" + "disableAll()\0enableAll()\0" +}; + +const QMetaObject MainWindow::staticMetaObject = { + { &QMainWindow::staticMetaObject, qt_meta_stringdata_MainWindow, + qt_meta_data_MainWindow, 0 } +}; + +#ifdef Q_NO_DATA_RELOCATION +const QMetaObject &MainWindow::getStaticMetaObject() { return staticMetaObject; } +#endif //Q_NO_DATA_RELOCATION + +const QMetaObject *MainWindow::metaObject() const +{ + return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject; +} + +void *MainWindow::qt_metacast(const char *_clname) +{ + if (!_clname) return 0; + if (!strcmp(_clname, qt_meta_stringdata_MainWindow)) + return static_cast(const_cast< MainWindow*>(this)); + return QMainWindow::qt_metacast(_clname); +} + +int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a) +{ + _id = QMainWindow::qt_metacall(_c, _id, _a); + if (_id < 0) + return _id; + if (_c == QMetaObject::InvokeMetaMethod) { + switch (_id) { + case 0: cliccatoIlBottone((*reinterpret_cast< int(*)>(_a[1]))); break; + case 1: cliccaBottone((*reinterpret_cast< int(*)>(_a[1]))); break; + case 2: clickA(); break; + case 3: clickB(); break; + case 4: clickC(); break; + case 5: clickD(); break; + case 6: clickE(); break; + case 7: clickF(); break; + case 8: clickG(); break; + case 9: clickH(); break; + case 10: clickI(); break; + case 11: sbagliato((*reinterpret_cast< int(*)>(_a[1]))); break; + case 12: disableAll(); break; + case 13: enableAll(); break; + default: ; + } + _id -= 14; + } + return _id; +} + +// SIGNAL 0 +void MainWindow::cliccatoIlBottone(int _t1) +{ + void *_a[] = { 0, const_cast(reinterpret_cast(&_t1)) }; + QMetaObject::activate(this, &staticMetaObject, 0, _a); +} +QT_END_MOC_NAMESPACE diff --git a/moc_testThread.cpp b/moc_testThread.cpp new file mode 100644 index 0000000..f6655c9 --- /dev/null +++ b/moc_testThread.cpp @@ -0,0 +1,128 @@ +/**************************************************************************** +** Meta object code from reading C++ file 'testThread.h' +** +** Created: Fri Feb 26 16:31:34 2010 +** by: The Qt Meta Object Compiler version 62 (Qt 4.6.1) +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +#include "testThread.h" +#if !defined(Q_MOC_OUTPUT_REVISION) +#error "The header file 'testThread.h' doesn't include ." +#elif Q_MOC_OUTPUT_REVISION != 62 +#error "This file was generated using the moc from 4.6.1. It" +#error "cannot be used with the include files from this version of Qt." +#error "(The moc has changed too much.)" +#endif + +QT_BEGIN_MOC_NAMESPACE +static const uint qt_meta_data_TestThread[] = { + + // content: + 4, // revision + 0, // classname + 0, 0, // classinfo + 7, 14, // methods + 0, 0, // properties + 0, 0, // enums/sets + 0, 0, // constructors + 0, // flags + 5, // signalCount + + // signals: signature, parameters, type, tag, flags + 14, 12, 11, 11, 0x05, + 28, 11, 11, 11, 0x05, + 35, 11, 11, 11, 0x05, + 46, 11, 11, 11, 0x05, + 65, 11, 11, 11, 0x05, + + // slots: signature, parameters, type, tag, flags + 93, 83, 11, 11, 0x0a, + 112, 11, 11, 11, 0x0a, + + 0 // eod +}; + +static const char qt_meta_stringdata_TestThread[] = { + "TestThread\0\0a\0generate(int)\0exit()\0" + "score(int)\0disableInterface()\0" + "enableInterface()\0inputUser\0" + "updateCaption(int)\0genera()\0" +}; + +const QMetaObject TestThread::staticMetaObject = { + { &QThread::staticMetaObject, qt_meta_stringdata_TestThread, + qt_meta_data_TestThread, 0 } +}; + +#ifdef Q_NO_DATA_RELOCATION +const QMetaObject &TestThread::getStaticMetaObject() { return staticMetaObject; } +#endif //Q_NO_DATA_RELOCATION + +const QMetaObject *TestThread::metaObject() const +{ + return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject; +} + +void *TestThread::qt_metacast(const char *_clname) +{ + if (!_clname) return 0; + if (!strcmp(_clname, qt_meta_stringdata_TestThread)) + return static_cast(const_cast< TestThread*>(this)); + return QThread::qt_metacast(_clname); +} + +int TestThread::qt_metacall(QMetaObject::Call _c, int _id, void **_a) +{ + _id = QThread::qt_metacall(_c, _id, _a); + if (_id < 0) + return _id; + if (_c == QMetaObject::InvokeMetaMethod) { + switch (_id) { + case 0: generate((*reinterpret_cast< int(*)>(_a[1]))); break; + case 1: exit(); break; + case 2: score((*reinterpret_cast< int(*)>(_a[1]))); break; + case 3: disableInterface(); break; + case 4: enableInterface(); break; + case 5: updateCaption((*reinterpret_cast< int(*)>(_a[1]))); break; + case 6: genera(); break; + default: ; + } + _id -= 7; + } + return _id; +} + +// SIGNAL 0 +void TestThread::generate(int _t1) +{ + void *_a[] = { 0, const_cast(reinterpret_cast(&_t1)) }; + QMetaObject::activate(this, &staticMetaObject, 0, _a); +} + +// SIGNAL 1 +void TestThread::exit() +{ + QMetaObject::activate(this, &staticMetaObject, 1, 0); +} + +// SIGNAL 2 +void TestThread::score(int _t1) +{ + void *_a[] = { 0, const_cast(reinterpret_cast(&_t1)) }; + QMetaObject::activate(this, &staticMetaObject, 2, _a); +} + +// SIGNAL 3 +void TestThread::disableInterface() +{ + QMetaObject::activate(this, &staticMetaObject, 3, 0); +} + +// SIGNAL 4 +void TestThread::enableInterface() +{ + QMetaObject::activate(this, &staticMetaObject, 4, 0); +} +QT_END_MOC_NAMESPACE diff --git a/testThread.cpp b/testThread.cpp new file mode 100644 index 0000000..7c6ba3c --- /dev/null +++ b/testThread.cpp @@ -0,0 +1,82 @@ +#include "testThread.h" +#include +#include +#include +#include +TestThread::TestThread(QObject *parent):QThread(parent){ + colore=0; + attendiInputUtente=false; + + _score=0; + index=0; + + qsrand(QDateTime::currentDateTime().toTime_t()); + +} +TestThread::~TestThread(){ + +} +void TestThread::run() +{ + while(true){ + //msleep(200); + qsrand(QDateTime::currentDateTime().toTime_t()); + sequenza.append(qrand()%9); + int i=0; + + qDebug()<<"Init Emission"; + emit disableInterface(); + while(i + + +class TestThread : public QThread +{ + Q_OBJECT + +public: + TestThread(QObject *parent = 0); + ~TestThread(); +signals: + void generate(int a); + void exit(); + void score(int); + void disableInterface(); + void enableInterface(); +protected: + void run(); + +public slots: + void updateCaption(int inputUser); + void genera(void); + + +private: + int colore; + int index; + int _score; + bool attendiInputUtente; + QList sequenza; +}; +#endif // TESTTHREAD_H diff --git a/ui_mainwindow.h b/ui_mainwindow.h new file mode 100644 index 0000000..a12c31a --- /dev/null +++ b/ui_mainwindow.h @@ -0,0 +1,107 @@ +/******************************************************************************** +** Form generated from reading UI file 'mainwindow.ui' +** +** Created: Fri Feb 26 16:31:30 2010 +** by: Qt User Interface Compiler version 4.6.1 +** +** WARNING! All changes made in this file will be lost when recompiling UI file! +********************************************************************************/ + +#ifndef UI_MAINWINDOW_H +#define UI_MAINWINDOW_H + +#include +#include +#include +#include +#include +#include +#include +#include "crazybutton.h" + +QT_BEGIN_NAMESPACE + +class Ui_MainWindow +{ +public: + QWidget *centralWidget; + CrazyButton *pushButton_2; + CrazyButton *pushButton_3; + CrazyButton *pushButton_4; + CrazyButton *pushButton_5; + CrazyButton *pushButton_6; + CrazyButton *pushButton_7; + CrazyButton *pushButton_8; + CrazyButton *pushButton_9; + CrazyButton *pushButton; + + void setupUi(QMainWindow *MainWindow) + { + if (MainWindow->objectName().isEmpty()) + MainWindow->setObjectName(QString::fromUtf8("MainWindow")); + MainWindow->resize(800, 480); + MainWindow->setAutoFillBackground(true); + centralWidget = new QWidget(MainWindow); + centralWidget->setObjectName(QString::fromUtf8("centralWidget")); + pushButton_2 = new CrazyButton(centralWidget); + pushButton_2->setObjectName(QString::fromUtf8("pushButton_2")); + pushButton_2->setGeometry(QRect(330, 40, 100, 100)); + pushButton_2->setMaximumSize(QSize(16777215, 16777215)); + pushButton_3 = new CrazyButton(centralWidget); + pushButton_3->setObjectName(QString::fromUtf8("pushButton_3")); + pushButton_3->setGeometry(QRect(510, 40, 100, 100)); + pushButton_4 = new CrazyButton(centralWidget); + pushButton_4->setObjectName(QString::fromUtf8("pushButton_4")); + pushButton_4->setGeometry(QRect(150, 180, 100, 100)); + pushButton_5 = new CrazyButton(centralWidget); + pushButton_5->setObjectName(QString::fromUtf8("pushButton_5")); + pushButton_5->setGeometry(QRect(330, 180, 100, 100)); + pushButton_6 = new CrazyButton(centralWidget); + pushButton_6->setObjectName(QString::fromUtf8("pushButton_6")); + pushButton_6->setGeometry(QRect(510, 180, 100, 100)); + pushButton_7 = new CrazyButton(centralWidget); + pushButton_7->setObjectName(QString::fromUtf8("pushButton_7")); + pushButton_7->setGeometry(QRect(150, 320, 100, 100)); + pushButton_8 = new CrazyButton(centralWidget); + pushButton_8->setObjectName(QString::fromUtf8("pushButton_8")); + pushButton_8->setGeometry(QRect(330, 320, 100, 100)); + pushButton_9 = new CrazyButton(centralWidget); + pushButton_9->setObjectName(QString::fromUtf8("pushButton_9")); + pushButton_9->setGeometry(QRect(510, 320, 100, 100)); + pushButton = new CrazyButton(centralWidget); + pushButton->setObjectName(QString::fromUtf8("pushButton")); + pushButton->setGeometry(QRect(150, 40, 101, 100)); + pushButton->setMinimumSize(QSize(0, 100)); +#ifndef QT_NO_TOOLTIP + pushButton->setToolTip(QString::fromUtf8("")); +#endif // QT_NO_TOOLTIP + MainWindow->setCentralWidget(centralWidget); + + retranslateUi(MainWindow); + + QMetaObject::connectSlotsByName(MainWindow); + } // setupUi + + void retranslateUi(QMainWindow *MainWindow) + { + MainWindow->setWindowTitle(QApplication::translate("MainWindow", "MainWindow", 0, QApplication::UnicodeUTF8)); + pushButton_2->setText(QApplication::translate("MainWindow", "2", 0, QApplication::UnicodeUTF8)); + pushButton_3->setText(QApplication::translate("MainWindow", "3", 0, QApplication::UnicodeUTF8)); + pushButton_4->setText(QApplication::translate("MainWindow", "4", 0, QApplication::UnicodeUTF8)); + pushButton_5->setText(QApplication::translate("MainWindow", "5", 0, QApplication::UnicodeUTF8)); + pushButton_6->setText(QApplication::translate("MainWindow", "6", 0, QApplication::UnicodeUTF8)); + pushButton_7->setText(QApplication::translate("MainWindow", "7", 0, QApplication::UnicodeUTF8)); + pushButton_8->setText(QApplication::translate("MainWindow", "8", 0, QApplication::UnicodeUTF8)); + pushButton_9->setText(QApplication::translate("MainWindow", "9", 0, QApplication::UnicodeUTF8)); + pushButton->setText(QApplication::translate("MainWindow", "1", 0, QApplication::UnicodeUTF8)); + } // retranslateUi + +}; + +namespace Ui { + class MainWindow: public Ui_MainWindow {}; +} // namespace Ui + +QT_END_NAMESPACE + +#endif // UI_MAINWINDOW_H -- 1.7.9.5