Start acceleration measurement button changed to custom button.
[speedfreak] / Client / mainwindow.cpp
index 9d9984d..741b179 100644 (file)
@@ -41,13 +41,13 @@ MainWindow::MainWindow(QWidget *parent) :
     connect(httpClient->myXmlreader, SIGNAL(receivedTop10List()), this, SLOT(showTop10()));    
 
     welcomeDialog = new WelcomeDialog;
-    //welcomeDialog->show();
+    welcomeDialog->show();
 
     this->setUsernameToMainPanel();
 
     //Button settings
-    ui->pushButtonAccelerate->setAutoFillBackground(true);
-    ui->pushButtonAccelerate->setStyleSheet("background-color: rgb(0, 0, 0); color: rgb(255, 255, 255)");
+    //ui->pushButtonAccelerate->setAutoFillBackground(true);
+    //ui->pushButtonAccelerate->setStyleSheet("background-color: rgb(0, 0, 0); color: rgb(255, 255, 255)");
     ui->pushButtonRoute->setAutoFillBackground(true);
     ui->pushButtonRoute->setStyleSheet("background-color: rgb(0, 0, 0); color: rgb(255, 255, 255)");
     ui->pushButtonResults->setAutoFillBackground(true);
@@ -58,6 +58,20 @@ MainWindow::MainWindow(QWidget *parent) :
     ui->pushButtonWWW->setStyleSheet("background-color: rgb(0, 0, 0); color: rgb(255, 255, 255)");
     ui->pushButtonCredits->setAutoFillBackground(true);
     ui->pushButtonCredits->setStyleSheet("background-color: rgb(0, 0, 0); color: rgb(255, 255, 255)");
+
+    QIcon* icon = new QIcon();
+    icon->addFile(QString(":/new/prefix1/Graphics/Speedometer.png"), QSize(125,125), QIcon::Normal, QIcon::Off);
+    icon->addFile(QString(":/new/prefix1/Graphics/Speedometer2.png"), QSize(125,125), QIcon::Normal, QIcon::On);
+
+    customButtonAccelerate = new CustomButton(this,icon);
+    delete icon;
+
+    int buttons_x = 50,buttons_y = 165;
+    customButtonAccelerate->setGeometry(buttons_x,buttons_y,130,130);
+    connect(customButtonAccelerate, SIGNAL(OpenDialog()), this, SLOT(OpenAccStartDialog()));
+
+    customButtonAccelerate->show();
+
 }
 
 MainWindow::~MainWindow()
@@ -84,6 +98,10 @@ MainWindow::~MainWindow()
 
     if(helpDialog)
         delete helpDialog;
+
+    if(customButtonAccelerate)
+        delete customButtonAccelerate;
+
 }
 
 void MainWindow::changeEvent(QEvent *e)
@@ -140,19 +158,6 @@ void MainWindow::on_pushButtonSettings_clicked()
 }
 
 /**
-  * This slot function opens the acceleration dialog
-  */
-void MainWindow::on_pushButtonAccelerate_clicked()
-{
-    if(!accstart)
-        accstart = new accelerationstart(this);
-
-    connect(accstart, SIGNAL(sendresult(QString, double)), this, SLOT(clientSendResult(QString, double)));
-    connect(accstart, SIGNAL(rejected()), this, SLOT(killDialog()));
-    accstart->show();
-}
-
-/**
   * This slot function opens the top results dialog
   */
 void MainWindow::on_pushButtonResults_clicked()
@@ -275,7 +280,7 @@ void MainWindow::clientSendResult(QString category, double result)
     }
 }
 /**
-  * This slot function called when ever dialog finished.
+  * This slot function called when ever dialog rejected.
   */
 void MainWindow::killDialog()
 {
@@ -310,7 +315,9 @@ void MainWindow::killDialog()
         helpDialog = NULL;
     }
 }
-
+/**
+  *
+  */
 void MainWindow::setUsernameToMainPanel()
 {
     if (loginSaved())
@@ -322,3 +329,15 @@ void MainWindow::setUsernameToMainPanel()
         this->setWindowTitle("SpeedFreak - Not logged");
     }
 }
+/**
+  * This slot function opens acceleration start dialog.
+  */
+void MainWindow::OpenAccStartDialog()
+{
+    if(!accstart)
+        accstart = new accelerationstart(this);
+
+    connect(accstart, SIGNAL(sendresult(QString, double)), this, SLOT(clientSendResult(QString, double)));
+    connect(accstart, SIGNAL(rejected()), this, SLOT(killDialog()));
+    accstart->show();
+}