Acceleration dialogs added.
[speedfreak] / Client / mainwindow.cpp
1 /*
2  * Mainwindow for speedFreak project
3  *
4  * @author      Rikhard Kuutti <rikhard.kuutti@fudeco.com>
5  * @copyright   (c) 2010 Speed Freak team
6  * @license     http://opensource.org/licenses/gpl-license.php GNU Public License
7  */
8
9 #include "mainwindow.h"
10 #include "ui_mainwindow.h"
11
12 #include <QDesktopServices>
13 #include <QUrl>
14 #include <QSettings>
15
16 MainWindow::MainWindow(QWidget *parent) :
17     QMainWindow(parent),
18     ui(new Ui::MainWindow)
19 {
20     ui->setupUi(this);
21
22     QCoreApplication::setOrganizationName("Fudeco Oy");
23     QCoreApplication::setOrganizationDomain("fudeco.com");
24     QCoreApplication::setApplicationName("Speed Freak");
25
26     creditsDialog = new CreditsDialog;
27     routeSaveDialog = new RouteSaveDialog;
28     settingsDialog = new SettingsDialog;
29     accstart = NULL;
30
31     welcomeDialog = new WelcomeDialog;
32     welcomeDialog->show();
33 }
34
35 MainWindow::~MainWindow()
36 {
37     delete ui;
38
39     delete routeSaveDialog;
40
41     if(!accstart)
42         delete accstart;
43 }
44
45 void MainWindow::changeEvent(QEvent *e)
46 {
47     QMainWindow::changeEvent(e);
48     switch (e->type()) {
49     case QEvent::LanguageChange:
50         ui->retranslateUi(this);
51         break;
52     default:
53         break;
54     }
55 }
56
57 void MainWindow::on_pushButtonWWW_clicked()
58 {
59     QDesktopServices::openUrl(QUrl("http://garage.maemo.org/projects/speedfreak/"));
60 }
61
62 void MainWindow::on_pushButtonCredits_clicked()
63 {
64     creditsDialog->show();
65 }
66
67 void MainWindow::on_pushButtonRoute_clicked()
68 {
69     routeSaveDialog->show();
70 }
71
72 void MainWindow::on_pushButtonSettings_clicked()
73 {
74     settingsDialog->show();
75 }
76
77 void MainWindow::on_pushButtonAccelerate_clicked()
78 {
79     if(!accstart)
80         accstart = new accelerationstart(this);
81     accstart->show();
82 }