/**
- *Constructor of this class.
- *@param QWidget pointer to parent object. By default the value is NULL.
+ * Constructor of this class.
+ * @param QWidget pointer to parent object. By default the value is NULL.
*/
MeasureDialog::MeasureDialog(QWidget *parent) :
QDialog(parent),
}
/**
- *This slot function is called when timer gives timeout signal.
+ * This slot function is called when timer gives timeout signal. Checks current speed
+ * and stores times in measure class.
*/
void MeasureDialog::after_timeout()
{
speed = accelerometer->getCurrentSpeed();
//speed = speed +10;
- if(speed > 9.7 && speed < 10.3)
+ if (speed > 9.7 && speed < 10.3)
{
measures->setTime10kmh(time);
}
}
/**
- *This slot function is called when Abort button is clicked.
+ * This slot function is called when Abort button is clicked.
*/
void MeasureDialog::on_pushButtonAbort_clicked()
{
this->close();
}
+/**
+ * Initializes measures class's member variables.
+ */
void MeasureDialog::initializeMeasures()
{
measures->setTime10kmh(0);
// Test point array for the diagram.
QPoint points[10];
+/**
+ * Constructor of this class.
+ * @param QWidget pointer to parent object. By default the value is NULL.
+ */
ResultDialog::ResultDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::ResultDialog)
// ui->labelYLine->setText(ui->labelYLine->text().append(": speed/ km/h"));
}
+/**
+ * Destructor of this class. Should be used to release all allocated resources.
+ */
ResultDialog::~ResultDialog()
{
delete ui;
/**
* Draws speed diagram to the UI
- *
+ * @param QPaintEvent
*/
void ResultDialog::paintEvent(QPaintEvent *)
{
int currentY = diagramStemStart.y();
// Draws diagram's X-axel
- for(int i = 0; i<13; i++)
+ for (int i = 0; i < 13; i++)
{
currentX += diagramGap;
painter.drawLine(currentX, currentY, currentX, currentY - 10);
currentY = diagramStemStart.y();
// Draws diagram's Y-axel
- for(int i = 0; i<10; i++)
+ for (int i = 0; i < 10; i++)
{
currentY -= diagramGap;
painter.drawLine(currentX, currentY, currentX+10, currentY);
}
/**
- *Change the given speed and time to the point for the diagram.
- *@param aSpeed is speed which need to change, aTime is time in seconds which need to change.
- *@return point is calculated from aSpeed and aTime.
- **/
+ * Change the given speed and time to the point for the diagram.
+ * @param aSpeed is speed which need to change, aTime is time in seconds which need to change.
+ * @return point is calculated from aSpeed and aTime.
+ */
QPoint ResultDialog::changeMeasuresToDiagramPoint(int aSpeed, qreal aTime)
{
QPoint point;
}
/**
- *Saves the given measures to array.
- *@param pMeasures has information about acceleration.
- **/
+ * Saves the given measures to array.
+ * @param pMeasures has information about acceleration.
+ */
void ResultDialog::saveMeasuresToArray(Measures *pMeasures)
{
timeArray[0] = pMeasures->getTime10kmh();
timeArray[8] = pMeasures->getTime90kmh();
timeArray[9] = pMeasures->getTime100kmh();
- for(int i = 0; i < 4; i++)
+ for (int i = 0; i < 4; i++)
{
points[i] = changeMeasuresToDiagramPoint(speedArray[i], timeArray[i]);
}
this->repaint();
- for(int i = 0; i < 10; i++)
+ for (int i = 0; i < 10; i++)
{
timeArray[i] = 0;
}