X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fchatwidget.h;fp=src%2Fqtui%2Fchatwidget.h;h=0000000000000000000000000000000000000000;hp=4c01ff1f9e78c74c48c947942a972676eaa8e986;hb=8a6f1f5a61e6aafa4960cfafce1a45f3aeda3a50;hpb=63af36e607d250637aaba0bba14d2158e79c7bed diff --git a/src/qtui/chatwidget.h b/src/qtui/chatwidget.h deleted file mode 100644 index 4c01ff1f..00000000 --- a/src/qtui/chatwidget.h +++ /dev/null @@ -1,129 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2005/06 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) version 3. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ - -#ifndef _CHATWIDGET_H_ -#define _CHATWIDGET_H_ - -#include - -#include "abstractbuffercontainer.h" -#include "types.h" - -class ChatLineOld; -class AbstractUiMsg; - -//!\brief Scroll area showing part of the chat messages for a given buffer. -/** The contents of the scroll area, i.e. a widget of type ChatWidgetContents, - * needs to be provided by calling init(). We don't create this widget ourselves, because - * while a ChatWidget will be destroyed and recreated quite often (for example when switching - * buffers), there ususally is no need to re-render its content every time (which can be time-consuming). - * Before a ChatWidget is destroyed, it gives up its ownership of its contents, referring responsibility - * back to where it came from. - * - * Because we use this as a custom widget in Qt Designer, we cannot use a constructor that takes custom - * parameters. Instead, it is mandatory to call init() before using this widget. - */ -class ChatWidget : public QAbstractScrollArea, public AbstractChatView { - Q_OBJECT - - public: - ChatWidget(BufferId, QWidget *parent = 0); - ~ChatWidget(); - void init(BufferId id); - - virtual QSize minimumSizeHint() const; - virtual QSize sizeHint() const; - - public slots: - void clear(); - - void prependMsg(AbstractUiMsg *); - void appendMsg(AbstractUiMsg *); - - void prependChatLine(ChatLineOld *); - void appendChatLine(ChatLineOld *); - void prependChatLines(QList); - void appendChatLines(QList); - void setContents(const QList &); - - protected: - virtual void resizeEvent(QResizeEvent *event); - virtual void paintEvent(QPaintEvent * event); - virtual void mousePressEvent(QMouseEvent *event); - virtual void mouseReleaseEvent(QMouseEvent *event); - virtual void mouseMoveEvent(QMouseEvent *event); - virtual void mouseDoubleClickEvent(QMouseEvent *event); - - private slots: - void layout(); - void scrollBarAction(int); - void scrollBarValChanged(int); - void ensureVisible(int line); - void handleScrollTimer(); - void viewportChanged(int newPos); - - private: - BufferId bufferId; - enum SelectionMode { NoSelection, TextSelected, LinesSelected }; - enum MouseMode { Normal, Pressed, DragTsSep, DragTextSep, MarkText, MarkLines }; - enum MousePos { None, OverTsSep, OverTextSep, OverUrl }; - MouseMode mouseMode; - MousePos mousePos; - QPoint dragStartPos; - MouseMode dragStartMode; - int dragStartLine; - int dragStartCursor; - int curCursor; - int curLine; - SelectionMode selectionMode; - int selectionStart, selectionEnd, selectionLine; - - int bottomLine, bottomLineOffset; - - QList lines; - QList ycoords; - QTimer *scrollTimer; - QPoint pointerPosition; - - int senderX; - int textX; - int tsWidth; - int senderWidth; - int textWidth; - int tsGrabPos; ///< X-Position for changing the timestamp width - int senderGrabPos; - void computePositions(); - - int width; - qreal height; - qreal y; - - void adjustScrollBar(); - - int yToLineIdx(qreal y); - void clearSelection(); - QString selectionToString(); - void handleMouseMoveEvent(const QPoint &pos); - - MsgId lastBacklogOffset; - int lastBacklogSize; -}; - -#endif