X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fchatview.cpp;h=f8fe6b8fe253aa187cc55aa08066a62644b4a84b;hp=3c7d8cf9d59ea24d4bc8275a170b54e9a73c73d6;hb=412b5319d090f122ae8c99be6578bc25023c8f24;hpb=c6a6c0e4317986792320826956fd5ead2b3e9e67 diff --git a/src/qtui/chatview.cpp b/src/qtui/chatview.cpp index 3c7d8cf9..f8fe6b8f 100644 --- a/src/qtui/chatview.cpp +++ b/src/qtui/chatview.cpp @@ -30,12 +30,14 @@ #include "messagefilter.h" #include "qtui.h" #include "qtuistyle.h" +#include "clientignorelistmanager.h" ChatView::ChatView(BufferId bufferId, QWidget *parent) : QGraphicsView(parent), AbstractChatView(), _bufferContainer(0), - _currentScaleFactor(1) + _currentScaleFactor(1), + _invalidateFilter(false) { QList filterList; filterList.append(bufferId); @@ -47,7 +49,8 @@ ChatView::ChatView(MessageFilter *filter, QWidget *parent) : QGraphicsView(parent), AbstractChatView(), _bufferContainer(0), - _currentScaleFactor(1) + _currentScaleFactor(1), + _invalidateFilter(false) { init(filter); } @@ -73,7 +76,10 @@ void ChatView::init(MessageFilter *filter) { setScene(_scene); connect(verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(verticalScrollbarChanged(int))); - connect(QtUi::style(), SIGNAL(changed()), this, SLOT(styleChanged())); + + // only connect if client is synched with a core + if(Client::isSynced()) + connect(Client::ignoreListManager(), SIGNAL(ignoreListChanged()), this, SLOT(invalidateFilter())); } bool ChatView::event(QEvent *event) { @@ -100,6 +106,11 @@ bool ChatView::event(QEvent *event) { } } + if(event->type() == QEvent::Show) { + if(_invalidateFilter) + invalidateFilter(); + } + return QGraphicsView::event(event); } @@ -172,12 +183,6 @@ void ChatView::verticalScrollbarChanged(int newPos) { vbar->setValue(vbar->maximum()); } -void ChatView::styleChanged() { - invalidateScene(); - if(scene()) - scene()->update(); -} - MsgId ChatView::lastMsgId() const { if(!scene()) return MsgId(); @@ -215,3 +220,16 @@ void ChatView::zoomOriginal() { _currentScaleFactor = 1; scene()->setWidth(viewport()->width() - 2); } + +void ChatView::invalidateFilter() { + // if this is the currently selected chatview + // invalidate immediately + if(isVisible()) { + _scene->filter()->invalidateFilter(); + _invalidateFilter = false; + } + // otherwise invalidate whenever the view is shown + else { + _invalidateFilter = true; + } +}