+/*
+ * SettingsDialog class
+ *
+ * @author Olavi Pulkkinen <olavi.pulkkinen@fudeco.com>
+ * @copyright (c) 2010 Speed Freak team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
+ */
+
#include "settingsdialog.h"
#include "ui_settingsdialog.h"
+#include "usersettings.h"
SettingsDialog::SettingsDialog(QWidget *parent) :
QDialog(parent),
{
ui->setupUi(this);
this->setWindowTitle("Settings");
+ this->ui->regEMailLineEdit->setText("@");
instructionsDialog = new InstructionsDialog;
+
+ if (loginSaved())
+ {
+ QString uName, pWord;
+
+ getLoginInfo( &uName, &pWord);
+ this->username = uName;
+ this->password = pWord;
+
+ ui->setUserPasswordLineEdit->setText(this->password);
+ ui->setUserUsernameLineEdit->setText(this->username);
+
+ // Already someone as user - change button text to "Change"
+ ui->setUserPushButton->setText("Change user");
+ }
}
SettingsDialog::~SettingsDialog()
this->regPassword = ui->regPasswordLineEdit->text();
this->regEmail = ui->regEMailLineEdit->text();
- //emit sendregistration();
+ emit sendregistration();
- close();
+ //close(); //using close() hides popup-window which reports error from server
}
// Next 6 functions can be removed if Settingsdialog is implemented without
this->username = ui->setUserUsernameLineEdit->text();
this->password = ui->setUserPasswordLineEdit->text();
- //emit userNameChanged();
- close();
+ // Save these also to usersettings
+ saveLogin( this->username, this->password);
+
+ // Set "Set/Change User" button text
+ if (this->username.length() > 0)
+ {
+ ui->setUserPushButton->setText("Change user");
+ }
+ else
+ { // Username "cleared"
+ ui->setUserPushButton->setText("Set user");
+ }
+
+ emit userNameChanged();
+
+ //close(); //using close() hides popup-window which reports error from server
}
// Next 4 functions can be removed if Settingsdialog is implemented without
return this->password;
}
+void SettingsDialog::setLabelInfoToUser(QString infoText)
+{
+ this->ui->labelInfoToUser->setText(infoText);
+}