From 6a93688b2e46f051ff80268783c6a8e1a2d7245f Mon Sep 17 00:00:00 2001 From: flow Date: Sun, 28 Aug 2022 22:58:43 -0300 Subject: fix: filtering in regex search in resource packs Signed-off-by: flow --- launcher/minecraft/mod/ResourcePack.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'launcher/minecraft/mod/ResourcePack.cpp') diff --git a/launcher/minecraft/mod/ResourcePack.cpp b/launcher/minecraft/mod/ResourcePack.cpp index cab20b50..5f45254d 100644 --- a/launcher/minecraft/mod/ResourcePack.cpp +++ b/launcher/minecraft/mod/ResourcePack.cpp @@ -2,6 +2,7 @@ #include #include +#include #include "Version.h" @@ -69,3 +70,19 @@ std::pair ResourcePack::compare(const Resource& other, SortType type) } return { 0, false }; } + +bool ResourcePack::applyFilter(QRegularExpression filter) const +{ + if (filter.match(description()).hasMatch()) + return true; + + if (filter.match(QString::number(packFormat())).hasMatch()) + return true; + + if (filter.match(compatibleVersions().first.toString()).hasMatch()) + return true; + if (filter.match(compatibleVersions().second.toString()).hasMatch()) + return true; + + return Resource::applyFilter(filter); +} -- cgit