X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fclient%2Fbuffer.cpp;h=7f4d885a71cd02c0a5e1ad6dca70a45216836515;hp=cf764c1b574efe373b15a38862376784ae67f82a;hb=8c3b7e4773e9f20ad9ea264cbaafaa52485bdf86;hpb=130ccf5033c21ca3ad0e0357a82953b5727bd0e9 diff --git a/src/client/buffer.cpp b/src/client/buffer.cpp index cf764c1b..7f4d885a 100644 --- a/src/client/buffer.cpp +++ b/src/client/buffer.cpp @@ -17,19 +17,11 @@ * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ - #include "buffer.h" -#include "util.h" -#include "chatwidget.h" -#include "bufferwidget.h" - -/* -Buffer::Buffer(QString netname, QString bufname) { - Buffer(BufferId(0, netname, bufname)); +#include "client.h" +#include "util.h" -} -*/ Buffer::Buffer(BufferId bufid) { id = bufid; @@ -62,18 +54,53 @@ Buffer::~Buffer() { emit bufferDestroyed(this); } -void Buffer::init() { +Buffer::Type Buffer::bufferType() const { + return type; +} +bool Buffer::isActive() const { + return active; +} + +QString Buffer::networkName() const { + return _networkName; +} +QString Buffer::bufferName() const { + return _bufferName; } -QString Buffer::displayName() { +QString Buffer::displayName() const { if(bufferType() == ServerBuffer) - return tr("status"); + return tr("Status Buffer"); else return bufferName(); } +BufferId Buffer::bufferId() const { + return id; +} + +QList Buffer::contents() const { + return layoutedMsgs; +} + +VarMap Buffer::nickList() const { + return nicks; +} + +QString Buffer::topic() const { + return _topic; +} + +QString Buffer::ownNick() const { + return _ownNick; +} + +bool Buffer::isStatusBuffer() const { + return bufferType() == ServerBuffer; +} + void Buffer::setActive(bool a) { if(a != active) { active = a; @@ -81,14 +108,23 @@ void Buffer::setActive(bool a) { } } -void Buffer::appendChatLine(ChatLine *line) { - lines.append(line); - emit chatLineAppended(line); +void Buffer::appendMsg(const Message &msg) { + AbstractUiMsg *m = Client::layoutMsg(msg); + layoutedMsgs.append(m); + emit msgAppended(m); } -void Buffer::prependChatLine(ChatLine *line) { - lines.prepend(line); - emit chatLinePrepended(line); +void Buffer::prependMsg(const Message &msg) { + layoutQueue.append(msg); +} + +bool Buffer::layoutMsg() { + if(layoutQueue.count()) { + AbstractUiMsg *m = Client::layoutMsg(layoutQueue.takeFirst()); + layoutedMsgs.prepend(m); + emit msgPrepended(m); + } + return layoutQueue.count(); } void Buffer::processUserInput(QString msg) { @@ -129,9 +165,3 @@ void Buffer::setOwnNick(QString nick) { _ownNick = nick; emit ownNickSet(nick); } - -/****************************************************************************************/ - - -/****************************************************************************************/ -