Răsfoiți Sursa

Allow searching by a substring of the title ID

zeltermann 2 ani în urmă
părinte
comite
1ed9e8812b
1 a modificat fișierele cu 6 adăugiri și 2 ștergeri
  1. 6 2
      src/yuzu/game_list.cpp

+ 6 - 2
src/yuzu/game_list.cpp

@@ -214,13 +214,17 @@ void GameList::OnTextChanged(const QString& new_text) {
             const int children_count = folder->rowCount();
             const int children_count = folder->rowCount();
             for (int j = 0; j < children_count; ++j) {
             for (int j = 0; j < children_count; ++j) {
                 ++children_total;
                 ++children_total;
+
                 const QStandardItem* child = folder->child(j, 0);
                 const QStandardItem* child = folder->child(j, 0);
+
+                const auto program_id = child->data(GameListItemPath::ProgramIdRole).toULongLong();
+
                 const QString file_path =
                 const QString file_path =
                     child->data(GameListItemPath::FullPathRole).toString().toLower();
                     child->data(GameListItemPath::FullPathRole).toString().toLower();
                 const QString file_title =
                 const QString file_title =
                     child->data(GameListItemPath::TitleRole).toString().toLower();
                     child->data(GameListItemPath::TitleRole).toString().toLower();
                 const QString file_program_id =
                 const QString file_program_id =
-                    child->data(GameListItemPath::ProgramIdRole).toString().toLower();
+                    QStringLiteral("%1").arg(program_id, 16, 16, QLatin1Char{'0'});
 
 
                 // Only items which filename in combination with its title contains all words
                 // Only items which filename in combination with its title contains all words
                 // that are in the searchfield will be visible in the gamelist
                 // that are in the searchfield will be visible in the gamelist
@@ -231,7 +235,7 @@ void GameList::OnTextChanged(const QString& new_text) {
                     file_path.mid(file_path.lastIndexOf(QLatin1Char{'/'}) + 1) + QLatin1Char{' '} +
                     file_path.mid(file_path.lastIndexOf(QLatin1Char{'/'}) + 1) + QLatin1Char{' '} +
                     file_title;
                     file_title;
                 if (ContainsAllWords(file_name, edit_filter_text) ||
                 if (ContainsAllWords(file_name, edit_filter_text) ||
-                    (file_program_id.count() == 16 && edit_filter_text.contains(file_program_id))) {
+                    (file_program_id.count() == 16 && file_program_id.contains(edit_filter_text))) {
                     tree_view->setRowHidden(j, folder_index, false);
                     tree_view->setRowHidden(j, folder_index, false);
                     ++result_count;
                     ++result_count;
                 } else {
                 } else {