Added new tab "Measure" in main window
[speedfreak] / Client / registration.cpp
1 #include "registration.h"
2 #include "ui_registration.h"
3 #include <QMessageBox>
4
5 Registration::Registration(QWidget *parent) :
6     QDialog(parent),
7     ui(new Ui::Registration)
8 {
9     ui->setupUi(this);
10     this->setWindowTitle("Registration for Speed Freak server");
11 }
12
13 Registration::~Registration()
14 {
15     delete ui;
16 }
17
18 void Registration::changeEvent(QEvent *e)
19 {
20     QDialog::changeEvent(e);
21     switch (e->type()) {
22     case QEvent::LanguageChange:
23         ui->retranslateUi(this);
24         break;
25     default:
26         break;
27     }
28 }
29
30 void Registration::on_registratePushButton_clicked()
31 {
32     //Let`s not type it again
33     ui->newUsernameLineEdit->setText("user123");
34     ui->newPasswordLineEdit->setText("salainen");
35     ui->eMailLineEdit->setText("user123@emaili.fi");
36
37     for(int i = 0; i < 3000; i++);
38
39     // Send username, password and email to SpeedFreak server
40     this->username = ui->newUsernameLineEdit->text();
41     this->password = ui->newPasswordLineEdit->text();
42     this->email = ui->eMailLineEdit->text();
43
44     emit sendregistration();
45
46     close();
47 }
48
49 void Registration::on_cancelPushButton_clicked()
50 {
51     close();
52 }
53
54 void Registration::setUserName(QString username)
55 {
56     this->username = username;
57 }
58
59 void Registration::setPassword(QString password)
60 {
61     this->password = password;
62 }
63
64 void Registration::setEmail(QString email)
65 {
66     this->email = email;
67 }
68
69 QString Registration::getUserName()
70 {
71     return this->username;
72 }
73
74 QString Registration::getPassword()
75 {
76     return this->password;
77 }
78
79 QString Registration::getEmail()
80 {
81     return this->email;
82 }