X-Git-Url: http://git.maemo.org/git/?p=speedfreak;a=blobdiff_plain;f=Client%2Fmainwindow.cpp;h=0b78399137b923beab3a93355d28d1ec0fcaba28;hp=64a5aa903b2bb8d4fb6006bf9a27c530436d68b7;hb=20d58825bd115adb8e56401a1055ff6d2a3c7850;hpb=afbc416a1a09e00162dd5ba4080cf7018b98208f diff --git a/Client/mainwindow.cpp b/Client/mainwindow.cpp index 64a5aa9..0b78399 100644 --- a/Client/mainwindow.cpp +++ b/Client/mainwindow.cpp @@ -25,20 +25,29 @@ MainWindow::MainWindow(QWidget *parent) : QCoreApplication::setOrganizationDomain("fudeco.com"); QCoreApplication::setApplicationName("Speed Freak"); - creditsDialog = new CreditsDialog; + routeDialog = new RouteDialog; + connect(routeDialog,SIGNAL(sendroute()),this,SLOT(clientSendRoute())); + routeSaveDialog = new RouteSaveDialog; + 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; + + accstart = NULL; + + creditsDialog = new CreditsDialog; + welcomeDialog = new WelcomeDialog; welcomeDialog->show(); @@ -53,14 +62,17 @@ MainWindow::MainWindow(QWidget *parent) : ui->pushButtonSettings->setStyleSheet("background-color: rgb(0, 0, 0); color: rgb(255, 255, 255)"); ui->pushButtonWWW->setAutoFillBackground(true); ui->pushButtonWWW->setStyleSheet("background-color: rgb(0, 0, 0); color: rgb(255, 255, 255)"); + ui->pushButtonCredits->setAutoFillBackground(true); + ui->pushButtonCredits->setStyleSheet("background-color: rgb(0, 0, 0); color: rgb(255, 255, 255)"); } MainWindow::~MainWindow() { delete ui; delete routeSaveDialog; + delete routeDialog; - if(!accstart) + if(accstart) delete accstart; } @@ -76,33 +88,52 @@ 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) accstart = new accelerationstart(this); + connect(accstart, SIGNAL(sendresult(QString, double)), this, SLOT(clientSendResult(QString, double))); accstart->show(); } +/** + * This slot function opens the top results dialog + */ void MainWindow::on_pushButtonResults_clicked() { topResultDialog->show(); @@ -121,7 +152,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); } @@ -132,7 +162,6 @@ void MainWindow::clientRequestTopList(int index) */ void MainWindow::setCategoryCompoBox() { - qDebug() << "_setCategoryCompoBox"; topResultDialog->setCompoBoxCategories(httpClient->myXmlreader->myCategoryList->getCategoryList()); } @@ -142,7 +171,6 @@ void MainWindow::setCategoryCompoBox() */ void MainWindow::showTop10() { - qDebug() << "_showTop10"; int ind = topResultDialog->getRecentCategoryIndex(); setListViewTopList(httpClient->myXmlreader->myCategoryList->getRecentCategory(ind), topResultDialog->getLimitNr()); } @@ -154,18 +182,47 @@ 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(); } + +/** + * This function send route to server + */ +void MainWindow::clientSendRoute() +{ + httpClient->sendRouteXml(); +} + +/** + * This function send acceleration data to server + */ +void MainWindow::clientSendResult(QString category, double result) +{ + /*QMessageBox msgBox; + msgBox.setWindowTitle("client send result!"); + msgBox.setText("client send result!"); + msgBox.setDefaultButton(QMessageBox::Ok); + msgBox.exec();*/ + + qDebug() << "__clientSendResult"; + if(accstart) { + qDebug() << "_clientSendResult, calling server"; + httpClient->sendResultXml(category, result); + //httpClient->sendResultXml(accstart->getMeasureCategory(), resultDialog->getResult()); + } +}