/***************************************************************************
- * Copyright (C) 2005-2010 by the Quassel Project *
+ * Copyright (C) 2005-2012 by the Quassel Project *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
***************************************************************************/
#include <QDateTime>
+#include <QGraphicsSceneMouseEvent>
#include <QString>
#include <QtGui>
setHighlighted(index.data(MessageModel::FlagsRole).toInt() & Message::Highlight);
}
+ChatLine::~ChatLine() {
+ if(chatView())
+ chatView()->setHasCache(this, false);
+}
+
ChatItem *ChatLine::item(ChatLineModel::ColumnType column) {
switch(column) {
case ChatLineModel::TimestampColumn:
return 0;
}
+void ChatLine::clearCache() {
+ _timestampItem.clearCache();
+ _senderItem.clearCache();
+ _contentsItem.clearCache();
+}
+
void ChatLine::setMouseGrabberItem(ChatItem *item) {
_mouseGrabberItem = item;
}
timestampItem()->paint(painter, option, widget);
senderItem()->paint(painter, option, widget);
contentsItem()->paint(painter, option, widget);
-
- // new line marker
- if(model_ && row() > 0 && chatScene()->isSingleBufferScene()) {
- QModelIndex prevRowIdx = model_->index(row() - 1, 0);
- MsgId prevMsgId = prevRowIdx.data(MessageModel::MsgIdRole).value<MsgId>();
- MsgId myMsgId = myIdx.data(MessageModel::MsgIdRole).value<MsgId>();
- Message::Flags flags = (Message::Flags)myIdx.data(MessageModel::FlagsRole).toInt();
-
- // 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()->markerLineMsgId(bufferId);
- if(lastSeenMsgId < myMsgId && lastSeenMsgId >= prevMsgId) {
- QLinearGradient gradient(0, 0, 0, contentsItem()->fontMetrics()->lineSpacing());
- 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);
- }
- }
- }
}
// We need to dispatch all mouse-related events to the appropriate (mouse grabbing) ChatItem