diff options
| author | 2022-07-27 11:34:00 -0500 | |
|---|---|---|
| committer | 2022-07-27 11:34:46 -0500 | |
| commit | 2fdefd706409c9d1ce2a211bb142017c8eca6bc1 (patch) | |
| tree | 64d6ef3762fc7ff135664b00ae233e406daba945 /src | |
| parent | Merge pull request #8484 from german77/irs_release (diff) | |
| download | yuzu-2fdefd706409c9d1ce2a211bb142017c8eca6bc1.tar.gz yuzu-2fdefd706409c9d1ce2a211bb142017c8eca6bc1.tar.xz yuzu-2fdefd706409c9d1ce2a211bb142017c8eca6bc1.zip | |
yuzu: Add incremental steps to volume hotkeys
Diffstat (limited to 'src')
| -rw-r--r-- | src/yuzu/main.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 08ccc1555..609d68ab4 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -1050,12 +1050,26 @@ void GMainWindow::InitializeHotkeys() { | |||
| 1050 | [] { Settings::values.audio_muted = !Settings::values.audio_muted; }); | 1050 | [] { Settings::values.audio_muted = !Settings::values.audio_muted; }); |
| 1051 | connect_shortcut(QStringLiteral("Audio Volume Down"), [] { | 1051 | connect_shortcut(QStringLiteral("Audio Volume Down"), [] { |
| 1052 | const auto current_volume = static_cast<int>(Settings::values.volume.GetValue()); | 1052 | const auto current_volume = static_cast<int>(Settings::values.volume.GetValue()); |
| 1053 | const auto new_volume = std::max(current_volume - 5, 0); | 1053 | int step = 5; |
| 1054 | if (current_volume <= 30) { | ||
| 1055 | step = 2; | ||
| 1056 | } | ||
| 1057 | if (current_volume <= 6) { | ||
| 1058 | step = 1; | ||
| 1059 | } | ||
| 1060 | const auto new_volume = std::max(current_volume - step, 0); | ||
| 1054 | Settings::values.volume.SetValue(static_cast<u8>(new_volume)); | 1061 | Settings::values.volume.SetValue(static_cast<u8>(new_volume)); |
| 1055 | }); | 1062 | }); |
| 1056 | connect_shortcut(QStringLiteral("Audio Volume Up"), [] { | 1063 | connect_shortcut(QStringLiteral("Audio Volume Up"), [] { |
| 1057 | const auto current_volume = static_cast<int>(Settings::values.volume.GetValue()); | 1064 | const auto current_volume = static_cast<int>(Settings::values.volume.GetValue()); |
| 1058 | const auto new_volume = std::min(current_volume + 5, 100); | 1065 | int step = 5; |
| 1066 | if (current_volume < 30) { | ||
| 1067 | step = 2; | ||
| 1068 | } | ||
| 1069 | if (current_volume < 6) { | ||
| 1070 | step = 1; | ||
| 1071 | } | ||
| 1072 | const auto new_volume = std::min(current_volume + step, 100); | ||
| 1059 | Settings::values.volume.SetValue(static_cast<u8>(new_volume)); | 1073 | Settings::values.volume.SetValue(static_cast<u8>(new_volume)); |
| 1060 | }); | 1074 | }); |
| 1061 | connect_shortcut(QStringLiteral("Toggle Framerate Limit"), [] { | 1075 | connect_shortcut(QStringLiteral("Toggle Framerate Limit"), [] { |