Qt updater integration, based on QtAutoUpdater

This commit is contained in:
James Rowe 2017-08-18 23:05:49 -06:00
parent ee5aecee3f
commit 2e6c80d1aa
11 changed files with 651 additions and 28 deletions

View file

@ -157,6 +157,12 @@ void Config::ReadValues() {
qt_config->beginGroup("UI");
UISettings::values.theme = qt_config->value("theme", UISettings::themes[0].second).toString();
qt_config->beginGroup("Updater");
UISettings::values.check_for_update_on_start =
qt_config->value("check_for_update_on_start", true).toBool();
UISettings::values.update_on_close = qt_config->value("update_on_close", false).toBool();
qt_config->endGroup();
qt_config->beginGroup("UILayout");
UISettings::values.geometry = qt_config->value("geometry").toByteArray();
UISettings::values.state = qt_config->value("state").toByteArray();
@ -307,6 +313,11 @@ void Config::SaveValues() {
qt_config->beginGroup("UI");
qt_config->setValue("theme", UISettings::values.theme);
qt_config->beginGroup("Updater");
qt_config->setValue("check_for_update_on_start", UISettings::values.check_for_update_on_start);
qt_config->setValue("update_on_close", UISettings::values.update_on_close);
qt_config->endGroup();
qt_config->beginGroup("UILayout");
qt_config->setValue("geometry", UISettings::values.geometry);
qt_config->setValue("state", UISettings::values.state);

View file

@ -20,6 +20,7 @@ ConfigureGeneral::ConfigureGeneral(QWidget* parent)
this->setConfiguration();
ui->toggle_cpu_jit->setEnabled(!Core::System::GetInstance().IsPoweredOn());
ui->updateBox->setVisible(UISettings::values.updater_found);
}
ConfigureGeneral::~ConfigureGeneral() {}
@ -29,6 +30,9 @@ void ConfigureGeneral::setConfiguration() {
ui->toggle_check_exit->setChecked(UISettings::values.confirm_before_closing);
ui->toggle_cpu_jit->setChecked(Settings::values.use_cpu_jit);
ui->toggle_update_check->setChecked(UISettings::values.check_for_update_on_start);
ui->toggle_auto_update->setChecked(UISettings::values.update_on_close);
// The first item is "auto-select" with actual value -1, so plus one here will do the trick
ui->region_combobox->setCurrentIndex(Settings::values.region_value + 1);
@ -40,6 +44,10 @@ void ConfigureGeneral::applyConfiguration() {
UISettings::values.confirm_before_closing = ui->toggle_check_exit->isChecked();
UISettings::values.theme =
ui->theme_combobox->itemData(ui->theme_combobox->currentIndex()).toString();
UISettings::values.check_for_update_on_start = ui->toggle_update_check->isChecked();
UISettings::values.update_on_close = ui->toggle_auto_update->isChecked();
Settings::values.region_value = ui->region_combobox->currentIndex() - 1;
Settings::values.use_cpu_jit = ui->toggle_cpu_jit->isChecked();
Settings::Apply();

View file

@ -25,16 +25,16 @@
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QCheckBox" name="toggle_deepscan">
<widget class="QCheckBox" name="toggle_check_exit">
<property name="text">
<string>Search sub-directories for games</string>
<string>Confirm exit while emulation is running</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="toggle_check_exit">
<widget class="QCheckBox" name="toggle_deepscan">
<property name="text">
<string>Confirm exit while emulation is running</string>
<string>Search sub-directories for games</string>
</property>
</widget>
</item>
@ -44,24 +44,51 @@
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Performance</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QCheckBox" name="toggle_cpu_jit">
<property name="text">
<string>Enable CPU JIT</string>
</property>
</widget>
</item>
</layout>
</item>
<widget class="QGroupBox" name="updateBox">
<property name="title">
<string>Updates</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_update">
<item>
<layout class="QVBoxLayout" name="verticalLayout_update">
<item>
<widget class="QCheckBox" name="toggle_update_check">
<property name="text">
<string>Check for updates on start</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="toggle_auto_update">
<property name="text">
<string>Silently auto update after closing</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Performance</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QCheckBox" name="toggle_cpu_jit">
<property name="text">
<string>Enable CPU JIT</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_4">
@ -149,8 +176,7 @@
</widget>
</item>
<item>
<widget class="QComboBox" name="theme_combobox">
</widget>
<widget class="QComboBox" name="theme_combobox"/>
</item>
</layout>
</item>