yuzu: Move audio settings to audio section

This commit is contained in:
german77 2023-03-11 20:04:36 -06:00
parent e8af3f29d2
commit e090a1c6bd
6 changed files with 56 additions and 45 deletions

View file

@ -10,6 +10,7 @@
#include "ui_configure_audio.h" #include "ui_configure_audio.h"
#include "yuzu/configuration/configuration_shared.h" #include "yuzu/configuration/configuration_shared.h"
#include "yuzu/configuration/configure_audio.h" #include "yuzu/configuration/configure_audio.h"
#include "yuzu/uisettings.h"
ConfigureAudio::ConfigureAudio(const Core::System& system_, QWidget* parent) ConfigureAudio::ConfigureAudio(const Core::System& system_, QWidget* parent)
: QWidget(parent), ui(std::make_unique<Ui::ConfigureAudio>()), system{system_} { : QWidget(parent), ui(std::make_unique<Ui::ConfigureAudio>()), system{system_} {
@ -47,17 +48,22 @@ void ConfigureAudio::SetConfiguration() {
const auto volume_value = static_cast<int>(Settings::values.volume.GetValue()); const auto volume_value = static_cast<int>(Settings::values.volume.GetValue());
ui->volume_slider->setValue(volume_value); ui->volume_slider->setValue(volume_value);
ui->toggle_background_mute->setChecked(UISettings::values.mute_when_in_background.GetValue());
if (!Settings::IsConfiguringGlobal()) { if (!Settings::IsConfiguringGlobal()) {
if (Settings::values.volume.UsingGlobal()) { if (Settings::values.volume.UsingGlobal()) {
ui->volume_combo_box->setCurrentIndex(0); ui->volume_combo_box->setCurrentIndex(0);
ui->volume_slider->setEnabled(false); ui->volume_slider->setEnabled(false);
ui->combo_sound->setCurrentIndex(Settings::values.sound_index.GetValue());
} else { } else {
ui->volume_combo_box->setCurrentIndex(1); ui->volume_combo_box->setCurrentIndex(1);
ui->volume_slider->setEnabled(true); ui->volume_slider->setEnabled(true);
ConfigurationShared::SetPerGameSetting(ui->combo_sound, &Settings::values.sound_index);
} }
ConfigurationShared::SetHighlight(ui->volume_layout, ConfigurationShared::SetHighlight(ui->volume_layout,
!Settings::values.volume.UsingGlobal()); !Settings::values.volume.UsingGlobal());
ConfigurationShared::SetHighlight(ui->mode_label,
!Settings::values.sound_index.UsingGlobal());
} }
SetVolumeIndicatorText(ui->volume_slider->sliderPosition()); SetVolumeIndicatorText(ui->volume_slider->sliderPosition());
} }
@ -109,6 +115,8 @@ void ConfigureAudio::SetVolumeIndicatorText(int percentage) {
} }
void ConfigureAudio::ApplyConfiguration() { void ConfigureAudio::ApplyConfiguration() {
ConfigurationShared::ApplyPerGameSetting(&Settings::values.sound_index, ui->combo_sound);
if (Settings::IsConfiguringGlobal()) { if (Settings::IsConfiguringGlobal()) {
Settings::values.sink_id = Settings::values.sink_id =
ui->sink_combo_box->itemText(ui->sink_combo_box->currentIndex()).toStdString(); ui->sink_combo_box->itemText(ui->sink_combo_box->currentIndex()).toStdString();
@ -116,6 +124,7 @@ void ConfigureAudio::ApplyConfiguration() {
ui->output_combo_box->itemText(ui->output_combo_box->currentIndex()).toStdString()); ui->output_combo_box->itemText(ui->output_combo_box->currentIndex()).toStdString());
Settings::values.audio_input_device_id.SetValue( Settings::values.audio_input_device_id.SetValue(
ui->input_combo_box->itemText(ui->input_combo_box->currentIndex()).toStdString()); ui->input_combo_box->itemText(ui->input_combo_box->currentIndex()).toStdString());
UISettings::values.mute_when_in_background = ui->toggle_background_mute->isChecked();
// Guard if during game and set to game-specific value // Guard if during game and set to game-specific value
if (Settings::values.volume.UsingGlobal()) { if (Settings::values.volume.UsingGlobal()) {
@ -174,10 +183,14 @@ void ConfigureAudio::RetranslateUI() {
void ConfigureAudio::SetupPerGameUI() { void ConfigureAudio::SetupPerGameUI() {
if (Settings::IsConfiguringGlobal()) { if (Settings::IsConfiguringGlobal()) {
ui->volume_slider->setEnabled(Settings::values.volume.UsingGlobal()); ui->volume_slider->setEnabled(Settings::values.volume.UsingGlobal());
// ui->combo_sound->setEnabled(Settings::values.sound_index.UsingGlobal());
return; return;
} }
// ConfigurationShared::SetColoredComboBox(ui->combo_sound, ui->label_sound,
// Settings::values.sound_index.GetValue(true));
connect(ui->volume_combo_box, qOverload<int>(&QComboBox::activated), this, [this](int index) { connect(ui->volume_combo_box, qOverload<int>(&QComboBox::activated), this, [this](int index) {
ui->volume_slider->setEnabled(index == 1); ui->volume_slider->setEnabled(index == 1);
ConfigurationShared::SetHighlight(ui->volume_layout, index == 1); ConfigurationShared::SetHighlight(ui->volume_layout, index == 1);

View file

@ -39,7 +39,7 @@
<item> <item>
<widget class="QLabel" name="output_label"> <widget class="QLabel" name="output_label">
<property name="text"> <property name="text">
<string>Output Device</string> <string>Output Device:</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -53,7 +53,7 @@
<item> <item>
<widget class="QLabel" name="input_label"> <widget class="QLabel" name="input_label">
<property name="text"> <property name="text">
<string>Input Device</string> <string>Input Device:</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -61,6 +61,36 @@
<widget class="QComboBox" name="input_combo_box"/> <widget class="QComboBox" name="input_combo_box"/>
</item> </item>
</layout> </layout>
</item>
<item>
<layout class="QHBoxLayout" name="mode_layout">
<item>
<widget class="QLabel" name="mode_label">
<property name="text">
<string>Sound Ouput Mode:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="combo_sound">
<item>
<property name="text">
<string>Mono</string>
</property>
</item>
<item>
<property name="text">
<string>Stereo</string>
</property>
</item>
<item>
<property name="text">
<string>Surround</string>
</property>
</item>
</widget>
</item>
</layout>
</item> </item>
<item> <item>
<widget class="QWidget" name="volume_layout" native="true"> <widget class="QWidget" name="volume_layout" native="true">
@ -149,6 +179,17 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<layout class="QHBoxLayout" name="mute_layout">
<item>
<widget class="QCheckBox" name="toggle_background_mute">
<property name="text">
<string>Mute audio when in background</string>
</property>
</widget>
</item>
</layout>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>

View file

@ -42,7 +42,6 @@ void ConfigureGeneral::SetConfiguration() {
ui->toggle_check_exit->setChecked(UISettings::values.confirm_before_closing.GetValue()); ui->toggle_check_exit->setChecked(UISettings::values.confirm_before_closing.GetValue());
ui->toggle_user_on_boot->setChecked(UISettings::values.select_user_on_boot.GetValue()); ui->toggle_user_on_boot->setChecked(UISettings::values.select_user_on_boot.GetValue());
ui->toggle_background_pause->setChecked(UISettings::values.pause_when_in_background.GetValue()); ui->toggle_background_pause->setChecked(UISettings::values.pause_when_in_background.GetValue());
ui->toggle_background_mute->setChecked(UISettings::values.mute_when_in_background.GetValue());
ui->toggle_hide_mouse->setChecked(UISettings::values.hide_mouse.GetValue()); ui->toggle_hide_mouse->setChecked(UISettings::values.hide_mouse.GetValue());
ui->toggle_speed_limit->setChecked(Settings::values.use_speed_limit.GetValue()); ui->toggle_speed_limit->setChecked(Settings::values.use_speed_limit.GetValue());
@ -88,7 +87,6 @@ void ConfigureGeneral::ApplyConfiguration() {
UISettings::values.confirm_before_closing = ui->toggle_check_exit->isChecked(); UISettings::values.confirm_before_closing = ui->toggle_check_exit->isChecked();
UISettings::values.select_user_on_boot = ui->toggle_user_on_boot->isChecked(); UISettings::values.select_user_on_boot = ui->toggle_user_on_boot->isChecked();
UISettings::values.pause_when_in_background = ui->toggle_background_pause->isChecked(); UISettings::values.pause_when_in_background = ui->toggle_background_pause->isChecked();
UISettings::values.mute_when_in_background = ui->toggle_background_mute->isChecked();
UISettings::values.hide_mouse = ui->toggle_hide_mouse->isChecked(); UISettings::values.hide_mouse = ui->toggle_hide_mouse->isChecked();
// Guard if during game and set to game-specific value // Guard if during game and set to game-specific value

View file

@ -89,13 +89,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QCheckBox" name="toggle_background_mute">
<property name="text">
<string>Mute audio when in background</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QCheckBox" name="toggle_hide_mouse"> <widget class="QCheckBox" name="toggle_hide_mouse">
<property name="text"> <property name="text">

View file

@ -116,14 +116,12 @@ void ConfigureSystem::SetConfiguration() {
ui->combo_language->setCurrentIndex(Settings::values.language_index.GetValue()); ui->combo_language->setCurrentIndex(Settings::values.language_index.GetValue());
ui->combo_region->setCurrentIndex(Settings::values.region_index.GetValue()); ui->combo_region->setCurrentIndex(Settings::values.region_index.GetValue());
ui->combo_time_zone->setCurrentIndex(Settings::values.time_zone_index.GetValue()); ui->combo_time_zone->setCurrentIndex(Settings::values.time_zone_index.GetValue());
ui->combo_sound->setCurrentIndex(Settings::values.sound_index.GetValue());
} else { } else {
ConfigurationShared::SetPerGameSetting(ui->combo_language, ConfigurationShared::SetPerGameSetting(ui->combo_language,
&Settings::values.language_index); &Settings::values.language_index);
ConfigurationShared::SetPerGameSetting(ui->combo_region, &Settings::values.region_index); ConfigurationShared::SetPerGameSetting(ui->combo_region, &Settings::values.region_index);
ConfigurationShared::SetPerGameSetting(ui->combo_time_zone, ConfigurationShared::SetPerGameSetting(ui->combo_time_zone,
&Settings::values.time_zone_index); &Settings::values.time_zone_index);
ConfigurationShared::SetPerGameSetting(ui->combo_sound, &Settings::values.sound_index);
ConfigurationShared::SetHighlight(ui->label_language, ConfigurationShared::SetHighlight(ui->label_language,
!Settings::values.language_index.UsingGlobal()); !Settings::values.language_index.UsingGlobal());
@ -131,8 +129,6 @@ void ConfigureSystem::SetConfiguration() {
!Settings::values.region_index.UsingGlobal()); !Settings::values.region_index.UsingGlobal());
ConfigurationShared::SetHighlight(ui->label_timezone, ConfigurationShared::SetHighlight(ui->label_timezone,
!Settings::values.time_zone_index.UsingGlobal()); !Settings::values.time_zone_index.UsingGlobal());
ConfigurationShared::SetHighlight(ui->label_sound,
!Settings::values.sound_index.UsingGlobal());
} }
} }
@ -164,7 +160,6 @@ void ConfigureSystem::ApplyConfiguration() {
ConfigurationShared::ApplyPerGameSetting(&Settings::values.region_index, ui->combo_region); ConfigurationShared::ApplyPerGameSetting(&Settings::values.region_index, ui->combo_region);
ConfigurationShared::ApplyPerGameSetting(&Settings::values.time_zone_index, ConfigurationShared::ApplyPerGameSetting(&Settings::values.time_zone_index,
ui->combo_time_zone); ui->combo_time_zone);
ConfigurationShared::ApplyPerGameSetting(&Settings::values.sound_index, ui->combo_sound);
if (Settings::IsConfiguringGlobal()) { if (Settings::IsConfiguringGlobal()) {
// Guard if during game and set to game-specific value // Guard if during game and set to game-specific value
@ -202,7 +197,6 @@ void ConfigureSystem::SetupPerGameUI() {
ui->combo_language->setEnabled(Settings::values.language_index.UsingGlobal()); ui->combo_language->setEnabled(Settings::values.language_index.UsingGlobal());
ui->combo_region->setEnabled(Settings::values.region_index.UsingGlobal()); ui->combo_region->setEnabled(Settings::values.region_index.UsingGlobal());
ui->combo_time_zone->setEnabled(Settings::values.time_zone_index.UsingGlobal()); ui->combo_time_zone->setEnabled(Settings::values.time_zone_index.UsingGlobal());
ui->combo_sound->setEnabled(Settings::values.sound_index.UsingGlobal());
ui->rng_seed_checkbox->setEnabled(Settings::values.rng_seed.UsingGlobal()); ui->rng_seed_checkbox->setEnabled(Settings::values.rng_seed.UsingGlobal());
ui->rng_seed_edit->setEnabled(Settings::values.rng_seed.UsingGlobal()); ui->rng_seed_edit->setEnabled(Settings::values.rng_seed.UsingGlobal());
@ -215,8 +209,6 @@ void ConfigureSystem::SetupPerGameUI() {
Settings::values.region_index.GetValue(true)); Settings::values.region_index.GetValue(true));
ConfigurationShared::SetColoredComboBox(ui->combo_time_zone, ui->label_timezone, ConfigurationShared::SetColoredComboBox(ui->combo_time_zone, ui->label_timezone,
Settings::values.time_zone_index.GetValue(true)); Settings::values.time_zone_index.GetValue(true));
ConfigurationShared::SetColoredComboBox(ui->combo_sound, ui->label_sound,
Settings::values.sound_index.GetValue(true));
ConfigurationShared::SetColoredTristate( ConfigurationShared::SetColoredTristate(
ui->rng_seed_checkbox, Settings::values.rng_seed.UsingGlobal(), ui->rng_seed_checkbox, Settings::values.rng_seed.UsingGlobal(),

View file

@ -439,32 +439,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="1">
<widget class="QComboBox" name="combo_sound">
<item>
<property name="text">
<string>Mono</string>
</property>
</item>
<item>
<property name="text">
<string>Stereo</string>
</property>
</item>
<item>
<property name="text">
<string>Surround</string>
</property>
</item>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_sound">
<property name="text">
<string>Sound output mode</string>
</property>
</widget>
</item>
<item row="4" column="1"> <item row="4" column="1">
<widget class="QDateTimeEdit" name="custom_rtc_edit"> <widget class="QDateTimeEdit" name="custom_rtc_edit">
<property name="minimumDate"> <property name="minimumDate">