QTfrontend/hwform.cpp
changeset 461 105af110b0e6
parent 453 4b1236759402
child 465 07eca0a2546c
--- a/QTfrontend/hwform.cpp	Tue Feb 20 17:32:25 2007 +0000
+++ b/QTfrontend/hwform.cpp	Tue Feb 20 17:50:59 2007 +0000
@@ -39,6 +39,7 @@
 #include "gamecfgwidget.h"
 #include "netudpserver.h"
 #include "netudpwidget.h"
+#include "chatwidget.h"
 
 HWForm::HWForm(QWidget *parent)
   : QMainWindow(parent), pnetserver(0), pUdpServer(0)
@@ -265,11 +266,12 @@
 	connect(hwnet, SIGNAL(AddGame(const QString &)), this, SLOT(AddGame(const QString &)));
 	connect(hwnet, SIGNAL(EnteredGame()), this, SLOT(NetGameEnter()));
 	connect(hwnet, SIGNAL(AddNetTeam(const HWTeam&)), this, SLOT(AddNetTeam(const HWTeam&)));
-	connect(hwnet, SIGNAL(chatStringFromNet(const QStringList&)), 
-		this, SLOT(onChatStringFromNet(const QStringList&)));
 
-	connect(ui.pageNetGame->chatEditLine, SIGNAL(returnPressed()),
-		this, SLOT(chatLineToNet()));
+	connect(hwnet, SIGNAL(chatStringFromNet(const QStringList&)), 
+		ui.pageNetGame->pChatWidget, SLOT(onChatStringFromNet(const QStringList&)));
+	connect(ui.pageNetGame->pChatWidget, SIGNAL(chatLine(const QString&)),
+		hwnet, SLOT(chatLineToNet(const QString&)));
+
 	connect(ui.pageNetGame->pNetTeamsWidget, SIGNAL(hhogsNumChanged(const HWTeam&)),
 		hwnet, SLOT(onHedgehogsNumChanged(const HWTeam&)));
 	connect(ui.pageNetGame->pNetTeamsWidget, SIGNAL(teamColorChanged(const HWTeam&)),
@@ -444,17 +446,3 @@
 			"Hedgewars",
 			msg);
 }
-
-void HWForm::chatLineToNet()
-{
-  hwnet->chatLineToNet(ui.pageNetGame->chatEditLine->text());
-  ui.pageNetGame->chatEditLine->clear();
-}
-
-void HWForm::onChatStringFromNet(const QStringList& str)
-{
-  QListWidget* w=ui.pageNetGame->chatText;
-  w->addItem(str[0]+": "+str[1]);
-  w->scrollToBottom();
-  w->setSelectionMode(QAbstractItemView::NoSelection);
-}