new rejoin possible dialog added

This commit is contained in:
doitux
2011-08-07 20:16:03 +00:00
parent b5a30d7def
commit ade189fdc5
8 changed files with 48 additions and 11 deletions
+6
View File
@@ -132,6 +132,12 @@ void ServerGuiWrapper::SignalNetClientLoginShow()
{ {
if (myClientcb) myClientcb->SignalNetClientLoginShow(); if (myClientcb) myClientcb->SignalNetClientLoginShow();
} }
void ServerGuiWrapper::SignalNetClientRejoinPossible(const std::string &gameName)
{
if (myClientcb) myClientcb->SignalNetClientRejoinPossible(gameName);
}
void ServerGuiWrapper::SignalNetClientPostRiverShowCards(unsigned playerId) void ServerGuiWrapper::SignalNetClientPostRiverShowCards(unsigned playerId)
{ {
if (myClientcb) myClientcb->SignalNetClientPostRiverShowCards(playerId); if (myClientcb) myClientcb->SignalNetClientPostRiverShowCards(playerId);
+1
View File
@@ -139,6 +139,7 @@ public:
void SignalNetClientServerListShow(); void SignalNetClientServerListShow();
void SignalNetClientLoginShow(); void SignalNetClientLoginShow();
void SignalNetClientRejoinPossible(const std::string &gameName);
void SignalNetClientPostRiverShowCards(unsigned playerId); void SignalNetClientPostRiverShowCards(unsigned playerId);
void SignalNetServerSuccess(int actionID); void SignalNetServerSuccess(int actionID);
+2 -2
View File
@@ -3784,9 +3784,9 @@ p, li { white-space: pre-wrap; }
</widget> </widget>
<widget class="QWidget" name="tab_editTip"> <widget class="QWidget" name="tab_editTip">
<attribute name="title"> <attribute name="title">
<string>Players tip</string> <string>Player info</string>
</attribute> </attribute>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout4">
<property name="verticalSpacing"> <property name="verticalSpacing">
<number>3</number> <number>3</number>
</property> </property>
+4
View File
@@ -294,6 +294,10 @@ void GuiWrapper::SignalNetClientLoginShow()
{ {
myStartWindow->signalNetClientLoginShow(); myStartWindow->signalNetClientLoginShow();
} }
void GuiWrapper::SignalNetClientRejoinPossible(const string &gameName)
{
myStartWindow->signalNetClientRejoinPossible(QString::fromUtf8(gameName.c_str()));
}
void GuiWrapper::SignalNetClientPostRiverShowCards(unsigned playerId) void GuiWrapper::SignalNetClientPostRiverShowCards(unsigned playerId)
{ {
myW->signalPostRiverShowCards(playerId); myW->signalPostRiverShowCards(playerId);
+1
View File
@@ -119,6 +119,7 @@ public:
void SignalNetClientServerListShow(); void SignalNetClientServerListShow();
void SignalNetClientServerListClear(); void SignalNetClientServerListClear();
void SignalNetClientLoginShow(); void SignalNetClientLoginShow();
void SignalNetClientRejoinPossible(const std::string &gameName);
void SignalNetClientPostRiverShowCards(unsigned playerId); void SignalNetClientPostRiverShowCards(unsigned playerId);
void SignalNetClientGameInfo(int actionID); void SignalNetClientGameInfo(int actionID);
void SignalNetClientError(int errorID, int osErrorID); void SignalNetClientError(int errorID, int osErrorID);
+31 -9
View File
@@ -114,6 +114,7 @@ startWindowImpl::startWindowImpl(ConfigFile *c)
connect(this, SIGNAL(signalNetClientServerListAdd(unsigned)), myServerListDialog, SLOT(addServerItem(unsigned))); connect(this, SIGNAL(signalNetClientServerListAdd(unsigned)), myServerListDialog, SLOT(addServerItem(unsigned)));
connect(this, SIGNAL(signalNetClientLoginShow()), this, SLOT(callInternetGameLoginDialog())); connect(this, SIGNAL(signalNetClientLoginShow()), this, SLOT(callInternetGameLoginDialog()));
connect(this, SIGNAL(signalNetClientRejoinPossible(QString)), this, SLOT(callRejoinPossibleDialog(QString)));
connect(this, SIGNAL(signalNetClientSelfJoined(unsigned, QString, bool)), myStartNetworkGameDialog, SLOT(joinedNetworkGame(unsigned, QString, bool))); connect(this, SIGNAL(signalNetClientSelfJoined(unsigned, QString, bool)), myStartNetworkGameDialog, SLOT(joinedNetworkGame(unsigned, QString, bool)));
connect(this, SIGNAL(signalNetClientPlayerJoined(unsigned, QString, bool)), myStartNetworkGameDialog, SLOT(addConnectedPlayer(unsigned, QString, bool))); connect(this, SIGNAL(signalNetClientPlayerJoined(unsigned, QString, bool)), myStartNetworkGameDialog, SLOT(addConnectedPlayer(unsigned, QString, bool)));
@@ -359,15 +360,36 @@ void startWindowImpl::callInternetGameLoginDialog()
if(myInternetGameLoginDialog->result() == QDialog::Accepted) { if(myInternetGameLoginDialog->result() == QDialog::Accepted) {
//send login infos //send login infos
mySession->setLogin( mySession->setLogin(
myConfig->readConfigString("MyName"), myConfig->readConfigString("MyName"),
myInternetGameLoginDialog->lineEdit_password->text().toUtf8().constData(), myInternetGameLoginDialog->lineEdit_password->text().toUtf8().constData(),
myInternetGameLoginDialog->checkBox_guest->isChecked()); myInternetGameLoginDialog->checkBox_guest->isChecked());
} else { } else {
myConnectToServerDialog->reject(); myConnectToServerDialog->reject();
mySession->terminateNetworkClient(); mySession->terminateNetworkClient();
} }
} }
void startWindowImpl::callRejoinPossibleDialog(QString gameName)
{
QMessageBox msgBox;
msgBox.setIcon(QMessageBox::Question);
msgBox.setWindowTitle("Rejoin possible!");
msgBox.setText(QString("There is an existing session with the game: %1").arg(gameName));
msgBox.setInformativeText("Do you want to rejoin this game?");
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
msgBox.setDefaultButton(QMessageBox::Yes);
int ret = msgBox.exec();
switch (ret) {
case QMessageBox::Yes:; //rejoin
break;
case QMessageBox::No:; //lobby
break;
}
}
void startWindowImpl::callCreateNetworkGameDialog() void startWindowImpl::callCreateNetworkGameDialog()
{ {
@@ -471,10 +493,10 @@ void startWindowImpl::callJoinNetworkGameDialog()
myStartNetworkGameDialog->clearDialog(); myStartNetworkGameDialog->clearDialog();
// Maybe use QUrl::toPunycode. // Maybe use QUrl::toPunycode.
mySession->startNetworkClient( mySession->startNetworkClient(
myJoinNetworkGameDialog->lineEdit_ipAddress->text().toUtf8().constData(), myJoinNetworkGameDialog->lineEdit_ipAddress->text().toUtf8().constData(),
myJoinNetworkGameDialog->spinBox_port->value(), myJoinNetworkGameDialog->spinBox_port->value(),
myJoinNetworkGameDialog->checkBox_ipv6->isChecked(), myJoinNetworkGameDialog->checkBox_ipv6->isChecked(),
myJoinNetworkGameDialog->checkBox_sctp->isChecked()); myJoinNetworkGameDialog->checkBox_sctp->isChecked());
//Dialog mit Statusbalken //Dialog mit Statusbalken
myConnectToServerDialog->exec(); myConnectToServerDialog->exec();
@@ -1032,7 +1054,7 @@ void startWindowImpl::networkMessage(unsigned msgId)
QMessageBox msgBox(QMessageBox::Information, tr("Server Message"), QMessageBox msgBox(QMessageBox::Information, tr("Server Message"),
msgText, QMessageBox::Close, this); msgText, QMessageBox::Close, this);
// msgBox.setTextFormat(Qt::RichText); // msgBox.setTextFormat(Qt::RichText);
msgBox.exec(); msgBox.exec();
} }
@@ -1082,7 +1104,7 @@ bool startWindowImpl::eventFilter(QObject *obj, QEvent *event)
{ {
if (event->type() == QEvent::Close) { if (event->type() == QEvent::Close) {
event->ignore(); event->ignore();
// mySession->getMyLog()->closeLogDbAtExit(); // mySession->getMyLog()->closeLogDbAtExit();
return QMainWindow::eventFilter(obj, event); return QMainWindow::eventFilter(obj, event);
} else { } else {
// pass the event on to the parent class // pass the event on to the parent class
+2
View File
@@ -77,6 +77,7 @@ signals:
void signalNetClientServerListClear(); void signalNetClientServerListClear();
void signalNetClientServerListAdd(unsigned serverId); void signalNetClientServerListAdd(unsigned serverId);
void signalNetClientLoginShow(); void signalNetClientLoginShow();
void signalNetClientRejoinPossible(QString gameName);
void signalNetClientGameInfo(int actionID); void signalNetClientGameInfo(int actionID);
void signalNetClientError(int errorID, int osErrorID); void signalNetClientError(int errorID, int osErrorID);
void signalNetClientNotification(int notificationId); void signalNetClientNotification(int notificationId);
@@ -120,6 +121,7 @@ public slots:
void callJoinNetworkGameDialog(); void callJoinNetworkGameDialog();
void showLobbyDialog(); void showLobbyDialog();
void callInternetGameLoginDialog(); void callInternetGameLoginDialog();
void callRejoinPossibleDialog(QString);
void joinGameLobby(); void joinGameLobby();
void showClientDialog(); void showClientDialog();
void showNetworkStartDialog(); void showNetworkStartDialog();
+1
View File
@@ -68,6 +68,7 @@ public:
virtual void SignalNetClientServerListShow() = 0; virtual void SignalNetClientServerListShow() = 0;
virtual void SignalNetClientLoginShow() = 0; virtual void SignalNetClientLoginShow() = 0;
virtual void SignalNetClientRejoinPossible(const std::string &gameName) = 0;
virtual void SignalNetClientPostRiverShowCards(unsigned playerId) = 0; virtual void SignalNetClientPostRiverShowCards(unsigned playerId) = 0;
virtual void SignalLobbyPlayerJoined(unsigned playerId, const std::string &nickName) = 0; virtual void SignalLobbyPlayerJoined(unsigned playerId, const std::string &nickName) = 0;