+ showOrHideLabels();
+}
+
+/**
+ * Sets right timeAxelLength value depending the time which
+ * has spent to reach target speed.
+ */
+void ResultDialog::setTimeAxelLength(int pChoice)
+{
+ if (timeArray[pChoice] <= 5.0)
+ {
+ timeAxelLength = 5;
+ }
+
+ else if (timeArray[pChoice] <= 10.0 && timeArray[pChoice] > 5.0)
+ {
+ timeAxelLength = 10;
+ }
+
+ else if (timeArray[pChoice] <= 16.0 && timeArray[pChoice] > 10.0)
+ {
+ timeAxelLength = 16;
+ }
+
+ else
+ {
+ timeAxelLength = 20;
+ }
+}
+
+/**
+ * This slot function close result dialog when new run -button has been clicked.
+ */
+void ResultDialog::on_pushButtonNew_clicked()
+{
+ for (int i = 0; i < 11; i++)
+ {
+ timeArray[i] = 0;
+ }
+ resultString = "";
+ this->close();
+ emit rejected();
+}
+
+/**
+ * This slot function emits sendresult signal for sending results to server when
+ * send results -button has been clicked.
+ * Emit accrealtimedialog sendresult.
+ */
+void ResultDialog::on_pushButtonSend_clicked()
+{
+ ui->pushButtonSend->setEnabled(false);
+ emit sendresult(timeArray[this->getTargetChoice()]);
+}
+
+double ResultDialog::getResult()
+{
+ return timeArray[this->getTargetChoice()];
+}
+
+/**
+ * This public function sets diagram's stem gap
+ * @param pValue is the speed value which determines diagram gap's value
+ */
+void ResultDialog::setEnd(int pValue)
+{
+ for (int i = 0; i < 11; i++)
+ {
+ timeArray[i] = 0;
+ }
+ resultString = "";
+
+ switch (pValue)
+ {
+ case 10:
+ this->diagramGapStem = DIAGRAMGAP10KMH;
+ break;
+
+ case 20:
+ this->diagramGapStem = DIAGRAMGAP20KMH;
+ break;
+
+ case 30:
+ this->diagramGapStem = DIAGRAMGAP30KMH;
+ break;
+
+ case 40:
+ this->diagramGapStem = DIAGRAMGAP40KMH;
+ break;
+
+ case 50:
+ this->diagramGapStem = DIAGRAMGAP50KMH;
+ break;
+
+ case 60:
+ this->diagramGapStem = DIAGRAMGAP60KMH;
+ break;
+
+ case 70:
+ this->diagramGapStem = DIAGRAMGAP70KMH;
+ break;
+
+ case 80:
+ this->diagramGapStem = DIAGRAMGAP80KMH;
+ break;
+
+ case 90:
+ this->diagramGapStem = DIAGRAMGAP90KMH;
+ break;
+
+ case 100:
+ this->diagramGapStem = DIAGRAMGAP100KMH;
+ break;
+
+ default:
+ this->diagramGapStem = DIAGRAMGAP100KMH;
+ break;
+ }
+}
+
+/**
+ * This public function stores time in timeArray
+ * @param pSpeed is the speed value at the time so we know where store time
+ * @param pTime is the result which needs to be store in timeArray
+ */
+void ResultDialog::setValue(int pSpeed, double pTime)
+{
+ //timeArray[0] = 0;
+ if (pTime <= 5.0)
+ {
+ this->diagramGapHorizontal = DIAGRAMGAP5S;
+ }
+
+ else if (pTime <= 10.0 && pTime > 5.0)
+ {
+ this->diagramGapHorizontal = DIAGRAMGAP10S;
+ }
+
+ else if (pTime <= 16.0 && pTime > 10.0)
+ {
+ this->diagramGapHorizontal = DIAGRAMGAP16S;
+ }
+
+ else
+ {
+ this->diagramGapHorizontal = DIAGRAMGAP20S;
+ }
+
+ switch (pSpeed)
+ {
+ case 10:
+ timeArray[1] = pTime;
+ break;
+ case 20:
+ timeArray[2] = pTime;
+ break;
+ case 30:
+ timeArray[3] = pTime;
+ break;
+ case 40:
+ timeArray[4] = pTime;
+ break;
+ case 50:
+ timeArray[5] = pTime;
+ break;
+ case 60:
+ timeArray[6] = pTime;
+ break;
+ case 70:
+ timeArray[7] = pTime;
+ break;
+ case 80:
+ timeArray[8] = pTime;
+ break;
+ case 90:
+ timeArray[9] = pTime;
+ break;
+ case 100:
+ timeArray[10] = pTime;
+ break;
+ }
+
+ setTimeAxelLength(getTargetChoice());
+
+ for (int i = 0; i < 11; i++)
+ {
+ points[i] = changeMeasuresToDiagramPoint(speedArray[i], timeArray[i]);
+ }
+
+ setTimesIntoLabels();
+ this->repaint();
+}
+
+/**
+ * Sets dialog's heading and result text
+ */
+void ResultDialog::setHeaders()
+{
+ //QString resultString;
+ resultString.append("Time was ");
+
+ QString time;
+
+ if (this->diagramGapStem == DIAGRAMGAP100KMH)
+ {
+ time.sprintf("%.2f", timeArray[10]);
+ resultString.append(time);
+ this->setWindowTitle("Result for accelerating 100 km/h");
+ }
+
+ else if (this->diagramGapStem == DIAGRAMGAP90KMH)
+ {
+ time.sprintf("%.2f", timeArray[9]);
+ resultString.append(time);
+ this->setWindowTitle("Result for accelerating 90 km/h");
+ }
+
+ else if (this->diagramGapStem == DIAGRAMGAP80KMH)
+ {
+ time.sprintf("%.2f", timeArray[8]);
+ resultString.append(time);
+ this->setWindowTitle("Result for accelerating 80 km/h");
+ }
+
+ else if (this->diagramGapStem == DIAGRAMGAP70KMH)