--- a/QTfrontend/chatwidget.cpp Sat Sep 24 00:00:57 2011 +0400
+++ b/QTfrontend/chatwidget.cpp Fri Sep 23 22:42:30 2011 +0200
@@ -111,6 +111,9 @@
.UserAction .nick { color: #ffa0ff; }\
.FriendAction { color: #ff00ff; }\
.FriendAction .nick { color: #ff30ff; }\
+.Error { color: #ff0000 }\
+.Warning { color: #ff8000 }\
+.Notice { color: #fefefe }\
";
HWChatWidget::HWChatWidget(QWidget* parent, QSettings * gameSettings, SDLInteraction * sdli, bool notify) :
@@ -340,9 +343,6 @@
isFriend = friendsList.contains(nick, Qt::CaseInsensitive);
}
- if (chatStrings.size() > 250)
- chatStrings.removeFirst();
-
QString formattedStr = Qt::escape(str.mid(1));
// make hedgewars.org urls actual links
formattedStr = formattedStr.replace(URLREGEXP, "<a href=\"http://\\3\">\\3</a>");
@@ -367,9 +367,17 @@
cssClass = "FriendChat";
}
- formattedStr = QString("<span class=\"%2\">%1</span>").arg(formattedStr).arg(cssClass);
+ addLine(cssClass,formattedStr);
+}
- chatStrings.append(formattedStr);
+void HWChatWidget::addLine(const QString& cssClass, QString line)
+{
+ if (chatStrings.size() > 250)
+ chatStrings.removeFirst();
+
+ line = QString("<span class=\"%2\">%1</span>").arg(line).arg(cssClass);
+
+ chatStrings.append(line);
chatText->setHtml(chatStrings.join("<br>"));