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