projects
/
speedfreak
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
71b441a
)
Result dialog fixed.
author
Jukka Kurttila
<jukka.kurttila@fudeco.com>
Wed, 31 Mar 2010 08:15:01 +0000
(11:15 +0300)
committer
Jukka Kurttila
<jukka.kurttila@fudeco.com>
Wed, 31 Mar 2010 08:15:01 +0000
(11:15 +0300)
Client/accelerationstart.cpp
patch
|
blob
|
history
Client/accelerationstart.h
patch
|
blob
|
history
Client/accelerometer.cpp
patch
|
blob
|
history
Client/accrealtimedialog.cpp
patch
|
blob
|
history
Client/accrealtimedialog.h
patch
|
blob
|
history
Client/calculate.cpp
patch
|
blob
|
history
Client/calculate.h
patch
|
blob
|
history
Client/calibratedialog.cpp
patch
|
blob
|
history
Client/calibratedialog.h
patch
|
blob
|
history
Client/calibratedialog.ui
patch
|
blob
|
history
diff --git
a/Client/accelerationstart.cpp
b/Client/accelerationstart.cpp
index
3da0070
..
22a0a02
100644
(file)
--- a/
Client/accelerationstart.cpp
+++ b/
Client/accelerationstart.cpp
@@
-1,3
+1,10
@@
+/*
+ * Acceleration start dialog
+ *
+ * @author Jukka Kurttila <jukka.kurttila@fudeco.com>
+ * @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 <QMessageBox>
#include "accelerationstart.h"
#include "ui_accelerationstartdialog.h"
#include <QMessageBox>
diff --git
a/Client/accelerationstart.h
b/Client/accelerationstart.h
index
ecd2406
..
e524f88
100644
(file)
--- a/
Client/accelerationstart.h
+++ b/
Client/accelerationstart.h
@@
-1,3
+1,10
@@
+/*
+ * Acceleration start dialog
+ *
+ * @author Jukka Kurttila <jukka.kurttila@fudeco.com>
+ * @copyright (c) 2010 Speed Freak team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
+ */
#ifndef ACCELERATIONSTART_H
#define ACCELERATIONSTART_H
#ifndef ACCELERATIONSTART_H
#define ACCELERATIONSTART_H
diff --git
a/Client/accelerometer.cpp
b/Client/accelerometer.cpp
index
ecde13d
..
c2f0bab
100644
(file)
--- a/
Client/accelerometer.cpp
+++ b/
Client/accelerometer.cpp
@@
-24,6
+24,7
@@
Accelerometer::Accelerometer()
{
initValues();
Accelerometer::Accelerometer()
{
initValues();
+ calibrateDialog = NULL;
}
/**
}
/**
@@
-32,6
+33,8
@@
Accelerometer::Accelerometer()
*/
Accelerometer::~Accelerometer()
{
*/
Accelerometer::~Accelerometer()
{
+ if(calibrateDialog)
+ delete calibrateDialog;
}
/**
}
/**
@@
-61,6
+64,7
@@
void Accelerometer::calibrate(void)
calibrateDialog = new CalibrateDialog();
calibrateDialog->show();
calibrateDialog->resetProgressValue();
calibrateDialog = new CalibrateDialog();
calibrateDialog->show();
calibrateDialog->resetProgressValue();
+ calibrateDialog->setMaxValue( kIterations + 1 );
do {
calibrateDialog->setProgressValue(iteration);
do {
calibrateDialog->setProgressValue(iteration);
@@
-79,7
+83,7
@@
void Accelerometer::calibrate(void)
calibrationY = calibrationY/kIterations;
calibrationZ = calibrationZ/kIterations;
calibrationY = calibrationY/kIterations;
calibrationZ = calibrationZ/kIterations;
- calibrateDialog->hide();
+ calibrateDialog->close();
}
/**
}
/**
diff --git
a/Client/accrealtimedialog.cpp
b/Client/accrealtimedialog.cpp
index
dc58627
..
9b5bc3f
100644
(file)
--- a/
Client/accrealtimedialog.cpp
+++ b/
Client/accrealtimedialog.cpp
@@
-1,3
+1,11
@@
+/*
+ * Acceleration info in real time dialog
+ *
+ * @author Jukka Kurttila <jukka.kurttila@fudeco.com>
+ * @copyright (c) 2010 Speed Freak team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
+ */
+
#include "accrealtimedialog.h"
#include "ui_accrealtimedialog.h"
#include <math.h>
#include "accrealtimedialog.h"
#include "ui_accrealtimedialog.h"
#include <math.h>
@@
-19,9
+27,7
@@
AccRealTimeDialog::AccRealTimeDialog(QWidget *parent) :
updateScreenCounter = 0;
resetAccelerometerMeasurements();
updateScreenCounter = 0;
resetAccelerometerMeasurements();
- //Load image
- QPixmap pixMap("back.png",0,Qt::AutoColor);
- ui->pictureLabel->setPixmap(pixMap);
+ resultDialog = NULL;
}
AccRealTimeDialog::~AccRealTimeDialog()
}
AccRealTimeDialog::~AccRealTimeDialog()
@@
-31,6
+37,8
@@
AccRealTimeDialog::~AccRealTimeDialog()
delete accelerometerTimer;
delete calculate;
delete movingAverageZ;
delete accelerometerTimer;
delete calculate;
delete movingAverageZ;
+ if(resultDialog)
+ delete resultDialog;
}
void AccRealTimeDialog::changeEvent(QEvent *e)
}
void AccRealTimeDialog::changeEvent(QEvent *e)
@@
-69,9
+77,9
@@
void AccRealTimeDialog::readAccelerometerData()
y -= accelerometer->getCalibrationY();
z -= accelerometer->getCalibrationZ();
y -= accelerometer->getCalibrationY();
z -= accelerometer->getCalibrationZ();
- QString str = QString("acc x: " + QString::number(x) + "\n" +
- "acc y: " + QString::number(y) + "\n" +
- "acc z: " + QString::number(z) + "\n");
+// QString str = QString("acc x: " + QString::number(x) + "\n" +
+// "acc y: " + QString::number(y) + "\n" +
+// "acc z: " + QString::number(z) + "\n");
currentAcceleration = z;//sqrt(x*x + y*y + z*z);
changeInAcceleration = currentAcceleration;
currentAcceleration = z;//sqrt(x*x + y*y + z*z);
changeInAcceleration = currentAcceleration;
@@
-128,9
+136,24
@@
void AccRealTimeDialog::readAccelerometerData()
updateScreenCounter++;
//Open result dialog if target speed reached
updateScreenCounter++;
//Open result dialog if target speed reached
- if( speed > stopMeasureSpeed )
+ if( (stopMeasureSpeed > 0) && (speed > stopMeasureSpeed) )
{
this->accelerometerTimer->stop();
{
this->accelerometerTimer->stop();
+ if(!resultDialog)
+ {
+ resultDialog = new ResultDialog(this);
+ }
+ resultDialog->setEnd(stopMeasureSpeed);
+
+ //Put all times from all speeds
+ QMap<int,double> tempMap = calculate->getValuesMap();
+
+ for( int i = 1 ; i <= tempMap.count() ; i++ )
+ {
+ resultDialog->setValue(i*10,tempMap[i*10]);
+ }
+ resultDialog->show();
+ this->hide();
}
}
}
}
@@
-164,6
+187,9
@@
void AccRealTimeDialog::on_buttonAbort_clicked()
}
void AccRealTimeDialog::startAccelerationMeasure()
{
}
void AccRealTimeDialog::startAccelerationMeasure()
{
+ double temp = stopMeasureSpeed;
+ resetAccelerometerMeasurements();
+ stopMeasureSpeed = temp;
accelerometerTimer->start(40);
}
void AccRealTimeDialog::SetStopMeasureSpeed(double speed)
accelerometerTimer->start(40);
}
void AccRealTimeDialog::SetStopMeasureSpeed(double speed)
diff --git
a/Client/accrealtimedialog.h
b/Client/accrealtimedialog.h
index
b389818
..
4545c9c
100644
(file)
--- a/
Client/accrealtimedialog.h
+++ b/
Client/accrealtimedialog.h
@@
-1,3
+1,10
@@
+/*
+ * Acceleration info in real time dialog
+ *
+ * @author Jukka Kurttila <jukka.kurttila@fudeco.com>
+ * @copyright (c) 2010 Speed Freak team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
+ */
#ifndef ACCREALTIMEDIALOG_H
#define ACCREALTIMEDIALOG_H
#ifndef ACCREALTIMEDIALOG_H
#define ACCREALTIMEDIALOG_H
@@
-5,6
+12,8
@@
#include <QTimer>
#include "accelerometer.h"
#include "movingaverage.h"
#include <QTimer>
#include "accelerometer.h"
#include "movingaverage.h"
+#include "resultdialog.h"
+
namespace Ui {
class AccRealTimeDialog;
namespace Ui {
class AccRealTimeDialog;
@@
-35,6
+44,7
@@
private:
Accelerometer* accelerometer;
Calculate *calculate;
MovingAverage* movingAverageZ;
Accelerometer* accelerometer;
Calculate *calculate;
MovingAverage* movingAverageZ;
+ ResultDialog* resultDialog;
int updateScreenCounter;
double accelerationStartThreshold;
int updateScreenCounter;
double accelerationStartThreshold;
diff --git
a/Client/calculate.cpp
b/Client/calculate.cpp
index
fb56f12
..
edd4246
100644
(file)
--- a/
Client/calculate.cpp
+++ b/
Client/calculate.cpp
@@
-2,6
+2,7
@@
* Calculate class to process accelerometer data
*
* @author Kai Rasilainen
* Calculate class to process accelerometer data
*
* @author Kai Rasilainen
+ * @author Jukka Kurttila <jukka.kurttila@fudeco.com>
* @copyright (c) 2010 Speed Freak team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*/
* @copyright (c) 2010 Speed Freak team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*/
@@
-303,3
+304,7
@@
void Calculate::setMaxSpeed(double value)
maxSpeed = value;
}
maxSpeed = value;
}
+QMap<int,double> Calculate::getValuesMap()
+{
+ return valuesMap;
+}
diff --git
a/Client/calculate.h
b/Client/calculate.h
index
bc3f81d
..
0100502
100644
(file)
--- a/
Client/calculate.h
+++ b/
Client/calculate.h
@@
-2,6
+2,7
@@
* Calculate class to process accelerometer data
*
* @author Kai Rasilainen
* Calculate class to process accelerometer data
*
* @author Kai Rasilainen
+ * @author Jukka Kurttila <jukka.kurttila@fudeco.com>
* @copyright (c) 2010 Speed Freak team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*/
* @copyright (c) 2010 Speed Freak team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*/
@@
-25,6
+26,7
@@
public:
void reset();
void calculateParameters(double currentAcceleration, double seconds);
void accelStoppedCheck(double currentAcceleration);
void reset();
void calculateParameters(double currentAcceleration, double seconds);
void accelStoppedCheck(double currentAcceleration);
+ QMap<int,double> getValuesMap();
double getAverageSpeed();
void setAverageSpeed(double value);
double getAverageSpeed();
void setAverageSpeed(double value);
@@
-82,7
+84,7
@@
private:
double currentPower;
double averagePower;
QList<int> speedCheckPoints;
double currentPower;
double averagePower;
QList<int> speedCheckPoints;
-public:
+
QMap<int,double> valuesMap;
signals:
QMap<int,double> valuesMap;
signals:
diff --git
a/Client/calibratedialog.cpp
b/Client/calibratedialog.cpp
index
a2ac9bd
..
7194c89
100644
(file)
--- a/
Client/calibratedialog.cpp
+++ b/
Client/calibratedialog.cpp
@@
-43,3
+43,8
@@
void CalibrateDialog::resetProgressValue()
{
ui->progressBar->reset();
}
{
ui->progressBar->reset();
}
+
+void CalibrateDialog::setMaxValue(int max)
+{
+ ui->progressBar->setMaximum( max );
+}
diff --git
a/Client/calibratedialog.h
b/Client/calibratedialog.h
index
af7af1c
..
341e91c
100644
(file)
--- a/
Client/calibratedialog.h
+++ b/
Client/calibratedialog.h
@@
-23,6
+23,7
@@
public:
void setProgressValue(int value);
void resetProgressValue();
void setProgressValue(int value);
void resetProgressValue();
+ void setMaxValue(int max);
protected:
void changeEvent(QEvent *e);
protected:
void changeEvent(QEvent *e);
diff --git
a/Client/calibratedialog.ui
b/Client/calibratedialog.ui
index
ac7a81a
..
16e9bb9
100644
(file)
--- a/
Client/calibratedialog.ui
+++ b/
Client/calibratedialog.ui
@@
-7,39
+7,17
@@
<x>0</x>
<y>0</y>
<width>800</width>
<x>0</x>
<y>0</y>
<width>800</width>
- <height>480</height>
+ <height>150</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
- <widget class="QLabel" name="label">
- <property name="geometry">
- <rect>
- <x>300</x>
- <y>30</y>
- <width>201</width>
- <height>161</height>
- </rect>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="pixmap">
- <pixmap>line_chart.png</pixmap>
- </property>
- <property name="scaledContents">
- <bool>true</bool>
- </property>
- <property name="alignment">
- <set>Qt::AlignHCenter|Qt::AlignTop</set>
- </property>
- </widget>
<widget class="QProgressBar" name="progressBar">
<property name="geometry">
<rect>
<widget class="QProgressBar" name="progressBar">
<property name="geometry">
<rect>
- <x>60</x>
- <y>220</y>
+ <x>50</x>
+ <y>40</y>
<width>681</width>
<height>71</height>
</rect>
<width>681</width>
<height>71</height>
</rect>