Added measures.h and measures.cpp files. Changed resultdialog.h, .cpp and measuredial...
authorJanne Änäkkälä <Janne_anakkala@hotmail.com>
Thu, 4 Mar 2010 11:09:12 +0000 (13:09 +0200)
committerJanne Änäkkälä <Janne_anakkala@hotmail.com>
Thu, 4 Mar 2010 11:09:12 +0000 (13:09 +0200)
Now measure dialog gets speed and time from accelerometer and when speed is raised to 40km/h
result dialog opens. Result dialog draws now diagram with real values which has got from accelerometer.

Merge branch 'feature/UIcommwithAccele2'

Conflicts:
Client/UI.pro

1  2 
Client/UI.pro
Client/carmainwindow.cpp

diff --combined Client/UI.pro
@@@ -12,18 -12,14 +12,22 @@@ SOURCES += main.cpp 
      measuredialog.cpp \
      calculate.cpp \
      accelerometer.cpp \
 +    loginwindow.cpp \
 +    registration.cpp
+     measures.cpp
++
  HEADERS += carmainwindow.h \
      resultdialog.h \
      stringlistmodel.h \
      measuredialog.h \
      accelerometer.h \
      calculate.h \
 +    loginwindow.h \
 +    registration.h
+     measures.h
++
  FORMS += carmainwindow.ui \
      resultdialog.ui \
 -    measuredialog.ui
 +    measuredialog.ui \
 +    loginwindow.ui \
 +    registration.ui
diff --combined Client/carmainwindow.cpp
@@@ -1,11 -1,9 +1,11 @@@
  #include "carmainwindow.h"
  #include "ui_carmainwindow.h"
  #include "stringlistmodel.h"
 +#include "loginwindow.h"
  #include <QStandardItemModel>
  #include <QStringList>
  #include <QString>
 +#include <QNetworkRequest>
  
  /**
    *Constructor of this class.
@@@ -20,12 -18,6 +20,12 @@@ CarMainWindow::CarMainWindow(QWidget *p
      initUnitCompoBox();
      initSpeedListView();
      initCategoryCompoBox();
 +
 +    myLogin = new LoginWindow(this);
 +    myRegistration = new Registration(this);
 +    manager = new QNetworkAccessManager(this);
 +    connect(manager,SIGNAL(finished(QNetworkReply*)),this,SLOT(networkResponse(QNetworkReply*)));
 +
  }
  
  /**
@@@ -74,15 -66,12 +74,12 @@@ void CarMainWindow::on_listView_clicked
    */
  void CarMainWindow::on_autoStartButton_clicked()
  {
-     if(measure)
-     {
-         delete measure;
-         measure = NULL;
-         measure = new MeasureDialog();
-     }
  
-     connect(measure, SIGNAL(speedAchieved()), this, SLOT(openResultView()));
+     delete measure;
+     measure = NULL;
+     measure = new MeasureDialog();
  
+     connect(measure, SIGNAL(speedAchieved()), this, SLOT(openResultView()));
      // Show measure dialog.
      measure->show();
  }
@@@ -119,7 -108,7 +116,7 @@@ void CarMainWindow::setUnitCompoBox(QSt
    */
  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);
  }
@@@ -173,43 -162,7 +170,44 @@@ void CarMainWindow::on_comboBoxTopCateg
    */
  void CarMainWindow::openResultView()
  {
+     result->saveMeasuresToArray(measure->measures);
      // Show result dialog.
      result->show();
  }
 +
 +/**
 +  *This slot function is called when the server has finished guery.
 +  */
 +void CarMainWindow::networkResponse(QNetworkReply *reply)
 +{
 +}
 +
 +/**
 +  *This slot function is called when the user will to send data to server.
 +  */
 +void CarMainWindow::on_pushButton_clicked()
 +{
 +     QNetworkRequest postData;
 +     postData.setUrl(QString("http://weather.yahooapis.com/forecastrss?p=FIXX0013&u=c"));
 +     manager->get(postData);
 +
 +}
 +
 +/**
 +  *This slot function is called when login/logout button is clicked.
 +  */
 +void CarMainWindow::on_loginLogoutButton_clicked()
 +{
 +    //LoginWindow myLogin;
 +
 +    myLogin->show();
 +    //ui->loginLogoutButton->setText("logout");
 +}
 +
 +/**
 +  *This slot function is called when registrate button is clicked.
 +  */
 +void CarMainWindow::on_registratePushButton_clicked()
 +{
 +    myRegistration->show();
 +}