Removed dummy instructions text and added correct instructions
[speedfreak] / Client / settingsdialog.cpp
1 #include "settingsdialog.h"
2 #include "ui_settingsdialog.h"
3
4 SettingsDialog::SettingsDialog(QWidget *parent) :
5     QDialog(parent),
6     ui(new Ui::SettingsDialog)
7 {
8     ui->setupUi(this);
9     this->setWindowTitle("Settings");
10     instructionsDialog = new InstructionsDialog;
11 }
12
13 SettingsDialog::~SettingsDialog()
14 {
15     delete ui;
16 }
17
18 void SettingsDialog::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 //
31 // Help
32 //
33 void SettingsDialog::on_pushButtonHelp_clicked()
34 {
35     instructionsDialog->show();
36 }
37
38 //
39 // Registrate
40 //
41 void SettingsDialog::on_registratePushButton_clicked()
42 {
43     // Send username, password and email to SpeedFreak server
44     this->regUsername = ui->regUserNameLineEdit->text();
45     this->regPassword = ui->regPasswordLineEdit->text();
46     this->regEmail = ui->regEMailLineEdit->text();
47
48     //emit sendregistration();
49
50     close();
51 }
52
53 // Next 6 functions can be removed if Settingsdialog is implemented without
54 // own copy of username, password & email
55 void SettingsDialog::setRegUserName(QString username)
56 {
57     this->regUsername = username;
58 }
59
60 void SettingsDialog::setRegPassword(QString password)
61 {
62     this->regPassword = password;
63 }
64
65 void SettingsDialog::setRegEmail(QString email)
66 {
67     this->regEmail = email;
68 }
69
70 QString SettingsDialog::getRegUserName()
71 {
72     return this->regUsername;
73 }
74
75 QString SettingsDialog::getRegPassword()
76 {
77     return this->regPassword;
78 }
79
80 QString SettingsDialog::getRegEmail()
81 {
82     return this->regEmail;
83 }
84
85 //
86 // Set / Change user
87 //
88 void SettingsDialog::on_setUserPushButton_clicked()
89 {
90     this->username = ui->setUserUsernameLineEdit->text();
91     this->password = ui->setUserPasswordLineEdit->text();
92
93     //emit userNameChanged();
94     close();
95 }
96
97 // Next 4 functions can be removed if Settingsdialog is implemented without
98 // own copy of username & password
99 void SettingsDialog::setUserName(QString username)
100 {
101     this->username = username;
102 }
103
104 void SettingsDialog::setPassword(QString password)
105 {
106     this->password = password;
107 }
108
109 QString SettingsDialog::getUserName()
110 {
111     return this->username;
112 }
113
114 QString SettingsDialog::getPassword()
115 {
116     return this->password;
117 }
118