Now using int as parameters for the signal/slot method. This needs to be fixed some time...

This commit is contained in:
lotodore
2007-04-27 22:55:19 +00:00
parent 73a5117066
commit e0bc14282f
8 changed files with 17 additions and 102 deletions
-2
View File
@@ -97,7 +97,6 @@ HEADERS += src/game.h \
src/gui/qt/mainwindow/mycardspixmaplabel.h \
src/gui/qt/mainwindow/startsplash/startsplash.h \
src/gui/qt/guiwrapper.h \
src/gui/qt/gamedatawrapper.h \
src/gui/qt/aboutpokerth/aboutpokerthimpl.h \
src/gui/qt/connecttoserverdialog/connecttoserverdialogimpl.h \
src/gui/qt/createnetworkgamedialog/createnetworkgamedialogimpl.h \
@@ -170,7 +169,6 @@ SOURCES += src/game.cpp \
src/net/common/netexception.cpp \
src/net/common/receiverhelper.cpp \
src/gui/qt/guiwrapper.cpp \
src/gui/qt/gamedatawrapper.cpp \
src/gui/qt/mainwindow/mainwindowimpl.cpp \
src/gui/qt/mainwindow/mycardspixmaplabel.cpp \
src/gui/qt/mainwindow/startsplash/startsplash.cpp \
+4 -4
View File
@@ -26,10 +26,10 @@
struct GameData
{
GameData() : numberOfPlayers(0), startCash(0), smallBlind(0), handsBeforeRaise(1) {}
unsigned numberOfPlayers;
unsigned startCash;
unsigned smallBlind;
unsigned handsBeforeRaise;
int numberOfPlayers;
int startCash;
int smallBlind;
int handsBeforeRaise;
};
#endif
-45
View File
@@ -1,45 +0,0 @@
/***************************************************************************
* Copyright (C) 2007 by Lothar May *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "gamedatawrapper.h"
GameDataWrapper::GameDataWrapper(const GameData &gameData)
: m_gameData(gameData)
{
}
GameDataWrapper::GameDataWrapper(const GameDataWrapper &other)
: m_gameData(other.GetGameData())
{
}
const GameData&
GameDataWrapper::GetGameData() const
{
return m_gameData;
}
const GameDataWrapper &
GameDataWrapper::operator=(const GameDataWrapper &other)
{
if (this != &other)
m_gameData = other.GetGameData();
return *this;
}
-43
View File
@@ -1,43 +0,0 @@
/***************************************************************************
* Copyright (C) 2007 by Lothar May *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef GAMEDATAWRAPPER_H
#define GAMEDATAWRAPPER_H
#include <gamedata.h>
#include <QtCore>
class GameDataWrapper : public QObject
{
Q_OBJECT
public:
GameDataWrapper(const GameData &gameData);
GameDataWrapper(const GameDataWrapper &other);
const GameData &GetGameData() const;
const GameDataWrapper &operator=(const GameDataWrapper &other);
private:
GameData m_gameData;
};
#endif
+1 -1
View File
@@ -92,7 +92,7 @@ void GuiWrapper::SignalNetClientConnect(int actionID) { myW->SignalNetClientConn
void GuiWrapper::SignalNetClientGameInfo(int actionID) { myW->SignalNetClientGameInfo(actionID); }
void GuiWrapper::SignalNetClientError(int errorID, int osErrorID) { myW->SignalNetClientError(errorID, osErrorID); }
void GuiWrapper::SignalNetClientGameStart(const GameData &gameData) { myW->SignalNetClientGameStart(GameDataWrapper(gameData)); }
void GuiWrapper::SignalNetClientGameStart(const GameData &gameData) { myW->SignalNetClientGameStart(gameData.numberOfPlayers, gameData.startCash, gameData.smallBlind, gameData.handsBeforeRaise); }
void GuiWrapper::SignalNetServerSuccess(int actionID) { }
void GuiWrapper::SignalNetServerError(int errorID, int osErrorID) { }
+8 -3
View File
@@ -538,7 +538,7 @@ mainWindowImpl::mainWindowImpl(QMainWindow *parent)
connect(this, SIGNAL(SignalNetClientGameInfo(int)), myWaitingForServerGameDialog, SLOT(refresh(int)));
// Errors are handled globally, not within one dialog.
connect(this, SIGNAL(SignalNetClientError(int, int)), this, SLOT(networkError(int, int)));
connect(this, SIGNAL(SignalNetClientGameStart(GameDataWrapper)), this, SLOT(networkStart(GameDataWrapper)));
connect(this, SIGNAL(SignalNetClientGameStart(int, int, int, int)), this, SLOT(networkStart(int, int, int, int)));
connect(this, SIGNAL(SignalNetServerPlayerJoined(QString)), myStartNetworkGameDialog, SLOT(addConnectedPlayer(QString)));
@@ -2200,9 +2200,14 @@ void mainWindowImpl::networkError(int errorID, int osErrorID) {
myWaitingForServerGameDialog->reject();
}
void mainWindowImpl::networkStart(GameDataWrapper gameData)
void mainWindowImpl::networkStart(int numberOfPlayers, int startCash, int smallBlind, int handsBeforeRaise)
{
mySession->startGame(gameData.GetGameData());
GameData gameData;
gameData.numberOfPlayers = numberOfPlayers;
gameData.startCash = startCash;
gameData.smallBlind = smallBlind;
gameData.handsBeforeRaise = handsBeforeRaise;
mySession->startGame(gameData);
}
void mainWindowImpl::keyPressEvent ( QKeyEvent * event ) {
+3 -3
View File
@@ -29,7 +29,7 @@
#include "handinterface.h"
#include "game_defs.h"
#include <gamedatawrapper.h>
#include <gamedata.h>
class Session;
class Game;
@@ -94,7 +94,7 @@ signals:
void SignalNetClientConnect(int actionID);
void SignalNetClientGameInfo(int actionID);
void SignalNetClientError(int errorID, int osErrorID);
void SignalNetClientGameStart(GameDataWrapper gameData);
void SignalNetClientGameStart(int numberOfPlayers, int startCash, int smallBlind, int handsBeforeRaise);
void SignalNetServerPlayerJoined(QString playerName);
public slots:
@@ -191,7 +191,7 @@ public slots:
void paintStartSplash();
void networkError(int, int);
void networkStart(GameDataWrapper);
void networkStart(int, int, int, int);
private:
+1 -1
View File
@@ -51,7 +51,7 @@ void Session::startGame(const GameData &gameData) {
currentGameID++;
PlayerDataList playerDataList;
for(unsigned i=0; i<gameData.numberOfPlayers; i++) {
for(int i=0; i<gameData.numberOfPlayers; i++) {
//Namen und Avatarpfad abfragen
ostringstream myName;