aboutsummaryrefslogtreecommitdiff
path: root/launcher/Application.cpp
diff options
context:
space:
mode:
authorSefa Eyeoglu <contact@scrumplex.net>2022-11-01 22:45:15 +0100
committerSefa Eyeoglu <contact@scrumplex.net>2022-11-21 16:18:05 +0100
commitfdbd8d9d2b2e04cd68fd800882309b40c05aba2c (patch)
tree431e1e556e97e1d5144cfa9cb4d429d677c50937 /launcher/Application.cpp
parent5cc91965d09070437af8c17113c5740401b127dd (diff)
downloadPrismLauncher-fdbd8d9d2b2e04cd68fd800882309b40c05aba2c.tar.gz
PrismLauncher-fdbd8d9d2b2e04cd68fd800882309b40c05aba2c.tar.bz2
PrismLauncher-fdbd8d9d2b2e04cd68fd800882309b40c05aba2c.zip
refactor: remove old updater
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
Diffstat (limited to 'launcher/Application.cpp')
-rw-r--r--launcher/Application.cpp68
1 files changed, 20 insertions, 48 deletions
diff --git a/launcher/Application.cpp b/launcher/Application.cpp
index ea8d2326..8fe5a8bf 100644
--- a/launcher/Application.cpp
+++ b/launcher/Application.cpp
@@ -104,7 +104,7 @@
#include "java/JavaUtils.h"
-#include "updater/UpdateChecker.h"
+#include "updater/ExternalUpdater.h"
#include "tools/JProfiler.h"
#include "tools/JVisualVM.h"
@@ -127,6 +127,10 @@
#include "gamemode_client.h"
#endif
+#ifdef Q_OS_MAC
+#include "updater/MacSparkleUpdater.h"
+#endif
+
#if defined Q_OS_WIN32
#ifndef WIN32_LEAN_AND_MEAN
@@ -162,45 +166,6 @@ void appDebugOutput(QtMsgType type, const QMessageLogContext &context, const QSt
fflush(stderr);
}
-QString getIdealPlatform(QString currentPlatform) {
- auto info = Sys::getKernelInfo();
- switch(info.kernelType) {
- case Sys::KernelType::Darwin: {
- if(info.kernelMajor >= 17) {
- // macOS 10.13 or newer
- return "osx64-5.15.2";
- }
- else {
- // macOS 10.12 or older
- return "osx64";
- }
- }
- case Sys::KernelType::Windows: {
- // FIXME: 5.15.2 is not stable on Windows, due to a large number of completely unpredictable and hard to reproduce issues
- break;
-/*
- if(info.kernelMajor == 6 && info.kernelMinor >= 1) {
- // Windows 7
- return "win32-5.15.2";
- }
- else if (info.kernelMajor > 6) {
- // Above Windows 7
- return "win32-5.15.2";
- }
- else {
- // Below Windows 7
- return "win32";
- }
-*/
- }
- case Sys::KernelType::Undetermined:
- case Sys::KernelType::Linux: {
- break;
- }
- }
- return currentPlatform;
-}
-
}
Application::Application(int &argc, char **argv) : QApplication(argc, argv)
@@ -490,10 +455,6 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
{
// Provide a fallback for migration from PolyMC
m_settings.reset(new INISettingsObject({ BuildConfig.LAUNCHER_CONFIGFILE, "polymc.cfg", "multimc.cfg" }, this));
- // Updates
- // Multiple channels are separated by spaces
- m_settings->registerSetting("UpdateChannel", BuildConfig.VERSION_CHANNEL);
- m_settings->registerSetting("AutoUpdate", true);
// Theming
m_settings->registerSetting("IconTheme", QString("pe_colored"));
@@ -724,10 +685,10 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
// initialize the updater
if(BuildConfig.UPDATER_ENABLED)
{
- auto platform = getIdealPlatform(BuildConfig.BUILD_PLATFORM);
- auto channelUrl = BuildConfig.UPDATER_BASE + platform + "/channels.json";
- qDebug() << "Initializing updater with platform: " << platform << " -- " << channelUrl;
- m_updateChecker.reset(new UpdateChecker(m_network, channelUrl, BuildConfig.VERSION_CHANNEL));
+ qDebug() << "Initializing updater";
+#ifdef Q_OS_MAC
+ m_updater.reset(new MacSparkleUpdater());
+#endif
qDebug() << "<> Updater started.";
}
@@ -1690,3 +1651,14 @@ bool Application::handleDataMigration(const QString& currentData,
}
return true;
}
+
+void Application::triggerUpdateCheck()
+{
+ if (m_updater) {
+ qDebug() << "Checking for updates.";
+ m_updater->setBetaAllowed(false); // There are no other channels than stable
+ m_updater->checkForUpdates();
+ } else {
+ qDebug() << "Updater not available.";
+ }
+}