aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui/pages/global/LauncherPage.cpp
diff options
context:
space:
mode:
authorKenneth Chew <kenneth.c0@protonmail.com>2022-04-25 19:33:17 -0400
committerKenneth Chew <kenneth.c0@protonmail.com>2022-05-19 15:16:37 -0400
commit05cd30ac06b67ebc594773fc7e7ccf110fc336a3 (patch)
tree0c477c542301b45c8c2436b7b92b0b00cf785098 /launcher/ui/pages/global/LauncherPage.cpp
parent34adcec6165662d6245a55ee0a75c36753061df2 (diff)
downloadPrismLauncher-05cd30ac06b67ebc594773fc7e7ccf110fc336a3.tar.gz
PrismLauncher-05cd30ac06b67ebc594773fc7e7ccf110fc336a3.tar.bz2
PrismLauncher-05cd30ac06b67ebc594773fc7e7ccf110fc336a3.zip
Refactor code, create abstract class `ExternalUpdater`
(Hopefully) this makes implementing updaters using external libraries easier on other platforms. To implement an updater on a new platform, create a new class that implements the pure virtual methods from `ExternalUpdater` and add code in the `UpdateChecker` initializer to initialize the new class.
Diffstat (limited to 'launcher/ui/pages/global/LauncherPage.cpp')
-rw-r--r--launcher/ui/pages/global/LauncherPage.cpp37
1 files changed, 27 insertions, 10 deletions
diff --git a/launcher/ui/pages/global/LauncherPage.cpp b/launcher/ui/pages/global/LauncherPage.cpp
index 51284a8e..b244b039 100644
--- a/launcher/ui/pages/global/LauncherPage.cpp
+++ b/launcher/ui/pages/global/LauncherPage.cpp
@@ -90,6 +90,13 @@ LauncherPage::LauncherPage(QWidget *parent) : QWidget(parent), ui(new Ui::Launch
{
APPLICATION->updateChecker()->updateChanList(false);
}
+
+ if (APPLICATION->updateChecker()->getExternalUpdater())
+ {
+ ui->updateChannelComboBox->setVisible(false);
+ ui->updateChannelDescLabel->setVisible(false);
+ ui->updateChannelLabel->setVisible(false);
+ }
}
else
{
@@ -261,11 +268,16 @@ void LauncherPage::applySettings()
auto s = APPLICATION->settings();
// Updates
-#ifdef Q_OS_MAC
- APPLICATION->updateChecker()->getSparkleUpdater()->setAutomaticallyChecksForUpdates(ui->autoUpdateCheckBox->isChecked());
-#else
- s->set("AutoUpdate", ui->autoUpdateCheckBox->isChecked());
-#endif
+ if (BuildConfig.UPDATER_ENABLED && APPLICATION->updateChecker()->getExternalUpdater())
+ {
+ APPLICATION->updateChecker()->getExternalUpdater()->setAutomaticallyChecksForUpdates(
+ ui->autoUpdateCheckBox->isChecked());
+ }
+ else
+ {
+ s->set("AutoUpdate", ui->autoUpdateCheckBox->isChecked());
+ }
+
s->set("UpdateChannel", m_currentUpdateChannel);
auto original = s->get("IconTheme").toString();
//FIXME: make generic
@@ -347,11 +359,16 @@ void LauncherPage::loadSettings()
{
auto s = APPLICATION->settings();
// Updates
-#ifdef Q_OS_MAC
- ui->autoUpdateCheckBox->setChecked(APPLICATION->updateChecker()->getSparkleUpdater()->getAutomaticallyChecksForUpdates());
-#else
- ui->autoUpdateCheckBox->setChecked(s->get("AutoUpdate").toBool());
-#endif
+ if (BuildConfig.UPDATER_ENABLED && APPLICATION->updateChecker()->getExternalUpdater())
+ {
+ ui->autoUpdateCheckBox->setChecked(
+ APPLICATION->updateChecker()->getExternalUpdater()->getAutomaticallyChecksForUpdates());
+ }
+ else
+ {
+ ui->autoUpdateCheckBox->setChecked(s->get("AutoUpdate").toBool());
+ }
+
m_currentUpdateChannel = s->get("UpdateChannel").toString();
//FIXME: make generic
auto theme = s->get("IconTheme").toString();