diff options
| author | Silarn <jrim@rimpo.org> | 2019-01-29 01:35:13 -0600 |
|---|---|---|
| committer | Silarn <jrim@rimpo.org> | 2019-02-18 21:28:26 -0600 |
| commit | a305ea2270c02172973f365986f194652ad344ec (patch) | |
| tree | 8b38ca0c15f84c74dd218286520b72aa6ff250ec /src | |
| parent | 370e010a1adebf68efe5062c5d3a2ed8e048b654 (diff) | |
Translate nexus game name to short name to fix fetching updates
Diffstat (limited to 'src')
| -rw-r--r-- | src/mainwindow.cpp | 26 | ||||
| -rw-r--r-- | src/nexusinterface.cpp | 5 |
2 files changed, 23 insertions, 8 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 2f39bf7a..02720d44 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -5455,14 +5455,14 @@ void MainWindow::nxmUpdatesAvailable(QString gameName, int modID, QVariant userD bool foundUpdate = false; m_ModsToUpdate--; bool sameNexus = false; + QString gameNameReal; for (IPluginGame *game : m_PluginContainer.plugins<IPluginGame>()) { - if (game->gameShortName() == gameName) { - if (game->nexusGameID() == m_OrganizerCore.managedGame()->nexusGameID()) - sameNexus = true; + if (game->gameNexusName() == gameName) { + gameNameReal = game->gameShortName(); break; } } - std::vector<ModInfo::Ptr> modsList = ModInfo::getByModID(gameName, modID); + std::vector<ModInfo::Ptr> modsList = ModInfo::getByModID(gameNameReal, modID); // Not clear to me what this is accomplishing? //if (sameNexus) { // std::vector<ModInfo::Ptr> mainInfo = ModInfo::getByModID(m_OrganizerCore.managedGame()->gameShortName(), modID); @@ -5553,7 +5553,14 @@ void MainWindow::nxmUpdatesAvailable(QString gameName, int modID, QVariant userD void MainWindow::nxmDescriptionAvailable(QString gameName, int modID, QVariant userData, QVariant resultData, int requestID) { QVariantMap result = resultData.toMap(); - std::vector<ModInfo::Ptr> modsList = ModInfo::getByModID(gameName, modID); + QString gameNameReal; + for (IPluginGame *game : m_PluginContainer.plugins<IPluginGame>()) { + if (game->gameNexusName() == gameName) { + gameNameReal = game->gameShortName(); + break; + } + } + std::vector<ModInfo::Ptr> modsList = ModInfo::getByModID(gameNameReal, modID); for (auto mod : modsList) { mod->setNexusDescription(result["description"].toString()); mod->setNewestVersion(result["version"].toString()); @@ -5615,7 +5622,14 @@ void MainWindow::nxmRequestFailed(QString gameName, int modID, int, QVariant, in statusBar()->hide(); } if (error == QNetworkReply::ContentAccessDenied || error == QNetworkReply::ContentNotFoundError) { - std::vector<ModInfo::Ptr> modsList = ModInfo::getByModID(gameName, modID); + QString gameNameReal; + for (IPluginGame *game : m_PluginContainer.plugins<IPluginGame>()) { + if (game->gameNexusName() == gameName) { + gameNameReal = game->gameShortName(); + break; + } + } + std::vector<ModInfo::Ptr> modsList = ModInfo::getByModID(gameNameReal, modID); for (auto mod : modsList) { mod->setNexusID(-1); } diff --git a/src/nexusinterface.cpp b/src/nexusinterface.cpp index c149f987..1e50f0b2 100644 --- a/src/nexusinterface.cpp +++ b/src/nexusinterface.cpp @@ -157,7 +157,7 @@ NexusInterface::NexusInterface(PluginContainer *pluginContainer) connect(m_AccessManager, SIGNAL(requestNXMDownload(QString)), this, SLOT(downloadRequestedNXM(QString))); m_RetryTimer.setSingleShot(true); - m_RetryTimer.setInterval(1000); + m_RetryTimer.setInterval(2000); m_RetryTimer.callOnTimeout(this, &NexusInterface::nextRequest); } @@ -476,7 +476,8 @@ void NexusInterface::nextRequest() if (m_RemainingRequests <= 0) { qWarning() << tr("You've exceeded the Nexus API rate limit and requests are now being throttled."); - m_RetryTimer.start(); + if (!m_RetryTimer.isActive()) + m_RetryTimer.start(); return; } |
