X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fchatline.cpp;h=38e78c699c0c80eabe6d225768a29ef53b39542c;hp=f6ea50f9b88b69e1aafc646f6db831b38ae3a5db;hb=541013790cdbd0c32d81debf8f42ac6b5183a4aa;hpb=c6a6c0e4317986792320826956fd5ead2b3e9e67 diff --git a/src/qtui/chatline.cpp b/src/qtui/chatline.cpp index f6ea50f9..38e78c69 100644 --- a/src/qtui/chatline.cpp +++ b/src/qtui/chatline.cpp @@ -105,20 +105,20 @@ void ChatLine::setSecondColumn(const qreal &senderWidth, const qreal &contentsWi void ChatLine::setGeometryByWidth(const qreal &width, const qreal &contentsWidth, qreal &linePos) { qreal height = _contentsItem.setGeometryByWidth(contentsWidth); linePos -= height; - bool needGeometryChange = linePos == pos().y(); + bool needGeometryChange = (height != _height || width != _width); - if(needGeometryChange) { + if(height != _height) { _timestampItem.prepareGeometryChange(); + _timestampItem.setHeight(height); _senderItem.prepareGeometryChange(); + _senderItem.setHeight(height); } - _timestampItem.setHeight(height); - _senderItem.setHeight(height); - if(needGeometryChange) + if(needGeometryChange) { prepareGeometryChange(); - - _height = height; - _width = width; + _height = height; + _width = width; + } setPos(0, linePos); // set pos is _very_ cheap if nothing changes. } @@ -184,11 +184,10 @@ void ChatLine::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, // don't show the marker if we wrote that new line if(!(flags & Message::Self)) { BufferId bufferId = BufferId(chatScene()->idString().toInt()); - MsgId lastSeenMsgId = Client::networkModel()->lastSeenMarkerMsgId(bufferId); + MsgId lastSeenMsgId = Client::networkModel()->markerLineMsgId(bufferId); if(lastSeenMsgId < myMsgId && lastSeenMsgId >= prevMsgId) { - QtUiStyleSettings s("Colors"); QLinearGradient gradient(0, 0, 0, contentsItem().fontMetrics()->lineSpacing()); - gradient.setColorAt(0, s.value("newMsgMarkerFG", QColor(Qt::red)).value()); + gradient.setColorAt(0, QtUi::style()->brush(UiStyle::MarkerLine).color()); // FIXME: Use full (gradient?) brush instead of just the color gradient.setColorAt(0.1, Qt::transparent); painter->fillRect(boundingRect(), gradient); }