#include "network.h"
#include "qtui.h"
+#include "qtuisettings.h"
+
//! Construct a ChatLineOld object from a message.
/**
* \param m The message to be layouted and rendered
*/
ChatLineOld::ChatLineOld(Message m) {
hght = 0;
- //networkName = m.buffer.network();
- //bufferName = m.buffer.buffer();
+
msg = m;
selectionMode = None;
isHighlight = false;
formatMsg(msg);
+
+ QtUiSettings s("QtUi/Colors");
+ _highlightColor = s.value("highlightColor", QVariant(QColor("lightcoral"))).value<QColor>();
}
ChatLineOld::~ChatLineOld() {
precomputeLine();
}
+QList<ChatLineOld::FormatRange> ChatLineOld::calcFormatRanges(const UiStyle::StyledText &fs) {
+ QTextLayout::FormatRange additional;
+ additional.start = additional.length = 0;
+ return calcFormatRanges(fs, additional);
+}
+
// This function is almost obsolete, since with the new style engine, we already get a list of formats...
// We don't know yet if we keep this implementation of ChatLineOld, so I won't bother making this actually nice.
-QList<ChatLineOld::FormatRange> ChatLineOld::calcFormatRanges(UiStyle::StyledText fs, QTextLayout::FormatRange additional) {
+QList<ChatLineOld::FormatRange> ChatLineOld::calcFormatRanges(const UiStyle::StyledText &_fs,
+ const QTextLayout::FormatRange &additional) {
+ UiStyle::StyledText fs = _fs;
QList<FormatRange> ranges;
if(additional.length > 0) {
}
}
}
+
foreach(QTextLayout::FormatRange f, fs.formats) {
if(f.length <= 0) continue;
FormatRange range;
} else {
if(isHighlight) {
p->setPen(Qt::NoPen);
- p->setBrush(QColor("lightcoral") /*pal.brush(QPalette::AlternateBase) */);
+ p->setBrush(_highlightColor /*pal.brush(QPalette::AlternateBase) */);
p->drawRect(QRectF(pos, QSizeF(tsWidth + QtUi::style()->sepTsSender() + senderWidth + QtUi::style()->sepSenderText() + textWidth, height())));
}
if(selectionMode == Partial) {