Changes in result dialog.
authorJanne Änäkkälä <Janne_anakkala@hotmail.com>
Thu, 4 Mar 2010 11:04:59 +0000 (13:04 +0200)
committerJanne Änäkkälä <Janne_anakkala@hotmail.com>
Thu, 4 Mar 2010 11:04:59 +0000 (13:04 +0200)
Client/carmainwindow.cpp
Client/measuredialog.cpp
Client/measures.cpp [new file with mode: 0644]
Client/measures.h [new file with mode: 0644]
Client/resultdialog.cpp
Client/resultdialog.ui

index 10affda..4bc2b3e 100644 (file)
@@ -108,7 +108,7 @@ void CarMainWindow::setUnitCompoBox(QStringList units)
   */
 void CarMainWindow::initSpeedListView()
 {
   */
 void CarMainWindow::initSpeedListView()
 {
-    numbers << "0-100 km/h" << "0-1/4 mil" << "0-50 km" << "50-100 mil" << "0-100 m" << "0-50 ft" << "0-50 yrd" << "0-500 in";
+    numbers << "0-40 km/h" << "0-1/4 mil" << "0-50 km" << "50-100 mil" << "0-100 m" << "0-50 ft" << "0-50 yrd" << "0-500 in";
     QAbstractItemModel *model = new StringListModel(numbers);
     ui->listView->setModel(model);
 }
     QAbstractItemModel *model = new StringListModel(numbers);
     ui->listView->setModel(model);
 }
index efec02b..038116a 100644 (file)
@@ -115,7 +115,7 @@ void MeasureDialog::after_timeout()
     }
 
     // If speed is over 100 km/h emits speedAchieved() signal and close this dialog.
     }
 
     // If speed is over 100 km/h emits speedAchieved() signal and close this dialog.
-    if (speed >= 100.0)
+    if (speed >= 40.0)
     {
         timer->stop();
         accelerometer->stop();
     {
         timer->stop();
         accelerometer->stop();
diff --git a/Client/measures.cpp b/Client/measures.cpp
new file mode 100644 (file)
index 0000000..c840ec0
--- /dev/null
@@ -0,0 +1,105 @@
+#include "measures.h"
+
+Measures::Measures()
+{
+}
+
+qreal Measures::getTime10kmh()
+{
+    return time10kmh;
+}
+
+qreal Measures::getTime20kmh()
+{
+    return time20kmh;
+}
+
+qreal Measures::getTime30kmh()
+{
+    return time30kmh;
+}
+
+qreal Measures::getTime40kmh()
+{
+    return time40kmh;
+}
+
+qreal Measures::getTime50kmh()
+{
+    return time50kmh;
+}
+
+qreal Measures::getTime60kmh()
+{
+    return time60kmh;
+}
+
+qreal Measures::getTime70kmh()
+{
+    return time70kmh;
+}
+
+qreal Measures::getTime80kmh()
+{
+    return time80kmh;
+}
+
+qreal Measures::getTime90kmh()
+{
+    return time90kmh;
+}
+
+qreal Measures::getTime100kmh()
+{
+    return time100kmh;
+}
+
+void Measures::setTime10kmh(qreal pTime)
+{
+    time10kmh = pTime;
+}
+
+void Measures::setTime20kmh(qreal pTime)
+{
+    time20kmh = pTime;
+}
+
+void Measures::setTime30kmh(qreal pTime)
+{
+    time30kmh = pTime;
+}
+
+void Measures::setTime40kmh(qreal pTime)
+{
+    time40kmh = pTime;
+}
+
+void Measures::setTime50kmh(qreal pTime)
+{
+    time50kmh = pTime;
+}
+
+void Measures::setTime60kmh(qreal pTime)
+{
+    time60kmh = pTime;
+}
+
+void Measures::setTime70kmh(qreal pTime)
+{
+    time70kmh = pTime;
+}
+
+void Measures::setTime80kmh(qreal pTime)
+{
+    time80kmh = pTime;
+}
+
+void Measures::setTime90kmh(qreal pTime)
+{
+    time90kmh = pTime;
+}
+
+void Measures::setTime100kmh(qreal pTime)
+{
+    time100kmh = pTime;
+}
diff --git a/Client/measures.h b/Client/measures.h
new file mode 100644 (file)
index 0000000..009e868
--- /dev/null
@@ -0,0 +1,46 @@
+#ifndef MEASURES_H
+#define MEASURES_H
+
+#include <QObject>
+
+class Measures
+{
+public:
+    Measures();
+    qreal getTime10kmh();
+    qreal getTime20kmh();
+    qreal getTime30kmh();
+    qreal getTime40kmh();
+    qreal getTime50kmh();
+    qreal getTime60kmh();
+    qreal getTime70kmh();
+    qreal getTime80kmh();
+    qreal getTime90kmh();
+    qreal getTime100kmh();
+
+    void setTime10kmh(qreal pTime);
+    void setTime20kmh(qreal pTime);
+    void setTime30kmh(qreal pTime);
+    void setTime40kmh(qreal pTime);
+    void setTime50kmh(qreal pTime);
+    void setTime60kmh(qreal pTime);
+    void setTime70kmh(qreal pTime);
+    void setTime80kmh(qreal pTime);
+    void setTime90kmh(qreal pTime);
+    void setTime100kmh(qreal pTime);
+
+
+private:
+    qreal time10kmh;
+    qreal time20kmh;
+    qreal time30kmh;
+    qreal time40kmh;
+    qreal time50kmh;
+    qreal time60kmh;
+    qreal time70kmh;
+    qreal time80kmh;
+    qreal time90kmh;
+    qreal time100kmh;
+};
+
+#endif // MEASURES_H
index 12f95db..c3b3a74 100644 (file)
@@ -80,7 +80,7 @@ void ResultDialog::paintEvent(QPaintEvent *)
             painter.drawLine(currentX, currentY, currentX+10, currentY);
         }
 
             painter.drawLine(currentX, currentY, currentX+10, currentY);
         }
 
-        painter.drawPolyline(points, 10);
+        painter.drawPolyline(points, 4);
 
 }
 
 
 }
 
@@ -120,33 +120,33 @@ void ResultDialog::saveMeasuresToArray(Measures *pMeasures)
     timeArray[8] = pMeasures->getTime90kmh();
     timeArray[9] = pMeasures->getTime100kmh();
 
     timeArray[8] = pMeasures->getTime90kmh();
     timeArray[9] = pMeasures->getTime100kmh();
 
-    for(int i = 0; i < 10; i++)
+    for(int i = 0; i < 4; i++)
     {
         points[i] = changeMeasuresToDiagramPoint(speedArray[i], timeArray[i]);
     }
 
     QString time, timeInteger;
     {
         points[i] = changeMeasuresToDiagramPoint(speedArray[i], timeArray[i]);
     }
 
     QString time, timeInteger;
-    timeInteger.setNum(timeArray[9]);
-    time = "0 - 100 km/h: ";
+    timeInteger.setNum(timeArray[3]);
+    time = "0 - 40 km/h: ";
     time.append(timeInteger);
     time.append(timeInteger);
-    ui->labelResult->setText(time);
+    ui->labelResult40kmh->setText(time);
 
 
-    timeInteger.setNum(timeArray[8]);
-    time = "0 - 90 km/h: ";
+    timeInteger.setNum(timeArray[2]);
+    time = "0 - 30 km/h: ";
     time.append(timeInteger);
     time.append(timeInteger);
-    ui->labelResult_2->setText(time);
+    ui->labelResult30kmh->setText(time);
 
 
-    timeInteger.setNum(timeArray[7]);
-    time = "0 - 80 km/h: ";
+    timeInteger.setNum(timeArray[1]);
+    time = "0 - 20 km/h: ";
     time.append(timeInteger);
     time.append(timeInteger);
-    ui->labelResult_3->setText(time);
+    ui->labelResult20kmh->setText(time);
 
 
-    timeInteger.setNum(timeArray[6]);
-    time = "0 - 70 km/h: ";
+    timeInteger.setNum(timeArray[0]);
+    time = "0 - 10 km/h: ";
     time.append(timeInteger);
     time.append(timeInteger);
-    ui->labelResult_4->setText(time);
+    ui->labelResult10kmh->setText(time);
 
 
-    timeInteger.setNum(timeArray[5]);
+   /* timeInteger.setNum(timeArray[5]);
     time = "0 - 60 km/h: ";
     time.append(timeInteger);
     ui->labelResult_5->setText(time);
     time = "0 - 60 km/h: ";
     time.append(timeInteger);
     ui->labelResult_5->setText(time);
@@ -159,7 +159,7 @@ void ResultDialog::saveMeasuresToArray(Measures *pMeasures)
     timeInteger.setNum(timeArray[3]);
     time = "0 - 40 km/h: ";
     time.append(timeInteger);
     timeInteger.setNum(timeArray[3]);
     time = "0 - 40 km/h: ";
     time.append(timeInteger);
-    ui->labelResult_7->setText(time);
+    ui->labelResult_7->setText(time);*/
 
     this->repaint();
 
 
     this->repaint();
 
index 81ee877..c0c3a73 100644 (file)
   <property name="windowTitle">
    <string>Dialog</string>
   </property>
   <property name="windowTitle">
    <string>Dialog</string>
   </property>
-  <widget class="QLabel" name="labelResult_4">
+  <widget class="QLabel" name="labelResult10kmh">
    <property name="geometry">
     <rect>
    <property name="geometry">
     <rect>
-     <x>520</x>
-     <y>120</y>
+     <x>410</x>
+     <y>230</y>
      <width>191</width>
      <height>31</height>
     </rect>
    </property>
    <property name="text">
      <width>191</width>
      <height>31</height>
     </rect>
    </property>
    <property name="text">
-    <string>0 - 50 km/h: 5,6 s</string>
+    <string>0 - 10 km/h: 5,6 s</string>
    </property>
   </widget>
    </property>
   </widget>
-  <widget class="QLabel" name="labelResult_7">
+  <widget class="QLabel" name="labelResult40kmh">
    <property name="geometry">
     <rect>
    <property name="geometry">
     <rect>
-     <x>520</x>
-     <y>240</y>
+     <x>410</x>
+     <y>90</y>
      <width>191</width>
      <height>31</height>
     </rect>
    </property>
    <property name="text">
      <width>191</width>
      <height>31</height>
     </rect>
    </property>
    <property name="text">
-    <string>0 - 20 km/h: 1,1 s</string>
+    <string>0 - 40 km/h: 9,8 s</string>
    </property>
   </widget>
    </property>
   </widget>
-  <widget class="QLabel" name="labelResult">
+  <widget class="QLabel" name="labelResult20kmh">
    <property name="geometry">
     <rect>
    <property name="geometry">
     <rect>
-     <x>520</x>
-     <y>10</y>
-     <width>191</width>
-     <height>31</height>
-    </rect>
-   </property>
-   <property name="text">
-    <string>0 - 100 km/h: 9,8 s</string>
-   </property>
-  </widget>
-  <widget class="QLabel" name="labelResult_6">
-   <property name="geometry">
-    <rect>
-     <x>520</x>
-     <y>200</y>
-     <width>191</width>
-     <height>31</height>
-    </rect>
-   </property>
-   <property name="text">
-    <string>0 - 30 km/h: 3,2 s</string>
-   </property>
-  </widget>
-  <widget class="QLabel" name="labelResult_5">
-   <property name="geometry">
-    <rect>
-     <x>520</x>
-     <y>160</y>
+     <x>410</x>
+     <y>180</y>
      <width>191</width>
      <height>31</height>
     </rect>
    </property>
    <property name="text">
      <width>191</width>
      <height>31</height>
     </rect>
    </property>
    <property name="text">
-    <string>0 - 40 km/h:4,5 s</string>
+    <string>0 - 20 km/h: 6,9 s</string>
    </property>
   </widget>
    </property>
   </widget>
-  <widget class="QLabel" name="labelResult_3">
+  <widget class="QLabel" name="labelResult30kmh">
    <property name="geometry">
     <rect>
    <property name="geometry">
     <rect>
-     <x>520</x>
-     <y>80</y>
-     <width>191</width>
-     <height>31</height>
-    </rect>
-   </property>
-   <property name="text">
-    <string>0 - 60 km/h: 6,9 s</string>
-   </property>
-  </widget>
-  <widget class="QLabel" name="labelResult_2">
-   <property name="geometry">
-    <rect>
-     <x>520</x>
-     <y>40</y>
+     <x>410</x>
+     <y>140</y>
      <width>191</width>
      <height>31</height>
     </rect>
    </property>
    <property name="text">
      <width>191</width>
      <height>31</height>
     </rect>
    </property>
    <property name="text">
-    <string>0 - 80 km/h: 8,6 s</string>
+    <string>0 - 30 km/h: 8,6 s</string>
    </property>
   </widget>
   <widget class="QLabel" name="labelY2">
    </property>
   </widget>
   <widget class="QLabel" name="labelY2">