X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fuisupport%2Fuistyle.cpp;h=dd530bd3a02485cb6b433b9f188fd18a9a2947c4;hp=59a673b903c0d23e83a55ebdec5c1b33c2c8945f;hb=24acf1efa9e91c58d9e64d76e03e7683ac0ac889;hpb=694f9bfbf7f1af19108461c7e00d133e55082bce diff --git a/src/uisupport/uistyle.cpp b/src/uisupport/uistyle.cpp index 59a673b9..dd530bd3 100644 --- a/src/uisupport/uistyle.cpp +++ b/src/uisupport/uistyle.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-09 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -15,8 +15,9 @@ * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ + #include #include "buffersettings.h" @@ -560,15 +561,42 @@ UiStyle::StyledString UiStyle::styleString(const QString &s_, quint32 baseFormat QString UiStyle::mircToInternal(const QString &mirc_) { - QString mirc = mirc_; - mirc.replace('%', "%%"); // escape % just to be sure - mirc.replace('\t', " "); // tabs break layout, also this is italics in Konversation - mirc.replace('\x02', "%B"); - mirc.replace('\x0f', "%O"); - mirc.replace('\x12', "%R"); - mirc.replace('\x16', "%R"); - mirc.replace('\x1d', "%S"); - mirc.replace('\x1f', "%U"); + QString mirc; + mirc.reserve(mirc_.size()); + foreach (const QChar &c, mirc_) { + if ((c < '\x20' || c == '\x7f') && c != '\x03') { + switch (c.unicode()) { + case '\x02': + mirc += "%B"; + break; + case '\x0f': + mirc += "%O"; + break; + case '\x09': + mirc += " "; + break; + case '\x12': + case '\x16': + mirc += "%R"; + break; + case '\x1d': + mirc += "%S"; + break; + case '\x1f': + mirc += "%U"; + break; + case '\x7f': + mirc += QChar(0x2421); + break; + default: + mirc += QChar(0x2400 + c.unicode()); + } + } else { + if (c == '%') + mirc += c; + mirc += c; + } + } // Now we bring the color codes (\x03) in a sane format that can be parsed more easily later. // %Dcfxx is foreground, %Dcbxx is background color, where xx is a 2 digit dec number denoting the color code. @@ -686,8 +714,10 @@ void UiStyle::StyledMessage::style() const //: Error Message t = tr("%1").arg(txt); break; case Message::DayChange: + { //: Day Change Message - t = tr("{Day changed to %1}").arg(timestamp().toString()); + t = tr("{Day changed to %1}").arg(timestamp().date().toString(Qt::DefaultLocaleLongDate)); + } break; case Message::Topic: //: Topic Message