diff options
| author | isanae <14251494+isanae@users.noreply.github.com> | 2019-11-30 04:04:40 -0500 |
|---|---|---|
| committer | isanae <14251494+isanae@users.noreply.github.com> | 2019-11-30 04:04:40 -0500 |
| commit | 38d56ef8310674bc5a2f8b304ee17a6b7e1c5798 (patch) | |
| tree | 1e4686906e07f4fb01a439e0a2a4bb90ebb1e94e | |
| parent | f080e2e25d05eb639cc4168d3c6905041f4dc564 (diff) | |
fixed setting selection when checking for updates
| -rw-r--r-- | src/filterlist.cpp | 10 | ||||
| -rw-r--r-- | src/filterlist.h | 2 | ||||
| -rw-r--r-- | src/mainwindow.cpp | 6 |
3 files changed, 12 insertions, 6 deletions
diff --git a/src/filterlist.cpp b/src/filterlist.cpp index 66a9aed0..81f8b670 100644 --- a/src/filterlist.cpp +++ b/src/filterlist.cpp @@ -203,7 +203,7 @@ void FilterList::refresh() } } -void FilterList::setSelection(std::vector<int> categories) +void FilterList::setSelection(const std::vector<Criteria>& criteria) { for (int i = 0; i < ui->filters->topLevelItemCount(); ++i) { const auto* item = dynamic_cast<CriteriaItem*>( @@ -213,9 +213,11 @@ void FilterList::setSelection(std::vector<int> categories) continue; } - if (item->id() == CategoryFactory::UpdateAvailable) { - ui->filters->setCurrentItem(ui->filters->topLevelItem(i)); - break; + for (auto&& c : criteria) { + if (item->type() == c.type && item->id() == c.id) { + ui->filters->setCurrentItem(ui->filters->topLevelItem(i)); + break; + } } } } diff --git a/src/filterlist.h b/src/filterlist.h index e98f81a9..52b90ea7 100644 --- a/src/filterlist.h +++ b/src/filterlist.h @@ -14,7 +14,7 @@ class FilterList : public QObject public: FilterList(Ui::MainWindow* ui, CategoryFactory& factory); - void setSelection(std::vector<int> categories); + void setSelection(const std::vector<ModListSortProxy::Criteria>& criteria); void clearSelection(); void refresh(); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 420242ad..096ea076 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -4130,7 +4130,11 @@ void MainWindow::checkModsForUpdates() false} }); - m_Filters->setSelection({CategoryFactory::UpdateAvailable}); + m_Filters->setSelection({{ + ModListSortProxy::TYPE_SPECIAL, + CategoryFactory::UpdateAvailable, + false + }}); } } |
