citra-qt: Add an "Alternative Speed Limit" with its hotkey (#5281)

* Change "Toggle Speed Limit" to toggle between 100% and a custom value

This will change the shortcut for "Toggle Speed Limit" to make it swap between 100% and the value of "Limit Speed Percent" in the config. Old functionality is still there, but renamed to "Unthrottle".

* Complete reimplementation of the function

* Fix something that didn't get saved correctly

* Fix missing indentation

* Rewrite to keep only a single QSpinBox

* Second rewrite

* set Unthrottled to 0 in the Qspinbox

* Hotkey for Unthrottle

* minor improvements to the design

* Apply suggestions from code review

Co-authored-by: Ben <bene_thomas@web.de>

* Default slider values

* clang-format fixes

* Prevent the speed slider from changing size

...when an element in its row has variable width.

* Change "Game Speed" to "Emulation Speed"

* Apply suggestions from code review

`game_speed` to` emulation_speed`

Co-authored-by: Valentin Vanelslande <vvanelslandedev@gmail.com>

* Fix for QSliders

* Revert "Prevent the speed slider from changing size"

This reverts commit ddaca2004484f1e024f49d2e6dc99ef5e261f64d.

* clang-format

...doesn't seem to stick to a choice

* Fix 2 for QSliders

Co-authored-by: B3n30 <benediktthomas@gmail.com>
Co-authored-by: Ben <bene_thomas@web.de>
Co-authored-by: Valentin Vanelslande <vvanelslandedev@gmail.com>
This commit is contained in:
SutandoTsukai181 2020-06-20 21:52:14 +03:00 committed by GitHub
parent 6d65319c85
commit 485d64ae73
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 259 additions and 61 deletions

View file

@ -78,7 +78,7 @@ const std::array<UISettings::Shortcut, 23> default_hotkeys{
{QStringLiteral("Toggle Filter Bar"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+F"), Qt::WindowShortcut}},
{QStringLiteral("Toggle Frame Advancing"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+A"), Qt::ApplicationShortcut}},
{QStringLiteral("Toggle Screen Layout"), QStringLiteral("Main Window"), {QStringLiteral("F10"), Qt::WindowShortcut}},
{QStringLiteral("Toggle Speed Limit"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+Z"), Qt::ApplicationShortcut}},
{QStringLiteral("Toggle Alternate Speed"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+Z"), Qt::ApplicationShortcut}},
{QStringLiteral("Toggle Status Bar"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+S"), Qt::WindowShortcut}},
{QStringLiteral("Toggle Texture Dumping"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+D"), Qt::ApplicationShortcut}}}};
// clang-format on
@ -483,9 +483,11 @@ void Config::ReadRendererValues() {
Settings::values.use_vsync_new = ReadSetting(QStringLiteral("use_vsync_new"), true).toBool();
Settings::values.resolution_factor =
static_cast<u16>(ReadSetting(QStringLiteral("resolution_factor"), 1).toInt());
Settings::values.use_frame_limit =
ReadSetting(QStringLiteral("use_frame_limit"), true).toBool();
Settings::values.frame_limit = ReadSetting(QStringLiteral("frame_limit"), 100).toInt();
Settings::values.use_frame_limit_alternate =
ReadSetting(QStringLiteral("use_frame_limit_alternate"), false).toBool();
Settings::values.frame_limit_alternate =
ReadSetting(QStringLiteral("frame_limit_alternate"), 200).toInt();
Settings::values.bg_red = ReadSetting(QStringLiteral("bg_red"), 0.0).toFloat();
Settings::values.bg_green = ReadSetting(QStringLiteral("bg_green"), 0.0).toFloat();
@ -983,8 +985,11 @@ void Config::SaveRendererValues() {
WriteSetting(QStringLiteral("use_shader_jit"), Settings::values.use_shader_jit, true);
WriteSetting(QStringLiteral("use_vsync_new"), Settings::values.use_vsync_new, true);
WriteSetting(QStringLiteral("resolution_factor"), Settings::values.resolution_factor, 1);
WriteSetting(QStringLiteral("use_frame_limit"), Settings::values.use_frame_limit, true);
WriteSetting(QStringLiteral("frame_limit"), Settings::values.frame_limit, 100);
WriteSetting(QStringLiteral("use_frame_limit_alternate"),
Settings::values.use_frame_limit_alternate, false);
WriteSetting(QStringLiteral("frame_limit_alternate"), Settings::values.frame_limit_alternate,
200);
// Cast to double because Qt's written float values are not human-readable
WriteSetting(QStringLiteral("bg_red"), (double)Settings::values.bg_red, 0.0);