From fdb9d7ab40da1d6b40ae11c3988af7082b6bc7cd Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Sat, 23 Jan 2021 00:30:45 +0100 Subject: Allow users to hide rooms with specific tags --- src/RoomList.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/RoomList.cpp') 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, 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 &roomsToHide) { setUpdatesEnabled(false); for (int i = 0; i < contentsLayout_->count(); i++) { auto widget = qobject_cast(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 &filter) +RoomList::applyFilter(const std::set &filter) { // Disabling paint updates will resolve issues with screen flickering on big room lists. setUpdatesEnabled(false); -- cgit 1.5.1