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