59
59
setHighlighted(index.data(MessageModel::FlagsRole).toInt() & Message::Highlight);
62
ChatLine::~ChatLine() {
64
chatView()->setHasCache(this, false);
62
67
ChatItem *ChatLine::item(ChatLineModel::ColumnType column) {
64
69
case ChatLineModel::TimestampColumn:
90
void ChatLine::clearCache() {
91
_timestampItem.clearCache();
92
_senderItem.clearCache();
93
_contentsItem.clearCache();
85
96
void ChatLine::setMouseGrabberItem(ChatItem *item) {
86
97
_mouseGrabberItem = item;
198
209
timestampItem()->paint(painter, option, widget);
199
210
senderItem()->paint(painter, option, widget);
200
211
contentsItem()->paint(painter, option, widget);
203
if(model_ && row() > 0 && chatScene()->isSingleBufferScene()) {
204
QModelIndex prevRowIdx = model_->index(row() - 1, 0);
205
MsgId prevMsgId = prevRowIdx.data(MessageModel::MsgIdRole).value<MsgId>();
206
MsgId myMsgId = myIdx.data(MessageModel::MsgIdRole).value<MsgId>();
207
Message::Flags flags = (Message::Flags)myIdx.data(MessageModel::FlagsRole).toInt();
209
// don't show the marker if we wrote that new line
210
if(!(flags & Message::Self)) {
211
BufferId bufferId = BufferId(chatScene()->idString().toInt());
212
MsgId lastSeenMsgId = Client::networkModel()->markerLineMsgId(bufferId);
213
if(lastSeenMsgId < myMsgId && lastSeenMsgId >= prevMsgId) {
214
QLinearGradient gradient(0, 0, 0, contentsItem()->fontMetrics()->lineSpacing());
215
gradient.setColorAt(0, QtUi::style()->brush(UiStyle::MarkerLine).color()); // FIXME: Use full (gradient?) brush instead of just the color
216
gradient.setColorAt(0.1, Qt::transparent);
217
painter->fillRect(boundingRect(), gradient);
223
214
// We need to dispatch all mouse-related events to the appropriate (mouse grabbing) ChatItem