X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fclient%2Fbuffer.cpp;h=023263bbb98ab0f84d3b61fd1d0029c3e20f1a81;hp=1fb07971aeeab45b593a615c377fd0caca87743c;hb=e9772bbd46ac2006b3f283bfc9f06b013d174ae3;hpb=902c95728306e5ba115de84800fc8d5d239c9d62 diff --git a/src/client/buffer.cpp b/src/client/buffer.cpp index 1fb07971..023263bb 100644 --- a/src/client/buffer.cpp +++ b/src/client/buffer.cpp @@ -17,24 +17,30 @@ * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ +#include + #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 = ServerBuffer; + _type = StatusType; else if(isChannelName(bufferid.buffer())) - _type = ChannelBuffer; + _type = ChannelType; else - _type = QueryBuffer; + _type = QueryType; + _nickModel = new NickModel(0, this); /* QSettings s; s.beginGroup(QString("GUI/BufferStates/%1/%2").arg(netname).arg(bufname)); @@ -53,7 +59,6 @@ Buffer::~Buffer() { s.endGroup(); */ //delete state; - emit bufferDestroyed(this); } Buffer::Type Buffer::bufferType() const { @@ -73,6 +78,10 @@ void Buffer::updateBufferInfo(BufferInfo bufferid) { _bufferInfo = bufferid; } +uint Buffer::uid() const { + return bufferInfo().uid(); +} + uint Buffer::networkId() const { return bufferInfo().networkId(); } @@ -81,15 +90,11 @@ QString Buffer::networkName() const { return bufferInfo().network(); } -QString Buffer::bufferName() const { - return bufferInfo().buffer(); -} - -QString Buffer::displayName() const { - if(bufferType() == ServerBuffer) +QString Buffer::name() const { + if(bufferType() == StatusType) return tr("Status Buffer"); else - return bufferName(); + return bufferInfo().buffer(); } QList Buffer::contents() const { @@ -112,7 +117,7 @@ QString Buffer::ownNick() const { } bool Buffer::isStatusBuffer() const { - return bufferType() == ServerBuffer; + return bufferType() == StatusType; } void Buffer::setActive(bool a) { @@ -146,6 +151,25 @@ 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) { + connect(_ircChannel, SIGNAL(destroyed()), this, SLOT(setIrcChannel())); + } + _nickModel->setIrcChannel(ircChannel()); +} + // no longer needed // back reference: // void Buffer::setTopic(QString t) {