X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=gui%2Fbuffer.h;h=7738ebe1e8e5b3a5ec27def9ee24bf5f7529dc73;hb=9d46ee920ab0687940b3d937189eff7e82025d7b;hp=4ef1112fd040197c3209f4129f0e28ac65991b07;hpb=12369966345e76e3bba92f64c84c940ef4d8d916;p=quassel.git diff --git a/gui/buffer.h b/gui/buffer.h index 4ef1112f..7738ebe1 100644 --- a/gui/buffer.h +++ b/gui/buffer.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005/06 by The Quassel Team * + * Copyright (C) 2005-07 by The Quassel Team * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -24,14 +24,15 @@ #include #include -#include "ui_bufferwidget.h" - +#include "chatwidget.h" #include "global.h" #include "message.h" class ChatWidget; +class ChatLine; class ChatWidgetContents; class BufferWidget; +struct BufferState; //!\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 @@ -42,20 +43,41 @@ 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 }; + Type bufferType() { return type; } bool isActive() { return active; } - public: - QWidget *getWidget(); + + QString networkName() { return _networkName; } + QString bufferName() { return _bufferName; } + BufferId bufferId() { return id; } + QList contents() { return lines; } + VarMap nickList() { return nicks; } + QString topic() { return _topic; } + QString ownNick() { return _ownNick; } signals: - void userInput(QString, QString, QString); - void nickListChanged(QStringList); + 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 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); @@ -65,67 +87,21 @@ class Buffer : public QObject { void updateNick(QString nick, VarMap props); void setOwnNick(QString nick); - QWidget * showWidget(QWidget *parent = 0); - void hideWidget(); - void deleteWidget(); - - void scrollToEnd(); - - private slots: - void userInput(QString); - - private: - bool active; - BufferWidget *widget; - ChatWidget *chatWidget; - ChatWidgetContents *contentsWidget; - VarMap nicks; - QString topic; - QString ownNick; - QString networkName, bufferName; - - 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, 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); - - private slots: - void enterPressed(); - void itemExpansionChanged(QTreeWidgetItem *); - void updateTitle(); + void processUserInput(QString); private: - Ui::BufferWidget ui; - Buffer *parentBuffer; + BufferId id; bool active; + Type type; - QString networkName; - QString bufferName; + VarMap nicks; + QString _topic; + QString _ownNick; + QString _networkName, _bufferName; + BufferState *state; - bool opsExpanded, voicedExpanded, usersExpanded; + //QList _contents; + QList lines; };