Quassel IRC  Pre-Release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
ChatView Class Reference

#include </tmp/quassel/src/qtui/chatview.h>

Inheritance diagram for ChatView:
Collaboration diagram for ChatView:

Public Slots

virtual void clear ()
void zoomIn ()
void zoomOut ()
void zoomOriginal ()
void setMarkerLineVisible (bool visible=true)
void setMarkerLine (MsgId msgId)
void jumpToMarkerLine (bool requestBacklog)

Public Member Functions

 ChatView (MessageFilter *, QWidget *parent=0)
 ChatView (BufferId bufferId, QWidget *parent=0)
virtual MsgId lastMsgId () const
virtual MsgId lastVisibleMsgId () const
AbstractBufferContainerbufferContainer () const
void setBufferContainer (AbstractBufferContainer *c)
ChatScenescene () const
QSet< ChatLine * > visibleChatLines (Qt::ItemSelectionMode mode=Qt::ContainsItemBoundingRect) const
 Return a set of ChatLines currently visible in the view.
QList< ChatLine * > visibleChatLinesSorted (Qt::ItemSelectionMode mode=Qt::ContainsItemBoundingRect) const
 Return a sorted list of ChatLines currently visible in the view.
ChatLinelastVisibleChatLine (bool ignoreDayChange=false) const
 Return the last fully visible ChatLine in this view.
virtual void addActionsToMenu (QMenu *, const QPointF &pos)
void setHasCache (ChatLine *line, bool hasCache=true)
 Tell the view that this ChatLine has cached data.

Protected Slots

virtual void verticalScrollbarChanged (int)

Protected Member Functions

virtual bool event (QEvent *event)
virtual void resizeEvent (QResizeEvent *event)
virtual void scrollContentsBy (int dx, int dy)

Private Slots

void lastLineChanged (QGraphicsItem *chatLine, qreal offset)
void adjustSceneRect ()
void checkChatLineCaches ()
void mouseMoveWhileSelecting (const QPointF &scenePos)
void scrollTimerTimeout ()
void invalidateFilter ()
void markerLineSet (BufferId buffer, MsgId msg)

Private Member Functions

void init (MessageFilter *filter)

Private Attributes

AbstractBufferContainer_bufferContainer
ChatScene_scene
int _lastScrollbarPos
qreal _currentScaleFactor
QTimer _scrollTimer
int _scrollOffset
bool _invalidateFilter
QSet< ChatLine * > _linesWithCache

Detailed Description

Definition at line 37 of file chatview.h.

Constructor & Destructor Documentation

ChatView ( MessageFilter filter,
QWidget *  parent = 0 
)

Definition at line 48 of file chatview.cpp.

References init().

ChatView ( BufferId  bufferId,
QWidget *  parent = 0 
)

Definition at line 37 of file chatview.cpp.

References init(), and Client::messageModel().

Member Function Documentation

MsgId lastMsgId ( ) const
virtual

Implements AbstractChatView.

Definition at line 229 of file chatview.cpp.

References ChatScene::model(), MessageModel::MsgIdRole, and scene().

Referenced by BufferWidget::currentChanged().

MsgId lastVisibleMsgId ( ) const
virtual

Definition at line 242 of file chatview.cpp.

References lastVisibleChatLine(), and ChatLine::msgId().

Referenced by BufferWidget::currentChanged().

AbstractBufferContainer* bufferContainer ( ) const
inline

Definition at line 47 of file chatview.h.

References _bufferContainer.

Referenced by addActionsToMenu().

void setBufferContainer ( AbstractBufferContainer c)
inline

Definition at line 48 of file chatview.h.

References _bufferContainer.

Referenced by BufferWidget::createChatView().

QSet< ChatLine * > visibleChatLines ( Qt::ItemSelectionMode  mode = Qt::ContainsItemBoundingRect) const

Return a set of ChatLines currently visible in the view.

Parameters
modeHow partially visible ChatLines are handled
Returns
A set of visible ChatLines

Definition at line 260 of file chatview.cpp.

Referenced by lastVisibleChatLine(), and visibleChatLinesSorted().

QList< ChatLine * > visibleChatLinesSorted ( Qt::ItemSelectionMode  mode = Qt::ContainsItemBoundingRect) const

Return a sorted list of ChatLines currently visible in the view.

Parameters
modeHow partially visible ChatLines are handled
Returns
A list of visible ChatLines sorted by row
Note
If the order of ChatLines does not matter, use visibleChatLines() instead

Definition at line 272 of file chatview.cpp.

References chatLinePtrLessThan(), and visibleChatLines().

ChatLine * lastVisibleChatLine ( bool  ignoreDayChange = false) const

Return the last fully visible ChatLine in this view.

Using this method more efficient than calling visibleChatLinesSorted() and taking its last element.

Returns
The last fully visible ChatLine in the view

Definition at line 280 of file chatview.cpp.

References ChatScene::chatLine(), ChatScene::model(), ChatLine::msgType(), ChatLine::row(), scene(), and visibleChatLines().

Referenced by lastVisibleMsgId(), and BufferWidget::setMarkerLine().

void addActionsToMenu ( QMenu *  menu,
const QPointF &  pos 
)
virtual

Reimplemented in ChatMonitorView, and AwayLogView.

Definition at line 336 of file chatview.cpp.

References BufferWidget::addActionsToMenu(), and bufferContainer().

Referenced by ChatScene::contextMenuEvent().

void setHasCache ( ChatLine line,
bool  hasCache = true 
)

Tell the view that this ChatLine has cached data.

ChatLines cache some layout data that should be cleared as soon as it's no longer visible. A ChatLine caching data registers itself with this method to tell the view about it. The view will call ChatLine::clearCache() when appropriate.

Parameters
lineThe ChatLine having cached data

Definition at line 393 of file chatview.cpp.

References _linesWithCache.

Referenced by ChatItem::layout(), and ChatLine::~ChatLine().

virtual void clear ( )
inlinevirtualslot

Definition at line 83 of file chatview.h.

void zoomIn ( )
slot

Definition at line 347 of file chatview.cpp.

References _currentScaleFactor, scene(), and ChatScene::setWidth().

Referenced by BufferWidget::zoomIn().

void zoomOut ( )
slot

Definition at line 355 of file chatview.cpp.

References _currentScaleFactor, scene(), and ChatScene::setWidth().

Referenced by BufferWidget::zoomOut().

void zoomOriginal ( )
slot

Definition at line 363 of file chatview.cpp.

References _currentScaleFactor, scene(), and ChatScene::setWidth().

Referenced by BufferWidget::zoomOriginal().

void setMarkerLineVisible ( bool  visible = true)
slot

Definition at line 304 of file chatview.cpp.

References scene(), and ChatScene::setMarkerLineVisible().

Referenced by BufferWidget::currentChanged().

void setMarkerLine ( MsgId  msgId)
slot

Definition at line 310 of file chatview.cpp.

References scene(), and ChatScene::singleBufferId().

void jumpToMarkerLine ( bool  requestBacklog)
slot

Definition at line 330 of file chatview.cpp.

References ChatScene::jumpToMarkerLine(), and scene().

Referenced by BufferWidget::jumpToMarkerLine().

bool event ( QEvent *  event)
protectedvirtual
void resizeEvent ( QResizeEvent *  event)
protectedvirtual
void scrollContentsBy ( int  dx,
int  dy 
)
protectedvirtual

Definition at line 386 of file chatview.cpp.

References checkChatLineCaches().

void verticalScrollbarChanged ( int  newPos)
protectedvirtualslot

Definition at line 206 of file chatview.cpp.

References _lastScrollbarPos, ChatScene::requestBacklog(), and scene().

Referenced by init().

void lastLineChanged ( QGraphicsItem *  chatLine,
qreal  offset 
)
privateslot

Definition at line 191 of file chatview.cpp.

References _currentScaleFactor.

Referenced by init().

void adjustSceneRect ( )
privateslot

Definition at line 153 of file chatview.cpp.

References scene().

Referenced by init(), and resizeEvent().

void checkChatLineCaches ( )
privateslot

Definition at line 402 of file chatview.cpp.

References _linesWithCache, ChatLine::clearCache(), and ChatLine::height().

Referenced by resizeEvent(), and scrollContentsBy().

void mouseMoveWhileSelecting ( const QPointF &  scenePos)
privateslot

Definition at line 166 of file chatview.cpp.

References _scrollOffset, and _scrollTimer.

Referenced by init().

void scrollTimerTimeout ( )
privateslot

Definition at line 180 of file chatview.cpp.

References _scrollOffset.

Referenced by init().

void invalidateFilter ( )
privateslot
void markerLineSet ( BufferId  buffer,
MsgId  msg 
)
privateslot

Definition at line 320 of file chatview.cpp.

References scene(), ChatScene::setMarkerLine(), and ChatScene::setMarkerLineVisible().

Referenced by init().

Member Data Documentation

AbstractBufferContainer* _bufferContainer
private

Definition at line 112 of file chatview.h.

Referenced by bufferContainer(), init(), and setBufferContainer().

ChatScene* _scene
private

Definition at line 113 of file chatview.h.

Referenced by init(), invalidateFilter(), and scene().

int _lastScrollbarPos
private

Definition at line 114 of file chatview.h.

Referenced by init(), resizeEvent(), and verticalScrollbarChanged().

qreal _currentScaleFactor
private

Definition at line 115 of file chatview.h.

Referenced by init(), lastLineChanged(), zoomIn(), zoomOriginal(), and zoomOut().

QTimer _scrollTimer
private

Definition at line 116 of file chatview.h.

Referenced by init(), and mouseMoveWhileSelecting().

int _scrollOffset
private

Definition at line 117 of file chatview.h.

Referenced by mouseMoveWhileSelecting(), and scrollTimerTimeout().

bool _invalidateFilter
private

Definition at line 118 of file chatview.h.

Referenced by event(), init(), and invalidateFilter().

QSet<ChatLine *> _linesWithCache
private

Definition at line 119 of file chatview.h.

Referenced by checkChatLineCaches(), and setHasCache().


The documentation for this class was generated from the following files: