QTfrontend/hwform.cpp
changeset 453 4b1236759402
parent 449 9f4063306e54
child 461 105af110b0e6
--- a/QTfrontend/hwform.cpp	Sun Feb 18 15:28:47 2007 +0000
+++ b/QTfrontend/hwform.cpp	Sun Feb 18 16:57:43 2007 +0000
@@ -265,7 +265,11 @@
 	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(ui.pageNetGame->pNetTeamsWidget, SIGNAL(hhogsNumChanged(const HWTeam&)),
 		hwnet, SLOT(onHedgehogsNumChanged(const HWTeam&)));
 	connect(ui.pageNetGame->pNetTeamsWidget, SIGNAL(teamColorChanged(const HWTeam&)),
@@ -440,3 +444,17 @@
 			"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);
+}