From c3ff652ff8c612054fa102234677c74fcd19a51c Mon Sep 17 00:00:00 2001 From: LostDragonist Date: Fri, 22 Mar 2019 17:33:10 -0500 Subject: Only change to the update filter if mods are being checked for update or mods have updates available --- src/modinfo.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src/modinfo.cpp') diff --git a/src/modinfo.cpp b/src/modinfo.cpp index 0afd92e6..28e9b8f2 100644 --- a/src/modinfo.cpp +++ b/src/modinfo.cpp @@ -166,6 +166,14 @@ std::vector ModInfo::getByModID(QString game, int modID) } +ModInfo::Ptr ModInfo::getByName(const QString &name) +{ + QMutexLocker locker(&s_Mutex); + + return s_Collection[ModInfo::getIndex(name)]; +} + + bool ModInfo::removeMod(unsigned int index) { QMutexLocker locker(&s_Mutex); @@ -285,8 +293,10 @@ ModInfo::ModInfo(PluginContainer *pluginContainer) } -void ModInfo::checkAllForUpdate(PluginContainer *pluginContainer, QObject *receiver) +bool ModInfo::checkAllForUpdate(PluginContainer *pluginContainer, QObject *receiver) { + bool updatesAvailable = true; + QDateTime earliest = QDateTime::currentDateTimeUtc(); QDateTime latest; std::set games; @@ -308,8 +318,10 @@ void ModInfo::checkAllForUpdate(PluginContainer *pluginContainer, QObject *recei } } - if (organizedGames.empty()) + if (organizedGames.empty()) { qWarning("All of your mods have been checked recently. We restrict update checks to help preserve your available API requests."); + updatesAvailable = false; + } for (auto game : organizedGames) { NexusInterface::instance(pluginContainer)->requestUpdates(game.second, receiver, QVariant(), game.first, QString()); @@ -327,6 +339,8 @@ void ModInfo::checkAllForUpdate(PluginContainer *pluginContainer, QObject *recei for (auto gameName : games) NexusInterface::instance(pluginContainer)->requestUpdateInfo(gameName, NexusInterface::UpdatePeriod::DAY, receiver, QVariant(false), QString()); } + + return updatesAvailable; } std::set> ModInfo::filteredMods(QString gameName, QVariantList updateData, bool addOldMods, bool markUpdated) -- cgit v1.3.1