X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fchatline-old.cpp;h=497017da684e97e37db3e2f7f0263f6178370272;hp=2c9cb0d3c1628df01ed4a5441b1dcf2d0c9a0b16;hb=a2bf6dec2ea5a72d15a3310f8a7abc11988228c4;hpb=d298e7275374e2da41b0ed9ef1080464a77c8cf1 diff --git a/src/qtui/chatline-old.cpp b/src/qtui/chatline-old.cpp index 2c9cb0d3..497017da 100644 --- a/src/qtui/chatline-old.cpp +++ b/src/qtui/chatline-old.cpp @@ -23,22 +23,27 @@ #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) { +QColor ChatLineOld::_highlightColor; +ChatLineOld::ChatLineOld(const Message &m) { hght = 0; - //networkName = m.buffer.network(); - //bufferName = m.buffer.buffer(); msg = m; selectionMode = None; isHighlight = false; formatMsg(msg); + + if(!_highlightColor.isValid()) { + QtUiSettings s("QtUi/Colors"); + _highlightColor = s.value("highlightColor", QVariant(QColor("lightcoral"))).value(); + } } ChatLineOld::~ChatLineOld() { - } void ChatLineOld::formatMsg(Message msg) { @@ -50,9 +55,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 +89,7 @@ QList ChatLineOld::calcFormatRanges(UiStyle::StyledTex } } } + foreach(QTextLayout::FormatRange f, fs.formats) { if(f.length <= 0) continue; FormatRange range; @@ -309,7 +323,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) {