finished chat-implementing in startnetworkgamedialog
This commit is contained in:
@@ -18,6 +18,7 @@
|
|||||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#include "chattools.h"
|
#include "chattools.h"
|
||||||
|
#include "session.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@@ -36,8 +37,11 @@ ChatTools::~ChatTools()
|
|||||||
void ChatTools::sendMessage() {
|
void ChatTools::sendMessage() {
|
||||||
|
|
||||||
fillChatLinesHistory(myLineEdit->text());
|
fillChatLinesHistory(myLineEdit->text());
|
||||||
// myW->getSession().sendChatMessage(myW->lineEdit_ChatInput->text().toUtf8().constData());
|
if(mySession) {
|
||||||
myLineEdit->setText("");
|
mySession->sendChatMessage(myLineEdit->text().toUtf8().constData());
|
||||||
|
myLineEdit->setText("");
|
||||||
|
}
|
||||||
|
else { cout << "Session is not valid" << endl;}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatTools::receiveMessage(QString playerName, QString message) {
|
void ChatTools::receiveMessage(QString playerName, QString message) {
|
||||||
|
|||||||
@@ -24,6 +24,8 @@
|
|||||||
#include <QtCore>
|
#include <QtCore>
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
|
|
||||||
|
class Session;
|
||||||
|
|
||||||
class ChatTools : public QObject
|
class ChatTools : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -33,6 +35,8 @@ public:
|
|||||||
|
|
||||||
~ChatTools();
|
~ChatTools();
|
||||||
|
|
||||||
|
void setSession(Session *session) { mySession = session; }
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void sendMessage();
|
void sendMessage();
|
||||||
@@ -55,11 +59,11 @@ private:
|
|||||||
QStringList lastMatchStringList;
|
QStringList lastMatchStringList;
|
||||||
int nickAutoCompletitionCounter;
|
int nickAutoCompletitionCounter;
|
||||||
|
|
||||||
QLineEdit* myLineEdit;
|
QLineEdit *myLineEdit;
|
||||||
QTreeWidget *myNickTreeWidget;
|
QTreeWidget *myNickTreeWidget;
|
||||||
QStringList myNickStringList;
|
QStringList myNickStringList;
|
||||||
QTextBrowser* myTextBrowser;
|
QTextBrowser *myTextBrowser;
|
||||||
|
Session *mySession;
|
||||||
// friend class GuiWrapper;
|
// friend class GuiWrapper;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -688,6 +688,7 @@ mainWindowImpl::mainWindowImpl(ConfigFile *c, QMainWindow *parent)
|
|||||||
|
|
||||||
//Chat Messages
|
//Chat Messages
|
||||||
connect(this, SIGNAL(signalNetClientChatMsg(QString, QString)), myChat, SLOT(receiveMessage(QString, QString)));
|
connect(this, SIGNAL(signalNetClientChatMsg(QString, QString)), myChat, SLOT(receiveMessage(QString, QString)));
|
||||||
|
connect(this, SIGNAL(signalNetClientChatMsg(QString, QString)), myStartNetworkGameDialog, SLOT(receiveChatMsg(QString, QString)));
|
||||||
|
|
||||||
connect(this, SIGNAL(signalIrcConnect(QString)), myGameLobbyDialog->getLobbyChat(), SLOT(connected(QString)));
|
connect(this, SIGNAL(signalIrcConnect(QString)), myGameLobbyDialog->getLobbyChat(), SLOT(connected(QString)));
|
||||||
connect(this, SIGNAL(signalIrcSelfJoined(QString, QString)), myGameLobbyDialog->getLobbyChat(), SLOT(selfJoined(QString, QString)));
|
connect(this, SIGNAL(signalIrcSelfJoined(QString, QString)), myGameLobbyDialog->getLobbyChat(), SLOT(selfJoined(QString, QString)));
|
||||||
|
|||||||
@@ -190,6 +190,7 @@ void startNetworkGameDialogImpl::clearDialog()
|
|||||||
void startNetworkGameDialogImpl::setSession(Session *session)
|
void startNetworkGameDialogImpl::setSession(Session *session)
|
||||||
{
|
{
|
||||||
mySession = session;
|
mySession = session;
|
||||||
|
myChat->setSession(mySession);
|
||||||
}
|
}
|
||||||
|
|
||||||
void startNetworkGameDialogImpl::keyPressEvent ( QKeyEvent * event ) {
|
void startNetworkGameDialogImpl::keyPressEvent ( QKeyEvent * event ) {
|
||||||
|
|||||||
Reference in New Issue
Block a user