equal
deleted
inserted
replaced
109 .FriendJoin .nick { color: #d0f0d0; }\ |
109 .FriendJoin .nick { color: #d0f0d0; }\ |
110 .UserAction { color: #ff80ff; }\ |
110 .UserAction { color: #ff80ff; }\ |
111 .UserAction .nick { color: #ffa0ff; }\ |
111 .UserAction .nick { color: #ffa0ff; }\ |
112 .FriendAction { color: #ff00ff; }\ |
112 .FriendAction { color: #ff00ff; }\ |
113 .FriendAction .nick { color: #ff30ff; }\ |
113 .FriendAction .nick { color: #ff30ff; }\ |
|
114 .Error { color: #ff0000 }\ |
|
115 .Warning { color: #ff8000 }\ |
|
116 .Notice { color: #fefefe }\ |
114 "; |
117 "; |
115 |
118 |
116 HWChatWidget::HWChatWidget(QWidget* parent, QSettings * gameSettings, SDLInteraction * sdli, bool notify) : |
119 HWChatWidget::HWChatWidget(QWidget* parent, QSettings * gameSettings, SDLInteraction * sdli, bool notify) : |
117 QWidget(parent), |
120 QWidget(parent), |
118 mainLayout(this) |
121 mainLayout(this) |
338 return; |
341 return; |
339 // friends will get special treatment, of course |
342 // friends will get special treatment, of course |
340 isFriend = friendsList.contains(nick, Qt::CaseInsensitive); |
343 isFriend = friendsList.contains(nick, Qt::CaseInsensitive); |
341 } |
344 } |
342 |
345 |
343 if (chatStrings.size() > 250) |
|
344 chatStrings.removeFirst(); |
|
345 |
|
346 QString formattedStr = Qt::escape(str.mid(1)); |
346 QString formattedStr = Qt::escape(str.mid(1)); |
347 // make hedgewars.org urls actual links |
347 // make hedgewars.org urls actual links |
348 formattedStr = formattedStr.replace(URLREGEXP, "<a href=\"http://\\3\">\\3</a>"); |
348 formattedStr = formattedStr.replace(URLREGEXP, "<a href=\"http://\\3\">\\3</a>"); |
349 |
349 |
350 // "link" nick, but before that encode it in base64 to make sure it can't intefere with html/url syntax |
350 // "link" nick, but before that encode it in base64 to make sure it can't intefere with html/url syntax |
365 default: |
365 default: |
366 if (isFriend) |
366 if (isFriend) |
367 cssClass = "FriendChat"; |
367 cssClass = "FriendChat"; |
368 } |
368 } |
369 |
369 |
370 formattedStr = QString("<span class=\"%2\">%1</span>").arg(formattedStr).arg(cssClass); |
370 addLine(cssClass,formattedStr); |
371 |
371 } |
372 chatStrings.append(formattedStr); |
372 |
|
373 void HWChatWidget::addLine(const QString& cssClass, QString line) |
|
374 { |
|
375 if (chatStrings.size() > 250) |
|
376 chatStrings.removeFirst(); |
|
377 |
|
378 line = QString("<span class=\"%2\">%1</span>").arg(line).arg(cssClass); |
|
379 |
|
380 chatStrings.append(line); |
373 |
381 |
374 chatText->setHtml(chatStrings.join("<br>")); |
382 chatText->setHtml(chatStrings.join("<br>")); |
375 |
383 |
376 chatText->moveCursor(QTextCursor::End); |
384 chatText->moveCursor(QTextCursor::End); |
377 } |
385 } |