mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-09-30 20:21:14 +00:00
102d254530
- Remove unnecessary icon update code (the UI reloads this stuff anyways); test on Windows please - Cleaned up a bunch of duplicated/unused code within the game list - Fix the game list constantly reloading on macOS * When you reconstruct the entire directory list on the watcher the directoryChanged signal fires on macOS--seems like a behavioral change that occurred somewhere in the 6.8 release cycle--and it would enter an infinite loop very quickly * To fix this, only the differences between the current and old watch list are accounted for on both ends. * Since this bug is now fixed, macOS uses Qt 6.11.1 now. Should theoretically improve our situation. - Fix the external content watcher crashing; the worker would attempt to read files that didn't exist without any bounds since its cache was still pointing to that file. This supersedes and replaces #4099. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4106 Reviewed-by: Lizzie <lizzie@eden-emu.dev> Reviewed-by: MaranBr <maranbr@eden-emu.dev>
37 lines
1.3 KiB
C++
37 lines
1.3 KiB
C++
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
#pragma once
|
|
|
|
#include <QStandardItem>
|
|
#include <QStringList>
|
|
|
|
#include "qt_common/game_list/game_list_p.h"
|
|
|
|
namespace Yuzu {
|
|
|
|
inline bool ContainsAllWords(const QString& haystack, const QString& userinput) {
|
|
const QStringList userinput_split = userinput.split(QLatin1Char{' '}, Qt::SkipEmptyParts);
|
|
return std::all_of(userinput_split.begin(), userinput_split.end(),
|
|
[&haystack](const QString& s) { return haystack.contains(s); });
|
|
}
|
|
|
|
inline bool FilterMatches(const QString& filter, const QStandardItem* item) {
|
|
if (filter.isEmpty())
|
|
return true;
|
|
|
|
const auto program_id = item->data(GameListItemPath::ProgramIdRole).toULongLong();
|
|
|
|
const QString file_path = item->data(GameListItemPath::FullPathRole).toString().toLower();
|
|
const QString file_title = item->data(GameListItemPath::TitleRole).toString().toLower();
|
|
const QString file_program_id = QStringLiteral("%1").arg(program_id, 16, 16, QLatin1Char{'0'});
|
|
|
|
const QString file_name =
|
|
file_path.mid(file_path.lastIndexOf(QLatin1Char{'/'}) + 1) + QLatin1Char{' '} + file_title;
|
|
|
|
return Yuzu::ContainsAllWords(file_name, filter) ||
|
|
(file_program_id.size() == 16 && file_program_id.contains(filter));
|
|
}
|
|
|
|
} // namespace Yuzu
|