Added classes.
[speedfreak] / Client / mainwindow.cpp
index 6ea222a..a304463 100644 (file)
@@ -12,6 +12,7 @@
 #include <QDesktopServices>
 #include <QUrl>
 #include <QSettings>
+#include <QDebug>
 
 MainWindow::MainWindow(QWidget *parent) :
     QMainWindow(parent),
@@ -26,8 +27,13 @@ MainWindow::MainWindow(QWidget *parent) :
     creditsDialog = new CreditsDialog;
     routeSaveDialog = new RouteSaveDialog;
     settingsDialog = new SettingsDialog;
+    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);
+
     welcomeDialog = new WelcomeDialog;
     welcomeDialog->show();
 }
@@ -80,3 +86,26 @@ void MainWindow::on_pushButtonAccelerate_clicked()
         accstart = new accelerationstart(this);
     accstart->show();
 }
+
+void MainWindow::on_pushButtonResults_clicked()
+{
+    topResultDialog->show();
+}
+
+/**
+  *This slot function is called when ever mytTopResultDialog emits signal refreshCategoryList button clicked.
+  */
+void MainWindow::clientRequestCategoryList()
+{
+    httpClient->requestCategories();
+}
+
+/**
+  *This slot function is called when ever mytTopResultDialog emits signal refreshTopList button clicked.
+  */
+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);
+}