Inserimento Led, Modifiche Layout
[qmemory] / mainwindow.cpp
index 178e2a1..2c29cfc 100644 (file)
@@ -9,8 +9,15 @@ MainWindow::MainWindow(QWidget *parent) :
 {
 
     ui->setupUi(this);
+    statusLed = new QLed(ui->verticalLayoutWidget);
+    statusLed->setLayout(ui->horizontalLayout_4);
+    statusLed->setOnColor(QLed::Red);
+    statusLed->setOffColor(QLed::Green);
+    statusLed->setGeometry(QRect(0,0,100,100));
+    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 +33,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 +44,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 +55,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);
+    QMessageBox::warning(this, tr("End Game"),sscore,QMessageBox::Escape);
     //tread.genera();
-    quick_exit(0);
+    exit(0);
 
 }
 void MainWindow::disableAll(){
@@ -65,6 +72,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 +85,7 @@ void MainWindow::enableAll(){
     ui->pushButton_7->setEnabled(true);
     ui->pushButton_8->setEnabled(true);
     ui->pushButton_9->setEnabled(true);
+    statusLed->setValue(false);
 }