Introducing an abstract layer above BufferWidget and Chat{Widget|View}. This allows
authorManuel Nickschas <sputnick@quassel-irc.org>
Tue, 25 Mar 2008 00:03:22 +0000 (00:03 +0000)
committerManuel Nickschas <sputnick@quassel-irc.org>
Tue, 25 Mar 2008 00:03:22 +0000 (00:03 +0000)
us to move most of the former BufferWidget logic into uisupport, thus reducing code duplication.
It also allows us to switch between ChatWidget and ChatView more easily.

14 files changed:
src/client/buffersettings.cpp
src/qtui/bufferwidget.cpp
src/qtui/bufferwidget.h
src/qtui/chatview.cpp
src/qtui/chatview.h
src/qtui/chatwidget.cpp
src/qtui/chatwidget.h
src/qtui/mainwin.cpp
src/uisupport/abstractbuffercontainer.cpp [new file with mode: 0644]
src/uisupport/abstractbuffercontainer.h [new file with mode: 0644]
src/uisupport/bufferview.cpp
src/uisupport/clearablelineedit.cpp
src/uisupport/uisupport.pri
version.inc

index c586471..eda1137 100644 (file)
@@ -30,4 +30,4 @@ void BufferSettings::setValue(const QString &key, const QVariant &data) {
 
 QVariant BufferSettings::value(const QString &key, const QVariant &def) {
   return localValue(key, def);
-}
\ No newline at end of file
+}
index d46fdec..a670705 100644 (file)
  ***************************************************************************/
 
 #include "bufferwidget.h"
-#include "buffer.h"
 #include "chatline.h"
 #include "chatline-old.h"
+#include "chatview.h"
 #include "chatwidget.h"
 #include "settings.h"
 #include "client.h"
-#include "identity.h"
-#include "network.h"
-#include "networkmodel.h"
 
 #include "global.h"
 
-BufferWidget::BufferWidget(QWidget *parent)
-  : AbstractItemView(parent),
-    _currentBuffer(0)
-{
+BufferWidget::BufferWidget(QWidget *parent) : AbstractBufferContainer(parent) {
   ui.setupUi(this);
 }
 
 BufferWidget::~BufferWidget() {
-}
 
-void BufferWidget::init() {
 }
 
-void BufferWidget::rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end) {
-  Q_ASSERT(model());
-  if(!parent.isValid()) {
-    // ok this means that whole networks are about to be removed
-    // we can't determine which buffers are affect, so we hope that all nets are removed
-    // this is the most common case (for example disconnecting from the core or terminating the clint)
-    if(model()->rowCount(parent) != end - start + 1)
-      return;
-
-    ChatWidget *chatWidget;
-    QHash<BufferId, ChatWidget *>::iterator iter = _chatWidgets.begin();
-    while(iter != _chatWidgets.end()) {
-      chatWidget = *iter;
-      iter = _chatWidgets.erase(iter);
-      ui.stackedWidget->removeWidget(chatWidget);
-      chatWidget->deleteLater();
-    }
-    
+AbstractChatView *BufferWidget::createChatView(BufferId id) {
+  AbstractChatView *chatView;
+  if(Global::SPUTDEV) {
+    chatView = new ChatView(Client::buffer(id), this);
   } else {
-    // check if there are explicitly buffers removed
-    for(int i = start; i <= end; i++) {
-      QVariant variant = parent.child(i,0).data(NetworkModel::BufferIdRole);
-      if(!variant.isValid())
-        continue;
-      
-      BufferId bufferId = qVariantValue<BufferId>(variant);
-      removeBuffer(bufferId);
-    }
+    chatView = new ChatWidget(id, this);
   }
+  ui.stackedWidget->addWidget(dynamic_cast<QWidget *>(chatView));
+  dynamic_cast<QWidget *>(chatView)->setFocusProxy(this);
+  return chatView;
 }
 
-void BufferWidget::removeBuffer(BufferId bufferId) {
-  if(!_chatWidgets.contains(bufferId))
-    return;
-
-  if(Client::buffer(bufferId)) Client::buffer(bufferId)->setVisible(false);
-  ChatWidget *chatWidget = _chatWidgets.take(bufferId);
-  ui.stackedWidget->removeWidget(chatWidget);
-  chatWidget->deleteLater();
-}
-
-void BufferWidget::currentChanged(const QModelIndex &current, const QModelIndex &previous) {
-  BufferId newBufferId = current.data(NetworkModel::BufferIdRole).value<BufferId>();
-  BufferId oldBufferId = previous.data(NetworkModel::BufferIdRole).value<BufferId>();
-  if(newBufferId != oldBufferId)
-    setCurrentBuffer(newBufferId);
+void BufferWidget::removeChatView(AbstractChatView *view) {
+  ui.stackedWidget->removeWidget(dynamic_cast<QWidget *>(view));
+  dynamic_cast<QWidget *>(view)->deleteLater();
 }
 
-void BufferWidget::setCurrentBuffer(BufferId bufferId) {
-  if(!bufferId.isValid()) {
-    ui.stackedWidget->setCurrentWidget(ui.page);
-    return;
-  }
-  
-  ChatWidget *chatWidget = 0;
-  ChatView *chatView = 0;
-  Buffer *buf = Client::buffer(bufferId);
-  if(!buf) {
-    qWarning() << "BufferWidget::setBuffer(BufferId): Can't show unknown Buffer:" << bufferId;
-    return;
-  }
-  Buffer *prevBuffer = Client::buffer(currentBuffer());
-  if(prevBuffer) prevBuffer->setVisible(false);
-  if(Global::SPUTDEV) {
-    if(_chatViews.contains(bufferId)) {
-      chatView = _chatViews[bufferId];
-    } else {
-      chatView = new ChatView(buf, this);
-      //chatView->init(bufferId);
-      QList<ChatLine *> lines;
-      QList<AbstractUiMsg *> msgs = buf->contents();
-      foreach(AbstractUiMsg *msg, msgs) {
-        lines.append(dynamic_cast<ChatLine *>(msg));
-      }
-      chatView->setContents(lines);
-      connect(buf, SIGNAL(msgAppended(AbstractUiMsg *)), chatView, SLOT(appendMsg(AbstractUiMsg *)));
-      connect(buf, SIGNAL(msgPrepended(AbstractUiMsg *)), chatView, SLOT(prependMsg(AbstractUiMsg *)));
-      _chatViews[bufferId] = chatView;
-      ui.stackedWidget->addWidget(chatView);
-      chatView->setFocusProxy(this);
-    }
-    _currentBuffer = bufferId;
-    ui.stackedWidget->setCurrentWidget(chatView);
-  } else {
-    if(_chatWidgets.contains(bufferId)) {
-      chatWidget = _chatWidgets[bufferId];
-    } else {
-      chatWidget = new ChatWidget(this);
-      chatWidget->init(bufferId);
-      QList<ChatLineOld *> lines;
-      QList<AbstractUiMsg *> msgs = buf->contents();
-      foreach(AbstractUiMsg *msg, msgs) {
-        lines.append(dynamic_cast<ChatLineOld*>(msg));
-      }
-      chatWidget->setContents(lines);
-      connect(buf, SIGNAL(msgAppended(AbstractUiMsg *)), chatWidget, SLOT(appendMsg(AbstractUiMsg *)));
-      connect(buf, SIGNAL(msgPrepended(AbstractUiMsg *)), chatWidget, SLOT(prependMsg(AbstractUiMsg *)));
-      _chatWidgets[bufferId] = chatWidget;
-      ui.stackedWidget->addWidget(chatWidget);
-      chatWidget->setFocusProxy(this);
-    }
-    _currentBuffer = bufferId;
-    ui.stackedWidget->setCurrentWidget(chatWidget);
-  }
-  buf->setVisible(true);
-  setFocus();
+void BufferWidget::showChatView(AbstractChatView *view) {
+  if(!view) ui.stackedWidget->setCurrentWidget(ui.page);
+  else ui.stackedWidget->setCurrentWidget(dynamic_cast<QWidget *>(view));
 }
 
index 089d498..17e939d 100644 (file)
  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
  ***************************************************************************/
 
-#ifndef _BUFFERWIDGET_H_
-#define _BUFFERWIDGET_H_
+#ifndef BUFFERWIDGET_H_
+#define BUFFERWIDGET_H_
 
 #include "ui_bufferwidget.h"
 
-#include "abstractitemview.h"
-#include "chatview.h"
-#include "types.h"
+#include "abstractbuffercontainer.h"
 
-class Network;
-class ChatView;
-class ChatWidget;
-
-#include "buffermodel.h"
-
-//! Displays the contents of a Buffer.
-/**
-*/
-class BufferWidget : public AbstractItemView {
+class BufferWidget : public AbstractBufferContainer {
   Q_OBJECT
 
-public:
-  BufferWidget(QWidget *parent = 0);
-  virtual ~BufferWidget();
-  void init();
+  public:
+    BufferWidget(QWidget *parent);
+    virtual ~BufferWidget();
 
-  inline BufferId currentBuffer() const { return _currentBuffer; }
-  
-protected slots:
-  virtual void currentChanged(const QModelIndex &current, const QModelIndex &previous);
-  virtual void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end);
+  protected:
+    virtual AbstractChatView *createChatView(BufferId);
+    virtual void removeChatView(AbstractChatView *view);
 
-private slots:
-  void removeBuffer(BufferId bufferId);
-  void setCurrentBuffer(BufferId bufferId);
+  protected slots:
+    virtual void showChatView(AbstractChatView *view);
 
-private:
-  Ui::BufferWidget ui;
-  QHash<BufferId, ChatWidget *> _chatWidgets;
-  QHash<BufferId, ChatView *> _chatViews;
+  private:
+    Ui::BufferWidget ui;
 
-  BufferId _currentBuffer;
 };
 
 #endif
index f9bc175..54ca6f9 100644 (file)
@@ -26,7 +26,7 @@
 #include "chatview.h"
 #include "quasselui.h"
 
-ChatView::ChatView(Buffer *buf, QWidget *parent) : QGraphicsView(parent) {
+ChatView::ChatView(Buffer *buf, QWidget *parent) : QGraphicsView(parent), AbstractChatView() {
   _scene = new ChatScene(buf, this);
   setScene(_scene);
 
@@ -80,8 +80,8 @@ void ChatView::appendChatLines(QList<ChatLine *> list) {
   }
 }
 
-void ChatView::setContents(QList<ChatLine *> list) {
+void ChatView::setContents(const QList<AbstractUiMsg *> &list) {
   qDebug() << "setting" << list.count();
-  appendChatLines(list);
+  //appendChatLines(list);
 }
 
index ef9d923..cc627c7 100644 (file)
 
 #include <QGraphicsView>
 
+#include "abstractbuffercontainer.h"
+
 class AbstractUiMsg;
 class Buffer;
 class ChatLine;
 class ChatScene;
 
-class ChatView : public QGraphicsView {
+class ChatView : public QGraphicsView, public AbstractChatView {
   Q_OBJECT
 
   public:
@@ -49,7 +51,7 @@ class ChatView : public QGraphicsView {
     void prependChatLines(QList<ChatLine *>);
     void appendChatLines(QList<ChatLine *>);
 
-    void setContents(QList<ChatLine *>);
+    void setContents(const QList<AbstractUiMsg *> &);
 
   private:
     ChatScene *_scene;
index 566de0d..131caa4 100644 (file)
@@ -27,8 +27,7 @@
 #include "buffer.h"
 #include "clientbacklogmanager.h"
 
-ChatWidget::ChatWidget(QWidget *parent)
-  : QAbstractScrollArea(parent),
+ChatWidget::ChatWidget(BufferId bufid, QWidget *parent) : QAbstractScrollArea(parent), AbstractChatView(),
     lastBacklogOffset(0),
     lastBacklogSize(0)
 {
@@ -50,6 +49,8 @@ ChatWidget::ChatWidget(QWidget *parent)
   pointerPosition = QPoint(0,0);
   connect(verticalScrollBar(), SIGNAL(actionTriggered(int)), this, SLOT(scrollBarAction(int)));
   connect(verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(scrollBarValChanged(int)));
+
+  init(bufid);
 }
 
 void ChatWidget::init(BufferId id) {
@@ -248,12 +249,14 @@ void ChatWidget::appendChatLines(QList<ChatLineOld *> list) {
   viewport()->update();
 }
 
-void ChatWidget::setContents(QList<ChatLineOld *> list) {
+void ChatWidget::setContents(const QList<AbstractUiMsg *> &list) {
   ycoords.clear();
   ycoords.append(0);
   height = 0;
   lines.clear();
-  appendChatLines(list);
+  QList<ChatLineOld *> cl;
+  foreach(AbstractUiMsg *msg, list) cl << dynamic_cast<ChatLineOld *>(msg);
+  appendChatLines(cl);
 }
 
 //!\brief Computes the different x position vars for given tsWidth and senderWidth.
index e7d1782..4c01ff1 100644 (file)
@@ -23,6 +23,7 @@
 
 #include <QtGui>
 
+#include "abstractbuffercontainer.h"
 #include "types.h"
 
 class ChatLineOld;
@@ -39,11 +40,11 @@ class AbstractUiMsg;
  * 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 {
+class ChatWidget : public QAbstractScrollArea, public AbstractChatView {
   Q_OBJECT
 
   public:
-    ChatWidget(QWidget *parent = 0);
+    ChatWidget(BufferId, QWidget *parent = 0);
     ~ChatWidget();
     void init(BufferId id);
 
@@ -60,7 +61,7 @@ class ChatWidget : public QAbstractScrollArea {
     void appendChatLine(ChatLineOld *);
     void prependChatLines(QList<ChatLineOld *>);
     void appendChatLines(QList<ChatLineOld *>);
-    void setContents(QList<ChatLineOld *>);
+    void setContents(const QList<AbstractUiMsg *> &);
 
   protected:
     virtual void resizeEvent(QResizeEvent *event);
index e81eb88..cb023cd 100644 (file)
@@ -84,7 +84,7 @@ void MainWin::init() {
 
   connect(Client::instance(), SIGNAL(networkCreated(NetworkId)), this, SLOT(clientNetworkCreated(NetworkId)));
   connect(Client::instance(), SIGNAL(networkRemoved(NetworkId)), this, SLOT(clientNetworkRemoved(NetworkId)));
-  ui.bufferWidget->init();
+  //ui.bufferWidget->init();
 
   show();
 
@@ -218,7 +218,7 @@ void MainWin::setupChatMonitor() {
   VerticalDock *dock = new VerticalDock(tr("Chat Monitor"), this);
   dock->setObjectName("ChatMonitorDock");
 
-  ChatWidget *chatWidget = new ChatWidget(this);
+  ChatWidget *chatWidget = new ChatWidget(0, this);
   chatWidget->show();
   dock->setWidget(chatWidget);
   dock->show();
@@ -227,13 +227,7 @@ void MainWin::setupChatMonitor() {
   if(!buf)
     return;
 
-  chatWidget->init(BufferId(0));
-  QList<ChatLineOld *> lines;
-  QList<AbstractUiMsg *> msgs = buf->contents();
-  foreach(AbstractUiMsg *msg, msgs) {
-    lines.append(dynamic_cast<ChatLineOld*>(msg));
-  }
-  chatWidget->setContents(lines);
+  chatWidget->setContents(buf->contents());
   connect(buf, SIGNAL(msgAppended(AbstractUiMsg *)), chatWidget, SLOT(appendMsg(AbstractUiMsg *)));
   connect(buf, SIGNAL(msgPrepended(AbstractUiMsg *)), chatWidget, SLOT(prependMsg(AbstractUiMsg *)));
 
diff --git a/src/uisupport/abstractbuffercontainer.cpp b/src/uisupport/abstractbuffercontainer.cpp
new file mode 100644 (file)
index 0000000..78ead27
--- /dev/null
@@ -0,0 +1,136 @@
+/***************************************************************************
+ *   Copyright (C) 2005-08 by the Quassel IRC Team                         *
+ *   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 "abstractbuffercontainer.h"
+#include "buffer.h"
+#include "client.h"
+#include "networkmodel.h"
+
+AbstractBufferContainer::AbstractBufferContainer(QWidget *parent) : AbstractItemView(parent), _currentBuffer(0)
+{
+
+}
+
+AbstractBufferContainer::~AbstractBufferContainer() {
+
+}
+
+
+void AbstractBufferContainer::rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end) {
+  Q_ASSERT(model());
+  if(!parent.isValid()) {
+    // ok this means that whole networks are about to be removed
+    // we can't determine which buffers are affect, so we hope that all nets are removed
+    // this is the most common case (for example disconnecting from the core or terminating the client)
+    if(model()->rowCount(parent) != end - start + 1)
+      return;
+
+    AbstractChatView *chatView;
+    QHash<BufferId, AbstractChatView *>::iterator iter = _chatViews.begin();
+    while(iter != _chatViews.end()) {
+      chatView = *iter;
+      iter = _chatViews.erase(iter);
+      removeChatView(chatView);
+    }
+  } else {
+    // check if there are explicitly buffers removed
+    for(int i = start; i <= end; i++) {
+      QVariant variant = parent.child(i,0).data(NetworkModel::BufferIdRole);
+      if(!variant.isValid())
+        continue;
+
+      BufferId bufferId = variant.value<BufferId>();
+      removeBuffer(bufferId);
+    }
+  }
+}
+
+void AbstractBufferContainer::removeBuffer(BufferId bufferId) {
+  if(!_chatViews.contains(bufferId))
+    return;
+
+  if(Client::buffer(bufferId)) Client::buffer(bufferId)->setVisible(false);
+  AbstractChatView *chatView = _chatViews.take(bufferId);
+  removeChatView(chatView);
+}
+
+void AbstractBufferContainer::currentChanged(const QModelIndex &current, const QModelIndex &previous) {
+  BufferId newBufferId = current.data(NetworkModel::BufferIdRole).value<BufferId>();
+  BufferId oldBufferId = previous.data(NetworkModel::BufferIdRole).value<BufferId>();
+  if(newBufferId != oldBufferId)
+    setCurrentBuffer(newBufferId);
+}
+
+void AbstractBufferContainer::setCurrentBuffer(BufferId bufferId) {
+  if(!bufferId.isValid()) {
+    showChatView(0);
+    return;
+  }
+
+  AbstractChatView *chatView = 0;
+  Buffer *buf = Client::buffer(bufferId);
+  if(!buf) {
+    qWarning() << "AbstractBufferContainer::setBuffer(BufferId): Can't show unknown Buffer:" << bufferId;
+    return;
+  }
+  Buffer *prevBuffer = Client::buffer(currentBuffer());
+  if(prevBuffer) prevBuffer->setVisible(false);
+  if(_chatViews.contains(bufferId)) {
+    chatView = _chatViews[bufferId];
+  } else {
+    chatView = createChatView(bufferId);
+    chatView->setContents(buf->contents());
+    connect(buf, SIGNAL(msgAppended(AbstractUiMsg *)), this, SLOT(appendMsg(AbstractUiMsg *)));
+    connect(buf, SIGNAL(msgPrepended(AbstractUiMsg *)), this, SLOT(prependMsg(AbstractUiMsg *)));
+    _chatViews[bufferId] = chatView;
+  }
+  _currentBuffer = bufferId;
+  showChatView(chatView);
+  buf->setVisible(true);
+  setFocus();
+}
+
+void AbstractBufferContainer::appendMsg(AbstractUiMsg *msg) {
+  Buffer *buf = qobject_cast<Buffer *>(sender());
+  if(!buf) {
+    qWarning() << "AbstractBufferContainer::appendMsg(): Invalid slot caller!";
+    return;
+  }
+  BufferId id = buf->bufferInfo().bufferId();
+  if(!_chatViews.contains(id)) {
+    qWarning() << "AbstractBufferContainer::appendMsg(): Received message for unknown buffer!";
+    return;
+  }
+  _chatViews[id]->appendMsg(msg);
+}
+
+void AbstractBufferContainer::prependMsg(AbstractUiMsg *msg) {
+  Buffer *buf = qobject_cast<Buffer *>(sender());
+  if(!buf) {
+    qWarning() << "AbstractBufferContainer:prependMsg(): Invalid slot caller!";
+    return;
+  }
+  BufferId id = buf->bufferInfo().bufferId();
+  if(!_chatViews.contains(id)) {
+    qWarning() << "AbstractBufferContainer::prependMsg(): Received message for unknown buffer!";
+    return;
+  }
+  _chatViews[id]->prependMsg(msg);
+}
diff --git a/src/uisupport/abstractbuffercontainer.h b/src/uisupport/abstractbuffercontainer.h
new file mode 100644 (file)
index 0000000..d727895
--- /dev/null
@@ -0,0 +1,82 @@
+/***************************************************************************
+ *   Copyright (C) 2005-08 by the Quassel IRC Team                         *
+ *   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 ABSTRACTBUFFERCONTAINER_H_
+#define ABSTRACTBUFFERCONTAINER_H_
+
+#include "abstractitemview.h"
+#include "buffermodel.h"
+
+class AbstractChatView;
+class AbstractUiMsg;
+class Buffer;
+
+class AbstractBufferContainer : public AbstractItemView {
+  Q_OBJECT
+
+  public:
+    AbstractBufferContainer(QWidget *parent);
+    virtual ~AbstractBufferContainer();
+
+    inline BufferId currentBuffer() const { return _currentBuffer; }
+
+  protected:
+    //! Create an AbstractChatView for the given BufferId and add it to the UI if necessary
+    virtual AbstractChatView *createChatView(BufferId) = 0;
+
+    //! Remove a chat view from the UI and delete it
+    /** This method shall remove the view from the UI (for example, from a QStackedWidget) if appropriate.
+     *  It also shall delete the object afterwards.
+     * \param view The chat view to be removed and deleted
+     */
+    virtual void removeChatView(AbstractChatView *view) = 0;
+
+  protected slots:
+    virtual void currentChanged(const QModelIndex &current, const QModelIndex &previous);
+    virtual void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end);
+
+    //! Show the given chat view
+    /** This method is called when the given chat view should be displayed. Use this e.g. for
+     *  selecting the appropriate page in a QStackedWidget.
+     * \param view The chat view to be displayed. May be 0 if no chat view is selected.
+     */
+    virtual void showChatView(AbstractChatView *view) = 0;
+
+  private slots:
+    void appendMsg(AbstractUiMsg *);
+    void prependMsg(AbstractUiMsg *);
+    void removeBuffer(BufferId bufferId);
+    void setCurrentBuffer(BufferId bufferId);
+
+  private:
+    BufferId _currentBuffer;
+    QHash<BufferId, AbstractChatView *> _chatViews;
+};
+
+class AbstractChatView {
+
+  public:
+    virtual void appendMsg(AbstractUiMsg *msg) = 0;
+    virtual void prependMsg(AbstractUiMsg *msg) = 0;
+    virtual void setContents(const QList<AbstractUiMsg *> &contents) = 0;
+
+};
+
+#endif
index c4529cb..bb19b75 100644 (file)
@@ -234,16 +234,20 @@ void BufferView::showContextMenu(const QPoint &pos) {
       network->requestDisconnect();
   } else
   if(result == joinChannelAction) {
+    // FIXME no QInputDialog in Qtopia
+#ifndef Q_WS_QWS
     bool ok;
     QString channelName = QInputDialog::getText(this, tr("Join Channel"), 
                                                 tr("Input channel name:"),QLineEdit::Normal,
                                                 QDir::home().dirName(), &ok);
+
     if (ok && !channelName.isEmpty()) {
       BufferInfo bufferInfo = index.child(0,0).data(NetworkModel::BufferInfoRole).value<BufferInfo>();
       if(bufferInfo.isValid()) {
         Client::instance()->userInput(bufferInfo, QString("/J %1").arg(channelName));
       }
     }
+#endif
   } else
   if(result == joinBufferAction) {
     Client::instance()->userInput(bufferInfo, QString("/JOIN %1").arg(channelname));
index ae99be6..0ba26d5 100644 (file)
@@ -28,7 +28,9 @@ ClearableLineEdit::ClearableLineEdit(QWidget *parent)
 {
   clearButton = new QToolButton(this);
   clearButton->setIcon(QIcon(":/22x22/actions/oxygen/22x22/actions/edit-clear-locationbar-rtl.png"));
+#ifndef Q_WS_QWS
   clearButton->setCursor(Qt::ArrowCursor);
+#endif
   clearButton->setStyleSheet("QToolButton { border: none; padding: 0px; }");
   clearButton->hide();
   
index 426515a..1f5de7f 100644 (file)
@@ -1,8 +1,10 @@
 DEPMOD = common client
 QT_MOD = core gui network
 
-SRCS += abstractitemview.cpp bufferview.cpp bufferviewfilter.cpp clearablelineedit.cpp colorbutton.cpp nickviewfilter.cpp inputline.cpp nickview.cpp settingspage.cpp tabcompleter.cpp uisettings.cpp uistyle.cpp uistylesettings.cpp
-HDRS += abstractitemview.h bufferview.h bufferviewfilter.h clearablelineedit.h colorbutton.h nickviewfilter.h inputline.h nickview.h settingspage.h tabcompleter.h uisettings.h uistyle.h uistylesettings.h
+SRCS += abstractbuffercontainer.cpp abstractitemview.cpp bufferview.cpp bufferviewfilter.cpp clearablelineedit.cpp colorbutton.cpp \
+        nickviewfilter.cpp inputline.cpp nickview.cpp settingspage.cpp tabcompleter.cpp uisettings.cpp uistyle.cpp uistylesettings.cpp
+HDRS += abstractbuffercontainer.h abstractitemview.h bufferview.h bufferviewfilter.h clearablelineedit.h colorbutton.h \
+        nickviewfilter.h inputline.h nickview.h settingspage.h tabcompleter.h uisettings.h uistyle.h uistylesettings.h
 
 FORMNAMES = 
 
index 278e4be..98a8133 100644 (file)
@@ -4,8 +4,8 @@
 { using namespace Global;
 
   quasselVersion = "0.2.0-alpha4-pre";
-  quasselDate = "2008-03-21";
-  quasselBuild = 655;
+  quasselDate = "2008-03-25";
+  quasselBuild = 657;
 
   //! Minimum client build number the core needs
   clientBuildNeeded = 642;