summary refs log tree commit diff
path: root/src/RoomList.cpp
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2021-01-23 00:30:45 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2021-01-23 00:49:28 +0100
commitfdb9d7ab40da1d6b40ae11c3988af7082b6bc7cd (patch)
tree25e3cff2e5824c6b94c10d349b925f91623f4cc5 /src/RoomList.cpp
parentFix font tags showing up in playable media messages (diff)
downloadnheko-fdb9d7ab40da1d6b40ae11c3988af7082b6bc7cd.tar.xz
Allow users to hide rooms with specific tags
Diffstat (limited to 'src/RoomList.cpp')
-rw-r--r--src/RoomList.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/RoomList.cpp b/src/RoomList.cpp

index aab89491..764a8e42 100644 --- a/src/RoomList.cpp +++ b/src/RoomList.cpp
@@ -50,8 +50,8 @@ RoomList::RoomList(QSharedPointer<UserSettings> userSettings, QWidget *parent) QScroller::grabGesture(scrollArea_, QScroller::TouchGesture); QScroller::grabGesture(scrollArea_, QScroller::LeftMouseButtonGesture); - // The scrollbar on macOS will hide itself when not active so it won't interfere - // with the content. +// The scrollbar on macOS will hide itself when not active so it won't interfere +// with the content. #if not defined(Q_OS_MAC) scrollArea_->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); #endif @@ -411,20 +411,24 @@ RoomList::closeJoinRoomDialog(bool isJoining, QString roomAlias) } void -RoomList::removeFilter() +RoomList::removeFilter(const std::set<QString> &roomsToHide) { setUpdatesEnabled(false); for (int i = 0; i < contentsLayout_->count(); i++) { auto widget = qobject_cast<RoomInfoListItem *>(contentsLayout_->itemAt(i)->widget()); - if (widget) - widget->show(); + if (widget) { + if (roomsToHide.find(widget->roomId()) == roomsToHide.end()) + widget->show(); + else + widget->hide(); + } } setUpdatesEnabled(true); } void -RoomList::applyFilter(const std::map<QString, bool> &filter) +RoomList::applyFilter(const std::set<QString> &filter) { // Disabling paint updates will resolve issues with screen flickering on big room lists. setUpdatesEnabled(false);