Code commenting added.
authorJanne Änäkkälä <Janne_anakkala@hotmail.com>
Fri, 5 Mar 2010 11:59:05 +0000 (13:59 +0200)
committerJanne Änäkkälä <Janne_anakkala@hotmail.com>
Fri, 5 Mar 2010 11:59:05 +0000 (13:59 +0200)
Client/measuredialog.cpp
Client/measures.cpp
Client/resultdialog.cpp

index 038116a..7e65537 100644 (file)
@@ -3,8 +3,8 @@
 
 
 /**
-  *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),
@@ -49,7 +49,8 @@ void MeasureDialog::changeEvent(QEvent *e)
 }
 
 /**
-  *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()
 {
@@ -59,7 +60,7 @@ 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);
     }
@@ -139,7 +140,7 @@ void MeasureDialog::after_timeout()
 }
 
 /**
-  *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()
 {
@@ -160,6 +161,9 @@ void MeasureDialog::on_pushButtonAbort_clicked()
     this->close();
 }
 
+/**
+  * Initializes measures class's member variables.
+  */
 void MeasureDialog::initializeMeasures()
 {
     measures->setTime10kmh(0);
index c840ec0..bf277f8 100644 (file)
@@ -4,6 +4,10 @@ Measures::Measures()
 {
 }
 
+/**
+ * Get the value of time10kmh
+ * @return time10kmh the time in qreal when speed has been 10 km/h
+ */
 qreal Measures::getTime10kmh()
 {
     return time10kmh;
@@ -54,6 +58,10 @@ qreal Measures::getTime100kmh()
     return time100kmh;
 }
 
+/**
+ * Set the given time in to the time10kmh
+ * @param pTime is time in qreal
+ */
 void Measures::setTime10kmh(qreal pTime)
 {
     time10kmh = pTime;
index c3b3a74..e10b46e 100644 (file)
@@ -17,6 +17,10 @@ static const int speedArray[10] = {10, 20, 30, 40, 50, 60, 70, 80, 90, 100};
 // 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)
@@ -29,6 +33,9 @@ ResultDialog::ResultDialog(QWidget *parent) :
    // 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;
@@ -48,7 +55,7 @@ void ResultDialog::changeEvent(QEvent *e)
 
 /**
   * Draws speed diagram to the UI
-  *
+  * @param QPaintEvent
  */
 void ResultDialog::paintEvent(QPaintEvent *)
 {
@@ -64,7 +71,7 @@ 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);
@@ -74,7 +81,7 @@ void ResultDialog::paintEvent(QPaintEvent *)
         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);
@@ -85,10 +92,10 @@ void ResultDialog::paintEvent(QPaintEvent *)
 }
 
 /**
-  *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;
@@ -104,9 +111,9 @@ QPoint ResultDialog::changeMeasuresToDiagramPoint(int aSpeed, qreal aTime)
 }
 
 /**
-  *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();
@@ -120,7 +127,7 @@ void ResultDialog::saveMeasuresToArray(Measures *pMeasures)
     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]);
     }
@@ -163,7 +170,7 @@ void ResultDialog::saveMeasuresToArray(Measures *pMeasures)
 
     this->repaint();
 
-    for(int i = 0; i < 10; i++)
+    for (int i = 0; i < 10; i++)
     {
         timeArray[i] = 0;
     }