Resurrecting chatline.{cpp|h} from the dead.
authorManuel Nickschas <sputnick@quassel-irc.org>
Tue, 13 May 2008 21:43:09 +0000 (21:43 +0000)
committerManuel Nickschas <sputnick@quassel-irc.org>
Tue, 13 May 2008 21:43:09 +0000 (21:43 +0000)
src/qtui/chatline.cpp [new file with mode: 0644]
src/qtui/chatline.h [new file with mode: 0644]
src/qtui/qtui.pri

diff --git a/src/qtui/chatline.cpp b/src/qtui/chatline.cpp
new file mode 100644 (file)
index 0000000..e0f6d6a
--- /dev/null
@@ -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 <QDateTime>
+#include <QString>
+#include <QtGui>
+
+#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 (file)
index 0000000..792563e
--- /dev/null
@@ -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 <QGraphicsItem>
+
+#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
index 5688c06..0b18667 100644 (file)
@@ -13,8 +13,8 @@ HDRS += aboutdlg.h bufferwidget.h chatline-old.h chatwidget.h \
 
 # new chatline model stuff
 sputdev {
 
 # 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
 }
   SRCS -= chatline-old.cpp chatwidget.cpp
   HDRS -= chatline-old.h chatwidget.h
 }