diff options
author | bunnei <bunneidev@gmail.com> | 2021-06-03 00:27:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-03 00:27:54 +0200 |
commit | d6006e9a3f0ea2b9fca17174542b5aba131dd294 (patch) | |
tree | cef8a17b9f65439a43573bdb53eaf478c26d4ac8 /src | |
parent | Merge pull request #6395 from lioncash/result-move (diff) | |
parent | game_list: Minor for loop optimizations (diff) | |
download | yuzu-d6006e9a3f0ea2b9fca17174542b5aba131dd294.tar yuzu-d6006e9a3f0ea2b9fca17174542b5aba131dd294.tar.gz yuzu-d6006e9a3f0ea2b9fca17174542b5aba131dd294.tar.bz2 yuzu-d6006e9a3f0ea2b9fca17174542b5aba131dd294.tar.lz yuzu-d6006e9a3f0ea2b9fca17174542b5aba131dd294.tar.xz yuzu-d6006e9a3f0ea2b9fca17174542b5aba131dd294.tar.zst yuzu-d6006e9a3f0ea2b9fca17174542b5aba131dd294.zip |
Diffstat (limited to 'src')
-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 { QString GameList::GetLastFilterResultItem() const { QString file_path; - const int folder_count = item_model->rowCount(); - for (int i = 0; i < folder_count; ++i) { + for (int i = 1; i < item_model->rowCount() - 1; ++i) { const QStandardItem* folder = item_model->item(i, 0); const QModelIndex folder_index = folder->index(); const int children_count = folder->rowCount(); @@ -184,7 +183,6 @@ void GameList::OnItemExpanded(const QModelIndex& item) { // Event in order to filter the gamelist after editing the searchfield void GameList::OnTextChanged(const QString& new_text) { - const int folder_count = tree_view->model()->rowCount(); QString edit_filter_text = new_text.toLower(); QStandardItem* folder; int children_total = 0; @@ -194,7 +192,7 @@ void GameList::OnTextChanged(const QString& new_text) { if (edit_filter_text.isEmpty()) { tree_view->setRowHidden(0, item_model->invisibleRootItem()->index(), UISettings::values.favorited_ids.size() == 0); - for (int i = 1; i < folder_count; ++i) { + for (int i = 1; i < item_model->rowCount() - 1; ++i) { folder = item_model->item(i, 0); const QModelIndex folder_index = folder->index(); const int children_count = folder->rowCount(); @@ -207,7 +205,7 @@ void GameList::OnTextChanged(const QString& new_text) { } else { tree_view->setRowHidden(0, item_model->invisibleRootItem()->index(), true); int result_count = 0; - for (int i = 1; i < folder_count; ++i) { + for (int i = 1; i < item_model->rowCount() - 1; ++i) { folder = item_model->item(i, 0); const QModelIndex folder_index = folder->index(); const int children_count = folder->rowCount(); @@ -466,9 +464,8 @@ void GameList::DonePopulating(const QStringList& watch_list) { QCoreApplication::processEvents(); } tree_view->setEnabled(true); - const int folder_count = tree_view->model()->rowCount(); int children_total = 0; - for (int i = 1; i < folder_count; ++i) { + for (int i = 1; i < item_model->rowCount() - 1; ++i) { children_total += item_model->item(i, 0)->rowCount(); } search_field->setFilterResult(children_total, children_total); @@ -649,9 +646,9 @@ void GameList::AddPermDirPopup(QMenu& context_menu, QModelIndex selected) { } void GameList::AddFavoritesPopup(QMenu& context_menu) { - QAction* clear_all = context_menu.addAction(tr("Clear")); + QAction* clear = context_menu.addAction(tr("Clear")); - connect(clear_all, &QAction::triggered, [this] { + connect(clear, &QAction::triggered, [this] { for (const auto id : UISettings::values.favorited_ids) { RemoveFavorite(id); } |