From: Manuel Nickschas Date: Tue, 13 May 2008 21:43:09 +0000 (+0000) Subject: Resurrecting chatline.{cpp|h} from the dead. X-Git-Tag: 0.3.0~421 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=dd90a17f0cbafb646e1916d9b8a1f048331f3111 Resurrecting chatline.{cpp|h} from the dead. --- diff --git a/src/qtui/chatline.cpp b/src/qtui/chatline.cpp new file mode 100644 index 00000000..e0f6d6a9 --- /dev/null +++ b/src/qtui/chatline.cpp @@ -0,0 +1,78 @@ +/*************************************************************************** + * 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) 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. * + ***************************************************************************/ + +#include +#include +#include + +#include "bufferinfo.h" +#include "chatitem.h" +#include "chatline.h" +#include "qtui.h" + +ChatLine::ChatLine(const QPersistentModelIndex &index_, QGraphicsItem *parent) : QGraphicsItem(parent), _index(index_) { + +} + +ChatLine::~ChatLine() { + +} + +QRectF ChatLine::boundingRect () const { + return childrenBoundingRect(); +} + +void ChatLine::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { + +} + +/* +void ChatLine::setColumnWidths(int tsColWidth, int senderColWidth, int textColWidth) { + if(tsColWidth >= 0) { + _tsColWidth = tsColWidth; + _tsItem->setWidth(tsColWidth); + } + if(senderColWidth >= 0) { + _senderColWidth = senderColWidth; + _senderItem->setWidth(senderColWidth); + } + if(textColWidth >= 0) { + _textColWidth = textColWidth; + _textItem->setWidth(textColWidth); + } + layout(); +} + +void ChatLine::layout() { + prepareGeometryChange(); + _tsItem->setPos(QPointF(0, 0)); + _senderItem->setPos(QPointF(_tsColWidth + QtUi::style()->sepTsSender(), 0)); + _textItem->setPos(QPointF(_tsColWidth + QtUi::style()->sepTsSender() + _senderColWidth + QtUi::style()->sepSenderText(), 0)); +} + + +bool ChatLine::sceneEvent ( QEvent * event ) { + qDebug() <<(void*)this<< "receiving event"; + event->ignore(); + return false; +} +*/ + + diff --git a/src/qtui/chatline.h b/src/qtui/chatline.h new file mode 100644 index 00000000..792563e1 --- /dev/null +++ b/src/qtui/chatline.h @@ -0,0 +1,49 @@ +/*************************************************************************** + * 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) 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 _CHATLINE_H_ +#define _CHATLINE_H_ + +#include + +#include "message.h" + +class ChatLine : public QGraphicsItem { + + public: + ChatLine(const QPersistentModelIndex &, QGraphicsItem *parent = 0); + virtual ~ChatLine(); + + virtual QRectF boundingRect () const; + virtual void paint (QPainter * painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); + //void layout(); + + //void setColumnWidths(int tsColWidth, int senderColWidth, int textColWidth); + + //void myMousePressEvent ( QGraphicsSceneMouseEvent * event ) { qDebug() << "press"; mousePressEvent(event); } + + protected: + //bool sceneEvent ( QEvent * event ); + + private: + QPersistentModelIndex _index; +}; + +#endif diff --git a/src/qtui/qtui.pri b/src/qtui/qtui.pri index 5688c06a..0b186674 100644 --- a/src/qtui/qtui.pri +++ b/src/qtui/qtui.pri @@ -13,8 +13,8 @@ HDRS += aboutdlg.h bufferwidget.h chatline-old.h chatwidget.h \ # new chatline model stuff sputdev { - SRCS += chatitem.cpp chatlinemodelitem.cpp chatlinemodel.cpp chatscene.cpp chatview.cpp - HDRS += chatitem.h chatlinemodelitem.h chatlinemodel.h chatscene.h chatview.h + SRCS += chatitem.cpp chatline.cpp chatlinemodelitem.cpp chatlinemodel.cpp chatscene.cpp chatview.cpp + HDRS += chatitem.h chatline.h chatlinemodelitem.h chatlinemodel.h chatscene.h chatview.h SRCS -= chatline-old.cpp chatwidget.cpp HDRS -= chatline-old.h chatwidget.h }