diff options
| author | 2020-07-13 19:30:11 -0400 | |
|---|---|---|
| committer | 2020-07-19 13:26:55 -0400 | |
| commit | bf25d583c6279aa425ed3211e1bffd67a5e7646d (patch) | |
| tree | 4fcba1f8d1bb1df29e9ca3f392ae43b3f9fd24b4 /src | |
| parent | configuration_shared: Require name of the widget for highlighting (diff) | |
| download | yuzu-bf25d583c6279aa425ed3211e1bffd67a5e7646d.tar.gz yuzu-bf25d583c6279aa425ed3211e1bffd67a5e7646d.tar.xz yuzu-bf25d583c6279aa425ed3211e1bffd67a5e7646d.zip | |
configure_audio: Implement highlighted overrides
Diffstat (limited to 'src')
| -rw-r--r-- | src/yuzu/configuration/configure_audio.cpp | 25 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_audio.ui | 142 |
2 files changed, 87 insertions, 80 deletions
diff --git a/src/yuzu/configuration/configure_audio.cpp b/src/yuzu/configuration/configure_audio.cpp index cc021beec..2418ca005 100644 --- a/src/yuzu/configuration/configure_audio.cpp +++ b/src/yuzu/configuration/configure_audio.cpp | |||
| @@ -49,12 +49,9 @@ void ConfigureAudio::SetConfiguration() { | |||
| 49 | 49 | ||
| 50 | ui->volume_slider->setValue(Settings::values.volume.GetValue() * ui->volume_slider->maximum()); | 50 | ui->volume_slider->setValue(Settings::values.volume.GetValue() * ui->volume_slider->maximum()); |
| 51 | 51 | ||
| 52 | if (Settings::configuring_global) { | 52 | ui->toggle_audio_stretching->setChecked(Settings::values.enable_audio_stretching.GetValue()); |
| 53 | ui->toggle_audio_stretching->setChecked( | 53 | |
| 54 | Settings::values.enable_audio_stretching.GetValue()); | 54 | if (!Settings::configuring_global) { |
| 55 | } else { | ||
| 56 | ConfigurationShared::SetPerGameSetting(ui->toggle_audio_stretching, | ||
| 57 | &Settings::values.enable_audio_stretching); | ||
| 58 | if (Settings::values.volume.UsingGlobal()) { | 55 | if (Settings::values.volume.UsingGlobal()) { |
| 59 | ui->volume_combo_box->setCurrentIndex(0); | 56 | ui->volume_combo_box->setCurrentIndex(0); |
| 60 | ui->volume_slider->setEnabled(false); | 57 | ui->volume_slider->setEnabled(false); |
| @@ -62,6 +59,8 @@ void ConfigureAudio::SetConfiguration() { | |||
| 62 | ui->volume_combo_box->setCurrentIndex(1); | 59 | ui->volume_combo_box->setCurrentIndex(1); |
| 63 | ui->volume_slider->setEnabled(true); | 60 | ui->volume_slider->setEnabled(true); |
| 64 | } | 61 | } |
| 62 | ConfigurationShared::SetHighlight(ui->volume_layout, "volume_layout", | ||
| 63 | !Settings::values.volume.UsingGlobal()); | ||
| 65 | } | 64 | } |
| 66 | SetVolumeIndicatorText(ui->volume_slider->sliderPosition()); | 65 | SetVolumeIndicatorText(ui->volume_slider->sliderPosition()); |
| 67 | } | 66 | } |
| @@ -119,8 +118,9 @@ void ConfigureAudio::ApplyConfiguration() { | |||
| 119 | ui->volume_slider->maximum()); | 118 | ui->volume_slider->maximum()); |
| 120 | } | 119 | } |
| 121 | } else { | 120 | } else { |
| 122 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.enable_audio_stretching, | 121 | ConfigurationShared::ApplyPerGameSetting( |
| 123 | ui->toggle_audio_stretching); | 122 | &Settings::values.enable_audio_stretching, ui->toggle_audio_stretching, |
| 123 | ConfigurationShared::trackers.enable_audio_stretching); | ||
| 124 | if (ui->volume_combo_box->currentIndex() == 0) { | 124 | if (ui->volume_combo_box->currentIndex() == 0) { |
| 125 | Settings::values.volume.SetGlobal(true); | 125 | Settings::values.volume.SetGlobal(true); |
| 126 | } else { | 126 | } else { |
| @@ -173,9 +173,14 @@ void ConfigureAudio::SetupPerGameUI() { | |||
| 173 | return; | 173 | return; |
| 174 | } | 174 | } |
| 175 | 175 | ||
| 176 | ui->toggle_audio_stretching->setTristate(true); | 176 | ConfigurationShared::SetColoredTristate(ui->toggle_audio_stretching, "toggle_audio_stretching", |
| 177 | Settings::values.enable_audio_stretching, | ||
| 178 | ConfigurationShared::trackers.enable_audio_stretching); | ||
| 177 | connect(ui->volume_combo_box, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), | 179 | connect(ui->volume_combo_box, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), |
| 178 | this, [this](int index) { ui->volume_slider->setEnabled(index == 1); }); | 180 | this, [this](int index) { |
| 181 | ui->volume_slider->setEnabled(index == 1); | ||
| 182 | ConfigurationShared::SetHighlight(ui->volume_layout, "volume_layout", index == 1); | ||
| 183 | }); | ||
| 179 | 184 | ||
| 180 | ui->output_sink_combo_box->setVisible(false); | 185 | ui->output_sink_combo_box->setVisible(false); |
| 181 | ui->output_sink_label->setVisible(false); | 186 | ui->output_sink_label->setVisible(false); |
diff --git a/src/yuzu/configuration/configure_audio.ui b/src/yuzu/configuration/configure_audio.ui index 862ccb988..3c1147935 100644 --- a/src/yuzu/configuration/configure_audio.ui +++ b/src/yuzu/configuration/configure_audio.ui | |||
| @@ -56,80 +56,82 @@ | |||
| 56 | </layout> | 56 | </layout> |
| 57 | </item> | 57 | </item> |
| 58 | <item> | 58 | <item> |
| 59 | <layout class="QHBoxLayout" name="horizontalLayout_2"> | 59 | <widget class="QWidget" name="volume_layout" native="true"> |
| 60 | <property name="topMargin"> | 60 | <layout class="QHBoxLayout" name="horizontalLayout_2"> |
| 61 | <number>0</number> | 61 | <property name="topMargin"> |
| 62 | </property> | 62 | <number>1</number> |
| 63 | <item> | 63 | </property> |
| 64 | <widget class="QComboBox" name="volume_combo_box"> | 64 | <item> |
| 65 | <item> | 65 | <widget class="QComboBox" name="volume_combo_box"> |
| 66 | <item> | ||
| 67 | <property name="text"> | ||
| 68 | <string>Use global volume</string> | ||
| 69 | </property> | ||
| 70 | </item> | ||
| 71 | <item> | ||
| 72 | <property name="text"> | ||
| 73 | <string>Set volume:</string> | ||
| 74 | </property> | ||
| 75 | </item> | ||
| 76 | </widget> | ||
| 77 | </item> | ||
| 78 | <item> | ||
| 79 | <widget class="QLabel" name="volume_label"> | ||
| 66 | <property name="text"> | 80 | <property name="text"> |
| 67 | <string>Use global volume</string> | 81 | <string>Volume:</string> |
| 82 | </property> | ||
| 83 | </widget> | ||
| 84 | </item> | ||
| 85 | <item> | ||
| 86 | <spacer name="horizontalSpacer"> | ||
| 87 | <property name="orientation"> | ||
| 88 | <enum>Qt::Horizontal</enum> | ||
| 89 | </property> | ||
| 90 | <property name="sizeHint" stdset="0"> | ||
| 91 | <size> | ||
| 92 | <width>30</width> | ||
| 93 | <height>20</height> | ||
| 94 | </size> | ||
| 95 | </property> | ||
| 96 | </spacer> | ||
| 97 | </item> | ||
| 98 | <item> | ||
| 99 | <widget class="QSlider" name="volume_slider"> | ||
| 100 | <property name="sizePolicy"> | ||
| 101 | <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> | ||
| 102 | <horstretch>0</horstretch> | ||
| 103 | <verstretch>0</verstretch> | ||
| 104 | </sizepolicy> | ||
| 105 | </property> | ||
| 106 | <property name="maximum"> | ||
| 107 | <number>100</number> | ||
| 108 | </property> | ||
| 109 | <property name="pageStep"> | ||
| 110 | <number>10</number> | ||
| 111 | </property> | ||
| 112 | <property name="orientation"> | ||
| 113 | <enum>Qt::Horizontal</enum> | ||
| 114 | </property> | ||
| 115 | </widget> | ||
| 116 | </item> | ||
| 117 | <item> | ||
| 118 | <widget class="QLabel" name="volume_indicator"> | ||
| 119 | <property name="minimumSize"> | ||
| 120 | <size> | ||
| 121 | <width>32</width> | ||
| 122 | <height>0</height> | ||
| 123 | </size> | ||
| 68 | </property> | 124 | </property> |
| 69 | </item> | ||
| 70 | <item> | ||
| 71 | <property name="text"> | 125 | <property name="text"> |
| 72 | <string>Set volume:</string> | 126 | <string>0 %</string> |
| 73 | </property> | 127 | </property> |
| 74 | </item> | 128 | <property name="alignment"> |
| 75 | </widget> | 129 | <set>Qt::AlignCenter</set> |
| 76 | </item> | 130 | </property> |
| 77 | <item> | 131 | </widget> |
| 78 | <widget class="QLabel" name="volume_label"> | 132 | </item> |
| 79 | <property name="text"> | 133 | </layout> |
| 80 | <string>Volume:</string> | 134 | </widget> |
| 81 | </property> | ||
| 82 | </widget> | ||
| 83 | </item> | ||
| 84 | <item> | ||
| 85 | <spacer name="horizontalSpacer"> | ||
| 86 | <property name="orientation"> | ||
| 87 | <enum>Qt::Horizontal</enum> | ||
| 88 | </property> | ||
| 89 | <property name="sizeHint" stdset="0"> | ||
| 90 | <size> | ||
| 91 | <width>30</width> | ||
| 92 | <height>20</height> | ||
| 93 | </size> | ||
| 94 | </property> | ||
| 95 | </spacer> | ||
| 96 | </item> | ||
| 97 | <item> | ||
| 98 | <widget class="QSlider" name="volume_slider"> | ||
| 99 | <property name="sizePolicy"> | ||
| 100 | <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> | ||
| 101 | <horstretch>0</horstretch> | ||
| 102 | <verstretch>0</verstretch> | ||
| 103 | </sizepolicy> | ||
| 104 | </property> | ||
| 105 | <property name="maximum"> | ||
| 106 | <number>100</number> | ||
| 107 | </property> | ||
| 108 | <property name="pageStep"> | ||
| 109 | <number>10</number> | ||
| 110 | </property> | ||
| 111 | <property name="orientation"> | ||
| 112 | <enum>Qt::Horizontal</enum> | ||
| 113 | </property> | ||
| 114 | </widget> | ||
| 115 | </item> | ||
| 116 | <item> | ||
| 117 | <widget class="QLabel" name="volume_indicator"> | ||
| 118 | <property name="minimumSize"> | ||
| 119 | <size> | ||
| 120 | <width>32</width> | ||
| 121 | <height>0</height> | ||
| 122 | </size> | ||
| 123 | </property> | ||
| 124 | <property name="text"> | ||
| 125 | <string>0 %</string> | ||
| 126 | </property> | ||
| 127 | <property name="alignment"> | ||
| 128 | <set>Qt::AlignCenter</set> | ||
| 129 | </property> | ||
| 130 | </widget> | ||
| 131 | </item> | ||
| 132 | </layout> | ||
| 133 | </item> | 135 | </item> |
| 134 | </layout> | 136 | </layout> |
| 135 | </widget> | 137 | </widget> |