Added classes.
[speedfreak] / Client / mainwindow.cpp
index 02a7e54..a304463 100644 (file)
@@ -11,6 +11,8 @@
 
 #include <QDesktopServices>
 #include <QUrl>
+#include <QSettings>
+#include <QDebug>
 
 MainWindow::MainWindow(QWidget *parent) :
     QMainWindow(parent),
@@ -18,12 +20,32 @@ MainWindow::MainWindow(QWidget *parent) :
 {
     ui->setupUi(this);
 
+    QCoreApplication::setOrganizationName("Fudeco Oy");
+    QCoreApplication::setOrganizationDomain("fudeco.com");
+    QCoreApplication::setApplicationName("Speed Freak");
+
     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();
 }
 
 MainWindow::~MainWindow()
 {
     delete ui;
+
+    delete routeSaveDialog;
+
+    if(!accstart)
+        delete accstart;
 }
 
 void MainWindow::changeEvent(QEvent *e)
@@ -47,3 +69,43 @@ void MainWindow::on_pushButtonCredits_clicked()
 {
     creditsDialog->show();
 }
+
+void MainWindow::on_pushButtonRoute_clicked()
+{
+    routeSaveDialog->show();
+}
+
+void MainWindow::on_pushButtonSettings_clicked()
+{
+    settingsDialog->show();
+}
+
+void MainWindow::on_pushButtonAccelerate_clicked()
+{
+    if(!accstart)
+        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);
+}