X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fclient%2Fbuffer.cpp;h=4ea013ee060392b0b3aa0988b1429ffc1f002a17;hp=b82a695e367215e4266546deea4ad229d1306a9f;hb=1989f165c2b754a42d3f06dfb5c33afd6111d820;hpb=748f25bbae0e0ca8df58ec69df8d19c84ae77252 diff --git a/src/client/buffer.cpp b/src/client/buffer.cpp index b82a695e..4ea013ee 100644 --- a/src/client/buffer.cpp +++ b/src/client/buffer.cpp @@ -1,11 +1,11 @@ /*************************************************************************** - * Copyright (C) 2005-07 by The Quassel Team * + * Copyright (C) 2005-08 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * + * (at your option) version 3. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * @@ -22,13 +22,16 @@ #include "buffer.h" #include "client.h" +#include "ircchannel.h" +#include "nickmodel.h" #include "util.h" Buffer::Buffer(BufferInfo bufferid, QObject *parent) : QObject(parent), _bufferInfo(bufferid), - _active(false) + _active(false), + _ircChannel(0), _nickModel(0) { if(bufferid.buffer().isEmpty()) _type = StatusType; @@ -37,6 +40,7 @@ Buffer::Buffer(BufferInfo bufferid, QObject *parent) else _type = QueryType; + _nickModel = new NickModel(0, this); /* QSettings s; s.beginGroup(QString("GUI/BufferStates/%1/%2").arg(netname).arg(bufname)); @@ -74,6 +78,10 @@ void Buffer::updateBufferInfo(BufferInfo bufferid) { _bufferInfo = bufferid; } +uint Buffer::uid() const { + return bufferInfo().uid(); +} + uint Buffer::networkId() const { return bufferInfo().networkId(); } @@ -82,15 +90,11 @@ QString Buffer::networkName() const { return bufferInfo().network(); } -QString Buffer::bufferName() const { - return bufferInfo().buffer(); -} - -QString Buffer::displayName() const { +QString Buffer::name() const { if(bufferType() == StatusType) return tr("Status Buffer"); else - return bufferName(); + return bufferInfo().buffer(); } QList Buffer::contents() const { @@ -103,12 +107,12 @@ QVariantMap Buffer::nickList() const { } QString Buffer::topic() const { - // FIXME check if we got a networkInfo() object + if(ircChannel()) return ircChannel()->topic(); return QString(); } QString Buffer::ownNick() const { - // FIXME check if we got a networkInfo() object + // FIXME if(ircChannel()) return ircChannel()->ownNick(); return QString(); } @@ -147,13 +151,29 @@ void Buffer::processUserInput(QString msg) { emit userInput(_bufferInfo, msg); } +NickModel *Buffer::nickModel() const { + return _nickModel; +} + +IrcChannel *Buffer::ircChannel() const { + return _ircChannel; +} + +void Buffer::setIrcChannel(IrcChannel *ircchan) { + if(_ircChannel) { + disconnect(_ircChannel, 0, this, 0); + } + _ircChannel = ircchan; + if(_ircChannel) { + emit topicSet(_ircChannel->topic()); + connect(_ircChannel, SIGNAL(topicSet(QString)), this, SIGNAL(topicSet(QString))); + connect(_ircChannel, SIGNAL(destroyed()), this, SLOT(setIrcChannel())); + } + _nickModel->setIrcChannel(ircChannel()); +} + // no longer needed // back reference: -// void Buffer::setTopic(QString t) { -// _topic = t; -// emit topicSet(t); -// emit bufferUpdated(this); -// } // void Buffer::addNick(QString nick, QVariantMap props) { // if(nick == ownNick()) setActive(true);