summaryrefslogtreecommitdiffstats
path: root/logic/updater/UpdateChecker.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2015-01-31 16:59:03 +0100
committerPetr Mrázek <peterix@gmail.com>2015-04-02 11:30:24 +0200
commit6f3aa65bd69f5155fa1ee56dee840e2e7e1d3c6f (patch)
tree28aaf76918d1ff0ffe2a437573bb1ab7a012c4ec /logic/updater/UpdateChecker.cpp
parente508728246043fcaf8bee565e73b15e15eb2e531 (diff)
downloadMultiMC-6f3aa65bd69f5155fa1ee56dee840e2e7e1d3c6f.tar
MultiMC-6f3aa65bd69f5155fa1ee56dee840e2e7e1d3c6f.tar.gz
MultiMC-6f3aa65bd69f5155fa1ee56dee840e2e7e1d3c6f.tar.lz
MultiMC-6f3aa65bd69f5155fa1ee56dee840e2e7e1d3c6f.tar.xz
MultiMC-6f3aa65bd69f5155fa1ee56dee840e2e7e1d3c6f.zip
NOISSUE Split MultiMC app object into MultiMC and Env
Diffstat (limited to 'logic/updater/UpdateChecker.cpp')
-rw-r--r--logic/updater/UpdateChecker.cpp20
1 files changed, 7 insertions, 13 deletions
diff --git a/logic/updater/UpdateChecker.cpp b/logic/updater/UpdateChecker.cpp
index c5cd2c2f..cd0b3c72 100644
--- a/logic/updater/UpdateChecker.cpp
+++ b/logic/updater/UpdateChecker.cpp
@@ -15,23 +15,19 @@
#include "UpdateChecker.h"
-#include "MultiMC.h"
-#include "BuildConfig.h"
-
#include "logger/QsLog.h"
#include <QJsonObject>
#include <QJsonArray>
#include <QJsonValue>
-#include "logic/settings/SettingsObject.h"
-
#define API_VERSION 0
#define CHANLIST_FORMAT 0
-UpdateChecker::UpdateChecker()
+UpdateChecker::UpdateChecker(QString channelListUrl, int currentBuild)
{
- m_channelListUrl = BuildConfig.CHANLIST_URL;
+ m_channelListUrl = channelListUrl;
+ m_currentBuild = currentBuild;
m_updateChecking = false;
m_chanListLoading = false;
m_checkUpdateWaiting = false;
@@ -48,7 +44,7 @@ bool UpdateChecker::hasChannels() const
return !m_channels.isEmpty();
}
-void UpdateChecker::checkForUpdate(bool notifyNoUpdate)
+void UpdateChecker::checkForUpdate(QString updateChannel, bool notifyNoUpdate)
{
QLOG_DEBUG() << "Checking for updates.";
@@ -59,6 +55,7 @@ void UpdateChecker::checkForUpdate(bool notifyNoUpdate)
QLOG_DEBUG() << "Channel list isn't loaded yet. Loading channel list and deferring "
"update check.";
m_checkUpdateWaiting = true;
+ m_deferredUpdateChannel = updateChannel;
updateChanList(notifyNoUpdate);
return;
}
@@ -71,9 +68,6 @@ void UpdateChecker::checkForUpdate(bool notifyNoUpdate)
m_updateChecking = true;
- // Get the channel we're checking.
- QString updateChannel = MMC->settings()->get("UpdateChannel").toString();
-
// Find the desired channel within the channel list and get its repo URL. If if cannot be
// found, error.
m_repoUrl = "";
@@ -149,7 +143,7 @@ void UpdateChecker::updateCheckFinished(bool notifyNoUpdate)
// We've got the version with the greatest ID number. Now compare it to our current build
// number and update if they're different.
int newBuildNumber = newestVersion.value("Id").toVariant().toInt();
- if (newBuildNumber != BuildConfig.VERSION_BUILD)
+ if (newBuildNumber != m_currentBuild)
{
QLOG_DEBUG() << "Found newer version with ID" << newBuildNumber;
// Update!
@@ -251,7 +245,7 @@ void UpdateChecker::chanListDownloadFinished(bool notifyNoUpdate)
// If we're waiting to check for updates, do that now.
if (m_checkUpdateWaiting)
- checkForUpdate(notifyNoUpdate);
+ checkForUpdate(m_deferredUpdateChannel, notifyNoUpdate);
emit channelListLoaded();
}