diff options
| -rw-r--r-- | src/yuzu/game_list.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp index aa3bd5e34..25bb066c9 100644 --- a/src/yuzu/game_list.cpp +++ b/src/yuzu/game_list.cpp | |||
| @@ -91,9 +91,8 @@ QString GameListSearchField::filterText() const { | |||
| 91 | 91 | ||
| 92 | QString GameList::GetLastFilterResultItem() const { | 92 | QString GameList::GetLastFilterResultItem() const { |
| 93 | QString file_path; | 93 | QString file_path; |
| 94 | const int folder_count = item_model->rowCount(); | ||
| 95 | 94 | ||
| 96 | for (int i = 0; i < folder_count; ++i) { | 95 | for (int i = 1; i < item_model->rowCount() - 1; ++i) { |
| 97 | const QStandardItem* folder = item_model->item(i, 0); | 96 | const QStandardItem* folder = item_model->item(i, 0); |
| 98 | const QModelIndex folder_index = folder->index(); | 97 | const QModelIndex folder_index = folder->index(); |
| 99 | const int children_count = folder->rowCount(); | 98 | const int children_count = folder->rowCount(); |
| @@ -184,7 +183,6 @@ void GameList::OnItemExpanded(const QModelIndex& item) { | |||
| 184 | 183 | ||
| 185 | // Event in order to filter the gamelist after editing the searchfield | 184 | // Event in order to filter the gamelist after editing the searchfield |
| 186 | void GameList::OnTextChanged(const QString& new_text) { | 185 | void GameList::OnTextChanged(const QString& new_text) { |
| 187 | const int folder_count = tree_view->model()->rowCount(); | ||
| 188 | QString edit_filter_text = new_text.toLower(); | 186 | QString edit_filter_text = new_text.toLower(); |
| 189 | QStandardItem* folder; | 187 | QStandardItem* folder; |
| 190 | int children_total = 0; | 188 | int children_total = 0; |
| @@ -194,7 +192,7 @@ void GameList::OnTextChanged(const QString& new_text) { | |||
| 194 | if (edit_filter_text.isEmpty()) { | 192 | if (edit_filter_text.isEmpty()) { |
| 195 | tree_view->setRowHidden(0, item_model->invisibleRootItem()->index(), | 193 | tree_view->setRowHidden(0, item_model->invisibleRootItem()->index(), |
| 196 | UISettings::values.favorited_ids.size() == 0); | 194 | UISettings::values.favorited_ids.size() == 0); |
| 197 | for (int i = 1; i < folder_count; ++i) { | 195 | for (int i = 1; i < item_model->rowCount() - 1; ++i) { |
| 198 | folder = item_model->item(i, 0); | 196 | folder = item_model->item(i, 0); |
| 199 | const QModelIndex folder_index = folder->index(); | 197 | const QModelIndex folder_index = folder->index(); |
| 200 | const int children_count = folder->rowCount(); | 198 | const int children_count = folder->rowCount(); |
| @@ -207,7 +205,7 @@ void GameList::OnTextChanged(const QString& new_text) { | |||
| 207 | } else { | 205 | } else { |
| 208 | tree_view->setRowHidden(0, item_model->invisibleRootItem()->index(), true); | 206 | tree_view->setRowHidden(0, item_model->invisibleRootItem()->index(), true); |
| 209 | int result_count = 0; | 207 | int result_count = 0; |
| 210 | for (int i = 1; i < folder_count; ++i) { | 208 | for (int i = 1; i < item_model->rowCount() - 1; ++i) { |
| 211 | folder = item_model->item(i, 0); | 209 | folder = item_model->item(i, 0); |
| 212 | const QModelIndex folder_index = folder->index(); | 210 | const QModelIndex folder_index = folder->index(); |
| 213 | const int children_count = folder->rowCount(); | 211 | const int children_count = folder->rowCount(); |
| @@ -466,9 +464,8 @@ void GameList::DonePopulating(const QStringList& watch_list) { | |||
| 466 | QCoreApplication::processEvents(); | 464 | QCoreApplication::processEvents(); |
| 467 | } | 465 | } |
| 468 | tree_view->setEnabled(true); | 466 | tree_view->setEnabled(true); |
| 469 | const int folder_count = tree_view->model()->rowCount(); | ||
| 470 | int children_total = 0; | 467 | int children_total = 0; |
| 471 | for (int i = 1; i < folder_count; ++i) { | 468 | for (int i = 1; i < item_model->rowCount() - 1; ++i) { |
| 472 | children_total += item_model->item(i, 0)->rowCount(); | 469 | children_total += item_model->item(i, 0)->rowCount(); |
| 473 | } | 470 | } |
| 474 | search_field->setFilterResult(children_total, children_total); | 471 | search_field->setFilterResult(children_total, children_total); |
| @@ -649,9 +646,9 @@ void GameList::AddPermDirPopup(QMenu& context_menu, QModelIndex selected) { | |||
| 649 | } | 646 | } |
| 650 | 647 | ||
| 651 | void GameList::AddFavoritesPopup(QMenu& context_menu) { | 648 | void GameList::AddFavoritesPopup(QMenu& context_menu) { |
| 652 | QAction* clear_all = context_menu.addAction(tr("Clear")); | 649 | QAction* clear = context_menu.addAction(tr("Clear")); |
| 653 | 650 | ||
| 654 | connect(clear_all, &QAction::triggered, [this] { | 651 | connect(clear, &QAction::triggered, [this] { |
| 655 | for (const auto id : UISettings::values.favorited_ids) { | 652 | for (const auto id : UISettings::values.favorited_ids) { |
| 656 | RemoveFavorite(id); | 653 | RemoveFavorite(id); |
| 657 | } | 654 | } |