~ubuntu-branches/ubuntu/raring/quassel/raring-proposed

« back to all changes in this revision

Viewing changes to src/qtui/chatline.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2010-08-11 12:48:08 UTC
  • mfrom: (1.1.40 upstream)
  • Revision ID: james.westby@ubuntu.com-20100811124808-wl3zpp4gpbzmvn4t
Tags: 0.7~beta1-0ubuntu1
* New upstream beta release
  - Add libqca2-dev to build-depends for blowfish support
* Switch to source format v3 (Quilt) to use .bz2 tarball
  - Drop build-depends on quilt and update debian/rules
  - Add debian/source/format

Show diffs side-by-side

added added

removed removed

Lines of Context:
59
59
  setHighlighted(index.data(MessageModel::FlagsRole).toInt() & Message::Highlight);
60
60
}
61
61
 
 
62
ChatLine::~ChatLine() {
 
63
  if(chatView())
 
64
    chatView()->setHasCache(this, false);
 
65
}
 
66
 
62
67
ChatItem *ChatLine::item(ChatLineModel::ColumnType column) {
63
68
  switch(column) {
64
69
    case ChatLineModel::TimestampColumn:
82
87
  return 0;
83
88
}
84
89
 
 
90
void ChatLine::clearCache() {
 
91
  _timestampItem.clearCache();
 
92
  _senderItem.clearCache();
 
93
  _contentsItem.clearCache();
 
94
}
 
95
 
85
96
void ChatLine::setMouseGrabberItem(ChatItem *item) {
86
97
  _mouseGrabberItem = item;
87
98
}
198
209
  timestampItem()->paint(painter, option, widget);
199
210
  senderItem()->paint(painter, option, widget);
200
211
  contentsItem()->paint(painter, option, widget);
201
 
 
202
 
  // new line marker
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();
208
 
 
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);
218
 
      }
219
 
    }
220
 
  }
221
212
}
222
213
 
223
214
// We need to dispatch all mouse-related events to the appropriate (mouse grabbing) ChatItem