X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;ds=sidebyside;f=Client%2Fmainwindow.cpp;h=bb1e6719431fb7c444d08ffc5f601a09cbba3d70;hb=e1fb08eb319b50ddae0c5ce9a23a1ddfc6cc15d3;hp=4eeeca8d8eee2c7e906983d8b593cdcd4ebe8806;hpb=3234868e987a0a8bc3967631c2f16afc4419b8e3;p=speedfreak diff --git a/Client/mainwindow.cpp b/Client/mainwindow.cpp index 4eeeca8..bb1e671 100644 --- a/Client/mainwindow.cpp +++ b/Client/mainwindow.cpp @@ -26,19 +26,23 @@ 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())); 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(); @@ -80,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) @@ -107,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(); @@ -125,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); } @@ -136,7 +157,6 @@ void MainWindow::clientRequestTopList(int index) */ void MainWindow::setCategoryCompoBox() { - qDebug() << "_setCategoryCompoBox"; topResultDialog->setCompoBoxCategories(httpClient->myXmlreader->myCategoryList->getCategoryList()); } @@ -146,7 +166,6 @@ void MainWindow::setCategoryCompoBox() */ void MainWindow::showTop10() { - qDebug() << "_showTop10"; int ind = topResultDialog->getRecentCategoryIndex(); setListViewTopList(httpClient->myXmlreader->myCategoryList->getRecentCategory(ind), topResultDialog->getLimitNr()); } @@ -158,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); + } +}