Changed URLs. Added open/close to QBuffer buffers.
[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     //Let`s not type it again
22     ui->newUsernameLineEdit->setText("user123");
23     ui->newPasswordLineEdit->setText("salainen");
24     ui->eMailLineEdit->setText("user123@emaili.fi");
25 }
26
27 Registration::~Registration()
28 {
29     delete ui;
30 }
31
32 void Registration::changeEvent(QEvent *e)
33 {
34     QDialog::changeEvent(e);
35     switch (e->type()) {
36     case QEvent::LanguageChange:
37         ui->retranslateUi(this);
38         break;
39     default:
40         break;
41     }
42 }
43
44 void Registration::on_registratePushButton_clicked()
45 {
46     // Send username, password and email to SpeedFreak server
47     this->username = ui->newUsernameLineEdit->text();
48     this->password = ui->newPasswordLineEdit->text();
49     this->email = ui->eMailLineEdit->text();
50
51     emit sendregistration();
52
53     close();
54 }
55
56 void Registration::on_cancelPushButton_clicked()
57 {
58     close();
59 }
60
61 void Registration::setUserName(QString username)
62 {
63     this->username = username;
64 }
65
66 void Registration::setPassword(QString password)
67 {
68     this->password = password;
69 }
70
71 void Registration::setEmail(QString email)
72 {
73     this->email = email;
74 }
75
76 QString Registration::getUserName()
77 {
78     return this->username;
79 }
80
81 QString Registration::getPassword()
82 {
83     return this->password;
84 }
85
86 QString Registration::getEmail()
87 {
88     return this->email;
89 }