Route dialog height.
authorToni Jussila <toni.jussila@fudeco.com>
Wed, 31 Mar 2010 11:09:56 +0000 (14:09 +0300)
committerToni Jussila <toni.jussila@fudeco.com>
Wed, 31 Mar 2010 11:09:56 +0000 (14:09 +0300)
Merge branch 'development/ui'

Conflicts:
Client/graphics.qrc
Client/routedialog.ui

22 files changed:
Client/Graphics/speedfreak.png [new file with mode: 0644]
Client/accelerationstart.cpp
Client/accelerationstart.h
Client/categorylist.cpp
Client/graphics.qrc
Client/httpclient.cpp
Client/mainwindow.cpp
Client/mainwindow.h
Client/mainwindow.ui
Client/resultdialog.cpp
Client/resultdialog.h
Client/resultdialog.ui
Client/routedialog.cpp
Client/routedialog.h
Client/routedialog.ui
Client/routesavedialog.cpp
Client/settingsdialog.cpp
Client/settingsdialog.h
Client/settingsdialog.ui
Client/topresultdialog.cpp
Client/topresultdialog.h
Client/topresultdialog.ui

diff --git a/Client/Graphics/speedfreak.png b/Client/Graphics/speedfreak.png
new file mode 100644 (file)
index 0000000..53bc01c
Binary files /dev/null and b/Client/Graphics/speedfreak.png differ
index 22a0a02..9315f6b 100644 (file)
@@ -73,10 +73,23 @@ void accelerationstart::on_buttonStart_clicked()
 void accelerationstart::on_categorComboBox_currentIndexChanged( int index )
 {
     stopMeasureSpeed = 0;
-    if( index == 1 )
-        stopMeasureSpeed = 20;
-    else if( index == 2 )
+    if( index == 1 ) {
+        stopMeasureSpeed = 10;
+        measureCategory = "acceleration-0-10";
+    }
+    else if( index == 2 ) {
         stopMeasureSpeed = 40;
-    else if( index == 3 )
+        measureCategory = "acceleration-0-40";
+    }
+    else if( index == 3 ) {
         stopMeasureSpeed = 100;
+        measureCategory = "acceleration-0-100";
+    }
+}
+
+
+QString accelerationstart::getMeasureCategory()
+{
+    return measureCategory;
 }
+
index e524f88..6502e1d 100644 (file)
@@ -20,6 +20,7 @@ class accelerationstart : public QDialog {
 public:
     accelerationstart(QWidget *parent = 0);
     ~accelerationstart();
+    QString getMeasureCategory();
 
 protected:
     void changeEvent(QEvent *e);
@@ -28,6 +29,7 @@ private:
     Ui::accelerationstart *ui;
     AccRealTimeDialog* accRealTimeDialog;
     double stopMeasureSpeed;
+    QString measureCategory;
 
 private slots:
     void on_categorComboBox_currentIndexChanged(int index);
index f15fde0..5d86f76 100644 (file)
@@ -137,6 +137,7 @@ void CategoryList::clearCats()
   *This function is used to get items to top list of the category that is chosen from combobox.
   *@param QString category
   *@param int size
+  *@todo Now there is only one (the latest top10List). Later picking up the requested category.
   */
 QString CategoryList::getTopList( QString category, int size)
 {
index 6771c3c..58153b5 100644 (file)
@@ -1,17 +1,19 @@
 <RCC>
     <qresource prefix="/new/prefix1">
         <file>Graphics/meter.png</file>
-        <file>Graphics/route.png</file>
         <file>Graphics/satellite_vista.png</file>
+       <file>Graphics/route.png</file>
         <file>Graphics/route_play.png</file>
         <file>Graphics/route_stop.png</file>
+       <file>Graphics/route_new.png</file>
+        <file>Graphics/route_save.png</file>
         <file>Graphics/settings.png</file>
         <file>Graphics/trophy_gold.png</file>
         <file>Graphics/applications_internet.png</file>
         <file>Graphics/Speedometer.png</file>
         <file>Graphics/Speedometer2.png</file>
         <file>Graphics/info.png</file>
-        <file>Graphics/route_new.png</file>
-        <file>Graphics/route_save.png</file>
+        <file>Graphics/speedfreak.png</file>
+        
     </qresource>
 </RCC>
index 8cc9a79..69f932e 100644 (file)
@@ -49,7 +49,7 @@ void HttpClient::requestRegistration()
     currentDownload = netManager->post(request, ("xml=" + regbuffer->data()));
     connect(currentDownload,SIGNAL(finished()),this,SLOT(ackOfRegistration()));
     //connect(currentDownload,SIGNAL(error(QNetworkReply::NetworkError)),myMainw,SLOT(errorFromServer(QNetworkReply::NetworkError)));
-    //myMainw->setLabelInfoToUser("Reguesting registration from server");
+    myMainw->settingsDialog->setLabelInfoToUser("Reguesting registration from server");
 
     regbuffer->close();
 }
@@ -80,7 +80,7 @@ void HttpClient::sendResultXml(QString category, double result)
     currentDownload = netManager->post(request, ("xml=" + xmlbuffer->data()));
     connect(currentDownload,SIGNAL(finished()),this,SLOT(ackOfResult()));
     //connect(currentDownload,SIGNAL(error(QNetworkReply::NetworkError)),myMainw,SLOT(errorFromServer(QNetworkReply::NetworkError)));
-    //myMainw->setLabelInfoToUser("Sending result to server");
+    myMainw->resultDialog->setLabelInfoToUser("Sending result to server");
 
     xmlbuffer->close();
 }
@@ -113,7 +113,7 @@ void HttpClient::sendRouteXml()
     currentDownload = netManager->post(request, ("xml=" + file.readAll()));
     connect(currentDownload,SIGNAL(finished()),this,SLOT(ackOfRoute()));
     //connect(currentDownload,SIGNAL(error(QNetworkReply::NetworkError)),myMainw,SLOT(errorFromServer(QNetworkReply::NetworkError)));
-    //myMainw->setLabelInfoToUser("Sending route to server");
+    myMainw->routeDialog->setLabelInfoToUser("Sending route to server");
 
     file.close();
 }
@@ -141,7 +141,7 @@ void HttpClient::requestTopList(QString category, QString limit)
     currentDownload = netManager->post(request, ("data=" ));
     connect(currentDownload,SIGNAL(finished()),this,SLOT(ackOfToplist()));
     //connect(currentDownload,SIGNAL(error(QNetworkReply::NetworkError)),myMainw,SLOT(errorFromServer(QNetworkReply::NetworkError)));
-    //myMainw->setLabelInfoToUser("Reguesting top10 list from server");
+    myMainw->topResultDialog->setLabelInfoToUser("Reguesting top10 list from server");
 }
 
 
@@ -165,7 +165,7 @@ void HttpClient::requestCategories()
     currentDownload = netManager->post(request, ("data=" ));
     connect(currentDownload,SIGNAL(finished()),this,SLOT(ackOfCategories()));
     //connect(currentDownload,SIGNAL(error(QNetworkReply::NetworkError)),myMainw,SLOT(errorFromServer(QNetworkReply::NetworkError)));
-    //myMainw->setLabelInfoToUser("Reguesting categories from server");
+    myMainw->topResultDialog->setLabelInfoToUser("Reguesting categories from server");
 }
 
 
@@ -189,7 +189,7 @@ void HttpClient::checkLogin()
     currentDownload = netManager->post(request, ("data=" ));
     connect(currentDownload,SIGNAL(finished()),this,SLOT(ackOfLogin()));
     //connect(currentDownload,SIGNAL(error(QNetworkReply::NetworkError)),myMainw,SLOT(errorFromServer(QNetworkReply::NetworkError)));
-    //myMainw->setLabelInfoToUser("Checking login validity from server");
+    myMainw->settingsDialog->setLabelInfoToUser("Checking login validity from server");
 }
 
 
@@ -200,7 +200,7 @@ void HttpClient::ackOfResult()
 {
     qDebug() << "_ackOfResult";
 
-    //myMainw->setLabelInfoToUser("");
+    myMainw->resultDialog->setLabelInfoToUser("");
 
     QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());
 
@@ -208,11 +208,11 @@ void HttpClient::ackOfResult()
     errorcode = reply->error();
     if(errorcode != 0) {
         qDebug() <<  "errorcode:" << errorcode << reply->errorString();
-        //QMessageBox::about(myMainw, "Server reply to result sending ",reply->errorString());
+        QMessageBox::about(myMainw->resultDialog, "Server reply to result sending ",reply->errorString());
     }
     else {
         qDebug() << "errorcode:" << errorcode << reply->errorString();
-        //QMessageBox::about(myMainw, "Server reply to result sending", "Result received " + reply->readAll());
+        //QMessageBox::about(myMainw->resultDialog, "Server reply to result sending", "Result received " + reply->readAll());
     }
 }
 
@@ -223,7 +223,7 @@ void HttpClient::ackOfRoute()
 {
     qDebug() << "_ackOfRoute";
 
-    //myMainw->setLabelInfoToUser("");
+    myMainw->routeDialog->setLabelInfoToUser("");
 
     QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());
 
@@ -231,7 +231,7 @@ void HttpClient::ackOfRoute()
     errorcode = reply->error();
     if(errorcode != 0) {
         qDebug() <<  "errorcode:" << errorcode << reply->errorString();
-        //QMessageBox::about(myMainw, "Server reply to route sending ",reply->errorString());
+        QMessageBox::about(myMainw->routeDialog, "Server reply to route sending ",reply->errorString());
     }
     else {
         qDebug() << "errorcode:" << errorcode << reply->errorString();
@@ -247,7 +247,7 @@ void HttpClient::ackOfRegistration()
 {
     qDebug() << "_ackOfRegistration";
 
-    //myMainw->setLabelInfoToUser("");
+    myMainw->settingsDialog->setLabelInfoToUser("");
 
     QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());
 
@@ -255,11 +255,11 @@ void HttpClient::ackOfRegistration()
     errorcode = reply->error();
     if(errorcode != 0) {
         qDebug() <<  "errorcode:" << errorcode << reply->errorString();
-        //QMessageBox::about(myMainw, "Server reply to registration",reply->readAll());
+        QMessageBox::about(myMainw->settingsDialog, "Server reply to registration",reply->readAll());
     }
     else {
         qDebug() << "errorcode=0" << errorcode << reply->errorString();
-        //QMessageBox::about(myMainw, "Server reply to registration", "User registration " + reply->readAll());
+        //QMessageBox::about(myMainw->settingsDialog, "Server reply to registration", "User registration " + reply->readAll());
     }
 }
 
@@ -271,7 +271,7 @@ void HttpClient::ackOfCategories()
 {
     qDebug() << "_ackOfCategories";
 
-    //myMainw->setLabelInfoToUser("");
+    myMainw->topResultDialog->setLabelInfoToUser("");
 
     QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());
     myXmlreader->xmlReadCategories(reply);
@@ -280,11 +280,11 @@ void HttpClient::ackOfCategories()
     errorcode = reply->error();
     if(errorcode != 0) {
         qDebug() <<  "errorcode:" << errorcode << reply->errorString();
-        //QMessageBox::about(myMainw, "Server reply to requesting categories",reply->errorString());
+        QMessageBox::about(myMainw->topResultDialog, "Server reply to requesting categories",reply->errorString());
     }
     else {
         qDebug() <<  "errorcode:" << errorcode << reply->errorString();
-        //QMessageBox::about(myMainw, "Server reply to requesting categories ", "OK");
+        //QMessageBox::about(myMainw->topResultDialog, "Server reply to requesting categories ", "OK");
     }
 }
 
@@ -296,7 +296,7 @@ void HttpClient::ackOfLogin()
 {
     qDebug() << "_ackOffLogin";
 
-    //myMainw->setLabelInfoToUser("");
+    myMainw->settingsDialog->setLabelInfoToUser("");
 
     QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());
 
@@ -304,12 +304,14 @@ void HttpClient::ackOfLogin()
     errorcode = reply->error();
     if(errorcode != 0) {
         qDebug() <<  "errorcode:" << errorcode << reply->errorString();
-        //QMessageBox::about(myMainw, "Server does not recognize your username. Please registrate.",reply->errorString());
+        QMessageBox::about(myMainw->settingsDialog, "Server does not recognize your username. Please registrate.",reply->errorString());
     }
     else {
         qDebug() <<  "errorcode:" << errorcode << reply->errorString();
-        //QMessageBox::about(myMainw, "Server reply to login", "User login " + reply->readAll());
+        //QMessageBox::about(myMainw->settingsDialog, "Server reply to login", "User login " + reply->readAll());
     }
+
+    myMainw->settingsDialog->close();
 }
 
 
@@ -352,11 +354,11 @@ void HttpClient::ackOfToplist()
     errorcode = reply->error();
     if(errorcode != 0) {
         qDebug() <<  "errorcode:" << errorcode << reply->errorString();
-        //QMessageBox::about(myMainw, "Server reply to requesting top 10 list",reply->errorString());
+        QMessageBox::about(myMainw->topResultDialog, "Server reply to requesting top 10 list",reply->errorString());
     }
     else {
         qDebug() <<  "errorcode:" << errorcode << reply->errorString();
-        //QMessageBox::about(myMainw, "Server reply to requesting top 10 list", "OK " + reply->readAll());
+        //QMessageBox::about(myMainw->topResultDialog, "Server reply to requesting top 10 list", "OK " + reply->readAll());
     }
 }
 
index 3f33cb9..bb1e671 100644 (file)
@@ -25,19 +25,24 @@ MainWindow::MainWindow(QWidget *parent) :
     QCoreApplication::setOrganizationDomain("fudeco.com");
     QCoreApplication::setApplicationName("Speed Freak");
 
+    routeDialog = new RouteDialog;
+    accstart = NULL;
+
     creditsDialog = new CreditsDialog;
     routeSaveDialog = new RouteSaveDialog;
+    routeDialog = new RouteDialog;
+    connect(routeDialog,SIGNAL(sendroute()),this,SLOT(clientSendRoute()));
     settingsDialog = new SettingsDialog;
-    connect(settingsDialog,SIGNAL(sendregistration()),this,SLOT(regUserToServer()));
-    connect(settingsDialog,SIGNAL(userNameChanged()),this,SLOT(userLogin()));
+    connect(settingsDialog,SIGNAL(sendregistration()),this,SLOT(clientRegUserToServer()));
+    connect(settingsDialog,SIGNAL(userNameChanged()),this,SLOT(clientUserLogin()));
     topResultDialog = new TopResultDialog;
     connect(topResultDialog, SIGNAL(refreshCategoryList()), this, SLOT(clientRequestCategoryList()));
     connect(topResultDialog, SIGNAL(refreshTopList(int)), this, SLOT(clientRequestTopList(int)));
-    accstart = NULL;
-
     httpClient = new HttpClient(this);
     connect(httpClient->myXmlreader, SIGNAL(receivedCategoryList()), this, SLOT(setCategoryCompoBox()));
     connect(httpClient->myXmlreader, SIGNAL(receivedTop10List()), this, SLOT(showTop10()));
+    resultDialog = new ResultDialog;
+    connect(resultDialog, SIGNAL(sendResult(double)), this, SLOT(clientSendResult(double)));
 
     welcomeDialog = new WelcomeDialog;
     welcomeDialog->show();
@@ -61,6 +66,7 @@ MainWindow::~MainWindow()
 {
     delete ui;
     delete routeSaveDialog;
+    delete routeDialog;
 
     if(accstart)
         delete accstart;
@@ -78,26 +84,41 @@ void MainWindow::changeEvent(QEvent *e)
     }
 }
 
+/**
+  * This slot function opens browser to project www page.
+  */
 void MainWindow::on_pushButtonWWW_clicked()
 {
     QDesktopServices::openUrl(QUrl("http://garage.maemo.org/projects/speedfreak/"));
 }
 
+/**
+  * This slot function opens the credits dialog
+  */
 void MainWindow::on_pushButtonCredits_clicked()
 {
     creditsDialog->show();
 }
 
+/**
+  * This slot function opens the route save dialog
+  */
 void MainWindow::on_pushButtonRoute_clicked()
 {
     routeSaveDialog->show();
 }
 
+/**
+  * This slot function opens the settings dialog
+  */
 void MainWindow::on_pushButtonSettings_clicked()
 {
     settingsDialog->show();
 }
 
+/**
+  * This slot function opens the acceleration dialog
+  */
 void MainWindow::on_pushButtonAccelerate_clicked()
 {
     if(!accstart)
@@ -105,6 +126,9 @@ void MainWindow::on_pushButtonAccelerate_clicked()
     accstart->show();
 }
 
+/**
+  * This slot function opens the top results dialog
+  */
 void MainWindow::on_pushButtonResults_clicked()
 {
     topResultDialog->show();
@@ -123,7 +147,6 @@ void MainWindow::clientRequestCategoryList()
   */
 void MainWindow::clientRequestTopList(int index)
 {
-    qDebug() << "index" << index << httpClient->myXmlreader->myCategoryList->getRecentCategory(index);
     QString limit = QString::number(topResultDialog->getLimitNr());
     httpClient->requestTopList(httpClient->myXmlreader->myCategoryList->getRecentCategory(index), limit);
 }
@@ -134,7 +157,6 @@ void MainWindow::clientRequestTopList(int index)
   */
 void MainWindow::setCategoryCompoBox()
 {
-    qDebug() << "_setCategoryCompoBox";
     topResultDialog->setCompoBoxCategories(httpClient->myXmlreader->myCategoryList->getCategoryList());
 }
 
@@ -144,7 +166,6 @@ void MainWindow::setCategoryCompoBox()
   */
 void MainWindow::showTop10()
 {
-    qDebug() << "_showTop10";
     int ind = topResultDialog->getRecentCategoryIndex();
     setListViewTopList(httpClient->myXmlreader->myCategoryList->getRecentCategory(ind), topResultDialog->getLimitNr());
 }
@@ -156,18 +177,32 @@ void MainWindow::showTop10()
   */
 void MainWindow::setListViewTopList(QString category, int size)
 {
-    qDebug() << "_setListViewTopList" << category;
     QString topList;
     topList.append(httpClient->myXmlreader->myCategoryList->getTopList(category, size));
     topResultDialog->showTopList(topList);
 }
 
-void MainWindow::regUserToServer()
+void MainWindow::clientRegUserToServer()
 {
     httpClient->requestRegistration();
 }
 
-void MainWindow::userLogin()
+/**
+  * This function performs login to server
+  */
+void MainWindow::clientUserLogin()
 {
     httpClient->checkLogin();
 }
+
+void MainWindow::clientSendRoute()
+{
+    httpClient->sendRouteXml();
+}
+
+void MainWindow::clientSendResult(double result)
+{
+    if(accstart) {
+        httpClient->sendResultXml(accstart->getMeasureCategory(), result);
+    }
+}
index f05a62c..58975a4 100644 (file)
 #include <QMessageBox>
 #include "creditsdialog.h"
 #include "routesavedialog.h"
+#include "routedialog.h"
 #include "welcomedialog.h"
 #include "settingsdialog.h"
 #include "accelerationstart.h"
 #include "topresultdialog.h"
 #include "httpclient.h"
+#include "routedialog.h"
+#include "resultdialog.h"
+
 
 namespace Ui {
     class MainWindow;
@@ -34,11 +38,13 @@ public:
 
     CreditsDialog *creditsDialog;
     RouteSaveDialog *routeSaveDialog;
+    RouteDialog *routeDialog;
     WelcomeDialog *welcomeDialog;
     SettingsDialog *settingsDialog;
     accelerationstart* accstart;
     TopResultDialog *topResultDialog;
     HttpClient *httpClient;
+    ResultDialog *resultDialog;
 
 protected:
     void changeEvent(QEvent *e);
@@ -56,10 +62,12 @@ private slots:
     void on_pushButtonWWW_clicked();
     void clientRequestCategoryList();
     void clientRequestTopList(int index);
+    void clientSendRoute();
+    void clientRegUserToServer();
+    void clientUserLogin();
+    void clientSendResult(double result);
     void setCategoryCompoBox();
     void showTop10();
-    void regUserToServer();
-    void userLogin();
 };
 
 #endif // MAINWINDOW_H
index a9cc987..7e248ae 100644 (file)
      </size>
     </property>
    </widget>
+   <widget class="QLabel" name="label">
+    <property name="geometry">
+     <rect>
+      <x>270</x>
+      <y>280</y>
+      <width>461</width>
+      <height>121</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string/>
+    </property>
+    <property name="pixmap">
+     <pixmap resource="graphics.qrc">:/new/prefix1/Graphics/speedfreak.png</pixmap>
+    </property>
+    <property name="scaledContents">
+     <bool>true</bool>
+    </property>
+   </widget>
   </widget>
   <widget class="QMenuBar" name="menuBar">
    <property name="geometry">
      <x>0</x>
      <y>0</y>
      <width>800</width>
-     <height>27</height>
+     <height>25</height>
     </rect>
    </property>
   </widget>
index 3c8c54e..f505348 100644 (file)
@@ -29,6 +29,7 @@ const int DIAGRAMGAP100KMH = 30;
 
 const int DIAGRAMGAP5S = 80;
 const int DIAGRAMGAP10S = 40;
+const int DIAGRAMGAP16S = 25;
 const int DIAGRAMGAP20S = 20;
 
 const QPoint diagramStemStart(70, 330);
@@ -122,6 +123,18 @@ void ResultDialog::paintEvent(QPaintEvent *)
     painter.setPen(QPen((Qt::darkCyan),2));
     painter.drawLine(diagramStemStart, diagramStemEnd);
     painter.drawLine(diagramHorizontalStart, diagramHorizontalEnd);
+    painter.drawText(diagramStemStart.x() - 50, diagramStemEnd.y() + 100, "S");
+    painter.drawText(diagramStemStart.x() - 50, diagramStemEnd.y() + 115, "P");
+    painter.drawText(diagramStemStart.x() - 50, diagramStemEnd.y() + 130, "E");
+    painter.drawText(diagramStemStart.x() - 50, diagramStemEnd.y() + 145, "E");
+    painter.drawText(diagramStemStart.x() - 50, diagramStemEnd.y() + 160, "D");
+    painter.drawText(diagramStemStart.x() - 65, diagramStemEnd.y() + 180, "(km/h)");
+
+    painter.drawText(diagramStemStart.x() + 140, diagramStemStart.y() + 40, "T");
+    painter.drawText(diagramStemStart.x() + 150, diagramStemStart.y() + 40, "I");
+    painter.drawText(diagramStemStart.x() + 155, diagramStemStart.y() + 40, "M");
+    painter.drawText(diagramStemStart.x() + 165, diagramStemStart.y() + 40, "E");
+    painter.drawText(diagramStemStart.x() + 180, diagramStemStart.y() + 40, "(s)");
 
     int currentX = 0;
     int currentY = diagramStemStart.y();
@@ -314,6 +327,12 @@ void ResultDialog::on_pushButtonSend_clicked()
   */
 void ResultDialog::setEnd(int pValue)
 {
+    for (int i = 0; i < 11; i++)
+    {
+        timeArray[i] = 0;
+    }
+    resultString = "";
+
     switch (pValue)
     {
     case 10:
@@ -370,16 +389,21 @@ void ResultDialog::setEnd(int pValue)
 void ResultDialog::setValue(int pSpeed, double pTime)
 {
     //timeArray[0] = 0;
-    if (floor(pTime) <= 5)
+    if (pTime <= 5.0)
     {
         this->diagramGapHorizontal = DIAGRAMGAP5S;
     }
 
-    else if (floor(pTime) <= 10)
+    else if (pTime <= 10.0)
     {
        this->diagramGapHorizontal = DIAGRAMGAP10S;
     }
 
+    else if (pTime <= 16.0)
+    {
+        this->diagramGapHorizontal = DIAGRAMGAP16S;
+    }
+
     else
     {
         this->diagramGapHorizontal = DIAGRAMGAP20S;
@@ -438,63 +462,75 @@ void ResultDialog::setHeaders()
     //QString resultString;
     resultString.append("Time was ");
 
+    QString time;
+
     if (this->diagramGapStem == DIAGRAMGAP100KMH)
     {
-        resultString.append(QString::number(timeArray[10]));
+        time.sprintf("%.2f", timeArray[10]);
+        resultString.append(time);
         this->setWindowTitle("Result for accelerating 100 km/h");
     }
 
     else if (this->diagramGapStem == DIAGRAMGAP90KMH)
     {
-        resultString.append(QString::number(timeArray[9]));
+        time.sprintf("%.2f", timeArray[9]);
+        resultString.append(time);
         this->setWindowTitle("Result for accelerating 90 km/h");
     }
 
     else if (this->diagramGapStem == DIAGRAMGAP80KMH)
     {
-        resultString.append(QString::number(timeArray[8]));
+        time.sprintf("%.2f", timeArray[8]);
+        resultString.append(time);
         this->setWindowTitle("Result for accelerating 80 km/h");
     }
 
     else if (this->diagramGapStem == DIAGRAMGAP70KMH)
     {
-        resultString.append(QString::number(timeArray[7]));
+        time.sprintf("%.2f", timeArray[7]);
+        resultString.append(time);
         this->setWindowTitle("Result for accelerating 70 km/h");
     }
 
     else if (this->diagramGapStem == DIAGRAMGAP60KMH)
     {
-        resultString.append(QString::number(timeArray[6]));
+        time.sprintf("%.2f", timeArray[6]);
+        resultString.append(time);
         this->setWindowTitle("Result for accelerating 60 km/h");
     }
 
     else if (this->diagramGapStem == DIAGRAMGAP50KMH)
     {
-        resultString.append(QString::number(timeArray[5]));
+        time.sprintf("%.2f", timeArray[5]);
+        resultString.append(time);
         this->setWindowTitle("Result for accelerating 50 km/h");
     }
 
     else if (this->diagramGapStem == DIAGRAMGAP40KMH)
     {
-        resultString.append(QString::number(timeArray[4]));
+        time.sprintf("%.2f", timeArray[4]);
+        resultString.append(time);
         this->setWindowTitle("Result for accelerating 40 km/h");
     }
 
     else if (this->diagramGapStem == DIAGRAMGAP30KMH)
     {
-        resultString.append(QString::number(timeArray[3]));
+        time.sprintf("%.2f", timeArray[3]);
+        resultString.append(time);
         this->setWindowTitle("Result for accelerating 30 km/h");
     }
 
     else if (this->diagramGapStem == DIAGRAMGAP20KMH)
     {
-        resultString.append(QString::number(timeArray[2]));
+        time.sprintf("%.2f", timeArray[2]);
+        resultString.append(time);
         this->setWindowTitle("Result for accelerating 20 km/h");
     }
 
     else
     {
-        resultString.append(QString::number(timeArray[1]));
+        time.sprintf("%.2f", timeArray[1]);
+        resultString.append(time);
         this->setWindowTitle("Result for accelerating 10 km/h");
     }
 }
@@ -706,3 +742,9 @@ int ResultDialog::getTargetChoice()
     }
     return targetChoice;
 }
+
+void ResultDialog::setLabelInfoToUser(QString infoText)
+{
+    this->ui->labelInfoToUser->setText(infoText);
+}
+
index 6f19c38..e8828c7 100644 (file)
@@ -24,9 +24,10 @@ public:
 
     void setEnd(int pValue);
     void setValue(int pSpeed, double pTime);
+    void setLabelInfoToUser(QString infoText);
 
 signals:
-    void sendresult(double result);
+    void sendresult(double);
 
 protected:
     void changeEvent(QEvent *e);
index 7d63fe7..6bd68bb 100644 (file)
     <string>New run</string>
    </property>
   </widget>
+  <widget class="QLabel" name="labelInfoToUser">
+   <property name="geometry">
+    <rect>
+     <x>10</x>
+     <y>310</y>
+     <width>471</width>
+     <height>51</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string/>
+   </property>
+  </widget>
  </widget>
  <resources/>
  <connections/>
index ff55de2..6edb716 100644 (file)
@@ -362,7 +362,7 @@ void RouteDialog::paintEvent(QPaintEvent *)
         painter.drawEllipse( x1Screen-5, y1Screen-5, 10, 10);
 
         QString jono;
-        jono = QString("%1 m/s").arg(maxv);
+        jono = QString("%1 km/h").arg(maxv);
         ui->speedValueLabel->setText(jono);
     }
 }
@@ -373,10 +373,11 @@ bool RouteDialog::readRouteFromFile( QString &routeFile)
     QString rivi;
     QFile file;
 
-    QString fileName = QFileDialog::getOpenFileName(this,
-         tr("Read Route"), "./", tr("Route Files (*.txt)"));
+    //QString fileName = QFileDialog::getOpenFileName(this,
+    //     tr("Read Route"), "./", tr("Route Files (*.txt)"));
 
-    file.setFileName( fileName);
+    //file.setFileName( fileName);
+    file.setFileName( "routetemp.xml");
     if (!file.open(QIODevice::ReadOnly))
     {
         QMessageBox::about(0, "Error", "File not found");
@@ -384,18 +385,65 @@ bool RouteDialog::readRouteFromFile( QString &routeFile)
     }
 
     vertexList.clear();
+
     while(!file.atEnd())
     {
+        int count;
+        bool allRead;
+        QString astr1, astr2, astr3, astr4;
         QString str1, str2, str3, str4;
         rivi = file.readLine();
 
+        allRead = false;
+        count = 0;
+        while( !allRead)
+        {
+            astr1 = rivi.section(" ", count*4+1, count*4+1); // latitude=""
+            astr2 = rivi.section(" ", count*4+2, count*4+2); // longitude=""
+            astr3 = rivi.section(" ", count*4+3, count*4+3); // altitude=""
+            astr4 = rivi.section(" ", count*4+4, count*4+4); // speed=""
+
+            {
+                double x, y, z, v;
+                str1 = astr1.section('"',1,1);
+                str2 = astr2.section('"',1,1);
+                str3 = astr3.section('"',1,1);
+                str4 = astr4.section('"',1,1);
+            //QString str = QString("%1 %2 %3 %4").arg(str1).arg(str2).arg(str3).arg(str4);
+            //QMessageBox::about(0, "LUKEE", str);
+                /* */
+
+                if (str1.length() > 0)
+                {
+                    x = str2.toDouble();// latitude y-value
+                    y = str1.toDouble();// longitude x-value
+                    z = str3.toDouble();// altitude z-value
+                    v = str4.toDouble();// speed km/h
+               // QString str = QString("%1 %2 %3 %4").arg(x).arg(y).arg(z).arg(v);
+               // QMessageBox::about(0, "LUKEE", str);
+                    temp.setX( x); // Longitude
+                    temp.setY( y); // Latitude
+                    temp.setZ( z); // altitude
+                    temp.setV( v);
+
+                    vertexList.append(temp);
+                    count++;
+                }
+                else
+                {
+                    allRead = true;
+                }
+            }
+        }
+        // Older version
+        /*
         str1 = rivi.section(" ", 0, 0);
         if (str1.compare("Start:") != 0 && str1.compare("Stop:") != 0)
         {
             str1 = rivi.section(" ", 2, 2); // latitude y-value
             str2 = rivi.section(" ", 4, 4); // longitude x-value
             str3 = rivi.section(" ", 6, 6); // altitude z-value
-            str4 = rivi.section(" ", 8, 8); // speed m/s
+            str4 = rivi.section(" ", 8, 8); // speed km/h
             //QString str = QString("la: %1 lo: %2 al: %3").arg(str1).arg(str2).arg(str3);
             //QMessageBox::about(0, "LUKEE", str);
 
@@ -414,6 +462,7 @@ bool RouteDialog::readRouteFromFile( QString &routeFile)
                 vertexList.append(temp);
             }
         }
+        */
     }
 
     file.close();
@@ -694,5 +743,10 @@ void RouteDialog::on_newPushButton_clicked()
 
 void RouteDialog::on_sendPushButton_clicked()
 {
-    // Send route points file to server
+    emit sendroute();
+}
+
+void RouteDialog::setLabelInfoToUser(QString infoText)
+{
+    this->ui->labelInfoToUser->setText(infoText);
 }
index bea6150..708e74a 100644 (file)
@@ -25,6 +25,10 @@ public:
     int getTop();
     int getRight();
     int getBottom();
+    void setLabelInfoToUser(QString infoText);
+
+signals:
+    void sendroute();
 
 protected:
     void changeEvent(QEvent *e);
index cdf0dba..563cd7c 100644 (file)
     </item>
    </layout>
   </widget>
+  <widget class="QLabel" name="labelInfoToUser">
+   <property name="geometry">
+    <rect>
+     <x>10</x>
+     <y>310</y>
+     <width>521</width>
+     <height>51</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string/>
+   </property>
+  </widget>
  </widget>
  <resources>
   <include location="graphics.qrc"/>
index 9f81e91..fd9853f 100644 (file)
@@ -116,7 +116,12 @@ void RouteSaveDialog::on_buttonRouteStartStop_clicked()
         ui->labelRoutePicture->setVisible(0);
         timerRoutePicture->stop();
         location->stopPollingGPS();
-        routeDialog->show();
+
+        QString routeFile = QString("routetemp.xml");
+        if (routeDialog->readRouteFromFile( routeFile) == true)
+        {
+            routeDialog->show();
+        }
 
         //GPS speed label
         ui->labelGpsSpeed->setVisible(0);
index 51d3565..b619576 100644 (file)
@@ -16,7 +16,7 @@ SettingsDialog::SettingsDialog(QWidget *parent) :
 {
     ui->setupUi(this);
     this->setWindowTitle("Settings");
-    this->ui->regEMailLineEdit->setText("@meili.fi");
+    this->ui->regEMailLineEdit->setText("@");
     instructionsDialog = new InstructionsDialog;
 
     if (loginSaved())
@@ -72,7 +72,7 @@ void SettingsDialog::on_registratePushButton_clicked()
 
     emit sendregistration();
 
-    close();
+    //close();      //using close() hides popup-window which reports error from server
 }
 
 // Next 6 functions can be removed if Settingsdialog is implemented without
@@ -129,7 +129,8 @@ void SettingsDialog::on_setUserPushButton_clicked()
     }
 
     emit userNameChanged();
-    close();
+
+    //close();  //using close() hides popup-window which reports error from server
 }
 
 // Next 4 functions can be removed if Settingsdialog is implemented without
@@ -154,3 +155,7 @@ QString SettingsDialog::getPassword()
     return this->password;
 }
 
+void SettingsDialog::setLabelInfoToUser(QString infoText)
+{
+    this->ui->labelInfoToUser->setText(infoText);
+}
index b6fdd8b..b496c41 100644 (file)
@@ -32,6 +32,7 @@ public:
     void setPassword(QString password);
     QString getUserName();
     QString getPassword();
+    void setLabelInfoToUser(QString infoText);
 
 signals:
     void sendregistration();
index cd151b6..0ce677d 100644 (file)
@@ -16,9 +16,9 @@
   <widget class="QPushButton" name="pushButtonHelp">
    <property name="geometry">
     <rect>
-     <x>280</x>
-     <y>300</y>
-     <width>241</width>
+     <x>520</x>
+     <y>310</y>
+     <width>221</width>
      <height>51</height>
     </rect>
    </property>
@@ -47,9 +47,9 @@
   <widget class="QPushButton" name="setUserPushButton">
    <property name="geometry">
     <rect>
-     <x>550</x>
-     <y>240</y>
-     <width>191</width>
+     <x>520</x>
+     <y>220</y>
+     <width>221</width>
      <height>51</height>
     </rect>
    </property>
@@ -78,9 +78,9 @@
   <widget class="QPushButton" name="registratePushButton">
    <property name="geometry">
     <rect>
-     <x>550</x>
-     <y>120</y>
-     <width>191</width>
+     <x>520</x>
+     <y>60</y>
+     <width>221</width>
      <height>51</height>
     </rect>
    </property>
     <string>Register</string>
    </property>
   </widget>
-  <widget class="QWidget" name="">
+  <widget class="QWidget" name="layoutWidget">
    <property name="geometry">
     <rect>
      <x>10</x>
      <y>50</y>
-     <width>531</width>
+     <width>491</width>
      <height>121</height>
     </rect>
    </property>
     </item>
    </layout>
   </widget>
-  <widget class="QWidget" name="">
+  <widget class="QWidget" name="layoutWidget">
    <property name="geometry">
     <rect>
      <x>10</x>
      <y>210</y>
-     <width>531</width>
+     <width>491</width>
      <height>81</height>
     </rect>
    </property>
     </item>
    </layout>
   </widget>
+  <widget class="QLabel" name="labelInfoToUser">
+   <property name="geometry">
+    <rect>
+     <x>10</x>
+     <y>310</y>
+     <width>521</width>
+     <height>51</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string/>
+   </property>
+  </widget>
  </widget>
  <resources/>
  <connections/>
index ef4478b..245646f 100644 (file)
@@ -36,11 +36,6 @@ void TopResultDialog::on_buttonTopRefresh_clicked()
     emit refreshCategoryList();
 }
 
-void TopResultDialog::on_pushButton_debclose_clicked()
-{
-    close();
-}
-
 void TopResultDialog::setCompoBoxCategories(QStringList list)
 {
     ui->comboBoxTopCategory->addItems(list);
@@ -71,3 +66,8 @@ void TopResultDialog::on_comboBoxTopCategory_currentIndexChanged(int index)
     recentCategoryIndex = index;
     emit refreshTopList(index);
 }
+
+void TopResultDialog::setLabelInfoToUser(QString infoText)
+{
+    this->ui->labelInfoToUser->setText(infoText);
+}
index a46b916..8fad9e8 100644 (file)
@@ -17,6 +17,7 @@ public:
     int getRecentCategoryIndex();
     int getLimitNr();
     void setLimitNr(int number);
+    void setLabelInfoToUser(QString infoText);
 
 protected:
     void changeEvent(QEvent *e);
@@ -32,7 +33,6 @@ private:
 
 private slots:
     void on_comboBoxTopCategory_currentIndexChanged(int index);
-    void on_pushButton_debclose_clicked();
     void on_buttonTopRefresh_clicked();
 
 };
index 8a77ac7..79b110e 100644 (file)
   <widget class="QListView" name="listViewTopList">
    <property name="geometry">
     <rect>
-     <x>300</x>
+     <x>280</x>
      <y>0</y>
-     <width>471</width>
-     <height>261</height>
+     <width>491</width>
+     <height>251</height>
     </rect>
    </property>
    <property name="font">
   <widget class="QLabel" name="labelTopList">
    <property name="geometry">
     <rect>
-     <x>320</x>
+     <x>300</x>
      <y>0</y>
-     <width>431</width>
-     <height>261</height>
+     <width>451</width>
+     <height>251</height>
     </rect>
    </property>
    <property name="font">
     <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
    </property>
   </widget>
-  <widget class="QPushButton" name="pushButton_debclose">
-   <property name="geometry">
-    <rect>
-     <x>10</x>
-     <y>20</y>
-     <width>91</width>
-     <height>27</height>
-    </rect>
-   </property>
-   <property name="text">
-    <string>PushButtondebclose</string>
-   </property>
-  </widget>
   <widget class="QLabel" name="labelCategory">
    <property name="geometry">
     <rect>
      <x>10</x>
-     <y>210</y>
+     <y>200</y>
      <width>221</width>
      <height>51</height>
     </rect>
    <property name="geometry">
     <rect>
      <x>10</x>
-     <y>269</y>
+     <y>260</y>
      <width>601</width>
      <height>41</height>
     </rect>
    </property>
   </widget>
+  <widget class="QLabel" name="labelInfoToUser">
+   <property name="geometry">
+    <rect>
+     <x>10</x>
+     <y>310</y>
+     <width>521</width>
+     <height>51</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string/>
+   </property>
+  </widget>
  </widget>
  <resources/>
  <connections/>