X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=gui%2Fbuffer.h;h=4ef1112fd040197c3209f4129f0e28ac65991b07;hp=5df19aa7a3c33dac6e4c30d7232cd6072eed48eb;hb=12369966345e76e3bba92f64c84c940ef4d8d916;hpb=3e7ed151306ef44a9be5ca7e3f37c89408d4a6d1 diff --git a/gui/buffer.h b/gui/buffer.h index 5df19aa7..4ef1112f 100644 --- a/gui/buffer.h +++ b/gui/buffer.h @@ -29,8 +29,15 @@ #include "global.h" #include "message.h" +class ChatWidget; +class ChatWidgetContents; class BufferWidget; +//!\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(). + */ class Buffer : public QObject { Q_OBJECT @@ -60,6 +67,7 @@ class Buffer : public QObject { QWidget * showWidget(QWidget *parent = 0); void hideWidget(); + void deleteWidget(); void scrollToEnd(); @@ -69,6 +77,8 @@ class Buffer : public QObject { private: bool active; BufferWidget *widget; + ChatWidget *chatWidget; + ChatWidgetContents *contentsWidget; VarMap nicks; QString topic; QString ownNick; @@ -77,23 +87,30 @@ class Buffer : public QObject { QList contents; }; +//!\brief Displays the contents of a Buffer. +/** A BufferWidget usually includes a topic line, a nicklist, the chat itself, and an input line. + * For server buffers or queries, there is of course no nicklist. + * The contents of the chat is rendered by a ChatWidget. + */ class BufferWidget : public QWidget { Q_OBJECT public: - BufferWidget(QString netname, QString bufname, bool active, QString ownNick, QList contents, QWidget *parent = 0); + BufferWidget(QString netname, QString bufname, bool active, QString ownNick, ChatWidgetContents *contents, Buffer *parentBuffer, QWidget *parent = 0); + ~BufferWidget(); void setActive(bool act = true); + signals: void userInput(QString); + protected: + public slots: void displayMsg(Message); void updateNickList(VarMap nicks); void setOwnNick(QString ownNick); void setTopic(QString topic); - void renderContents(); - void scrollToEnd(); private slots: void enterPressed(); @@ -102,17 +119,14 @@ class BufferWidget : public QWidget { private: Ui::BufferWidget ui; + Buffer *parentBuffer; bool active; - QList contents; - QString stdCol, errorCol, noticeCol, joinCol, quitCol, partCol, kickCol, serverCol, nickCol, inactiveCol; - QString CSS; QString networkName; QString bufferName; bool opsExpanded, voicedExpanded, usersExpanded; - QString htmlFromMsg(Message); }; #endif