DBus lib added.
[speedfreak] / Client / resultdialog.cpp
index c3b3a74..679afce 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * CarMainWindow main class
+ *
+ * @author     Janne Änäkkälä <janne.anakkala@fudeco.com>
+ * @copyright  (c) 2010 Speed Freak team
+ * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
+ */
+
 #include "resultdialog.h"
 #include "ui_resultdialog.h"
 #include <QPainter>
@@ -17,6 +25,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 +41,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 +63,7 @@ void ResultDialog::changeEvent(QEvent *e)
 
 /**
   * Draws speed diagram to the UI
-  *
+  * @param QPaintEvent
  */
 void ResultDialog::paintEvent(QPaintEvent *)
 {
@@ -64,7 +79,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 +89,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 +100,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 +119,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 +135,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,8 +178,13 @@ void ResultDialog::saveMeasuresToArray(Measures *pMeasures)
 
     this->repaint();
 
-    for(int i = 0; i < 10; i++)
+    for (int i = 0; i < 10; i++)
     {
         timeArray[i] = 0;
     }
 }
+
+void ResultDialog::on_pushButtonSend_clicked()
+{
+    emit sendresult();
+}