X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fchatscene.h;h=7bfd6eb0b96df426d378c8133ff9a30c10433f1d;hp=0963afacfdc1c7ac65c1584b734a98056edfdde9;hb=65118437813c853cbcc52f0c1a061457e264ed1a;hpb=70706ff642683d03ff091cab25d984ec7d9612de diff --git a/src/qtui/chatscene.h b/src/qtui/chatscene.h index 0963afac..7bfd6eb0 100644 --- a/src/qtui/chatscene.h +++ b/src/qtui/chatscene.h @@ -1,11 +1,11 @@ /*************************************************************************** - * Copyright (C) 2005-07 by the Quassel IRC Team * + * Copyright (C) 2005-08 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * + * (at your option) version 3. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * @@ -21,34 +21,60 @@ #ifndef _CHATSCENE_H_ #define _CHATSCENE_H_ +#include #include class AbstractUiMsg; class Buffer; +class ChatItem; class ChatLine; +class ColumnHandleItem; + class QGraphicsSceneMouseEvent; class ChatScene : public QGraphicsScene { Q_OBJECT public: - ChatScene(Buffer *buffer, QObject *parent); + ChatScene(QAbstractItemModel *model, const QString &idString, QObject *parent); virtual ~ChatScene(); Buffer *buffer() const; + inline QAbstractItemModel *model() const { return _model; } public slots: + void setWidth(qreal); + + // these are used by the chatitems to notify the scene + void setSelectingItem(ChatItem *item); + ChatItem *selectingItem() const { return _selectingItem; } + void startGlobalSelection(ChatItem *item); + + signals: + void heightChanged(qreal height); + + protected: + virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent); + virtual void mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent); + virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent); protected slots: - void appendMsg(AbstractUiMsg *msg); - void prependMsg(AbstractUiMsg *msg); + void rowsInserted(const QModelIndex &, int, int); - void mousePressEvent ( QGraphicsSceneMouseEvent * mouseEvent ); + private slots: + void rectChanged(const QRectF &); + void handlePositionChanged(qreal xpos); private: - Buffer *_buffer; - QList _lines; + QString _idString; + qreal _width, _height; + QAbstractItemModel *_model; + QList _lines; + + ColumnHandleItem *firstColHandle, *secondColHandle; + qreal firstColHandlePos, secondColHandlePos; + ChatItem *_selectingItem; }; #endif