Refactoring the GUI. Work in progress.
[quassel.git] / gui / buffer.h
index 09f7e02..944b07c 100644 (file)
 #include <QtCore>
 #include <QtGui>
 
+#include "chatwidget.h"
 #include "global.h"
 #include "message.h"
 
 class ChatWidget;
+class ChatLine;
 class ChatWidgetContents;
 class BufferWidget;
 struct BufferState;
@@ -41,24 +43,39 @@ class Buffer : public QObject {
   Q_OBJECT
 
   public:
-    Buffer(QString network, QString buffer);
+    //Buffer(QString network, QString buffer);
+    Buffer(BufferId);
     ~Buffer();
     static void init();
 
     enum Type { ServerBuffer, ChannelBuffer, QueryBuffer };
+
+    enum Activity {
+      NoActivity = 0x00,
+      OtherActivity = 0x01,
+      NewMessage = 0x02,
+      Highlight = 0x40
+    };
+    Q_DECLARE_FLAGS(ActivityLevel, Activity)
+    
     Type bufferType() { return type; }
     bool isActive() { return active; }
 
     QString networkName() { return _networkName; }
     QString bufferName() { return _bufferName; }
-    QList<Message> *contents() { return &_contents; }
+    QString displayName();
+    BufferId bufferId() { return id; }
+    QList<ChatLine *> contents() { return lines; }
     VarMap nickList() { return nicks; }
     QString topic() { return _topic; }
     QString ownNick() { return _ownNick; }
+    bool isStatusBuffer() { return bufferType() == ServerBuffer; }
 
   signals:
-    void userInput(QString, QString, QString);
-    void msgDisplayed(Message);
+    void userInput(BufferId, QString);
+    //void msgDisplayed(Message);
+    void chatLineAppended(ChatLine *);
+    void chatLinePrepended(ChatLine *);
     void nickListChanged(VarMap nicks);
     void topicSet(QString topic);
     void ownNickSet(QString ownNick);
@@ -67,8 +84,11 @@ class Buffer : public QObject {
 
   public slots:
     void setActive(bool active = true);
-    void displayMsg(Message);
-    void prependMessages(QList<Message>); // for backlog
+    //void displayMsg(Message);
+    //void prependMessages(QList<Message>); // for backlog
+    void appendChatLine(ChatLine *);
+    void prependChatLine(ChatLine *);
+    //void prependChatLines(QList<ChatLine *>);
     //void recvStatusMsg(QString msg);
     void setTopic(QString);
     //void setNicks(QStringList);
@@ -81,6 +101,7 @@ class Buffer : public QObject {
     void processUserInput(QString);
 
   private:
+    BufferId id;
     bool active;
     Type type;
 
@@ -90,8 +111,10 @@ class Buffer : public QObject {
     QString _networkName, _bufferName;
     BufferState *state;
 
-    QList<Message> _contents;
+    //QList<Message> _contents;
+    QList<ChatLine *> lines;
 
 };
+Q_DECLARE_OPERATORS_FOR_FLAGS(Buffer::ActivityLevel)    
 
 #endif