# HG changeset patch # User sheepluva # Date 1319895105 -7200 # Node ID 4c834af76c3bb9b75272d7751fca65ee3745c96c # Parent ce60b734fff195ecf6f19615710239cbdbfa3a96 * fix highlighting (i just broke it by not negating a boolean expression) * fix issues with first display: none; being ignored + allow css to hide hours / seconds of timestamp diff -r ce60b734fff1 -r 4c834af76c3b QTfrontend/res/css/chat.css --- a/QTfrontend/res/css/chat.css Sat Oct 29 11:47:37 2011 +0200 +++ b/QTfrontend/res/css/chat.css Sat Oct 29 15:31:45 2011 +0200 @@ -8,8 +8,9 @@ * see http://doc.qt.nokia.com/4.5/richtext-html-subset.html#css-properties * * In the QTfrontend of hedgewars also display:none; will work for class names - * that start with msg_ and .TimeStamp - as long as they are referenced - * directly and not within any hierachy. + * that start with msg_ and .timestamp - as long as they are referenced + * directly and not within any class hierachy. + * Note: Will only effect new lines! * ****************************************************************************** * @@ -48,6 +49,9 @@ .msg_FriendAction { color: #ff00ff; } .msg_FriendAction .nick { color: #ff30ff; } +/* uncomment next line to disable join and leave messages of non-friends */ +/* .msg_UserJoin { display:none; } */ + /* timestamps */ .timestamp { color: #e0d8e0; @@ -58,6 +62,9 @@ /* display: none; */ } +.timestamp:hours { display: none; } +/* .timestamp:seconds { display: none; } */ + /* you can also set timestamp style for different msg types */ .msg_FriendChat .timestamp { color: #ffffff; } @@ -65,9 +72,6 @@ .highlight { } .highlight .nick { color: red; } /* nicknames in highlighted messages */ -/* uncomment next line to disable join and leave messages of non-friends */ -/* .msg_UserJoin { display:none; } */ - /* system messages */ .msg_Error { color: #ff0000; } .msg_Warning { color: #ff8000; } diff -r ce60b734fff1 -r 4c834af76c3b QTfrontend/ui/widget/chatwidget.cpp --- a/QTfrontend/ui/widget/chatwidget.cpp Sat Oct 29 11:47:37 2011 +0200 +++ b/QTfrontend/ui/widget/chatwidget.cpp Sat Oct 29 15:31:45 2011 +0200 @@ -34,6 +34,8 @@ #include #include +#include + #include "HWDataManager.h" #include "hwconsts.h" @@ -103,6 +105,7 @@ QString * HWChatWidget::s_styleSheet = NULL; QStringList * HWChatWidget::s_displayNone = NULL; bool HWChatWidget::s_isTimeStamped = true; +QString HWChatWidget::s_tsFormat = ":mm:ss"; const QString & HWChatWidget::styleSheet() { @@ -173,6 +176,7 @@ QStringList victims = QString(style). remove(displayed). // remove visible stuff + trimmed(). split(split). // get a list of the names filter(nohierarchy). // only direct class names replaceInStrings(QRegExp("^."),""); // crop . @@ -183,6 +187,17 @@ s_isTimeStamped = false; victims.removeAll("timestamp"); } + else + { + s_isTimeStamped = true; + s_tsFormat = + ((victims.contains("timestamp:hours"))?"":"hh") + + QString(":mm:") + + ((victims.contains("timestamp:seconds"))?"":"ss"); + } + + victims.removeAll("timestamp:hours"); + victims.removeAll("timestamp:seconds"); victims.removeDuplicates(); @@ -540,7 +555,7 @@ bool isHL = false; if ((c != 3) && (!nick.isEmpty()) && - (nick != m_userNick) && (m_userNick.isEmpty())) + (nick != m_userNick) && (!m_userNick.isEmpty())) { QString lcStr = str.toLower(); @@ -569,7 +584,7 @@ { QString tsMarkUp = "[%1] "; QTime now = QDateTime::currentDateTime().time(); - line = tsMarkUp.arg(now.toString(":mm:ss")) + line; + line = tsMarkUp.arg(now.toString(s_tsFormat)) + line; } line = QString("%2").arg(cssClass).arg(line); diff -r ce60b734fff1 -r 4c834af76c3b QTfrontend/ui/widget/chatwidget.h --- a/QTfrontend/ui/widget/chatwidget.h Sat Oct 29 11:47:37 2011 +0200 +++ b/QTfrontend/ui/widget/chatwidget.h Sat Oct 29 15:31:45 2011 +0200 @@ -25,6 +25,7 @@ #include #include #include +#include #include #include "SDLInteraction.h" @@ -88,6 +89,7 @@ static QString * s_styleSheet; static QStringList * s_displayNone; static bool s_isTimeStamped; + static QString s_tsFormat; static const QRegExp URLREGEXP; static void setStyleSheet(const QString & styleSheet = "");