diff options
| author | Silarn <jrim@rimpo.org> | 2019-07-22 01:00:42 -0500 |
|---|---|---|
| committer | Silarn <jrim@rimpo.org> | 2019-07-22 01:00:42 -0500 |
| commit | dcd6d624672019727d7effd17aac86f72bff438b (patch) | |
| tree | 1e8d3856f657d898c5992631599cf272d785f973 /src/modinfo.cpp | |
| parent | 179a73857125ee604f42b0d5c2d765183c86d2c7 (diff) | |
| parent | e73c309f08eff98f0dbd2590f594a83b67431eac (diff) | |
Merge branch 'Develop'
Diffstat (limited to 'src/modinfo.cpp')
| -rw-r--r-- | src/modinfo.cpp | 37 |
1 files changed, 30 insertions, 7 deletions
diff --git a/src/modinfo.cpp b/src/modinfo.cpp index c1974152..3484b644 100644 --- a/src/modinfo.cpp +++ b/src/modinfo.cpp @@ -310,23 +310,27 @@ bool ModInfo::checkAllForUpdate(PluginContainer *pluginContainer, QObject *recei } } - if (latest < QDateTime::currentDateTimeUtc().addDays(-30)) { + if (latest < QDateTime::currentDateTimeUtc().addMonths(-1)) { std::set<std::pair<QString, int>> organizedGames; for (auto mod : s_Collection) { - if (mod->canBeUpdated()) { + if (mod->canBeUpdated() && mod->getLastNexusUpdate() < QDateTime::currentDateTimeUtc().addMonths(-1)) { organizedGames.insert(std::make_pair<QString, int>(mod->getGameName().toLower(), mod->getNexusID())); } } if (organizedGames.empty()) { - qWarning("All of your mods have been checked recently. We restrict update checks to help preserve your available API requests."); + qWarning() << tr("All of your mods have been checked recently. We restrict update checks to help preserve your available API requests."); updatesAvailable = false; + } else { + qInfo() << tr( + "You have mods that haven't been checked within the last month using the new API. These mods must be checked before we can use the bulk update API. " + "This will consume significantly more API requests than usual. You will need to rerun the update check once complete in order to parse the remaining mods." + ); } - for (auto game : organizedGames) { + for (auto game : organizedGames) NexusInterface::instance(pluginContainer)->requestUpdates(game.second, receiver, QVariant(), game.first, QString()); - } - } else if (earliest < QDateTime::currentDateTimeUtc().addDays(-30)) { + } else if (earliest < QDateTime::currentDateTimeUtc().addMonths(-1)) { for (auto gameName : games) NexusInterface::instance(pluginContainer)->requestUpdateInfo(gameName, NexusInterface::UpdatePeriod::MONTH, receiver, QVariant(true), QString()); } else if (earliest < QDateTime::currentDateTimeUtc().addDays(-7)) { @@ -358,7 +362,7 @@ std::set<QSharedPointer<ModInfo>> ModInfo::filteredMods(QString gameName, QVaria if (addOldMods) for (auto mod : s_Collection) - if (mod->getLastNexusUpdate() < QDateTime::currentDateTimeUtc().addDays(-30) && mod->getGameName().compare(gameName, Qt::CaseInsensitive) == 0) + if (mod->getLastNexusUpdate() < QDateTime::currentDateTimeUtc().addMonths(-1) && mod->getGameName().compare(gameName, Qt::CaseInsensitive) == 0) finalMods.insert(mod); if (markUpdated) { @@ -516,3 +520,22 @@ void ModInfo::testValid() dirIter.next(); } } + +QUrl ModInfo::parseCustomURL() const +{ + if (!hasCustomURL() || getCustomURL().isEmpty()) { + return {}; + } + + const auto url = QUrl::fromUserInput(getCustomURL()); + + if (!url.isValid()) { + qCritical() + << "mod '" << name() << "' has an invalid custom url " + << "'" << getCustomURL() << "'"; + + return {}; + } + + return url; +} |
