mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-29 06:08:48 +03:00
Fix spaces showing up with world filter
This commit is contained in:
parent
d30446a8b3
commit
f8dfc72625
1 changed files with 45 additions and 26 deletions
|
@ -531,6 +531,12 @@ bool
|
||||||
FilteredRoomlistModel::filterAcceptsRow(int sourceRow, const QModelIndex &) const
|
FilteredRoomlistModel::filterAcceptsRow(int sourceRow, const QModelIndex &) const
|
||||||
{
|
{
|
||||||
if (filterType == FilterBy::Nothing) {
|
if (filterType == FilterBy::Nothing) {
|
||||||
|
if (sourceModel()
|
||||||
|
->data(sourceModel()->index(sourceRow, 0), RoomlistModel::IsSpace)
|
||||||
|
.toBool()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!hiddenTags.empty()) {
|
if (!hiddenTags.empty()) {
|
||||||
auto tags =
|
auto tags =
|
||||||
sourceModel()
|
sourceModel()
|
||||||
|
@ -540,7 +546,9 @@ FilteredRoomlistModel::filterAcceptsRow(int sourceRow, const QModelIndex &) cons
|
||||||
for (const auto &t : tags)
|
for (const auto &t : tags)
|
||||||
if (hiddenTags.contains(t))
|
if (hiddenTags.contains(t))
|
||||||
return false;
|
return false;
|
||||||
} else if (!hiddenSpaces.empty()) {
|
}
|
||||||
|
|
||||||
|
if (!hiddenSpaces.empty()) {
|
||||||
auto parents =
|
auto parents =
|
||||||
sourceModel()
|
sourceModel()
|
||||||
->data(sourceModel()->index(sourceRow, 0), RoomlistModel::ParentSpaces)
|
->data(sourceModel()->index(sourceRow, 0), RoomlistModel::ParentSpaces)
|
||||||
|
@ -548,25 +556,30 @@ FilteredRoomlistModel::filterAcceptsRow(int sourceRow, const QModelIndex &) cons
|
||||||
for (const auto &t : parents)
|
for (const auto &t : parents)
|
||||||
if (hiddenSpaces.contains(t))
|
if (hiddenSpaces.contains(t))
|
||||||
return false;
|
return false;
|
||||||
} else if (sourceModel()
|
|
||||||
->data(sourceModel()->index(sourceRow, 0), RoomlistModel::IsSpace)
|
|
||||||
.toBool()) {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else if (filterType == FilterBy::Tag) {
|
} else if (filterType == FilterBy::Tag) {
|
||||||
|
if (sourceModel()
|
||||||
|
->data(sourceModel()->index(sourceRow, 0), RoomlistModel::IsSpace)
|
||||||
|
.toBool()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
auto tags = sourceModel()
|
auto tags = sourceModel()
|
||||||
->data(sourceModel()->index(sourceRow, 0), RoomlistModel::Tags)
|
->data(sourceModel()->index(sourceRow, 0), RoomlistModel::Tags)
|
||||||
.toStringList();
|
.toStringList();
|
||||||
|
|
||||||
if (!tags.contains(filterStr))
|
if (!tags.contains(filterStr))
|
||||||
return false;
|
return false;
|
||||||
else if (!hiddenTags.empty()) {
|
|
||||||
|
if (!hiddenTags.empty()) {
|
||||||
for (const auto &t : tags)
|
for (const auto &t : tags)
|
||||||
if (t != filterStr && hiddenTags.contains(t))
|
if (t != filterStr && hiddenTags.contains(t))
|
||||||
return false;
|
return false;
|
||||||
} else if (!hiddenSpaces.empty()) {
|
}
|
||||||
|
|
||||||
|
if (!hiddenSpaces.empty()) {
|
||||||
auto parents =
|
auto parents =
|
||||||
sourceModel()
|
sourceModel()
|
||||||
->data(sourceModel()->index(sourceRow, 0), RoomlistModel::ParentSpaces)
|
->data(sourceModel()->index(sourceRow, 0), RoomlistModel::ParentSpaces)
|
||||||
|
@ -574,41 +587,47 @@ FilteredRoomlistModel::filterAcceptsRow(int sourceRow, const QModelIndex &) cons
|
||||||
for (const auto &t : parents)
|
for (const auto &t : parents)
|
||||||
if (hiddenSpaces.contains(t))
|
if (hiddenSpaces.contains(t))
|
||||||
return false;
|
return false;
|
||||||
} else if (sourceModel()
|
|
||||||
->data(sourceModel()->index(sourceRow, 0), RoomlistModel::IsSpace)
|
|
||||||
.toBool()) {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else if (filterType == FilterBy::Space) {
|
} else if (filterType == FilterBy::Space) {
|
||||||
auto parents =
|
|
||||||
sourceModel()
|
|
||||||
->data(sourceModel()->index(sourceRow, 0), RoomlistModel::ParentSpaces)
|
|
||||||
.toStringList();
|
|
||||||
auto tags = sourceModel()
|
|
||||||
->data(sourceModel()->index(sourceRow, 0), RoomlistModel::Tags)
|
|
||||||
.toStringList();
|
|
||||||
|
|
||||||
if (filterStr == sourceModel()
|
if (filterStr == sourceModel()
|
||||||
->data(sourceModel()->index(sourceRow, 0), RoomlistModel::RoomId)
|
->data(sourceModel()->index(sourceRow, 0), RoomlistModel::RoomId)
|
||||||
.toString())
|
.toString())
|
||||||
return true;
|
return true;
|
||||||
else if (!parents.contains(filterStr))
|
|
||||||
|
auto parents =
|
||||||
|
sourceModel()
|
||||||
|
->data(sourceModel()->index(sourceRow, 0), RoomlistModel::ParentSpaces)
|
||||||
|
.toStringList();
|
||||||
|
|
||||||
|
if (!parents.contains(filterStr))
|
||||||
return false;
|
return false;
|
||||||
else if (!hiddenTags.empty()) {
|
|
||||||
|
if (!hiddenTags.empty()) {
|
||||||
|
auto tags =
|
||||||
|
sourceModel()
|
||||||
|
->data(sourceModel()->index(sourceRow, 0), RoomlistModel::Tags)
|
||||||
|
.toStringList();
|
||||||
|
|
||||||
for (const auto &t : tags)
|
for (const auto &t : tags)
|
||||||
if (hiddenTags.contains(t))
|
if (hiddenTags.contains(t))
|
||||||
return false;
|
return false;
|
||||||
} else if (!hiddenSpaces.empty()) {
|
}
|
||||||
|
|
||||||
|
if (!hiddenSpaces.empty()) {
|
||||||
for (const auto &t : parents)
|
for (const auto &t : parents)
|
||||||
if (hiddenSpaces.contains(t))
|
if (hiddenSpaces.contains(t))
|
||||||
return false;
|
return false;
|
||||||
} else if (sourceModel()
|
}
|
||||||
->data(sourceModel()->index(sourceRow, 0), RoomlistModel::IsSpace)
|
|
||||||
.toBool() &&
|
if (sourceModel()
|
||||||
!parents.contains(filterStr)) {
|
->data(sourceModel()->index(sourceRow, 0), RoomlistModel::IsSpace)
|
||||||
|
.toBool() &&
|
||||||
|
!parents.contains(filterStr)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue