/***************************************************************************
- * Copyright (C) 2005-2013 by the Quassel Project *
+ * Copyright (C) 2005-2014 by the Quassel Project *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
UiStyle::StyledString UiStyle::styleString(const QString &s_, quint32 baseFormat)
{
QString s = s_;
+ StyledString result;
+ result.formatList.append(qMakePair((quint16)0, baseFormat));
+
if (s.length() > 65535) {
+ // We use quint16 for indexes
qWarning() << QString("String too long to be styled: %1").arg(s);
- return StyledString();
+ result.plainText = s;
+ return result;
}
- StyledString result;
- result.formatList.append(qMakePair((quint16)0, baseFormat));
+
quint32 curfmt = baseFormat;
int pos = 0; quint16 length = 0;
for (;;) {
case '\x0f':
mirc += "%O";
break;
+ case '\x09':
+ mirc += " ";
+ break;
case '\x12':
case '\x16':
mirc += "%R";
mirc += QChar(0x2400 + c.unicode());
}
} else {
- if (c == '\t') {
- mirc += " ";
- continue;
- }
if (c == '%')
mirc += c;
mirc += c;
case Message::DayChange:
{
//: Day Change Message
- t = tr("{Day changed to %1}").arg(QLocale().toString(timestamp(), QLocale().dateFormat()));
+ t = tr("{Day changed to %1}").arg(timestamp().date().toString(Qt::DefaultLocaleLongDate));
}
break;
case Message::Topic:
if (chopCount < nick.size())
nick.chop(chopCount);
}
- quint16 hash = qChecksum(nick.toAscii().data(), nick.toAscii().size());
+ quint16 hash = qChecksum(nick.toLatin1().data(), nick.toLatin1().size());
return (_senderHash = (hash & 0xf) + 1);
}