add chat functions
This commit is contained in:
@@ -94,6 +94,8 @@ void ServerGuiWrapper::meInAction() {}
|
|||||||
void ServerGuiWrapper::logPlayerActionMsg(string playerName, int action, int setValue) {}
|
void ServerGuiWrapper::logPlayerActionMsg(string playerName, int action, int setValue) {}
|
||||||
void ServerGuiWrapper::logNewGameHandMsg(int gameID, int handID) {}
|
void ServerGuiWrapper::logNewGameHandMsg(int gameID, int handID) {}
|
||||||
|
|
||||||
|
void ServerGuiWrapper::chatAppendMsg(std::string msg) {}
|
||||||
|
|
||||||
void ServerGuiWrapper::SignalNetClientConnect(int actionID) { if (myClientcb) myClientcb->SignalNetClientConnect(actionID); }
|
void ServerGuiWrapper::SignalNetClientConnect(int actionID) { if (myClientcb) myClientcb->SignalNetClientConnect(actionID); }
|
||||||
void ServerGuiWrapper::SignalNetClientGameInfo(int actionID) { if (myClientcb) myClientcb->SignalNetClientGameInfo(actionID); }
|
void ServerGuiWrapper::SignalNetClientGameInfo(int actionID) { if (myClientcb) myClientcb->SignalNetClientGameInfo(actionID); }
|
||||||
void ServerGuiWrapper::SignalNetClientError(int errorID, int osErrorID) { if (myClientcb) myClientcb->SignalNetClientError(errorID, osErrorID); }
|
void ServerGuiWrapper::SignalNetClientError(int errorID, int osErrorID) { if (myClientcb) myClientcb->SignalNetClientError(errorID, osErrorID); }
|
||||||
|
|||||||
@@ -77,6 +77,8 @@ public:
|
|||||||
void logPlayerActionMsg(std::string playerName, int action, int setValue) ;
|
void logPlayerActionMsg(std::string playerName, int action, int setValue) ;
|
||||||
void logNewGameHandMsg(int gameID, int handID) ;
|
void logNewGameHandMsg(int gameID, int handID) ;
|
||||||
|
|
||||||
|
void chatAppendMsg(std::string msg);
|
||||||
|
|
||||||
void SignalNetClientConnect(int actionID);
|
void SignalNetClientConnect(int actionID);
|
||||||
void SignalNetClientGameInfo(int actionID);
|
void SignalNetClientGameInfo(int actionID);
|
||||||
void SignalNetClientError(int errorID, int osErrorID);
|
void SignalNetClientError(int errorID, int osErrorID);
|
||||||
|
|||||||
@@ -93,6 +93,9 @@ public:
|
|||||||
virtual void logPlayerActionMsg(std::string playName, int action, int setValue) =0;
|
virtual void logPlayerActionMsg(std::string playName, int action, int setValue) =0;
|
||||||
virtual void logNewGameHandMsg(int gameID, int HandID) =0;
|
virtual void logNewGameHandMsg(int gameID, int HandID) =0;
|
||||||
|
|
||||||
|
//chat
|
||||||
|
virtual void chatAppendMsg(std::string msg) =0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
#include "guiwrapper.h"
|
#include "guiwrapper.h"
|
||||||
#include "session.h"
|
#include "session.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "chat.h"
|
||||||
#include "mainwindowimpl.h"
|
#include "mainwindowimpl.h"
|
||||||
#include "configfile.h"
|
#include "configfile.h"
|
||||||
|
|
||||||
@@ -34,6 +35,7 @@ GuiWrapper::GuiWrapper(ConfigFile *c) : myLog(0), myW(0), myConfig(c)
|
|||||||
myW = new mainWindowImpl(myConfig);
|
myW = new mainWindowImpl(myConfig);
|
||||||
myW->show();
|
myW->show();
|
||||||
myLog = new Log(myW, myConfig);
|
myLog = new Log(myW, myConfig);
|
||||||
|
myChat = new Chat(myW, myConfig);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,6 +92,8 @@ void GuiWrapper::meInAction() { myW->signalMeInAction(); }
|
|||||||
void GuiWrapper::logPlayerActionMsg(string playerName, int action, int setValue) { myLog->signalLogPlayerActionMsg(QString::fromUtf8(playerName.c_str()), action, setValue); }
|
void GuiWrapper::logPlayerActionMsg(string playerName, int action, int setValue) { myLog->signalLogPlayerActionMsg(QString::fromUtf8(playerName.c_str()), action, setValue); }
|
||||||
void GuiWrapper::logNewGameHandMsg(int gameID, int handID) { myLog->signalLogNewGameHandMsg(gameID, handID); }
|
void GuiWrapper::logNewGameHandMsg(int gameID, int handID) { myLog->signalLogNewGameHandMsg(gameID, handID); }
|
||||||
|
|
||||||
|
void GuiWrapper::chatAppendMsg(string msg) { myChat->receiveMessage(msg); }
|
||||||
|
|
||||||
void GuiWrapper::SignalNetClientConnect(int actionID) { myW->signalNetClientConnect(actionID); }
|
void GuiWrapper::SignalNetClientConnect(int actionID) { myW->signalNetClientConnect(actionID); }
|
||||||
void GuiWrapper::SignalNetClientGameInfo(int actionID) { myW->signalNetClientGameInfo(actionID); }
|
void GuiWrapper::SignalNetClientGameInfo(int actionID) { myW->signalNetClientGameInfo(actionID); }
|
||||||
void GuiWrapper::SignalNetClientError(int errorID, int osErrorID) { myW->signalNetClientError(errorID, osErrorID); }
|
void GuiWrapper::SignalNetClientError(int errorID, int osErrorID) { myW->signalNetClientError(errorID, osErrorID); }
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
class Session;
|
class Session;
|
||||||
class mainWindowImpl;
|
class mainWindowImpl;
|
||||||
class Log;
|
class Log;
|
||||||
|
class Chat;
|
||||||
class ConfigFile;
|
class ConfigFile;
|
||||||
|
|
||||||
class GuiWrapper : public GuiInterface
|
class GuiWrapper : public GuiInterface
|
||||||
@@ -84,6 +85,8 @@ public:
|
|||||||
void logPlayerActionMsg(std::string playerName, int action, int setValue) ;
|
void logPlayerActionMsg(std::string playerName, int action, int setValue) ;
|
||||||
void logNewGameHandMsg(int gameID, int handID) ;
|
void logNewGameHandMsg(int gameID, int handID) ;
|
||||||
|
|
||||||
|
void chatAppendMsg(std::string msg);
|
||||||
|
|
||||||
void SignalNetClientConnect(int actionID);
|
void SignalNetClientConnect(int actionID);
|
||||||
void SignalNetClientGameInfo(int actionID);
|
void SignalNetClientGameInfo(int actionID);
|
||||||
void SignalNetClientError(int errorID, int osErrorID);
|
void SignalNetClientError(int errorID, int osErrorID);
|
||||||
@@ -100,6 +103,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
Log *myLog;
|
Log *myLog;
|
||||||
|
Chat *myChat;
|
||||||
mainWindowImpl *myW;
|
mainWindowImpl *myW;
|
||||||
ConfigFile *myConfig;
|
ConfigFile *myConfig;
|
||||||
|
|
||||||
|
|||||||
@@ -1847,7 +1847,7 @@
|
|||||||
<enum>QTabWidget::Rounded</enum>
|
<enum>QTabWidget::Rounded</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex" >
|
<property name="currentIndex" >
|
||||||
<number>1</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tab_Log" >
|
<widget class="QWidget" name="tab_Log" >
|
||||||
<attribute name="title" >
|
<attribute name="title" >
|
||||||
|
|||||||
@@ -20,12 +20,14 @@
|
|||||||
#include "chat.h"
|
#include "chat.h"
|
||||||
|
|
||||||
#include "mainwindowimpl.h"
|
#include "mainwindowimpl.h"
|
||||||
|
#include "session.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
Chat::Chat(mainWindowImpl* w, ConfigFile *c) : myW(w), myConfig(c)
|
Chat::Chat(mainWindowImpl* w, ConfigFile *c) : myW(w), myConfig(c)
|
||||||
{
|
{
|
||||||
// myW->setChat(this);
|
|
||||||
|
myW->setChat(this);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,3 +36,11 @@ Chat::~Chat()
|
|||||||
delete myConfig;
|
delete myConfig;
|
||||||
myConfig = 0;
|
myConfig = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Chat::sendMessage() {
|
||||||
|
|
||||||
|
myW->getSession().sendChatMessage(myW->lineEdit_ChatInput->text().toUtf8().constData());
|
||||||
|
myW->lineEdit_ChatInput->setText("");
|
||||||
|
}
|
||||||
|
|
||||||
|
void Chat::receiveMessage(std::string message) { myW->textBrowser_Chat->append(QString::fromUtf8(message.c_str())); }
|
||||||
@@ -40,10 +40,9 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
public:
|
void sendMessage();
|
||||||
|
void receiveMessage(std::string);
|
||||||
signals:
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
mainWindowImpl *myW;
|
mainWindowImpl *myW;
|
||||||
|
|||||||
@@ -558,6 +558,9 @@ mainWindowImpl::mainWindowImpl(ConfigFile *c, QMainWindow *parent)
|
|||||||
connect ( horizontalSlider_speed, SIGNAL( valueChanged(int)), this, SLOT ( setGameSpeed(int) ) );
|
connect ( horizontalSlider_speed, SIGNAL( valueChanged(int)), this, SLOT ( setGameSpeed(int) ) );
|
||||||
connect ( pushButton_break, SIGNAL( clicked()), this, SLOT ( breakButtonClicked() ) ); // auch wieder starten!!!!
|
connect ( pushButton_break, SIGNAL( clicked()), this, SLOT ( breakButtonClicked() ) ); // auch wieder starten!!!!
|
||||||
|
|
||||||
|
connect( tabWidget, SIGNAL( currentChanged(int) ), this, SLOT( setChatFocus() ) );
|
||||||
|
connect( lineEdit_ChatInput, SIGNAL( returnPressed () ), this, SLOT( sendChatMessage() ) );
|
||||||
|
|
||||||
//Nachrichten Thread-Save
|
//Nachrichten Thread-Save
|
||||||
connect(this, SIGNAL(signalRefreshSet()), this, SLOT(refreshSet()));
|
connect(this, SIGNAL(signalRefreshSet()), this, SLOT(refreshSet()));
|
||||||
connect(this, SIGNAL(signalRefreshCash()), this, SLOT(refreshCash()));
|
connect(this, SIGNAL(signalRefreshCash()), this, SLOT(refreshCash()));
|
||||||
@@ -862,7 +865,7 @@ void mainWindowImpl::setSession(boost::shared_ptr<Session> session)
|
|||||||
mySession = session;
|
mySession = session;
|
||||||
}
|
}
|
||||||
|
|
||||||
void mainWindowImpl::setLog(Log* l) { myLog = l; }
|
|
||||||
|
|
||||||
//refresh-Funktionen
|
//refresh-Funktionen
|
||||||
void mainWindowImpl::refreshSet() {
|
void mainWindowImpl::refreshSet() {
|
||||||
@@ -2506,6 +2509,15 @@ void mainWindowImpl::blinkingStartButtonAnimationAction() {
|
|||||||
pushButton_break->setPalette(tempPalette);
|
pushButton_break->setPalette(tempPalette);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void mainWindowImpl::sendChatMessage() { myChat->sendMessage(); }
|
||||||
|
|
||||||
|
void mainWindowImpl::setChatFocus() {
|
||||||
|
|
||||||
|
if(tabWidget->currentIndex() == 1) lineEdit_ChatInput->setFocus();
|
||||||
|
else lineEdit_ChatInput->clearFocus();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void mainWindowImpl::closeEvent(QCloseEvent *event) {
|
void mainWindowImpl::closeEvent(QCloseEvent *event) {
|
||||||
|
|
||||||
mySession->terminateNetworkClient();
|
mySession->terminateNetworkClient();
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
#include <QtCore>
|
#include <QtCore>
|
||||||
|
|
||||||
class Log;
|
class Log;
|
||||||
|
class Chat;
|
||||||
class ConfigFile;
|
class ConfigFile;
|
||||||
class Session;
|
class Session;
|
||||||
class Game;
|
class Game;
|
||||||
@@ -66,7 +67,8 @@ public:
|
|||||||
Session &getSession();
|
Session &getSession();
|
||||||
void setSession(boost::shared_ptr<Session> session);
|
void setSession(boost::shared_ptr<Session> session);
|
||||||
|
|
||||||
void setLog(Log*);
|
void setLog(Log* l) { myLog = l; }
|
||||||
|
void setChat(Chat* c) { myChat = c; }
|
||||||
|
|
||||||
void setSpeeds();
|
void setSpeeds();
|
||||||
|
|
||||||
@@ -234,6 +236,9 @@ public slots:
|
|||||||
|
|
||||||
void paintStartSplash();
|
void paintStartSplash();
|
||||||
|
|
||||||
|
void sendChatMessage();
|
||||||
|
void setChatFocus();
|
||||||
|
|
||||||
void networkError(int, int);
|
void networkError(int, int);
|
||||||
void networkStart(boost::shared_ptr<Game> game);
|
void networkStart(boost::shared_ptr<Game> game);
|
||||||
|
|
||||||
@@ -244,6 +249,7 @@ private:
|
|||||||
boost::shared_ptr<GuiInterface> myServerGuiInterface;
|
boost::shared_ptr<GuiInterface> myServerGuiInterface;
|
||||||
boost::shared_ptr<Session> mySession;
|
boost::shared_ptr<Session> mySession;
|
||||||
Log *myLog;
|
Log *myLog;
|
||||||
|
Chat *myChat;
|
||||||
ConfigFile *myConfig;
|
ConfigFile *myConfig;
|
||||||
|
|
||||||
//Logo
|
//Logo
|
||||||
|
|||||||
@@ -189,3 +189,8 @@ void Session::sendClientPlayerAction()
|
|||||||
myNetClient->SendPlayerAction();
|
myNetClient->SendPlayerAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Session::sendChatMessage(std::string message) {
|
||||||
|
|
||||||
|
//hi lothar --> zum testen schick ich es gleich wieder zurück an die gui. wie du siehst klappt es ;-)
|
||||||
|
myGui->chatAppendMsg(message);
|
||||||
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
#include "playerdata.h"
|
#include "playerdata.h"
|
||||||
#include "game_defs.h"
|
#include "game_defs.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <iostream>
|
||||||
#include <boost/shared_ptr.hpp>
|
#include <boost/shared_ptr.hpp>
|
||||||
|
|
||||||
class GuiInterface;
|
class GuiInterface;
|
||||||
@@ -58,6 +59,8 @@ public:
|
|||||||
void setCurrentGameID(const int& theValue) { currentGameID = theValue; }
|
void setCurrentGameID(const int& theValue) { currentGameID = theValue; }
|
||||||
int getCurrentGameID() const { return currentGameID; }
|
int getCurrentGameID() const { return currentGameID; }
|
||||||
|
|
||||||
|
void sendChatMessage(std::string message);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
int currentGameID;
|
int currentGameID;
|
||||||
|
|||||||
Reference in New Issue
Block a user