Post-merge cleanups, remove the old message handling
authorManuel Nickschas <sputnick@quassel-irc.org>
Mon, 4 Aug 2008 20:53:38 +0000 (22:53 +0200)
committerManuel Nickschas <sputnick@quassel-irc.org>
Mon, 4 Aug 2008 21:04:42 +0000 (23:04 +0200)
src/client/buffer.cpp
src/client/buffer.h
src/client/client.cpp
src/client/client.h
src/qtui/chatview.cpp
src/qtui/chatview.h
src/uisupport/abstractbuffercontainer.cpp
src/uisupport/abstractbuffercontainer.h

index 241e2e6..df78639 100644 (file)
@@ -42,55 +42,17 @@ BufferInfo Buffer::bufferInfo() const {
   return _bufferInfo;
 }
 
-const QList<AbstractUiMsg *> &Buffer::contents() const {
-  return layoutedMsgs;
-}
-
-void Buffer::appendMsg(const Message &msg) {
-  updateActivityLevel(msg);
-  AbstractUiMsg *m = Client::layoutMsg(msg);
-  layoutedMsgs.append(m);
-  emit msgAppended(m);
-}
-
-void Buffer::prependMsg(const Message &msg) {
-  // check for duplicate first
-  if(!layoutedMsgs.isEmpty()  && msg.msgId() >= layoutedMsgs.first()->msgId()) {
-    return;
-  }
-  updateActivityLevel(msg);
-  layoutQueue.append(msg);
-}
-
-bool Buffer::layoutMsg() {
-  if(layoutQueue.isEmpty())
-    return false;
-
-  AbstractUiMsg *m = Client::layoutMsg(layoutQueue.takeFirst());
-  layoutedMsgs.prepend(m);
-  emit msgPrepended(m);
-
-  return !layoutQueue.isEmpty();
-}
-
 void Buffer::setVisible(bool visible) {
   _isVisible = visible;
   setActivityLevel(NoActivity);
-  //if(layoutedMsgs.isEmpty())
-  //  return;
-  //setLastSeenMsg(layoutedMsgs.last()->msgId());
   if(_lastRcvdMsg.msgId() > 0) setLastSeenMsg(_lastRcvdMsg.msgId());
-  //qDebug() << "setting last seen" << _lastRcvdMsg.msgId();
 }
 
 void Buffer::setLastSeenMsg(const MsgId &msgId) {
-  // qDebug() << "want to set lastSeen:" << bufferInfo() << seen << lastSeen();
   const MsgId oldLastSeen = lastSeenMsg();
   if(!oldLastSeen.isValid() || (msgId.isValid() && msgId > oldLastSeen)) {
-    //qDebug() << "setting:" << bufferInfo().bufferName() << seen;
     _lastSeenMsg = msgId;
     Client::setBufferLastSeenMsg(bufferInfo().bufferId(), msgId);
-    //qDebug() << "setting lastSeen:" << bufferInfo() << lastSeen();
     setActivityLevel(NoActivity);
   }
 }
@@ -99,7 +61,6 @@ void Buffer::setActivityLevel(ActivityLevel level) {
   _activityLevel = level;
   if(bufferInfo().bufferId() > 0) {
     Client::networkModel()->setBufferActivity(bufferInfo(), level);
-    //qDebug() << "setting level:" << bufferInfo() << lastSeen() << level;
   }
 }
 
index 17e9b23..72a30f1 100644 (file)
@@ -32,7 +32,6 @@ struct BufferState;
 #include "message.h"
 #include "bufferinfo.h"
 
-/// Encapsulates the contents of a single channel, query or server status context.
 /**
  */
 class Buffer : public QObject {
@@ -50,20 +49,11 @@ public:
   Buffer(BufferInfo, QObject *parent = 0);
 
   BufferInfo bufferInfo() const;
-  const QList<AbstractUiMsg *> &contents() const;
   inline bool isVisible() const { return _isVisible; }
   inline MsgId lastSeenMsg() const { return _lastSeenMsg; }
   inline ActivityLevel activityLevel() const { return _activityLevel; }
 
-signals:
-  void msgAppended(AbstractUiMsg *);
-  void msgPrepended(AbstractUiMsg *);
-  void layoutQueueEmpty();
-
 public slots:
-  void appendMsg(const Message &);
-  void prependMsg(const Message &);
-  bool layoutMsg();
   void setVisible(bool visible);
   void setLastSeenMsg(const MsgId &msgId);
   void setActivityLevel(ActivityLevel level);
@@ -76,9 +66,6 @@ private:
   Message _lastRcvdMsg;
   ActivityLevel _activityLevel;
 
-  QLinkedList<Message> layoutQueue;
-  QList<AbstractUiMsg *> layoutedMsgs;
-
 };
 
 Q_DECLARE_OPERATORS_FOR_FLAGS(Buffer::ActivityLevel)
index eeb25d5..f9665c6 100644 (file)
@@ -126,11 +126,6 @@ void Client::init() {
   connect(this, SIGNAL(connected()), mainUi, SLOT(connectedToCore()));
   connect(this, SIGNAL(disconnected()), mainUi, SLOT(disconnectedFromCore()));
 
-  layoutTimer = new QTimer(this);
-  layoutTimer->setInterval(0);
-  layoutTimer->setSingleShot(false);
-  connect(layoutTimer, SIGNAL(timeout()), this, SLOT(layoutMsg()));
-
 }
 
 /*** public static methods ***/
@@ -390,8 +385,6 @@ void Client::disconnectFromCore() {
   }
   Q_ASSERT(_identities.isEmpty());
 
-  layoutQueue.clear();
-  layoutTimer->stop();
 }
 
 void Client::setCoreConfiguration(const QVariantMap &settings) {
@@ -460,26 +453,6 @@ void Client::receiveBacklog(BufferId bufferId, const QVariantList &msgs) {
   //qDebug() << "processed" << msgs.count() << "backlog lines in" << start.msecsTo(QTime::currentTime());
 }
 
-void Client::layoutMsg() {
-  if(layoutQueue.isEmpty()) {
-    layoutTimer->stop();
-    return;
-  }
-
-  Buffer *buffer = layoutQueue.takeFirst();
-  if(buffer->layoutMsg()) {
-    layoutQueue.append(buffer);  // Buffer has more messages in its queue --> Round Robin
-    return;
-  }
-
-  if(layoutQueue.isEmpty())
-    layoutTimer->stop();
-}
-
-AbstractUiMsg *Client::layoutMsg(const Message &msg) {
-  return instance()->mainUi->layoutMsg(msg);
-}
-
 // TODO optimize checkForHighlight
 void Client::checkForHighlight(Message &msg) {
   if(!((msg.type() & (Message::Plain | Message::Notice | Message::Action)) && !(msg.flags() & Message::Self)))
@@ -549,7 +522,6 @@ void Client::bufferRemoved(BufferId bufferId) {
   Buffer *buff = 0;
   if(_buffers.contains(bufferId)) {
     buff = _buffers.take(bufferId);
-    layoutQueue.removeAll(buff);
     disconnect(buff, 0, this, 0);
   }
 
index ad5740c..7c42784 100644 (file)
@@ -48,8 +48,6 @@ class IrcChannel;
 class SignalProxy;
 struct NetworkInfo;
 
-class QTimer;
-
 class Client : public QObject {
   Q_OBJECT
 
@@ -100,10 +98,8 @@ public:
   static inline ClientBacklogManager *backlogManager() { return instance()->_backlogManager; }
   static inline ClientIrcListHelper *ircListHelper() { return instance()->_ircListHelper; }
   static inline BufferViewManager *bufferViewManager() { return instance()->_bufferViewManager; }
-  
-  static AccountId currentCoreAccount();
 
-  static AbstractUiMsg *layoutMsg(const Message &);
+  static AccountId currentCoreAccount();
 
   static bool isConnected();
   static bool isSynced();
@@ -123,7 +119,6 @@ signals:
   void backlogReceived(Buffer *, QList<Message>);
   void requestBacklog(BufferInfo, QVariant, QVariant);
   void requestNetworkStates();
-  void messageReceived(const Message &msg);
 
   void showConfigWizard(const QVariantMap &coredata);
 
@@ -181,8 +176,6 @@ private slots:
   void updateBufferInfo(BufferInfo);
   void updateLastSeenMsg(BufferId id, const MsgId &msgId);
 
-  void layoutMsg();
-
   void bufferDestroyed();
   void networkDestroyed();
   void coreIdentityCreated(const Identity &);
@@ -232,9 +225,6 @@ private:
 
   Buffer *_monitorBuffer;
 
-  QTimer *layoutTimer;
-  QLinkedList<Buffer *> layoutQueue;
-
   static AccountId _currentCoreAccount;
 
   friend class ClientSyncer;
index 98346ca..be2cbc6 100644 (file)
@@ -75,40 +75,3 @@ void ChatView::sceneHeightChanged(qreal h) {
 void ChatView::clear()
 {
 }
-
-void ChatView::prependMsg(AbstractUiMsg *msg) {
-  //ChatLine *line = dynamic_cast<ChatLine*>(msg);
-  //Q_ASSERT(line);
-  //prependChatLine(line);
-}
-
-void ChatView::prependChatLine(ChatLine *line) {
-  //qDebug() << "prepending";
-}
-
-void ChatView::prependChatLines(QList<ChatLine *> clist) {
-
-}
-
-void ChatView::appendMsg(AbstractUiMsg *msg) {
-  //ChatLine *line = dynamic_cast<ChatLine*>(msg);
-  //Q_ASSERT(line);
-  //appendChatLine(line);
-}
-
-void ChatView::appendChatLine(ChatLine *line) {
-  //qDebug() << "appending";
-}
-
-
-void ChatView::appendChatLines(QList<ChatLine *> list) {
-  //foreach(ChatLine *line, list) {
-
-  //}
-}
-
-void ChatView::setContents(const QList<AbstractUiMsg *> &list) {
-  //qDebug() << "setting" << list.count();
-  //appendChatLines(list);
-}
-
index be26a11..7d84e6a 100644 (file)
@@ -45,16 +45,6 @@ class ChatView : public QGraphicsView, public AbstractChatView {
 
     void clear();
 
-    void prependMsg(AbstractUiMsg *);
-    void appendMsg(AbstractUiMsg *);
-
-    void prependChatLine(ChatLine *);
-    void appendChatLine(ChatLine *);
-    void prependChatLines(QList<ChatLine *>);
-    void appendChatLines(QList<ChatLine *>);
-
-    void setContents(const QList<AbstractUiMsg *> &);
-
   protected:
     virtual void resizeEvent(QResizeEvent *event);
 
index f3ffbf8..a12b031 100644 (file)
@@ -84,7 +84,7 @@ void AbstractBufferContainer::setCurrentBuffer(BufferId bufferId) {
 
   Buffer *buf;
   if(!bufferId.isValid() || !(buf = Client::buffer(bufferId))) {
-    if(bufferId.isValid()) 
+    if(bufferId.isValid())
       qWarning() << "AbstractBufferContainer::setBuffer(BufferId): Can't show unknown Buffer:" << bufferId;
     _currentBuffer = 0;
     showChatView(0);
@@ -94,9 +94,6 @@ void AbstractBufferContainer::setCurrentBuffer(BufferId 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;
@@ -104,31 +101,3 @@ void AbstractBufferContainer::setCurrentBuffer(BufferId bufferId) {
   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);
-}
index cb0e502..bf8a34c 100644 (file)
@@ -63,8 +63,6 @@ class AbstractBufferContainer : public AbstractItemView {
     virtual void showChatView(BufferId) = 0;
 
   private slots:
-    void appendMsg(AbstractUiMsg *);
-    void prependMsg(AbstractUiMsg *);
     void removeBuffer(BufferId bufferId);
     void setCurrentBuffer(BufferId bufferId);
 
@@ -77,10 +75,6 @@ class AbstractChatView {
 
   public:
     virtual ~AbstractChatView() {};
-    virtual void appendMsg(AbstractUiMsg *msg) = 0;
-    virtual void prependMsg(AbstractUiMsg *msg) = 0;
-    virtual void setContents(const QList<AbstractUiMsg *> &contents) = 0;
-    //virtual BufferId bufferId() const = 0;
 
 };