X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fchatline.cpp;h=c1c98da62babd4f9711fd4846d4d8d7dfab82bc4;hp=1c7db84c11a20a01662e86fb692bd915aa7af993;hb=120861b909702039da9993278d8319dad14fd292;hpb=2c16b8e356817cb4a4bf7fcd59c0c7429b0100e1 diff --git a/src/qtui/chatline.cpp b/src/qtui/chatline.cpp index 1c7db84c..c1c98da6 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. } @@ -165,11 +165,13 @@ void ChatLine::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, painter->fillRect(boundingRect(), msgFmt.background()); } - // TODO make this dependent on the style engine (highlight-color & friends) if(_selection & Selected) { - qreal left = item((ChatLineModel::ColumnType)(_selection & ItemMask)).x(); - QRectF selectRect(left, 0, width() - left, height()); - painter->fillRect(selectRect, QApplication::palette().brush(QPalette::Highlight)); + QTextCharFormat selFmt = QtUi::style()->format(UiStyle::formatType(type), label | UiStyle::Selected); + if(selFmt.hasProperty(QTextFormat::BackgroundBrush)) { + qreal left = item((ChatLineModel::ColumnType)(_selection & ItemMask)).x(); + QRectF selectRect(left, 0, width() - left, height()); + painter->fillRect(selectRect, selFmt.background()); + } } // new line marker @@ -184,9 +186,8 @@ void ChatLine::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, BufferId bufferId = BufferId(chatScene()->idString().toInt()); MsgId lastSeenMsgId = Client::networkModel()->lastSeenMarkerMsgId(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); }