X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fclient%2Fbuffer.h;h=3465e5f282ccacb4ca807e40028fd9baea8bf811;hp=944b07cc07c7882a71f96d347eba5739d928a486;hb=902c95728306e5ba115de84800fc8d5d239c9d62;hpb=130ccf5033c21ca3ad0e0357a82953b5727bd0e9 diff --git a/src/client/buffer.h b/src/client/buffer.h index 944b07cc..3465e5f2 100644 --- a/src/client/buffer.h +++ b/src/client/buffer.h @@ -21,100 +21,97 @@ #ifndef _BUFFER_H_ #define _BUFFER_H_ -#include -#include +class AbstractUiMsg; + +struct BufferState; -#include "chatwidget.h" -#include "global.h" #include "message.h" +#include "bufferinfo.h" -class ChatWidget; -class ChatLine; -class ChatWidgetContents; -class BufferWidget; -struct BufferState; +#include //!\brief Encapsulates the contents of a single channel, query or server status context. -/** A Buffer maintains a list of existing nicks and their status. New messages can be appended using - * displayMsg(). A buffer displays its contents by way of a BufferWidget, which can be shown - * (and created on demand) by calling showWidget(). +/** A Buffer maintains a list of existing nicks and their status. */ class Buffer : public QObject { Q_OBJECT - public: - //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; } - QString displayName(); - BufferId bufferId() { return id; } - QList contents() { return lines; } - VarMap nickList() { return nicks; } - QString topic() { return _topic; } - QString ownNick() { return _ownNick; } - bool isStatusBuffer() { return bufferType() == ServerBuffer; } - - signals: - 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); - void bufferUpdated(Buffer *); - void bufferDestroyed(Buffer *); - - public slots: - void setActive(bool active = true); - //void displayMsg(Message); - //void prependMessages(QList); // for backlog - void appendChatLine(ChatLine *); - void prependChatLine(ChatLine *); - //void prependChatLines(QList); - //void recvStatusMsg(QString msg); - void setTopic(QString); - //void setNicks(QStringList); - void addNick(QString nick, VarMap props); - void renameNick(QString oldnick, QString newnick); - void removeNick(QString nick); - void updateNick(QString nick, VarMap props); - void setOwnNick(QString nick); - - void processUserInput(QString); - - private: - BufferId id; - bool active; - Type type; - - VarMap nicks; - QString _topic; - QString _ownNick; - QString _networkName, _bufferName; - BufferState *state; - - //QList _contents; - QList lines; +public: + Buffer(BufferInfo, QObject *parent = 0); + ~Buffer(); + + enum Type { + ServerBuffer, + ChannelBuffer, + QueryBuffer + }; + + enum Activity { + NoActivity = 0x00, + OtherActivity = 0x01, + NewMessage = 0x02, + Highlight = 0x40 + }; + Q_DECLARE_FLAGS(ActivityLevel, Activity) + + bool isStatusBuffer() const; + Type bufferType() const; + bool isActive() const; + + BufferInfo bufferInfo() const; + void updateBufferInfo(BufferInfo bufferid); + + uint networkId() const; + + QString networkName() const; + QString bufferName() const; + QString displayName() const; + + QList contents() const; + + QVariantMap nickList() const; + QString topic() const; + QString ownNick() const; + +signals: + void userInput(const BufferInfo &, QString); + void nickListChanged(QVariantMap nicks); + void topicSet(QString topic); + void ownNickSet(QString ownNick); + void bufferUpdated(Buffer *); + void bufferDestroyed(Buffer *); + + void msgAppended(AbstractUiMsg *); + void msgPrepended(AbstractUiMsg *); + void layoutQueueEmpty(); + +public slots: + void setActive(bool active = true); + void appendMsg(const Message &); + void prependMsg(const Message &); + bool layoutMsg(); + + // no longer needed +// void setTopic(QString); +// //void setNicks(QStringList); +// void addNick(QString nick, QVariantMap props); +// void renameNick(QString oldnick, QString newnick); +// void removeNick(QString nick); +// void updateNick(QString nick, QVariantMap props); +// void setOwnNick(QString nick); + + void processUserInput(QString); + +private: + BufferInfo _bufferInfo; + bool _active; + Type _type; + BufferState *state; + + QList layoutQueue; + QList layoutedMsgs; }; -Q_DECLARE_OPERATORS_FOR_FLAGS(Buffer::ActivityLevel) +Q_DECLARE_OPERATORS_FOR_FLAGS(Buffer::ActivityLevel) #endif