Merge branch 'package'
[speedfreak] / Client / helpdialog.cpp
1 /*
2  * Help dialog
3  *
4  * @author     Janne Änäkkälä   <janne.anakkala@fudeco.com>
5  * @author     Toni Jussila     <toni.jussila@fudeco.com>
6  * @copyright  (c) 2010 Speed Freak team
7  * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
8  */
9
10 #include "helpdialog.h"
11 #include "ui_helpdialog.h"
12 #include <QDebug>
13
14 /**
15   * Default constructor of this class.
16   */
17 HelpDialog::HelpDialog(QWidget *parent) :
18     QDialog(parent),
19     ui(new Ui::HelpDialog)
20 {
21     ui->setupUi(this);
22     helpResultsDialog = NULL;
23     helpAccelerationDialog = NULL;
24     helpRoutingDialog = NULL;
25     creditsDialog = NULL;
26     helpSettingsDialog = NULL;
27     helpUsersDialog = NULL;
28 }
29
30 /**
31   * Default destructor of this class.
32   */
33 HelpDialog::~HelpDialog()
34 {
35     delete ui;
36 }
37
38 /**
39   *
40   */
41 void HelpDialog::changeEvent(QEvent *e)
42 {
43     QDialog::changeEvent(e);
44     switch (e->type()) {
45     case QEvent::LanguageChange:
46         ui->retranslateUi(this);
47         break;
48     default:
49         break;
50     }
51 }
52
53 /**
54   * This slot function called when ever help results button clicked.
55   */
56 void HelpDialog::on_pushButtonHelpResults_clicked()
57 {
58     if(!helpResultsDialog)
59     {
60         helpResultsDialog = new HelpResultsDialog;
61     }
62     connect(helpResultsDialog, SIGNAL(rejected()), this, SLOT(killHelpDialogs()));
63     helpResultsDialog->show();
64 }
65
66 /**
67   * This slot function called when ever help accelerate button clicked.
68   */
69 void HelpDialog::on_pushButtonHelpAccelerate_clicked()
70 {
71     if(!helpAccelerationDialog)
72     {
73         helpAccelerationDialog = new HelpAccelerationDialog;
74     }
75     connect(helpAccelerationDialog, SIGNAL(rejected()), this, SLOT(killHelpDialogs()));
76     helpAccelerationDialog->show();
77 }
78
79 /**
80   * This slot function called when ever help route button clicked.
81   */
82 void HelpDialog::on_pushButtonHelpRoute_clicked()
83 {
84     if(!helpRoutingDialog)
85     {
86         helpRoutingDialog = new HelpRoutingDialog;
87     }
88     connect(helpRoutingDialog, SIGNAL(rejected()), this, SLOT(killHelpDialogs()));
89     helpRoutingDialog->show();
90 }
91
92 /**
93   * This slot function called when ever credits button clicked.
94   */
95 void HelpDialog::on_pushButtonCredits_clicked()
96 {
97     if(!creditsDialog)
98     {
99         creditsDialog = new CreditsDialog;
100     }
101     connect(creditsDialog, SIGNAL(rejected()), this, SLOT(killHelpDialogs()));
102     creditsDialog->show();
103 }
104
105 /**
106   * This slot function called when ever help settings button clicked.
107   */
108 void HelpDialog::on_pushButtonHelpSettings_clicked()
109 {
110     if(!helpSettingsDialog)
111     {
112         helpSettingsDialog = new HelpSettingsDialog;
113     }
114     connect(helpSettingsDialog, SIGNAL(rejected()), this, SLOT(killHelpDialogs()));
115     helpSettingsDialog->show();
116 }
117
118 /**
119   * This slot function called when ever dialog rejected.
120   */
121 void HelpDialog::killHelpDialogs()
122 {
123     if(helpResultsDialog)
124     {
125         qDebug() << "__Help kill: helpResultsDialog";
126         delete helpResultsDialog;
127         helpResultsDialog = NULL;
128     }
129     if(helpAccelerationDialog)
130     {
131         qDebug() << "__Help kill: helpAccelerationDialog";
132         delete helpAccelerationDialog;
133         helpAccelerationDialog = NULL;
134     }
135     if(helpRoutingDialog)
136     {
137         qDebug() << "__Help kill: helpRoutingDialog";
138         delete helpRoutingDialog;
139         helpRoutingDialog = NULL;
140     }
141     if(creditsDialog)
142     {
143         qDebug() << "__Help kill: creditsDialog";
144         delete creditsDialog;
145         creditsDialog = NULL;
146     }
147
148     if(helpSettingsDialog)
149     {
150         qDebug() << "__Help kill: helpSettingsDialog";
151         delete helpSettingsDialog;
152         helpSettingsDialog = NULL;
153     }
154
155     if(helpUsersDialog)
156     {
157         qDebug() << "__Help kill: helpUsersDialog";
158         delete helpUsersDialog;
159         helpUsersDialog = NULL;
160     }
161 }
162
163 /**
164   * This slot function called when ever help users button clicked.
165   */
166 void HelpDialog::on_pushButtonHelpUsers_clicked()
167 {
168     if(!helpUsersDialog)
169     {
170         helpUsersDialog = new HelpUsersDialog;
171     }
172     connect(helpUsersDialog, SIGNAL(rejected()), this, SLOT(killHelpDialogs()));
173     helpUsersDialog->show();
174 }