X-Git-Url: http://git.maemo.org/git/?p=qmemory;a=blobdiff_plain;f=mainwindow.cpp;h=abad19925264d2ec3dd715300d6cadc6aff24eba;hp=42ed804747a3bc4a54ba355b26f290dbb26b6d9e;hb=f4fde0bc1d952233a2fcf7fad824daf35747a689;hpb=d0fcc08805061548b05426b241b67a9b98e8cc46;ds=sidebyside diff --git a/mainwindow.cpp b/mainwindow.cpp index 42ed804..abad199 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -9,8 +9,17 @@ MainWindow::MainWindow(QWidget *parent) : { ui->setupUi(this); + statusLed = new QLed(ui->verticalLayoutWidget); + ui->horizontalLayout_4->insertWidget(0,statusLed); + + statusLed->setOnColor(QLed::Red); + statusLed->setOffColor(QLed::Green); + //statusLed->setGeometry(QRect(0,0,100,100)); + statusLed->setShape(QLed::Rounded); + setCentralWidget(ui->verticalLayoutWidget); connect(&tread,SIGNAL(generate(int)),this,SLOT(cliccaBottone(int))); - connect(&tread,SIGNAL(score(int)),this,SLOT(sbagliato(int))); + connect(&tread,SIGNAL(score(int)),ui->lcdNumber,SLOT(display(int))); + 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))); @@ -26,7 +35,7 @@ MainWindow::MainWindow(QWidget *parent) : tread.start(); - setStyleSheet("QPushButton {" + setStyleSheet("CrazyButton {" "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;" @@ -37,10 +46,10 @@ MainWindow::MainWindow(QWidget *parent) : "font-size: 50px;" "padding-left: 5px;" "padding-right: 5px;" - "min-width: 150px;" - "max-width: 150px;" - "min-height: 113px;" - "max-height: 113px;" + "min-width: 15px;" + "max-width: 300px;" + "min-height: 11px;" + "max-height: 300px;" "}" "QPushButton:pressed {" "padding-top: 15px;" @@ -48,11 +57,11 @@ MainWindow::MainWindow(QWidget *parent) : //showMaximized(); } void MainWindow::sbagliato(int score){ - QString sscore("Score:"); + QString sscore("Score "); sscore.append(QString::number(score)); - QMessageBox::warning(this, tr("Sbagliato"),sscore,QMessageBox::Escape); - tread.genera(); - //quick_exit(0); + QMessageBox::warning(this, tr("End Game"),sscore,QMessageBox::Escape); + //tread.genera(); + exit(0); } void MainWindow::disableAll(){ @@ -65,6 +74,7 @@ void MainWindow::disableAll(){ ui->pushButton_7->setEnabled(false); ui->pushButton_8->setEnabled(false); ui->pushButton_9->setEnabled(false); + statusLed->setValue(true); } void MainWindow::enableAll(){ @@ -77,6 +87,7 @@ void MainWindow::enableAll(){ ui->pushButton_7->setEnabled(true); ui->pushButton_8->setEnabled(true); ui->pushButton_9->setEnabled(true); + statusLed->setValue(false); } @@ -119,40 +130,40 @@ MainWindow::~MainWindow() } 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"; + }