Save much space for chat widget on lobby page by removing server message widget (now this messages goes to chat)
authorunc0rr
Tue, 06 Jan 2009 11:28:13 +0000
changeset 1584 90f6a5abad17
parent 1583 30257fe3f9e9
child 1585 9f9138531070
Save much space for chat widget on lobby page by removing server message widget (now this messages goes to chat)
QTfrontend/chatwidget.cpp
QTfrontend/hwform.cpp
QTfrontend/newnetclient.cpp
QTfrontend/pages.cpp
QTfrontend/pages.h
netserver/HWProto.hs
--- a/QTfrontend/chatwidget.cpp	Tue Jan 06 09:58:50 2009 +0000
+++ b/QTfrontend/chatwidget.cpp	Tue Jan 06 11:28:13 2009 +0000
@@ -76,7 +76,7 @@
 	
 	chatStrings.append(str);
 	
-	chatText->setPlainText(chatStrings.join("\n"));
+	chatText->setHtml(chatStrings.join("<br>"));
 
 	chatText->moveCursor(QTextCursor::End);
 }
--- a/QTfrontend/hwform.cpp	Tue Jan 06 09:58:50 2009 +0000
+++ b/QTfrontend/hwform.cpp	Tue Jan 06 11:28:13 2009 +0000
@@ -448,9 +448,10 @@
 
 	connect(hwnet, SIGNAL(roomsList(const QStringList&)),
 		ui.pageRoomsList, SLOT(setRoomsList(const QStringList&)));
+	
 	connect(hwnet, SIGNAL(serverMessage(const QString&)),
-		ui.pageRoomsList->serverMessage, SLOT(setText(const QString&)));
-	
+		ui.pageRoomsList->chatWidget, SLOT(onChatString(const QString&)));
+
 	connect(ui.pageRoomsList, SIGNAL(askForCreateRoom(const QString &)),
 		hwnet, SLOT(CreateRoom(const QString&)));
 	connect(ui.pageRoomsList, SIGNAL(askForJoinRoom(const QString &)),
--- a/QTfrontend/newnetclient.cpp	Tue Jan 06 09:58:50 2009 +0000
+++ b/QTfrontend/newnetclient.cpp	Tue Jan 06 11:28:13 2009 +0000
@@ -270,9 +270,9 @@
 	}
 
 	if (lst[0] == "INFO") {
-		if(lst.size() < 2)
+		if(lst.size() < 5)
 		{
-			qWarning("Net: Empty INFO message");
+			qWarning("Net: Malformed INFO message");
 			return;
 		}
 		QStringList tmp = lst;
--- a/QTfrontend/pages.cpp	Tue Jan 06 09:58:50 2009 +0000
+++ b/QTfrontend/pages.cpp	Tue Jan 06 11:28:13 2009 +0000
@@ -684,18 +684,13 @@
 	roomsList->horizontalHeader()->setResizeMode(QHeaderView::Interactive);
 	roomsList->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch);
 	pageLayout->addWidget(roomsList, 1, 0, 3, 1);
-	pageLayout->setRowStretch(2, 125);
+	pageLayout->setRowStretch(2, 100);
 	
-	serverMessage = new QTextBrowser(this);
-	serverMessage->setOpenExternalLinks(true);
-	pageLayout->addWidget(serverMessage, 4, 0, 1, 2);
-	pageLayout->setRowStretch(4, 100);
+	chatWidget = new HWChatWidget(this);
+	pageLayout->addWidget(chatWidget, 4, 0, 1, 2);
+	pageLayout->setRowStretch(4, 350);
 
-	chatWidget = new HWChatWidget(this);
-	pageLayout->addWidget(chatWidget, 5, 0, 1, 2);
-	pageLayout->setRowStretch(5, 200);
-
-	BtnBack = addButton(":/res/Exit.png", pageLayout, 6, 0, true);
+	BtnBack = addButton(":/res/Exit.png", pageLayout, 5, 0, true);
 	BtnCreate = addButton(tr("Create"), pageLayout, 0, 1);
 	BtnJoin = addButton(tr("Join"), pageLayout, 1, 1);
 	BtnRefresh = addButton(tr("Refresh"), pageLayout, 3, 1);
--- a/QTfrontend/pages.h	Tue Jan 06 09:58:50 2009 +0000
+++ b/QTfrontend/pages.h	Tue Jan 06 11:28:13 2009 +0000
@@ -365,7 +365,6 @@
 	QPushButton * BtnCreate;
 	QPushButton * BtnJoin;
 	QPushButton * BtnRefresh;
-	QTextBrowser * serverMessage;
 	HWChatWidget * chatWidget;
 	
 public slots:
--- a/netserver/HWProto.hs	Tue Jan 06 09:58:50 2009 +0000
+++ b/netserver/HWProto.hs	Tue Jan 06 11:28:13 2009 +0000
@@ -163,7 +163,8 @@
 		[]
 	else
 		(answerClientOnly $ ["LOBBY:JOINED"] ++ (map nick $ clients)) ++
-		(answerOthersRoom ["LOBBY:JOINED", nick client])
+		(answerOthersRoom ["LOBBY:JOINED", nick client]) ++
+		(answerServerMessage client clients)
 
 handleCmd_noInfo :: CmdHandler
 handleCmd_noInfo client clients _ ["NICK", newNick] =
@@ -192,7 +193,7 @@
 -- 'noRoom' clients state command handlers
 handleCmd_noRoom :: CmdHandler
 handleCmd_noRoom client clients rooms ["LIST"] =
-		(noChangeClients, noChangeRooms, answerServerMessage client clients ++ (answerRoomsList $ concatMap roomInfo $ sameProtoRooms))
+		(noChangeClients, noChangeRooms, (answerRoomsList $ concatMap roomInfo $ sameProtoRooms))
 		where
 			roomInfo room = [
 					name room,