Skip to content

Commit

Permalink
Qt: Remove Apperance/Update settings from Game Properties
Browse files Browse the repository at this point in the history
  • Loading branch information
stenzek committed Jan 7, 2025
1 parent 092e819 commit 6318223
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 30 deletions.
74 changes: 51 additions & 23 deletions src/duckstation-qt/interfacesettingswidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,20 @@ InterfaceSettingsWidget::InterfaceSettingsWidget(SettingsWindow* dialog, QWidget
connect(m_ui.renderToSeparateWindow, &QCheckBox::checkStateChanged, this,
&InterfaceSettingsWidget::onRenderToSeparateWindowChanged);

SettingWidgetBinder::BindWidgetToEnumSetting(sif, m_ui.theme, "UI", "Theme", THEME_NAMES, THEME_VALUES,
QtHost::GetDefaultThemeName(), "MainWindow");
connect(m_ui.theme, QOverload<int>::of(&QComboBox::currentIndexChanged), [this]() { emit themeChanged(); });
if (!m_dialog->isPerGameSettings())
{
SettingWidgetBinder::BindWidgetToEnumSetting(sif, m_ui.theme, "UI", "Theme", THEME_NAMES, THEME_VALUES,
QtHost::GetDefaultThemeName(), "MainWindow");
connect(m_ui.theme, QOverload<int>::of(&QComboBox::currentIndexChanged), [this]() { emit themeChanged(); });

populateLanguageDropdown(m_ui.language);
SettingWidgetBinder::BindWidgetToStringSetting(sif, m_ui.language, "Main", "Language",
QtHost::GetDefaultLanguage());
connect(m_ui.language, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
&InterfaceSettingsWidget::onLanguageChanged);

populateLanguageDropdown(m_ui.language);
SettingWidgetBinder::BindWidgetToStringSetting(sif, m_ui.language, "Main", "Language", QtHost::GetDefaultLanguage());
connect(m_ui.language, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
&InterfaceSettingsWidget::onLanguageChanged);
m_ui.autoUpdateCurrentVersion->setText(tr("%1 (%2)").arg(g_scm_tag_str).arg(g_scm_date_str));
}

onRenderToSeparateWindowChanged();

Expand Down Expand Up @@ -114,27 +120,49 @@ InterfaceSettingsWidget::InterfaceSettingsWidget(SettingsWindow* dialog, QWidget
dialog->registerWidgetHelp(m_ui.enableDiscordPresence, tr("Enable Discord Presence"), tr("Unchecked"),
tr("Shows the game you are currently playing as part of your profile in Discord."));

dialog->registerWidgetHelp(m_ui.autoUpdateEnabled, tr("Enable Automatic Update Check"), tr("Checked"),
tr("Automatically checks for updates to the program on startup. Updates can be deferred "
"until later or skipped entirely."));

m_ui.autoUpdateCurrentVersion->setText(tr("%1 (%2)").arg(g_scm_tag_str).arg(g_scm_date_str));
if (!m_dialog->isPerGameSettings())
{
dialog->registerWidgetHelp(m_ui.autoUpdateEnabled, tr("Enable Automatic Update Check"), tr("Checked"),
tr("Automatically checks for updates to the program on startup. Updates can be deferred "
"until later or skipped entirely."));
}

if (!m_dialog->isPerGameSettings() && AutoUpdaterDialog::isSupported())
if (!m_dialog->isPerGameSettings())
{
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.autoUpdateEnabled, "AutoUpdater", "CheckAtStartup", true);
m_ui.autoUpdateTag->addItems(AutoUpdaterDialog::getTagList());
SettingWidgetBinder::BindWidgetToStringSetting(sif, m_ui.autoUpdateTag, "AutoUpdater", "UpdateTag",
AutoUpdaterDialog::getDefaultTag());
connect(m_ui.checkForUpdates, &QPushButton::clicked, this, []() { g_main_window->checkForUpdates(true); });
if (AutoUpdaterDialog::isSupported())
{
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.autoUpdateEnabled, "AutoUpdater", "CheckAtStartup", true);
m_ui.autoUpdateTag->addItems(AutoUpdaterDialog::getTagList());
SettingWidgetBinder::BindWidgetToStringSetting(sif, m_ui.autoUpdateTag, "AutoUpdater", "UpdateTag",
AutoUpdaterDialog::getDefaultTag());
connect(m_ui.checkForUpdates, &QPushButton::clicked, this, []() { g_main_window->checkForUpdates(true); });
}
else
{
m_ui.autoUpdateTag->addItem(tr("Unavailable"));
m_ui.autoUpdateEnabled->setEnabled(false);
m_ui.autoUpdateTag->setEnabled(false);
m_ui.checkForUpdates->setEnabled(false);
m_ui.updatesGroup->setEnabled(false);
}
}
else
{
m_ui.autoUpdateTag->addItem(tr("Unavailable"));
m_ui.autoUpdateEnabled->setEnabled(false);
m_ui.autoUpdateTag->setEnabled(false);
m_ui.checkForUpdates->setEnabled(false);
m_ui.updatesGroup->setEnabled(false);
delete m_ui.appearanceGroup;
m_ui.appearanceGroup = nullptr;
m_ui.languageLabel = nullptr;
m_ui.language = nullptr;
m_ui.themeLabel = nullptr;
m_ui.theme = nullptr;

delete m_ui.updatesGroup;
m_ui.autoUpdateTagLabel = nullptr;
m_ui.autoUpdateTag = nullptr;
m_ui.autoUpdateCurrentVersionLabel = nullptr;
m_ui.autoUpdateCurrentVersion = nullptr;
m_ui.autoUpdateCheckLayout = nullptr;
m_ui.autoUpdateEnabled = nullptr;
m_ui.checkForUpdates = nullptr;
}
}

Expand Down
14 changes: 7 additions & 7 deletions src/duckstation-qt/interfacesettingswidget.ui
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<number>0</number>
</property>
<item>
<widget class="QGroupBox" name="groupBox_4">
<widget class="QGroupBox" name="behaviorGroup">
<property name="title">
<string>Behaviour</string>
</property>
Expand Down Expand Up @@ -89,7 +89,7 @@
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<widget class="QGroupBox" name="gameDisplayGroup">
<property name="title">
<string>Game Display</string>
</property>
Expand Down Expand Up @@ -149,14 +149,14 @@
<widget class="QComboBox" name="theme"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<widget class="QLabel" name="languageLabel">
<property name="text">
<string>Language:</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_2">
<widget class="QLabel" name="themeLabel">
<property name="text">
<string>Theme:</string>
</property>
Expand All @@ -175,7 +175,7 @@
</property>
<layout class="QFormLayout" name="formLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<widget class="QLabel" name="autoUpdateTagLabel">
<property name="text">
<string>Update Channel:</string>
</property>
Expand All @@ -185,7 +185,7 @@
<widget class="QComboBox" name="autoUpdateTag"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_5">
<widget class="QLabel" name="autoUpdateCurrentVersionLabel">
<property name="text">
<string>Current Version:</string>
</property>
Expand All @@ -199,7 +199,7 @@
</widget>
</item>
<item row="2" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<layout class="QHBoxLayout" name="autoUpdateCheckLayout">
<item>
<widget class="QCheckBox" name="autoUpdateEnabled">
<property name="text">
Expand Down

0 comments on commit 6318223

Please sign in to comment.