X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fqtui%2Fchatline-old.cpp;h=2df6bbb43b6fc5646aa0da9e9f8b3da87ffe8c54;hb=7a67b37e12ae8c1e7b0eea2063e071fda8ba8aee;hp=2c9cb0d3c1628df01ed4a5441b1dcf2d0c9a0b16;hpb=d298e7275374e2da41b0ed9ef1080464a77c8cf1;p=quassel.git diff --git a/src/qtui/chatline-old.cpp b/src/qtui/chatline-old.cpp index 2c9cb0d3..2df6bbb4 100644 --- a/src/qtui/chatline-old.cpp +++ b/src/qtui/chatline-old.cpp @@ -23,18 +23,22 @@ #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(); } ChatLineOld::~ChatLineOld() { @@ -50,9 +54,17 @@ void ChatLineOld::formatMsg(Message msg) { precomputeLine(); } +QList 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::calcFormatRanges(UiStyle::StyledText fs, QTextLayout::FormatRange additional) { +QList ChatLineOld::calcFormatRanges(const UiStyle::StyledText &_fs, + const QTextLayout::FormatRange &additional) { + UiStyle::StyledText fs = _fs; QList ranges; if(additional.length > 0) { @@ -76,6 +88,7 @@ QList ChatLineOld::calcFormatRanges(UiStyle::StyledTex } } } + foreach(QTextLayout::FormatRange f, fs.formats) { if(f.length <= 0) continue; FormatRange range; @@ -309,7 +322,7 @@ void ChatLineOld::draw(QPainter *p, const QPointF &pos) { } 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) {