X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fclient%2Fbufferviewoverlay.cpp;h=66dec133f941989e783761f613b30a983f8a3cd9;hb=8aa25a7c1526915741a7da989cc0a663bd84eb31;hp=93af395e5d499236940e9822e412bb7f3722d2ea;hpb=71ef3ec0c4c4d02431aa560ed83b379c416798c5;p=quassel.git diff --git a/src/client/bufferviewoverlay.cpp b/src/client/bufferviewoverlay.cpp index 93af395e..66dec133 100644 --- a/src/client/bufferviewoverlay.cpp +++ b/src/client/bufferviewoverlay.cpp @@ -22,9 +22,10 @@ #include -#include "client.h" #include "bufferviewconfig.h" +#include "client.h" #include "clientbufferviewmanager.h" +#include "networkmodel.h" const int BufferViewOverlay::_updateEventId = QEvent::registerEventType(); @@ -118,29 +119,49 @@ void BufferViewOverlay::updateHelper() { QSet removedBuffers; QSet tempRemovedBuffers; - BufferViewConfig *config = 0; - QSet::const_iterator viewIter; - for(viewIter = _bufferViewIds.constBegin(); viewIter != _bufferViewIds.constEnd(); viewIter++) { - config = Client::bufferViewManager()->bufferViewConfig(*viewIter); - if(!config) - continue; - - networkIds << config->networkId(); - buffers += config->bufferList().toSet(); - tempRemovedBuffers += config->temporarilyRemovedBuffers(); - - // in the overlay a buffer is removed it is removed from all views - if(removedBuffers.isEmpty()) - removedBuffers = config->removedBuffers(); - else - removedBuffers.intersect(config->removedBuffers()); - - - addBuffersAutomatically |= config->addNewBuffersAutomatically(); - hideInactiveBuffers &= config->hideInactiveBuffers(); - allowedBufferTypes |= config->allowedBufferTypes(); - if(minimumActivity == -1 || config->minimumActivity() < minimumActivity) - minimumActivity = config->minimumActivity(); + if(Client::bufferViewManager()) { + BufferViewConfig *config = 0; + QSet::const_iterator viewIter; + for(viewIter = _bufferViewIds.constBegin(); viewIter != _bufferViewIds.constEnd(); viewIter++) { + config = Client::bufferViewManager()->bufferViewConfig(*viewIter); + if(!config) + continue; + + networkIds << config->networkId(); + if(config->networkId().isValid()) { + NetworkId networkId = config->networkId(); + // we have to filter out all the buffers that don't belong to this net... :/ + QSet bufferIds; + foreach(BufferId bufferId, config->bufferList()) { + if(Client::networkModel()->networkId(bufferId) == networkId) + bufferIds << bufferId; + } + buffers += bufferIds; + + bufferIds.clear(); + foreach(BufferId bufferId, config->temporarilyRemovedBuffers()) { + if(Client::networkModel()->networkId(bufferId) == networkId) + bufferIds << bufferId; + } + tempRemovedBuffers += bufferIds; + } else { + buffers += config->bufferList().toSet(); + tempRemovedBuffers += config->temporarilyRemovedBuffers(); + } + + // in the overlay a buffer is removed it is removed from all views + if(removedBuffers.isEmpty()) + removedBuffers = config->removedBuffers(); + else + removedBuffers.intersect(config->removedBuffers()); + + + addBuffersAutomatically |= config->addNewBuffersAutomatically(); + hideInactiveBuffers &= config->hideInactiveBuffers(); + allowedBufferTypes |= config->allowedBufferTypes(); + if(minimumActivity == -1 || config->minimumActivity() < minimumActivity) + minimumActivity = config->minimumActivity(); + } } changed |= (addBuffersAutomatically != _addBuffersAutomatically);