+ if (!ui->setUserPushButton->text().compare("Log out"))
+ {
+ ui->setUserUsernameLineEdit->setDisabled(false);
+ ui->setUserPasswordLineEdit->setDisabled(false);
+ //ui->setUserUsernameLineEdit->setText("");
+ //ui->setUserPasswordLineEdit->setText("");
+ ui->setUserUsernameLineEdit->clear();
+ ui->setUserPasswordLineEdit->clear();
+ this->username = ui->setUserUsernameLineEdit->text();
+ this->password = ui->setUserPasswordLineEdit->text();
+ ui->setUserPushButton->setText("Log in");
+ saveLogin( this->username, this->password);
+ emit logout();
+ }
+ else
+ {
+ this->username = ui->setUserUsernameLineEdit->text();
+ this->password = ui->setUserPasswordLineEdit->text();
+ saveLogin( this->username, this->password);
+ ui->setUserPushButton->setText("Log out");
+
+ if(this->username.compare(""))
+ {
+ emit userNameChanged();
+ //ui->setUserPushButton->setText("Log out");
+ }
+
+ else
+ {
+ QMessageBox::about(this, "Username field is empty", "Set username and log in again");
+ ui->setUserPushButton->setText("Log in");
+ }
+ }