Handle rowsInserted() and add new messages to the scene.
[quassel.git] / src / qtui / chatview.cpp
index db93f07..8551a83 100644 (file)
 #include <QGraphicsTextItem>
 
 #include "buffer.h"
-#include "chatline.h"
+#include "chatlinemodelitem.h"
 #include "chatscene.h"
 #include "chatview.h"
+#include "client.h"
 #include "quasselui.h"
 
 ChatView::ChatView(Buffer *buf, QWidget *parent) : QGraphicsView(parent), AbstractChatView() {
-  _scene = new ChatScene(buf, this);
+  setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+  _scene = new ChatScene(Client::messageModel(), this);
+  _scene->setWidth(width());
   setScene(_scene);
 
-  QGraphicsTextItem *item = scene()->addText(buf->bufferInfo().bufferName());
 
 }
 
@@ -44,6 +46,10 @@ ChatScene *ChatView::scene() const {
   return _scene;
 }
 
+void ChatView::resizeEvent(QResizeEvent *event) {
+  scene()->setWidth(event->size().width());
+
+}
 
 void ChatView::clear()
 {
@@ -81,7 +87,7 @@ void ChatView::appendChatLines(QList<ChatLine *> list) {
 }
 
 void ChatView::setContents(const QList<AbstractUiMsg *> &list) {
-  qDebug() << "setting" << list.count();
+  //qDebug() << "setting" << list.count();
   //appendChatLines(list);
 }