From 1fa4460590ec0b10b6098ae84da865bf943bdccd Mon Sep 17 00:00:00 2001 From: ValadAmoleo <23036778+ValadAmoleo@users.noreply.github.com> Date: Wed, 12 May 2021 18:24:43 +0100 Subject: [PATCH] Added a toggle for persistent message. (#2106) * Added a toggle for persistent message. Added a toggle to display settings to disable persistent messages (ff, pause) in the fullscreen UI. * Moved toggle for the icons to advanced settings. Moved the toggle to the advanced settings as suggested. Renamed the option from "show persistent messages" to "show speed icons", so that it's much more specific. --- src/core/host_interface.cpp | 1 + src/core/settings.cpp | 2 ++ src/core/settings.h | 1 + src/duckstation-qt/advancedsettingswidget.cpp | 3 +++ src/duckstation-qt/advancedsettingswidget.ui | 7 +++++++ src/frontend-common/fullscreen_ui.cpp | 9 +++++++-- 6 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/core/host_interface.cpp b/src/core/host_interface.cpp index 8ffcf2880..81b53e2ea 100644 --- a/src/core/host_interface.cpp +++ b/src/core/host_interface.cpp @@ -492,6 +492,7 @@ void HostInterface::SetDefaultSettings(SettingsInterface& si) si.SetBoolValue("Main", "ApplyGameSettings", true); si.SetBoolValue("Main", "AutoLoadCheats", true); si.SetBoolValue("Main", "DisableAllEnhancements", false); + si.SetBoolValue("Main", "ShowSpeedIcons", true); si.SetBoolValue("Main", "RewindEnable", false); si.SetFloatValue("Main", "RewindFrequency", 10.0f); si.SetIntValue("Main", "RewindSaveSlots", 10); diff --git a/src/core/settings.cpp b/src/core/settings.cpp index 0abcbe901..3cae44eda 100644 --- a/src/core/settings.cpp +++ b/src/core/settings.cpp @@ -166,6 +166,7 @@ void Settings::Load(SettingsInterface& si) apply_game_settings = si.GetBoolValue("Main", "ApplyGameSettings", true); auto_load_cheats = si.GetBoolValue("Main", "AutoLoadCheats", true); disable_all_enhancements = si.GetBoolValue("Main", "DisableAllEnhancements", false); + show_speed_icons = si.GetBoolValue("Main", "ShowSpeedIcons", true); rewind_enable = si.GetBoolValue("Main", "RewindEnable", false); rewind_save_frequency = si.GetFloatValue("Main", "RewindFrequency", 10.0f); rewind_save_slots = static_cast(si.GetIntValue("Main", "RewindSaveSlots", 10)); @@ -358,6 +359,7 @@ void Settings::Save(SettingsInterface& si) const si.SetBoolValue("Main", "ApplyGameSettings", apply_game_settings); si.SetBoolValue("Main", "AutoLoadCheats", auto_load_cheats); si.SetBoolValue("Main", "DisableAllEnhancements", disable_all_enhancements); + si.SetBoolValue("Main", "ShowSpeedIcons", show_speed_icons); si.SetBoolValue("Main", "RewindEnable", rewind_enable); si.SetFloatValue("Main", "RewindFrequency", rewind_save_frequency); si.SetIntValue("Main", "RewindSaveSlots", rewind_save_slots); diff --git a/src/core/settings.h b/src/core/settings.h index 534f1d17a..021fb5abc 100644 --- a/src/core/settings.h +++ b/src/core/settings.h @@ -96,6 +96,7 @@ struct Settings bool apply_game_settings = true; bool auto_load_cheats = false; bool disable_all_enhancements = false; + bool show_speed_icons = false; bool rewind_enable = false; float rewind_save_frequency = 10.0f; diff --git a/src/duckstation-qt/advancedsettingswidget.cpp b/src/duckstation-qt/advancedsettingswidget.cpp index 8c73aeba3..53702bd46 100644 --- a/src/duckstation-qt/advancedsettingswidget.cpp +++ b/src/duckstation-qt/advancedsettingswidget.cpp @@ -136,6 +136,7 @@ AdvancedSettingsWidget::AdvancedSettingsWidget(QtHostInterface* host_interface, SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.logToFile, "Logging", "LogToFile"); SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.showDebugMenu, "Main", "ShowDebugMenu"); + SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.showSpeedIcons, "Main", "ShowSpeedIcons", true); connect(m_ui.resetToDefaultButton, &QPushButton::clicked, this, &AdvancedSettingsWidget::onResetToDefaultClicked); connect(m_ui.showDebugMenu, &QCheckBox::toggled, m_host_interface->getMainWindow(), @@ -208,6 +209,8 @@ AdvancedSettingsWidget::AdvancedSettingsWidget(QtHostInterface* host_interface, tr("Logs messages to duckstation.log in the user directory.")); dialog->registerWidgetHelp(m_ui.showDebugMenu, tr("Show Debug Menu"), tr("Unchecked"), tr("Shows a debug menu bar with additional statistics and quick settings.")); + dialog->registerWidgetHelp(m_ui.showSpeedIcons, tr("Show Speed Icons"), tr("Checked"), + tr("Shows persistent icons when turbo is active or when paused while using the fullscreen UI.")); } AdvancedSettingsWidget::~AdvancedSettingsWidget() = default; diff --git a/src/duckstation-qt/advancedsettingswidget.ui b/src/duckstation-qt/advancedsettingswidget.ui index 80047ccc3..7f8ec578d 100644 --- a/src/duckstation-qt/advancedsettingswidget.ui +++ b/src/duckstation-qt/advancedsettingswidget.ui @@ -104,6 +104,13 @@ + + + + Show Speed Icons + + + diff --git a/src/frontend-common/fullscreen_ui.cpp b/src/frontend-common/fullscreen_ui.cpp index bbb250f93..5f39b40a9 100644 --- a/src/frontend-common/fullscreen_ui.cpp +++ b/src/frontend-common/fullscreen_ui.cpp @@ -2280,6 +2280,10 @@ void DrawSettingsWindow() s_host_interface->RunLater([debug_menu]() { SetDebugMenuEnabled(debug_menu); }); } + settings_changed |= ToggleButton("Show Speed Icons", + "Shows persistent icons when turbo is active or when paused.", + &s_settings_copy.show_speed_icons); + settings_changed |= ToggleButton("Disable All Enhancements", "Temporarily disables all enhancements, useful when testing.", &s_settings_copy.disable_all_enhancements); @@ -3122,13 +3126,14 @@ void DrawStatsOverlay() DRAW_LINE(g_large_font, g_large_font->FontSize, 0.0f, IM_COL32(255, 255, 255, 255)); } - if (s_host_interface->IsFastForwardEnabled() || s_host_interface->IsTurboEnabled()) + if (g_settings.show_speed_icons && + (s_host_interface->IsFastForwardEnabled() || s_host_interface->IsTurboEnabled())) { text.Assign(ICON_FA_FAST_FORWARD); DRAW_LINE(g_large_font, g_large_font->FontSize * 2.0f, margin, IM_COL32(255, 255, 255, 255)); } } - else if (state == System::State::Paused) + else if (g_settings.show_speed_icons && state == System::State::Paused) { text.Assign(ICON_FA_PAUSE); DRAW_LINE(g_large_font, g_large_font->FontSize * 2.0f, margin, IM_COL32(255, 255, 255, 255));