From b19c3ab29a7f3631cf307b11ac677947068ac04b Mon Sep 17 00:00:00 2001 From: Rikhard Kuutti Date: Thu, 18 Mar 2010 13:30:27 +0200 Subject: [PATCH] Various changes made to comply with altered implementation of accelerometer class --- Client/carmainwindow.cpp | 10 ++-------- Client/measuredialog.cpp | 10 ++-------- Client/ui_carmainwindow.h | 33 ++++++++++++++++++++++++++++++++- Client/ui_resultdialog.h | 2 +- 4 files changed, 37 insertions(+), 18 deletions(-) diff --git a/Client/carmainwindow.cpp b/Client/carmainwindow.cpp index 354e403..138daac 100644 --- a/Client/carmainwindow.cpp +++ b/Client/carmainwindow.cpp @@ -53,7 +53,6 @@ CarMainWindow::CarMainWindow(QWidget *parent):QMainWindow(parent), ui(new Ui::Ca // Accelerometer accelerometer = new Accelerometer(); - accelerometer->setSampleRate(100); reverseAccelerationFlag = false; vehicleStartedMoving = false; @@ -165,7 +164,6 @@ void CarMainWindow::on_autoStartButton_clicked() //measure = NULL; //measure = new MeasureDialog(); // connect(measure, SIGNAL(speedAchieved()), this, SLOT(openResultView())); - accelerometer->start(); timer->start(); // Show measure dialog. //measure->show(); @@ -397,10 +395,8 @@ void CarMainWindow::on_manualStartButton_clicked() void CarMainWindow::after_timeout() { QString timeString, speedString; - //time++; - time = accelerometer->getTotalTime(); - speed = accelerometer->getCurrentSpeed(); - //speed = speed +10; + time++; + speed = speed +10; if (floor(speed) == 10) { @@ -461,7 +457,6 @@ void CarMainWindow::after_timeout() if (speed >= 40.0) { timer->stop(); - accelerometer->stop(); time = 0; speed = 0; //emit this->speedAchieved(); @@ -516,7 +511,6 @@ void CarMainWindow::on_pushButtonMeasureTabAbort_clicked() measures->setTime90kmh(0); measures->setTime100kmh(0); timer->stop(); - accelerometer->stop(); time = 0; speed = 0; ui->tabWidget->setCurrentWidget(this->ui->StartTab); diff --git a/Client/measuredialog.cpp b/Client/measuredialog.cpp index e6813f2..c469a7e 100644 --- a/Client/measuredialog.cpp +++ b/Client/measuredialog.cpp @@ -25,8 +25,6 @@ MeasureDialog::MeasureDialog(QWidget *parent) : timer = new QTimer(); accelerometer = new Accelerometer(); - accelerometer->setSampleRate(100); - accelerometer->start(); measures = new Measures(); this->initializeMeasures(); @@ -63,10 +61,8 @@ void MeasureDialog::changeEvent(QEvent *e) void MeasureDialog::after_timeout() { QString timeString, speedString; - //time++; - time = accelerometer->getTotalTime(); - speed = accelerometer->getCurrentSpeed(); - //speed = speed +10; + time++; + speed = speed +10; if (floor(speed) == 10) { @@ -127,7 +123,6 @@ void MeasureDialog::after_timeout() if (speed >= 40.0) { timer->stop(); - accelerometer->stop(); time = 0; speed = 0; emit this->speedAchieved(); @@ -163,7 +158,6 @@ void MeasureDialog::on_pushButtonAbort_clicked() measures->setTime90kmh(0); measures->setTime100kmh(0); timer->stop(); - accelerometer->stop(); time = 0; speed = 0; this->close(); diff --git a/Client/ui_carmainwindow.h b/Client/ui_carmainwindow.h index 0921db9..44d7fce 100644 --- a/Client/ui_carmainwindow.h +++ b/Client/ui_carmainwindow.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading ui file 'carmainwindow.ui' ** -** Created: Thu Mar 18 09:17:23 2010 +** Created: Thu Mar 18 13:34:56 2010 ** by: Qt User Interface Compiler version 4.5.3 ** ** WARNING! All changes made in this file will be lost when recompiling ui file! @@ -76,6 +76,11 @@ public: QPushButton *startRecPushButton; QPushButton *stopRecPushButton; QPushButton *drawRoutePushButton; + QWidget *widget; + QVBoxLayout *verticalLayout; + QLabel *labelRouteTabGPSStatus; + QLabel *labelRouteTabLatitude; + QLabel *labelRouteTabLongitude; QPushButton *registratePushButton; QMenuBar *menuBar; QToolBar *mainToolBar; @@ -273,6 +278,29 @@ public: drawRoutePushButton = new QPushButton(tab); drawRoutePushButton->setObjectName(QString::fromUtf8("drawRoutePushButton")); drawRoutePushButton->setGeometry(QRect(30, 220, 151, 51)); + widget = new QWidget(tab); + widget->setObjectName(QString::fromUtf8("widget")); + widget->setGeometry(QRect(310, 16, 221, 211)); + verticalLayout = new QVBoxLayout(widget); + verticalLayout->setSpacing(6); + verticalLayout->setMargin(11); + verticalLayout->setObjectName(QString::fromUtf8("verticalLayout")); + verticalLayout->setContentsMargins(0, 0, 0, 0); + labelRouteTabGPSStatus = new QLabel(widget); + labelRouteTabGPSStatus->setObjectName(QString::fromUtf8("labelRouteTabGPSStatus")); + + verticalLayout->addWidget(labelRouteTabGPSStatus); + + labelRouteTabLatitude = new QLabel(widget); + labelRouteTabLatitude->setObjectName(QString::fromUtf8("labelRouteTabLatitude")); + + verticalLayout->addWidget(labelRouteTabLatitude); + + labelRouteTabLongitude = new QLabel(widget); + labelRouteTabLongitude->setObjectName(QString::fromUtf8("labelRouteTabLongitude")); + + verticalLayout->addWidget(labelRouteTabLongitude); + tabWidget->addTab(tab, QString()); registratePushButton = new QPushButton(centralWidget); registratePushButton->setObjectName(QString::fromUtf8("registratePushButton")); @@ -329,6 +357,9 @@ public: startRecPushButton->setText(QApplication::translate("CarMainWindow", "Start recording", 0, QApplication::UnicodeUTF8)); stopRecPushButton->setText(QApplication::translate("CarMainWindow", "Stop recording", 0, QApplication::UnicodeUTF8)); drawRoutePushButton->setText(QApplication::translate("CarMainWindow", "Draw route", 0, QApplication::UnicodeUTF8)); + labelRouteTabGPSStatus->setText(QApplication::translate("CarMainWindow", "Label GPS Status", 0, QApplication::UnicodeUTF8)); + labelRouteTabLatitude->setText(QApplication::translate("CarMainWindow", "Label Latitude", 0, QApplication::UnicodeUTF8)); + labelRouteTabLongitude->setText(QApplication::translate("CarMainWindow", "Label Longitude", 0, QApplication::UnicodeUTF8)); tabWidget->setTabText(tabWidget->indexOf(tab), QApplication::translate("CarMainWindow", "Route", 0, QApplication::UnicodeUTF8)); registratePushButton->setText(QApplication::translate("CarMainWindow", "Registrate", 0, QApplication::UnicodeUTF8)); Q_UNUSED(CarMainWindow); diff --git a/Client/ui_resultdialog.h b/Client/ui_resultdialog.h index 92890f3..cd46d93 100644 --- a/Client/ui_resultdialog.h +++ b/Client/ui_resultdialog.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading ui file 'resultdialog.ui' ** -** Created: Thu Mar 18 09:17:23 2010 +** Created: Thu Mar 18 13:34:57 2010 ** by: Qt User Interface Compiler version 4.5.3 ** ** WARNING! All changes made in this file will be lost when recompiling ui file! -- 1.7.9.5