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.
This commit is contained in:
@ -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();
|
||||
|
Reference in New Issue
Block a user