projects
/
quassel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
No more posF in Qt 5; use the new localPos
[quassel.git]
/
src
/
uisupport
/
uistyle.cpp
diff --git
a/src/uisupport/uistyle.cpp
b/src/uisupport/uistyle.cpp
index
df23a62
..
975c79d
100644
(file)
--- a/
src/uisupport/uistyle.cpp
+++ b/
src/uisupport/uistyle.cpp
@@
-1,5
+1,5
@@
/***************************************************************************
/***************************************************************************
- * Copyright (C) 2005-201
3
by the Quassel Project *
+ * Copyright (C) 2005-201
4
by the Quassel Project *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
@@
-491,12
+491,16
@@
QList<QTextLayout::FormatRange> UiStyle::toTextLayoutList(const FormatList &form
UiStyle::StyledString UiStyle::styleString(const QString &s_, quint32 baseFormat)
{
QString s = s_;
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) {
if (s.length() > 65535) {
+ // We use quint16 for indexes
qWarning() << QString("String too long to be styled: %1").arg(s);
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 (;;) {
quint32 curfmt = baseFormat;
int pos = 0; quint16 length = 0;
for (;;) {
@@
-572,6
+576,9
@@
QString UiStyle::mircToInternal(const QString &mirc_)
case '\x0f':
mirc += "%O";
break;
case '\x0f':
mirc += "%O";
break;
+ case '\x09':
+ mirc += " ";
+ break;
case '\x12':
case '\x16':
mirc += "%R";
case '\x12':
case '\x16':
mirc += "%R";
@@
-589,10
+596,6
@@
QString UiStyle::mircToInternal(const QString &mirc_)
mirc += QChar(0x2400 + c.unicode());
}
} else {
mirc += QChar(0x2400 + c.unicode());
}
} else {
- if (c == '\t') {
- mirc += " ";
- continue;
- }
if (c == '%')
mirc += c;
mirc += c;
if (c == '%')
mirc += c;
mirc += c;
@@
-717,7
+720,7
@@
void UiStyle::StyledMessage::style() const
case Message::DayChange:
{
//: Day Change Message
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:
}
break;
case Message::Topic:
@@
-859,7
+862,7
@@
quint8 UiStyle::StyledMessage::senderHash() const
if (chopCount < nick.size())
nick.chop(chopCount);
}
if (chopCount < nick.size())
nick.chop(chopCount);
}
- quint16 hash = qChecksum(nick.to
Ascii().data(), nick.toAscii
().size());
+ quint16 hash = qChecksum(nick.to
Latin1().data(), nick.toLatin1
().size());
return (_senderHash = (hash & 0xf) + 1);
}
return (_senderHash = (hash & 0xf) + 1);
}