login dialog changes

This commit is contained in:
doitux
2009-09-27 18:43:19 +00:00
parent 2a2254ad0b
commit 6b4925580f
6 changed files with 49 additions and 45 deletions
@@ -396,10 +396,6 @@ void gameLobbyDialogImpl::addGame(unsigned gameId)
updateGameItem(itemList, gameId);
delete item1;
delete item2;
delete item3;
delete item4;
}
void gameLobbyDialogImpl::updateGameMode(unsigned gameId, int /*newMode*/)
+10 -10
View File
@@ -17,7 +17,7 @@
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox_reguser">
<property name="title">
<string>Registered User</string>
<string>Registered user</string>
</property>
<property name="checkable">
<bool>true</bool>
@@ -43,14 +43,14 @@
<item row="1" column="1">
<widget class="QLineEdit" name="lineEdit_password">
<property name="echoMode">
<enum>QLineEdit::Normal</enum>
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="checkBox_rememberPassword">
<property name="text">
<string>Remember Password (not recommended)</string>
<string>Remember password (not recommended)</string>
</property>
</widget>
</item>
@@ -60,7 +60,7 @@
<item row="1" column="0">
<widget class="QCheckBox" name="checkBox_guest">
<property name="text">
<string>Login as Guest</string>
<string>Login as guest</string>
</property>
</widget>
</item>
@@ -80,14 +80,14 @@
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton">
<widget class="QPushButton" name="pushButton_login">
<property name="text">
<string>Login</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_2">
<widget class="QPushButton" name="pushButton_cancel">
<property name="text">
<string>Cancel</string>
</property>
@@ -101,8 +101,8 @@
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot;font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; color:#0000ff;&quot;&gt;Create an user account ...&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Nimbus Sans L'; font-size:8pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; color:#0000ff;&quot;&gt;Create new user account ...&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
@@ -111,7 +111,7 @@ p, li { white-space: pre-wrap; }
<resources/>
<connections>
<connection>
<sender>pushButton</sender>
<sender>pushButton_login</sender>
<signal>clicked()</signal>
<receiver>internetGameLoginDialog</receiver>
<slot>accept()</slot>
@@ -127,7 +127,7 @@ p, li { white-space: pre-wrap; }
</hints>
</connection>
<connection>
<sender>pushButton_2</sender>
<sender>pushButton_cancel</sender>
<signal>clicked()</signal>
<receiver>internetGameLoginDialog</receiver>
<slot>reject()</slot>
@@ -8,6 +8,8 @@ internetGameLoginDialogImpl::internetGameLoginDialogImpl(QWidget *parent, Config
connect(groupBox_reguser, SIGNAL(toggled(bool)), this, SLOT(regUserToggled(bool)));
connect(checkBox_guest, SIGNAL(toggled(bool)), this, SLOT(guestUserToggled(bool)));
connect(lineEdit_password, SIGNAL(textEdited(QString)), this, SLOT(okButtonCheck()));
connect(lineEdit_username, SIGNAL(textEdited(QString)), this, SLOT(okButtonCheck()));
}
void internetGameLoginDialogImpl::regUserToggled(bool b) {
@@ -18,12 +20,14 @@ void internetGameLoginDialogImpl::regUserToggled(bool b) {
void internetGameLoginDialogImpl::guestUserToggled(bool b) {
groupBox_reguser->setChecked(!b);
if(b) {
checkBox_rememberPassword->setChecked(false);
lineEdit_password->clear();
lineEdit_username->clear();
}
}
void internetGameLoginDialogImpl::exec() {
if(myConfig->readConfigInt("InternetLoginMode") == 0) {
@@ -38,6 +42,7 @@ void internetGameLoginDialogImpl::exec() {
checkBox_guest->setChecked(true);
}
okButtonCheck();
QDialog::exec();
}
@@ -64,3 +69,18 @@ void internetGameLoginDialogImpl::accept() {
QDialog::accept();
}
void internetGameLoginDialogImpl::okButtonCheck() {
if(groupBox_reguser->isChecked()) {
if(!lineEdit_password->text().isEmpty() && !lineEdit_username->text().isEmpty()) {
pushButton_login->setEnabled(true);
}
else {
pushButton_login->setEnabled(false);
}
}
else {
pushButton_login->setEnabled(true);
}
}
@@ -17,6 +17,7 @@ public:
public slots:
void regUserToggled(bool);
void guestUserToggled(bool);
void okButtonCheck();
private:
+14 -26
View File
@@ -302,7 +302,6 @@ void startWindowImpl::joinGameLobby() {
// Stop local game.
myGuiInterface->getMyW()->stopTimer();
// Join Lobby
mySession->terminateNetworkClient();
if (myServerGuiInterface)
myServerGuiInterface->getSession()->terminateNetworkServer();
@@ -313,16 +312,20 @@ void startWindowImpl::joinGameLobby() {
// Clear Lobby dialog.
myGameLobbyDialog->clearDialog();
showInternetGameLoginDialog();
//Dialog mit Statusbalken
myConnectToServerDialog->exec();
if (myConnectToServerDialog->result() == QDialog::Rejected ) {
mySession->terminateNetworkClient();
}
else {
showLobbyDialog();
//login
myInternetGameLoginDialog->exec();
if(myInternetGameLoginDialog->result() == QDialog::Accepted) {
//send login infos
mySession->startInternetClient(std::string(myInternetGameLoginDialog->lineEdit_username->text().toUtf8().constData()), std::string(myInternetGameLoginDialog->lineEdit_password->text().toUtf8().constData()));
//Dialog mit Statusbalken
myConnectToServerDialog->exec();
if (myConnectToServerDialog->result() == QDialog::Accepted ) {
showLobbyDialog();
}
else {
mySession->terminateNetworkClient();
}
}
}
@@ -871,18 +874,3 @@ QStringList startWindowImpl::getPlayerNicksList() {
return list;
}
void startWindowImpl::showInternetGameLoginDialog() {
myInternetGameLoginDialog->exec();
// send login infos
mySession->startInternetClient(std::string(myInternetGameLoginDialog->lineEdit_username->text().toUtf8().constData()), std::string(myInternetGameLoginDialog->lineEdit_password->text().toUtf8().constData()));
}
//void startWindowImpl::keyPressEvent ( QKeyEvent * event ) {
//
// if (event->key() == Qt::Key_F6) { showInternetGameLoginDialog(); }
//
//}
-1
View File
@@ -112,7 +112,6 @@ public slots:
void joinGameLobby();
void showClientDialog();
void showNetworkStartDialog();
void showInternetGameLoginDialog();
void startNewLocalGame(newGameDialogImpl* =0);