ClientThread is now created in Session.

This commit is contained in:
lotodore
2007-02-18 13:45:56 +00:00
parent 9ec3e020dd
commit a4eefbe18b
9 changed files with 60 additions and 26 deletions
+2 -2
View File
@@ -20,7 +20,7 @@
#ifndef GUIINTERFACE_H
#define GUIINTERFACE_H
// #include <iostream>
#include <net/clientcallback.h>
#include <string>
class Game;
@@ -28,7 +28,7 @@ class Session;
class HandInterface;
class GuiInterface{
class GuiInterface : public ClientCallback {
public:
virtual ~GuiInterface();
+2 -2
View File
@@ -90,5 +90,5 @@ void GuiWrapper::meInAction() const { myW->meInAction(); }
void GuiWrapper::logPlayerActionMsg(string playerName, int action, int setValue) { myLog->logPlayerActionMsg(playerName, action, setValue); }
void GuiWrapper::logNewGameHandMsg(int gameID, int handID) { myLog->logNewGameHandMsg(gameID, handID); }
void GuiWrapper::showActionConnectToServerDialog(int actionID) { myConnectToServerDialog->refresh(actionID); }
void GuiWrapper::showErrorConnectToServerDialog(int errorID, int osErrorID) { myConnectToServerDialog->error(errorID, osErrorID); }
void GuiWrapper::SignalNetClientSuccess(int actionID) { myConnectToServerDialog->refresh(actionID); }
void GuiWrapper::SignalNetClientError(int errorID, int osErrorID) { myConnectToServerDialog->error(errorID, osErrorID); }
+2 -2
View File
@@ -87,8 +87,8 @@ public:
void logPlayerActionMsg(std::string playerName, int action, int setValue) ;
void logNewGameHandMsg(int gameID, int handID) ;
void showActionConnectToServerDialog(int actionID);
void showErrorConnectToServerDialog(int errorID, int osErrorID);
void SignalNetClientSuccess(int actionID);
void SignalNetClientError(int errorID, int osErrorID);
private:
@@ -18,6 +18,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "joinnetworkgamedialogimpl.h"
#include "session.h"
// #include "configfile.h"
joinNetworkGameDialogImpl::joinNetworkGameDialogImpl(QWidget *parent)
@@ -30,11 +31,14 @@ joinNetworkGameDialogImpl::joinNetworkGameDialogImpl(QWidget *parent)
}
void joinNetworkGameDialogImpl::setSession(Session* s)
{
mySession = s;
}
void joinNetworkGameDialogImpl::startClient() {
ClientThread *myClientThread = new ClientThread();
myClientThread->Init(lineEdit_ipAddress->text().toStdString(), spinBox_port->value(), checkBox_ipv6->isChecked(), lineEdit_password->text().toStdString());
myClientThread->Run();
// TODO: Check input values!
if (mySession)
mySession->startNetworkClient(lineEdit_ipAddress->text().toUtf8().constData(), spinBox_port->value(), checkBox_ipv6->isChecked(), lineEdit_password->text().toUtf8().constData());
}
@@ -22,21 +22,26 @@
#include "ui_joinnetworkgamedialog.h"
#include "clientthread.h"
#include <iostream>
#include <QtGui>
#include <QtCore>
class Session;
class joinNetworkGameDialogImpl: public QDialog, public Ui::joinNetworkGameDialog {
Q_OBJECT
public:
joinNetworkGameDialogImpl(QWidget *parent = 0);
void joinNetworkGameDialogImpl::setSession(Session* s);
public slots:
void startClient();
private:
Session *mySession;
};
#endif
+1
View File
@@ -545,6 +545,7 @@ void mainWindowImpl::callAboutPokerthDialog() {
void mainWindowImpl::callJoinNetworkGameDialog() {
joinNetworkGameDialogImpl *v = new joinNetworkGameDialogImpl();
v->setSession(mySession);
v->exec();
if (v->result() == QDialog::Accepted ) {