Conflict
[speedfreak] / Client / mainwindow.cpp
index bb1e671..8179fd7 100644 (file)
@@ -26,23 +26,26 @@ MainWindow::MainWindow(QWidget *parent) :
     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()));
+
+    helpDialog = NULL;
+    routeSaveDialog = NULL;
+
     settingsDialog = new SettingsDialog;
     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)));
+
     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)));
+
+    accstart = NULL;
+
+    //creditsDialog = new CreditsDialog;
 
     welcomeDialog = new WelcomeDialog;
     welcomeDialog->show();
@@ -97,7 +100,10 @@ void MainWindow::on_pushButtonWWW_clicked()
   */
 void MainWindow::on_pushButtonCredits_clicked()
 {
-    creditsDialog->show();
+    if(!helpDialog)
+        helpDialog = new HelpDialog;
+    helpDialog->show();
+    //creditsDialog->show();
 }
 
 /**
@@ -105,6 +111,9 @@ void MainWindow::on_pushButtonCredits_clicked()
   */
 void MainWindow::on_pushButtonRoute_clicked()
 {
+    if(!routeSaveDialog)
+        routeSaveDialog = new RouteSaveDialog;
+    connect(routeSaveDialog, SIGNAL(sendroute()), this, SLOT(clientSendRoute()));
     routeSaveDialog->show();
 }
 
@@ -123,6 +132,7 @@ void MainWindow::on_pushButtonAccelerate_clicked()
 {
     if(!accstart)
         accstart = new accelerationstart(this);
+    connect(accstart, SIGNAL(sendresult(QString, double)), this, SLOT(clientSendResult(QString, double)));
     accstart->show();
 }
 
@@ -182,6 +192,9 @@ void MainWindow::setListViewTopList(QString category, int size)
     topResultDialog->showTopList(topList);
 }
 
+/**
+  * This function
+  */
 void MainWindow::clientRegUserToServer()
 {
     httpClient->requestRegistration();
@@ -195,14 +208,22 @@ void MainWindow::clientUserLogin()
     httpClient->checkLogin();
 }
 
+/**
+  * This function send route to server
+  */
 void MainWindow::clientSendRoute()
 {
     httpClient->sendRouteXml();
 }
 
-void MainWindow::clientSendResult(double result)
+/**
+  * This function send acceleration data to server
+  */
+void MainWindow::clientSendResult(QString category, double result)
 {
+    qDebug() << "__clientSendResult";
     if(accstart) {
-        httpClient->sendResultXml(accstart->getMeasureCategory(), result);
+        qDebug() << "_clientSendResult, calling server";
+        httpClient->sendResultXml(category, result);
     }
 }