continue login dialog implementation

This commit is contained in:
doitux
2009-08-27 20:54:37 +00:00
parent 12e12c6f21
commit d03c15a0f8
6 changed files with 64 additions and 20 deletions
+4 -2
View File
@@ -48,7 +48,7 @@ ConfigFile::ConfigFile(char *argv0, bool readonly) : noWriteAccess(readonly)
myQtToolsInterface = CreateQtToolsWrapper();
// !!!! Revisionsnummer der Configdefaults !!!!!
configRev = 74;
configRev = 76;
//standard defaults
logOnOffDefault = "1";
@@ -264,8 +264,10 @@ ConfigFile::ConfigFile(char *argv0, bool readonly) : noWriteAccess(readonly)
configList.push_back(ConfigInfo("GameTableFullScreenSave", CONFIG_TYPE_INT, "0"));
configList.push_back(ConfigInfo("GameTableHeightSave", CONFIG_TYPE_INT, "600"));
configList.push_back(ConfigInfo("GameTableWidthSave", CONFIG_TYPE_INT, "1024"));
configList.push_back(ConfigInfo("InternetLoginMode", CONFIG_TYPE_INT, "0"));
configList.push_back(ConfigInfo("InternetLoginUserName", CONFIG_TYPE_STRING, ""));
configList.push_back(ConfigInfo("InternetLoginPasswordMd5", CONFIG_TYPE_STRING, ""));
configList.push_back(ConfigInfo("InternetLoginPassword", CONFIG_TYPE_STRING, ""));
configList.push_back(ConfigInfo("InternetSavePassword", CONFIG_TYPE_INT, "0"));
//fill tempList firstTime
+2 -2
View File
@@ -43,12 +43,12 @@
<item row="1" column="1">
<widget class="QLineEdit" name="lineEdit_password">
<property name="echoMode">
<enum>QLineEdit::Password</enum>
<enum>QLineEdit::Normal</enum>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="checkBox_2">
<widget class="QCheckBox" name="checkBox_rememberPassword">
<property name="text">
<string>Remember Password (not recommended)</string>
</property>
@@ -5,26 +5,64 @@
internetGameLoginDialogImpl::internetGameLoginDialogImpl(QWidget *parent, ConfigFile *c) :
QDialog(parent), myConfig(c){
setupUi(this);
connect(groupBox_reguser, SIGNAL(toggled(bool)), this, SLOT(regUserToggled(bool)));
connect(checkBox_guest, SIGNAL(toggled(bool)), this, SLOT(guestUserToggled(bool)));
}
void internetGameLoginDialogImpl::regUserToggled(bool b) {
checkBox_guest->setChecked(!b);
}
void internetGameLoginDialogImpl::guestUserToggled(bool b) {
groupBox_reguser->setChecked(!b);
}
void internetGameLoginDialogImpl::exec() {
lineEdit_username->setText(QString::fromUtf8(myConfig->readConfigString("InternetLoginUserName").c_str()));
// lineEdit_password->
qDebug() << QString::fromUtf8(myConfig->readConfigString("InternetLoginPasswordMd5").c_str());
if(myConfig->readConfigInt("InternetLoginMode") == 0) {
groupBox_reguser->setChecked(true);
lineEdit_username->setText(QString::fromUtf8(myConfig->readConfigString("InternetLoginUserName").c_str()));
if(myConfig->readConfigInt("InternetSavePassword")) {
checkBox_rememberPassword->setChecked(true);
lineEdit_password->setText(QString::fromUtf8(QByteArray::fromBase64(myConfig->readConfigString("InternetLoginPassword").c_str())));
}
}
else {
checkBox_guest->setChecked(true);
}
QDialog::exec();
}
void internetGameLoginDialogImpl::accept() {
myConfig->writeConfigString("InternetLoginUserName", lineEdit_username->text().toUtf8().constData());
QByteArray myBytes = QCryptographicHash::hash(lineEdit_password->text().toUtf8(), QCryptographicHash::Md5).toHex();
std::string myPwMd5String (myBytes.constData(), myBytes.size());
myConfig->writeConfigString("InternetLoginPasswordMd5", myPwMd5String);
if(groupBox_reguser->isChecked()) {
myConfig->writeConfigInt("InternetLoginMode", 0);
myConfig->writeConfigString("InternetLoginUserName", lineEdit_username->text().toUtf8().constData());
if(checkBox_rememberPassword->isChecked()) {
myConfig->writeConfigInt("InternetSavePassword", 1);
myConfig->writeConfigString("InternetLoginPassword", lineEdit_password->text().toUtf8().toBase64().constData());
}
else {
myConfig->writeConfigInt("InternetSavePassword", 0);
}
}
else {
myConfig->writeConfigInt("InternetLoginMode", 1);
}
myConfig->writeBuffer();
//TODO send login data to server
QDialog::accept();
}
@@ -13,6 +13,10 @@ public:
void exec();
void accept();
public slots:
void regUserToggled(bool);
void guestUserToggled(bool);
private:
+7 -7
View File
@@ -99,8 +99,8 @@ startWindowImpl::startWindowImpl(ConfigFile *c)
connect( actionStart_Local_Game, SIGNAL( triggered() ), this, SLOT( callNewGameDialog() ) );
connect( pushButtonStart_Local_Game, SIGNAL( clicked() ), this, SLOT( callNewGameDialog() ) );
connect( actionInternet_Game, SIGNAL( triggered() ), this, SLOT( callGameLobbyDialog() ) );
connect( pushButtonInternet_Game, SIGNAL( clicked() ), this, SLOT( callGameLobbyDialog() ) );
connect( actionInternet_Game, SIGNAL( triggered() ), this, SLOT( showInternetGameLoginDialog() ) );
connect( pushButtonInternet_Game, SIGNAL( clicked() ), this, SLOT( showInternetGameLoginDialog() ) );
connect( actionCreate_Network_Game, SIGNAL( triggered() ), this, SLOT( callCreateNetworkGameDialog() ) );
connect( pushButton_Create_Network_Game, SIGNAL( clicked() ), this, SLOT( callCreateNetworkGameDialog() ) );
connect( actionJoin_Network_Game, SIGNAL( triggered() ), this, SLOT( callJoinNetworkGameDialog() ) );
@@ -877,8 +877,8 @@ void startWindowImpl::showInternetGameLoginDialog() {
myInternetGameLoginDialog->exec();
}
void startWindowImpl::keyPressEvent ( QKeyEvent * event ) {
if (event->key() == Qt::Key_F6) { showInternetGameLoginDialog(); }
}
//void startWindowImpl::keyPressEvent ( QKeyEvent * event ) {
//
// if (event->key() == Qt::Key_F6) { showInternetGameLoginDialog(); }
//
//}
+1 -1
View File
@@ -55,7 +55,7 @@ public:
boost::shared_ptr< GuiInterface > getMyServerGuiInterface() const { return myServerGuiInterface; }
connectToServerDialogImpl* getMyConnectToServerDialog() const { return myConnectToServerDialog; }
void keyPressEvent( QKeyEvent *);
// void keyPressEvent( QKeyEvent *);
signals:
void signalShowClientDialog();