Added licence info for login & registration dialog source codes
[speedfreak] / Client / registration.cpp
1 /*
2  * Registration class to registrate username for user
3  *
4  * @author      Olavi Pulkkinen <olavi.pulkkinen@fudeco.com>
5  * @author
6  * @copyright   (c) 2010 Speed Freak team
7  * @license     http://opensource.org/licenses/gpl-license.php GNU Public License
8  */
9
10 #include "registration.h"
11 #include "ui_registration.h"
12 #include <QMessageBox>
13
14 Registration::Registration(QWidget *parent) :
15     QDialog(parent),
16     ui(new Ui::Registration)
17 {
18     ui->setupUi(this);
19     this->setWindowTitle("Registration for Speed Freak server");
20 }
21
22 Registration::~Registration()
23 {
24     delete ui;
25 }
26
27 void Registration::changeEvent(QEvent *e)
28 {
29     QDialog::changeEvent(e);
30     switch (e->type()) {
31     case QEvent::LanguageChange:
32         ui->retranslateUi(this);
33         break;
34     default:
35         break;
36     }
37 }
38
39 void Registration::on_registratePushButton_clicked()
40 {
41     //Let`s not type it again
42     ui->newUsernameLineEdit->setText("user123");
43     ui->newPasswordLineEdit->setText("salainen");
44     ui->eMailLineEdit->setText("user123@emaili.fi");
45
46     for(int i = 0; i < 3000; i++);
47
48     // Send username, password and email to SpeedFreak server
49     this->username = ui->newUsernameLineEdit->text();
50     this->password = ui->newPasswordLineEdit->text();
51     this->email = ui->eMailLineEdit->text();
52
53     emit sendregistration();
54
55     close();
56 }
57
58 void Registration::on_cancelPushButton_clicked()
59 {
60     close();
61 }
62
63 void Registration::setUserName(QString username)
64 {
65     this->username = username;
66 }
67
68 void Registration::setPassword(QString password)
69 {
70     this->password = password;
71 }
72
73 void Registration::setEmail(QString email)
74 {
75     this->email = email;
76 }
77
78 QString Registration::getUserName()
79 {
80     return this->username;
81 }
82
83 QString Registration::getPassword()
84 {
85     return this->password;
86 }
87
88 QString Registration::getEmail()
89 {
90     return this->email;
91 }