Ejemplo n.º 1
0
void BufferSyncer::initSetMarkerLines(const QVariantList &list)
{
    _markerLines.clear();
    Q_ASSERT(list.count() % 2 == 0);
    for (int i = 0; i < list.count(); i += 2) {
        setMarkerLine(list.at(i).value<BufferId>(), list.at(i+1).value<MsgId>());
    }
}
Ejemplo n.º 2
0
void BufferWidget::currentChanged(const QModelIndex &current, const QModelIndex &previous) {
  ChatView *prevView = qobject_cast<ChatView *>(ui.stackedWidget->currentWidget());

  AbstractBufferContainer::currentChanged(current, previous); // switch first to avoid a redraw

  // we need to hide the marker line if it's already/still at the bottom of the view (and not scrolled up)
  ChatView *curView = qobject_cast<ChatView *>(ui.stackedWidget->currentWidget());
  if(curView) {
    BufferId curBufferId = current.data(NetworkModel::BufferIdRole).value<BufferId>();
    if(curBufferId.isValid()) {
      MsgId markerMsgId = Client::networkModel()->markerLineMsgId(curBufferId);
      if(markerMsgId == curView->lastMsgId() && markerMsgId == curView->lastVisibleMsgId())
        curView->setMarkerLineVisible(false);
      else
        curView->setMarkerLineVisible(true);
    }
  }

  if(prevView && autoMarkerLine())
    setMarkerLine(prevView, false);
}
Ejemplo n.º 3
0
void CoreBufferSyncer::requestSetMarkerLine(BufferId buffer, const MsgId &msgId)
{
    if (setMarkerLine(buffer, msgId))
        dirtyMarkerLineBuffers << buffer;
}