X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fchatline-old.cpp;h=c1cd7d2ff970d805aca446b8592f27a1722e4460;hp=2c9cb0d3c1628df01ed4a5441b1dcf2d0c9a0b16;hb=56c684447058042182308ad35cd9446601779016;hpb=d298e7275374e2da41b0ed9ef1080464a77c8cf1 diff --git a/src/qtui/chatline-old.cpp b/src/qtui/chatline-old.cpp index 2c9cb0d3..c1cd7d2f 100644 --- a/src/qtui/chatline-old.cpp +++ b/src/qtui/chatline-old.cpp @@ -23,14 +23,15 @@ #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; @@ -50,9 +51,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 +85,7 @@ QList ChatLineOld::calcFormatRanges(UiStyle::StyledTex } } } + foreach(QTextLayout::FormatRange f, fs.formats) { if(f.length <= 0) continue; FormatRange range; @@ -308,8 +318,10 @@ void ChatLineOld::draw(QPainter *p, const QPointF &pos) { p->drawRect(QRectF(pos, QSizeF(tsWidth + QtUi::style()->sepTsSender() + senderWidth + QtUi::style()->sepSenderText() + textWidth, height()))); } else { if(isHighlight) { + QtUiSettings s("QtUi/Colors"); + QColor highlightColor = s.value("highlightColor", QVariant(QColor("lightcoral"))).value(); 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) {