diff options
| author | LostDragonist <lost.dragonist@gmail.com> | 2019-03-22 17:33:10 -0500 |
|---|---|---|
| committer | LostDragonist <lost.dragonist@gmail.com> | 2019-03-22 17:33:10 -0500 |
| commit | c3ff652ff8c612054fa102234677c74fcd19a51c (patch) | |
| tree | a3dce005c5ed82989ecff6a8809bc9c72732153a /src/mainwindow.cpp | |
| parent | d14125835790fe2d660acddf78e313affde0ee29 (diff) | |
Only change to the update filter if mods are being checked for update or mods have updates available
Diffstat (limited to 'src/mainwindow.cpp')
| -rw-r--r-- | src/mainwindow.cpp | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 669820be..8fe786ba 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -4075,28 +4075,40 @@ void MainWindow::saveArchiveList() void MainWindow::checkModsForUpdates() { - statusBar()->show(); + bool checkingModsForUpdate = false; if (NexusInterface::instance(&m_PluginContainer)->getAccessManager()->validated()) { - ModInfo::checkAllForUpdate(&m_PluginContainer, this); + checkingModsForUpdate = ModInfo::checkAllForUpdate(&m_PluginContainer, this); NexusInterface::instance(&m_PluginContainer)->requestEndorsementInfo(this, QVariant(), QString()); NexusInterface::instance(&m_PluginContainer)->requestTrackingInfo(this, QVariant(), QString()); } else { QString apiKey; if (m_OrganizerCore.settings().getNexusApiKey(apiKey)) { m_OrganizerCore.doAfterLogin([this] () { this->checkModsForUpdates(); }); + statusBar()->show(); NexusInterface::instance(&m_PluginContainer)->getAccessManager()->apiCheck(apiKey); } else { qWarning("You are not currently authenticated with Nexus. Please do so under Settings -> Nexus."); } } - m_ModListSortProxy->setCategoryFilter(boost::assign::list_of(CategoryFactory::CATEGORY_SPECIAL_UPDATEAVAILABLE)); - for (int i = 0; i < ui->categoriesList->topLevelItemCount(); ++i) { - if (ui->categoriesList->topLevelItem(i)->data(0, Qt::UserRole) == CategoryFactory::CATEGORY_SPECIAL_UPDATEAVAILABLE) { - ui->categoriesList->setCurrentItem(ui->categoriesList->topLevelItem(i)); + bool updatesAvailable = false; + for (auto mod : m_OrganizerCore.modList()->allMods()) { + ModInfo::Ptr modInfo = ModInfo::getByName(mod); + if (modInfo->updateAvailable()) { + updatesAvailable = true; break; } } + + if (updatesAvailable || checkingModsForUpdate) { + m_ModListSortProxy->setCategoryFilter(boost::assign::list_of(CategoryFactory::CATEGORY_SPECIAL_UPDATEAVAILABLE)); + for (int i = 0; i < ui->categoriesList->topLevelItemCount(); ++i) { + if (ui->categoriesList->topLevelItem(i)->data(0, Qt::UserRole) == CategoryFactory::CATEGORY_SPECIAL_UPDATEAVAILABLE) { + ui->categoriesList->setCurrentItem(ui->categoriesList->topLevelItem(i)); + break; + } + } + } } void MainWindow::changeVersioningScheme() { |
