X-Git-Url: http://git.maemo.org/git/?p=speedfreak;a=blobdiff_plain;f=Client%2Faccelerationstart.cpp;h=00c3160e12d93cf6a4a10e2fb10cacee58083988;hp=3da0070f7fa08efda90ed749b29aed22c071ae36;hb=52aa08b0127f4a19192c3a68eeeede9a3d61321c;hpb=418c218ef417574ba034cb26d65da388aba852d0 diff --git a/Client/accelerationstart.cpp b/Client/accelerationstart.cpp index 3da0070..00c3160 100644 --- a/Client/accelerationstart.cpp +++ b/Client/accelerationstart.cpp @@ -1,6 +1,15 @@ +/* + * Acceleration start dialog + * + * @author Jukka Kurttila + * @author Toni Jussila + * @copyright (c) 2010 Speed Freak team + * @license http://opensource.org/licenses/gpl-license.php GNU Public License + */ #include "accelerationstart.h" #include "ui_accelerationstartdialog.h" #include +#include accelerationstart::accelerationstart(QWidget *parent) : QDialog(parent), @@ -8,7 +17,10 @@ accelerationstart::accelerationstart(QWidget *parent) : { ui->setupUi(this); ui->buttonStart->setDisabled(true); + accRealTimeDialog = NULL; + helpAccelerationDialog = NULL; + stopMeasureSpeed = 0; ui->categorComboBox->addItem("Select category"); @@ -16,6 +28,14 @@ accelerationstart::accelerationstart(QWidget *parent) : ui->categorComboBox->addItem("0 - 20 km/h",20); ui->categorComboBox->addItem("0 - 40 km/h"); ui->categorComboBox->addItem("0 - 100 km/h"); + + //Button settings + ui->buttonCalib->setAutoFillBackground(true); + ui->buttonCalib->setStyleSheet("background-color: rgb(0, 0, 0); color: rgb(255, 255, 255)"); + ui->buttonStart->setAutoFillBackground(true); + ui->buttonStart->setStyleSheet("background-color: rgb(0, 0, 0); color: rgb(255, 255, 255)"); + ui->pushButtonInfo->setAutoFillBackground(true); + ui->pushButtonInfo->setStyleSheet("background-color: rgb(0, 0, 0); color: rgb(255, 255, 255)"); } accelerationstart::~accelerationstart() @@ -42,6 +62,8 @@ void accelerationstart::on_buttonCalib_clicked() if(accRealTimeDialog == NULL) accRealTimeDialog = new AccRealTimeDialog(this); + connect(accRealTimeDialog, SIGNAL(sendresult(double)), this, SLOT(sendResult(double))); + accRealTimeDialog->Calibrate(); ui->buttonStart->setEnabled(true); @@ -66,10 +88,57 @@ void accelerationstart::on_buttonStart_clicked() void accelerationstart::on_categorComboBox_currentIndexChanged( int index ) { stopMeasureSpeed = 0; - if( index == 1 ) + if( index == 1 ) { stopMeasureSpeed = 20; - else if( index == 2 ) + measureCategory = "acceleration-0-20"; + } + else if( index == 2 ) { stopMeasureSpeed = 40; - else if( index == 3 ) + measureCategory = "acceleration-0-40"; + } + else if( index == 3 ) { stopMeasureSpeed = 100; + measureCategory = "acceleration-0-100"; + } +} + + +QString accelerationstart::getMeasureCategory() +{ + return measureCategory; +} + +/** + *This slot function emit mainwindow sendresult. + * + **/ +void accelerationstart::sendResult(double result) +{ + emit sendresult(measureCategory, result); +} + +/** + * This slot function called when ever info button clicked. + */ +void accelerationstart::on_pushButtonInfo_clicked() +{ + if(!helpAccelerationDialog) + { + helpAccelerationDialog = new HelpAccelerationDialog; + } + connect(helpAccelerationDialog, SIGNAL(rejected()), this, SLOT(killHelpDialog())); + helpAccelerationDialog->show(); +} + +/** + * This slot function called when ever dialog rejected. + */ +void accelerationstart::killHelpDialog() +{ + if(helpAccelerationDialog) + { + qDebug() << "__Acc kill: helpAccelerationDialog"; + delete helpAccelerationDialog; + helpAccelerationDialog = NULL; + } }