auto dark mode restored, fix merging

This commit is contained in:
Nayla Hanegan 2024-08-23 14:48:50 -04:00
parent 4ced9ad700
commit 2670ec26f6
8 changed files with 61 additions and 223 deletions

View file

@ -131,17 +131,11 @@
<ClInclude Include="SDL\src\hidapi\hidapi\hidapi.h" />
<ClInclude Include="SDL\src\hidapi\SDL_hidapi_c.h" />
<ClInclude Include="SDL\src\joystick\controller_type.h" />
<ClInclude Include="SDL\src\joystick\hidapi\steam\controller_constants.h" />
<ClInclude Include="SDL\src\joystick\hidapi\steam\controller_structs.h" />
<ClInclude Include="SDL\src\joystick\hidapi\SDL_hidapi_nintendo.h" />
<ClInclude Include="SDL\src\joystick\hidapi\SDL_hidapi_rumble.h" />
<ClInclude Include="SDL\src\joystick\hidapi\SDL_hidapijoystick_c.h" />
<ClInclude Include="SDL\src\joystick\steam\SDL_steamcontroller.h" />
<ClInclude Include="SDL\src\joystick\SDL_gamecontrollerdb.h" />
<ClInclude Include="SDL\src\joystick\SDL_joystick_c.h" />
<ClInclude Include="SDL\src\joystick\SDL_steam_virtual_gamepad.h" />
<ClInclude Include="SDL\src\joystick\SDL_sysjoystick.h" />
<ClInclude Include="SDL\src\joystick\controller_list.h" />
<ClInclude Include="SDL\src\joystick\usb_ids.h" />
<ClInclude Include="SDL\src\joystick\virtual\SDL_virtualjoystick_c.h" />
<ClInclude Include="SDL\src\joystick\windows\SDL_dinputjoystick_c.h" />
@ -192,13 +186,6 @@
<ClInclude Include="SDL\src\video\dummy\SDL_nullevents_c.h" />
<ClInclude Include="SDL\src\video\dummy\SDL_nullframebuffer_c.h" />
<ClInclude Include="SDL\src\video\dummy\SDL_nullvideo.h" />
<ClInclude Include="SDL\src\video\khronos\vk_video\vulkan_video_codec_h264std.h" />
<ClInclude Include="SDL\src\video\khronos\vk_video\vulkan_video_codec_h264std_decode.h" />
<ClInclude Include="SDL\src\video\khronos\vk_video\vulkan_video_codec_h264std_encode.h" />
<ClInclude Include="SDL\src\video\khronos\vk_video\vulkan_video_codec_h265std.h" />
<ClInclude Include="SDL\src\video\khronos\vk_video\vulkan_video_codec_h265std_decode.h" />
<ClInclude Include="SDL\src\video\khronos\vk_video\vulkan_video_codec_h265std_encode.h" />
<ClInclude Include="SDL\src\video\khronos\vk_video\vulkan_video_codecs_common.h" />
<ClInclude Include="SDL\src\video\khronos\vulkan\vk_icd.h" />
<ClInclude Include="SDL\src\video\khronos\vulkan\vk_layer.h" />
<ClInclude Include="SDL\src\video\khronos\vulkan\vk_platform.h" />
@ -212,7 +199,6 @@
<ClInclude Include="SDL\src\video\khronos\vulkan\vulkan_ios.h" />
<ClInclude Include="SDL\src\video\khronos\vulkan\vulkan_macos.h" />
<ClInclude Include="SDL\src\video\khronos\vulkan\vulkan_metal.h" />
<ClInclude Include="SDL\src\video\khronos\vulkan\vulkan_screen.h" />
<ClInclude Include="SDL\src\video\khronos\vulkan\vulkan_vi.h" />
<ClInclude Include="SDL\src\video\khronos\vulkan\vulkan_wayland.h" />
<ClInclude Include="SDL\src\video\khronos\vulkan\vulkan_win32.h" />
@ -245,19 +231,14 @@
<ClInclude Include="SDL\src\video\windows\SDL_windowsopengl.h" />
<ClInclude Include="SDL\src\video\windows\SDL_windowsopengles.h" />
<ClInclude Include="SDL\src\video\windows\SDL_windowsshape.h" />
<ClInclude Include="SDL\src\video\windows\SDL_windowstaskdialog.h" />
<ClInclude Include="SDL\src\video\windows\SDL_windowsvideo.h" />
<ClInclude Include="SDL\src\video\windows\SDL_windowsvulkan.h" />
<ClInclude Include="SDL\src\video\windows\SDL_windowswindow.h" />
<ClInclude Include="SDL\src\video\windows\wmmsg.h" />
<ClInclude Include="SDL\src\video\yuv2rgb\yuv_rgb.h" />
<ClInclude Include="SDL\src\video\yuv2rgb\yuv_rgb_common.h" />
<ClInclude Include="SDL\src\video\yuv2rgb\yuv_rgb_internal.h" />
<ClInclude Include="SDL\src\video\yuv2rgb\yuv_rgb_lsx.h" />
<ClInclude Include="SDL\src\video\yuv2rgb\yuv_rgb_lsx_func.h" />
<ClInclude Include="SDL\src\video\yuv2rgb\yuv_rgb_sse.h" />
<ClInclude Include="SDL\src\video\yuv2rgb\yuv_rgb_sse_func.h" />
<ClInclude Include="SDL\src\video\yuv2rgb\yuv_rgb_std.h" />
<ClInclude Include="SDL\src\video\yuv2rgb\yuv_rgb_std_func.h" />
<ClInclude Include="SDL\src\video\yuv2rgb\yuv_rgb.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="SDL\src\atomic\SDL_atomic.c" />
@ -310,17 +291,14 @@
<ClCompile Include="SDL\src\joystick\hidapi\SDL_hidapi_shield.c" />
<ClCompile Include="SDL\src\joystick\hidapi\SDL_hidapi_stadia.c" />
<ClCompile Include="SDL\src\joystick\hidapi\SDL_hidapi_steam.c" />
<ClCompile Include="SDL\src\joystick\hidapi\SDL_hidapi_steamdeck.c" />
<ClCompile Include="SDL\src\joystick\hidapi\SDL_hidapi_switch.c" />
<ClCompile Include="SDL\src\joystick\hidapi\SDL_hidapi_wii.c" />
<ClCompile Include="SDL\src\joystick\hidapi\SDL_hidapi_xbox360.c" />
<ClCompile Include="SDL\src\joystick\hidapi\SDL_hidapi_xbox360w.c" />
<ClCompile Include="SDL\src\joystick\hidapi\SDL_hidapi_xboxone.c" />
<ClCompile Include="SDL\src\joystick\hidapi\SDL_hidapijoystick.c" />
<ClCompile Include="SDL\src\joystick\steam\SDL_steamcontroller.c" />
<ClCompile Include="SDL\src\joystick\SDL_gamecontroller.c" />
<ClCompile Include="SDL\src\joystick\SDL_joystick.c" />
<ClCompile Include="SDL\src\joystick\SDL_steam_virtual_gamepad.c" />
<ClCompile Include="SDL\src\joystick\virtual\SDL_virtualjoystick.c" />
<ClCompile Include="SDL\src\joystick\windows\SDL_dinputjoystick.c" />
<ClCompile Include="SDL\src\joystick\windows\SDL_rawinputjoystick.c" />
@ -423,9 +401,7 @@
<ClCompile Include="SDL\src\video\windows\SDL_windowsvideo.c" />
<ClCompile Include="SDL\src\video\windows\SDL_windowsvulkan.c" />
<ClCompile Include="SDL\src\video\windows\SDL_windowswindow.c" />
<ClCompile Include="SDL\src\video\yuv2rgb\yuv_rgb_lsx.c" />
<ClCompile Include="SDL\src\video\yuv2rgb\yuv_rgb_sse.c" />
<ClCompile Include="SDL\src\video\yuv2rgb\yuv_rgb_std.c" />
<ClCompile Include="SDL\src\video\yuv2rgb\yuv_rgb.c" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">

View file

@ -281,7 +281,7 @@ int main(int argc, char* argv[])
"efforts. It also helps us identify rare configurations that are "
"causing bugs, performance and stability issues.\n"
"This authorization can be revoked at any time through Dolphin's "
"settings."));
"settings.\n\nNone of this information will be sent to the staff at Mario Party Netplay."));
SetQWidgetWindowDecorations(&analytics_prompt);
const int answer = analytics_prompt.exec();

View file

@ -203,7 +203,8 @@ void Settings::ApplyStyle()
// which would select Qt's default theme, but unlike other OSes we don't automatically get a
// default dark theme on Windows when the user has selected dark mode in the Windows settings.
// So manually check if the user wants dark mode and, if yes, load our embedded dark theme.
if (style_type == StyleType::Dark && IsSystemDark())
QString productName = QSysInfo::prettyProductName();
if (!productName.contains(QStringLiteral("Windows 11"), Qt::CaseInsensitive) && IsSystemDark())
{
QFile file(QStringLiteral(":/dolphin_dark_win/dark.qss"));
if (file.open(QFile::ReadOnly))
@ -539,6 +540,15 @@ bool Settings::GetCheatsEnabled() const
return Config::Get(Config::MAIN_ENABLE_CHEATS);
}
void Settings::SetCheatsEnabled(bool enabled)
{
if (Config::Get(Config::MAIN_ENABLE_CHEATS) != enabled)
{
Config::SetBaseOrCurrent(Config::MAIN_ENABLE_CHEATS, enabled);
emit EnableCheatsChanged(enabled);
}
}
void Settings::SetDebugModeEnabled(bool enabled)
{
if (AchievementManager::GetInstance().IsHardcoreModeActive())

View file

@ -145,6 +145,7 @@ public:
// Cheats
bool GetCheatsEnabled() const;
void SetCheatsEnabled(bool enabled);
// Debug
void SetDebugModeEnabled(bool enabled);

View file

@ -24,11 +24,8 @@
#include "Core/PowerPC/PowerPC.h"
#include "Core/System.h"
#include "DolphinQt/Config/ConfigControls/ConfigBool.h"
#include "DolphinQt/Config/ToolTipControls/ToolTipCheckBox.h"
#include "DolphinQt/Config/ToolTipControls/ToolTipComboBox.h"
#include "DolphinQt/Config/ToolTipControls/ToolTipPushButton.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h"
#include "DolphinQt/QtUtils/NonDefaultQPushButton.h"
#include "DolphinQt/QtUtils/SetWindowDecorations.h"
#include "DolphinQt/QtUtils/SignalBlocking.h"
#include "DolphinQt/Settings.h"
@ -55,7 +52,6 @@ GeneralPane::GeneralPane(QWidget* parent) : QWidget(parent)
{
CreateLayout();
LoadConfig();
AddDescriptions();
ConnectLayout();
@ -79,16 +75,19 @@ void GeneralPane::CreateLayout()
CreateCheats();
m_main_layout->addStretch(1);
setLayout(m_main_layout);
}
void GeneralPane::OnEmulationStateChanged(Core::State state)
{
const bool running = state != Core::State::Uninitialized;
const bool hardcore = AchievementManager::GetInstance().IsHardcoreModeActive();
m_checkbox_dualcore->setEnabled(!running);
#ifdef USE_RETRO_ACHIEVEMENTS
bool hardcore = AchievementManager::GetInstance().IsHardcoreModeActive();
m_checkbox_cheats->setEnabled(!running && !hardcore);
#else // USE_RETRO_ACHIEVEMENTS
m_checkbox_cheats->setEnabled(!running);
#endif // USE_RETRO_ACHIEVEMENTS
m_checkbox_override_region_settings->setEnabled(!running);
#ifdef USE_DISCORD_PRESENCE
m_checkbox_discord_presence->setEnabled(!running);
@ -100,7 +99,8 @@ void GeneralPane::ConnectLayout()
{
connect(m_checkbox_dualcore, &QCheckBox::toggled, this, &GeneralPane::OnSaveConfig);
connect(m_checkbox_cheats, &QCheckBox::toggled, this, &GeneralPane::OnSaveConfig);
connect(m_combobox_codehandler, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &GeneralPane::OnCodeHandlerChanged);
connect(m_combobox_codehandler, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
&GeneralPane::OnCodeHandlerChanged);
connect(m_checkbox_override_region_settings, &QCheckBox::stateChanged, this,
&GeneralPane::OnSaveConfig);
connect(m_checkbox_auto_disc_change, &QCheckBox::toggled, this, &GeneralPane::OnSaveConfig);
@ -134,18 +134,17 @@ void GeneralPane::CreateBasic()
basic_group->setLayout(basic_group_layout);
m_main_layout->addWidget(basic_group);
m_checkbox_dualcore = new ConfigBool(tr("Enable Dual Core (speedhack)"), Config::MAIN_CPU_THREAD);
m_checkbox_dualcore = new QCheckBox(tr("Enable Dual Core (speed-hack)"));
basic_group_layout->addWidget(m_checkbox_dualcore);
m_checkbox_override_region_settings = new QCheckBox(tr("Allow Mismatched Region Settings"));
basic_group_layout->addWidget(m_checkbox_override_region_settings);
m_checkbox_auto_disc_change =
new ConfigBool(tr("Change Discs Automatically"), Config::MAIN_AUTO_DISC_CHANGE);
m_checkbox_auto_disc_change = new QCheckBox(tr("Change Discs Automatically"));
basic_group_layout->addWidget(m_checkbox_auto_disc_change);
#ifdef USE_DISCORD_PRESENCE
m_checkbox_discord_presence = new ToolTipCheckBox(tr("Show Current Game on Discord"));
m_checkbox_discord_presence = new QCheckBox(tr("Show Current Game on Discord"));
basic_group_layout->addWidget(m_checkbox_discord_presence);
#endif
@ -154,7 +153,7 @@ void GeneralPane::CreateBasic()
speed_limit_layout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
basic_group_layout->addLayout(speed_limit_layout);
m_combobox_speedlimit = new ToolTipComboBox();
m_combobox_speedlimit = new QComboBox();
m_combobox_speedlimit->addItem(tr("Unlimited"));
for (int i = 10; i <= 200; i += 10) // from 10% to 200%
@ -183,11 +182,17 @@ void GeneralPane::CreateFallbackRegion()
fallback_region_dropdown_layout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
fallback_region_group_layout->addLayout(fallback_region_dropdown_layout);
m_combobox_fallback_region = new ToolTipComboBox();
m_combobox_fallback_region = new QComboBox(this);
fallback_region_dropdown_layout->addRow(tr("Fallback Region:"), m_combobox_fallback_region);
for (const QString& option : {tr("NTSC-J"), tr("NTSC-U"), tr("PAL"), tr("NTSC-K")})
m_combobox_fallback_region->addItem(option);
auto* fallback_region_description =
new QLabel(tr("Dolphin will use this for titles whose region cannot be determined "
"automatically."));
fallback_region_description->setWordWrap(true);
fallback_region_group_layout->addWidget(fallback_region_description);
}
#if defined(USE_ANALYTICS) && USE_ANALYTICS
@ -198,8 +203,9 @@ void GeneralPane::CreateAnalytics()
analytics_group->setLayout(analytics_group_layout);
m_main_layout->addWidget(analytics_group);
m_checkbox_enable_analytics = new ToolTipCheckBox(tr("Enable Usage Statistics Reporting"));
m_button_generate_new_identity = new ToolTipPushButton(tr("Generate a New Statistics Identity"));
m_checkbox_enable_analytics = new QCheckBox(tr("Enable Usage Statistics Reporting"));
m_button_generate_new_identity =
new NonDefaultQPushButton(tr("Generate a New Statistics Identity"));
analytics_group_layout->addWidget(m_checkbox_enable_analytics);
analytics_group_layout->addWidget(m_button_generate_new_identity);
}
@ -222,7 +228,6 @@ void GeneralPane::CreateCheats()
m_combobox_codehandler->addItem(tr("Dolphin (Stock)"), QVariant(0));
m_combobox_codehandler->addItem(tr("MPN (Extended)"), QVariant(1));
m_combobox_codehandler->addItem(tr("MPN (Super Extended)"), QVariant(2));
code_handler_layout->addRow(code_handler_label, m_combobox_codehandler);
cheats_group_layout->addLayout(code_handler_layout);
@ -334,6 +339,12 @@ void GeneralPane::OnSaveConfig()
Settings::Instance().SetAnalyticsEnabled(m_checkbox_enable_analytics->isChecked());
DolphinAnalytics::Instance().ReloadConfig();
#endif
Config::SetBaseOrCurrent(Config::MAIN_CPU_THREAD, m_checkbox_dualcore->isChecked());
Settings::Instance().SetCheatsEnabled(m_checkbox_cheats->isChecked());
Config::SetBaseOrCurrent(Config::MAIN_OVERRIDE_REGION_SETTINGS,
m_checkbox_override_region_settings->isChecked());
Config::SetBase(Config::MAIN_AUTO_DISC_CHANGE, m_checkbox_auto_disc_change->isChecked());
Config::SetBaseOrCurrent(Config::MAIN_ENABLE_CHEATS, m_checkbox_cheats->isChecked());
Settings::Instance().SetFallbackRegion(
UpdateFallbackRegionFromIndex(m_combobox_fallback_region->currentIndex()));
@ -359,107 +370,4 @@ void GeneralPane::OnCodeHandlerChanged(int index)
int code_handler_value = m_combobox_codehandler->itemData(index).toInt();
Config::SetBaseOrCurrent(Config::MAIN_CODE_HANDLER, code_handler_value);
Config::Save();
void GeneralPane::AddDescriptions()
{
static constexpr char TR_DUALCORE_DESCRIPTION[] =
QT_TR_NOOP("Separates CPU and GPU emulation work to separate threads. Reduces single-thread "
"burden by spreading Dolphin's heaviest load across two cores, which usually "
"improves performance. However, it can result in glitches and crashes."
"<br><br>This setting cannot be changed while emulation is active."
"<br><br><dolphin_emphasis>If unsure, leave this checked.</dolphin_emphasis>");
static constexpr char TR_CHEATS_DESCRIPTION[] = QT_TR_NOOP(
"Enables the use of AR and Gecko cheat codes which can be used to modify games' behavior. "
"These codes can be configured with the Cheats Manager in the Tools menu."
"<br><br>This setting cannot be changed while emulation is active."
"<br><br><dolphin_emphasis>If unsure, leave this unchecked.</dolphin_emphasis>");
static constexpr char TR_OVERRIDE_REGION_SETTINGS_DESCRIPTION[] =
QT_TR_NOOP("Lets you use languages and other region-related settings that the game may not "
"be designed for. May cause various crashes and bugs."
"<br><br>This setting cannot be changed while emulation is active."
"<br><br><dolphin_emphasis>If unsure, leave this unchecked.</dolphin_emphasis>");
static constexpr char TR_AUTO_DISC_CHANGE_DESCRIPTION[] = QT_TR_NOOP(
"Automatically changes the game disc when requested by games with two discs. This feature "
"requires the game to be launched in one of the following ways:"
"<br>- From the game list, with both discs being present in the game list."
"<br>- With File > Open or the command line interface, with the paths to both discs being "
"provided."
"<br>- By launching an M3U file with File > Open or the command line interface."
"<br><br><dolphin_emphasis>If unsure, leave this unchecked.</dolphin_emphasis>");
#ifdef USE_DISCORD_PRESENCE
static constexpr char TR_DISCORD_PRESENCE_DESCRIPTION[] =
QT_TR_NOOP("Shows which game is active and the duration of your current play session in your "
"Discord status."
"<br><br>This setting cannot be changed while emulation is active."
"<br><br><dolphin_emphasis>If unsure, leave this checked.</dolphin_emphasis>");
#endif
static constexpr char TR_SPEEDLIMIT_DESCRIPTION[] =
QT_TR_NOOP("Controls how fast emulation runs relative to the original hardware."
"<br><br>Values higher than 100% will emulate faster than the original hardware "
"can run, if your hardware is able to keep up. Values lower than 100% will slow "
"emulation instead. Unlimited will emulate as fast as your hardware is able to."
"<br><br><dolphin_emphasis>If unsure, select 100%.</dolphin_emphasis>");
static constexpr char TR_UPDATE_TRACK_DESCRIPTION[] = QT_TR_NOOP(
"Selects which update track Dolphin uses when checking for updates at startup. If a new "
"update is available, Dolphin will show a list of changes made since your current version "
"and ask you if you want to update."
"<br><br>The Dev track has the latest version of Dolphin which often updates multiple times "
"per day. Select this track if you want the newest features and fixes."
"<br><br>The Releases track has an update every few months. Some reasons you might prefer to "
"use this track:"
"<br>- You prefer using versions that have had additional testing."
"<br>- NetPlay requires players to have the same Dolphin version, and the latest Release "
"version will have the most players to match with."
"<br>- You frequently use Dolphin's savestate system, which doesn't guarantee backward "
"compatibility of savestates between Dolphin versions. If this applies to you, make sure you "
"make an in-game save before updating (i.e. save your game in the same way you would on a "
"physical GameCube or Wii), then load the in-game save after updating Dolphin and before "
"making any new savestates."
"<br><br>Selecting \"Don't Update\" will prevent Dolphin from automatically checking for "
"updates."
"<br><br><dolphin_emphasis>If unsure, select Releases.</dolphin_emphasis>");
static constexpr char TR_FALLBACK_REGION_DESCRIPTION[] =
QT_TR_NOOP("Sets the region used for titles whose region cannot be determined automatically."
"<br><br>This setting cannot be changed while emulation is active.");
#if defined(USE_ANALYTICS) && USE_ANALYTICS
static constexpr char TR_ENABLE_ANALYTICS_DESCRIPTION[] = QT_TR_NOOP(
"If selected, Dolphin can collect data on its performance, feature usage, emulated games, "
"and configuration, as well as data on your system's hardware and operating system."
"<br><br>No private data is ever collected. This data helps us understand how people and "
"emulated games use Dolphin and prioritize our efforts. It also helps us identify rare "
"configurations that are causing bugs, performance and stability issues.");
static constexpr char TR_GENERATE_NEW_IDENTITY_DESCRIPTION[] =
QT_TR_NOOP("Generate a new anonymous ID for your usage statistics. This will cause any "
"future statistics to be unassociated with your previous statistics.");
#endif
m_checkbox_dualcore->SetDescription(tr(TR_DUALCORE_DESCRIPTION));
m_checkbox_cheats->SetDescription(tr(TR_CHEATS_DESCRIPTION));
m_checkbox_override_region_settings->SetDescription(tr(TR_OVERRIDE_REGION_SETTINGS_DESCRIPTION));
m_checkbox_auto_disc_change->SetDescription(tr(TR_AUTO_DISC_CHANGE_DESCRIPTION));
#ifdef USE_DISCORD_PRESENCE
m_checkbox_discord_presence->SetDescription(tr(TR_DISCORD_PRESENCE_DESCRIPTION));
#endif
m_combobox_speedlimit->SetTitle(tr("Speed Limit"));
m_combobox_speedlimit->SetDescription(tr(TR_SPEEDLIMIT_DESCRIPTION));
if (AutoUpdateChecker::SystemSupportsAutoUpdates())
{
m_combobox_update_track->SetTitle(tr("Auto Update"));
m_combobox_update_track->SetDescription(tr(TR_UPDATE_TRACK_DESCRIPTION));
}
m_combobox_fallback_region->SetTitle(tr("Fallback Region"));
m_combobox_fallback_region->SetDescription(tr(TR_FALLBACK_REGION_DESCRIPTION));
#if defined(USE_ANALYTICS) && USE_ANALYTICS
m_checkbox_enable_analytics->SetDescription(tr(TR_ENABLE_ANALYTICS_DESCRIPTION));
m_button_generate_new_identity->SetTitle(tr("Generate a New Statistics Identity"));
m_button_generate_new_identity->SetDescription(tr(TR_GENERATE_NEW_IDENTITY_DESCRIPTION));
#endif
}

View file

@ -5,7 +5,6 @@
#include <QWidget>
class ConfigBool;
class QCheckBox;
class QComboBox;
class QLabel;
@ -13,9 +12,6 @@ class QPushButton;
class QRadioButton;
class QSlider;
class QVBoxLayout;
class ToolTipCheckBox;
class ToolTipComboBox;
class ToolTipPushButton;
namespace Core
{
@ -34,8 +30,6 @@ private:
void CreateBasic();
// void CreateAutoUpdate();
void CreateFallbackRegion();
void AddDescriptions();
void LoadConfig();
void OnSaveConfig();
void OnEmulationStateChanged(Core::State state);
@ -44,23 +38,25 @@ private:
// Widgets
QVBoxLayout* m_main_layout;
ToolTipComboBox* m_combobox_speedlimit;
ToolTipComboBox* m_combobox_update_track;
ToolTipComboBox* m_combobox_fallback_region;
ConfigBool* m_checkbox_dualcore;
ConfigBool* m_checkbox_cheats;
ConfigBool* m_checkbox_override_region_settings;
ConfigBool* m_checkbox_auto_disc_change;
QComboBox* m_combobox_speedlimit;
QComboBox* m_combobox_update_track;
QComboBox* m_combobox_fallback_region;
QCheckBox* m_checkbox_dualcore;
QCheckBox* m_checkbox_cheats;
QCheckBox* m_checkbox_override_region_settings;
QCheckBox* m_checkbox_auto_disc_change;
QComboBox* m_combobox_codehandler;
#ifdef USE_DISCORD_PRESENCE
ToolTipCheckBox* m_checkbox_discord_presence;
QCheckBox* m_checkbox_discord_presence;
#endif
QLabel* m_label_speedlimit;
// Analytics related
#if defined(USE_ANALYTICS) && USE_ANALYTICS
void CreateAnalytics();
void GenerateNewIdentity();
ToolTipPushButton* m_button_generate_new_identity;
ToolTipCheckBox* m_checkbox_enable_analytics;
QPushButton* m_button_generate_new_identity;
QCheckBox* m_checkbox_enable_analytics;
#endif
};

View file

@ -91,7 +91,6 @@ InterfacePane::InterfacePane(QWidget* parent) : QWidget(parent)
{
CreateLayout();
UpdateShowDebuggingCheckbox();
LoadUserStyle();
ConnectLayout();
connect(&Settings::Instance(), &Settings::EmulationStateChanged, this,
@ -138,28 +137,6 @@ void InterfacePane::CreateUI()
m_combobox_theme = new ConfigStringChoice(theme_names, Config::MAIN_THEME_NAME);
combobox_layout->addRow(tr("&Theme:"), m_combobox_theme);
// User Style Combobox
m_combobox_userstyle = new ToolTipComboBox;
m_label_userstyle = new QLabel(tr("Style:"));
combobox_layout->addRow(m_label_userstyle, m_combobox_userstyle);
auto userstyle_search_results = Common::DoFileSearch({File::GetUserPath(D_STYLES_IDX)});
auto current = QOperatingSystemVersionBase::current();
#ifdef _WIN32
if (current <= QOperatingSystemVersion(QOperatingSystemVersion::Windows, 10))
{
m_combobox_userstyle->addItem(tr("Windows 11"), static_cast<int>(Settings::StyleType::Light));
m_combobox_userstyle->addItem(tr("Windows 10"), static_cast<int>(Settings::StyleType::Dark));
}
#endif
for (const std::string& path : userstyle_search_results)
{
const QFileInfo file_info(QString::fromStdString(path));
m_combobox_userstyle->addItem(file_info.completeBaseName(), file_info.fileName());
}
// Checkboxes
m_checkbox_use_builtin_title_database = new ConfigBool(tr("Use Built-In Database of Game Names"),
Config::MAIN_USE_BUILT_IN_TITLE_DATABASE);
@ -242,8 +219,6 @@ void InterfacePane::ConnectLayout()
&Settings::SetDebugModeEnabled);
connect(m_combobox_theme, &QComboBox::currentIndexChanged, &Settings::Instance(),
&Settings::ThemeChanged);
connect(m_combobox_userstyle, &QComboBox::currentIndexChanged, this,
&InterfacePane::OnUserStyleChanged);
connect(m_combobox_language, &QComboBox::currentIndexChanged, this,
&InterfacePane::OnLanguageChanged);
connect(m_checkbox_top_window, &QCheckBox::toggled, &Settings::Instance(),
@ -284,31 +259,6 @@ void InterfacePane::UpdateShowDebuggingCheckbox()
}
}
void InterfacePane::LoadUserStyle()
{
const Settings::StyleType style_type = Settings::Instance().GetStyleType();
const QString userstyle = Settings::Instance().GetUserStyleName();
const int index = style_type == Settings::StyleType::User ?
m_combobox_userstyle->findData(userstyle) :
m_combobox_userstyle->findData(static_cast<int>(style_type));
if (index > 0)
SignalBlocking(m_combobox_userstyle)->setCurrentIndex(index);
}
void InterfacePane::OnUserStyleChanged()
{
const auto selected_style = m_combobox_userstyle->currentData();
bool is_builtin_type = false;
const int style_type_int = selected_style.toInt(&is_builtin_type);
Settings::Instance().SetStyleType(is_builtin_type ?
static_cast<Settings::StyleType>(style_type_int) :
Settings::StyleType::User);
if (!is_builtin_type)
Settings::Instance().SetUserStyleName(selected_style.toString());
Settings::Instance().ApplyStyle();
}
void InterfacePane::OnLanguageChanged()
{
ModalMessageBox::information(
@ -414,7 +364,4 @@ void InterfacePane::AddDescriptions()
m_radio_cursor_visible_never->SetDescription(tr(TR_CURSOR_VISIBLE_NEVER_DESCRIPTION));
m_radio_cursor_visible_always->SetDescription(tr(TR_CURSOR_VISIBLE_ALWAYS_DESCRIPTION));
m_combobox_userstyle->SetTitle(tr("Style"));
m_combobox_userstyle->SetDescription(tr(TR_USER_STYLE_DESCRIPTION));
}

View file

@ -18,6 +18,8 @@ class InterfacePane final : public QWidget
Q_OBJECT
public:
explicit InterfacePane(QWidget* parent = nullptr);
ToolTipComboBox* m_combobox_userstyle;
ConfigStringChoice* m_combobox_theme;
private:
void CreateLayout();
@ -33,8 +35,6 @@ private:
QVBoxLayout* m_main_layout;
ConfigStringChoice* m_combobox_language;
ConfigStringChoice* m_combobox_theme;
ToolTipComboBox* m_combobox_userstyle;
QLabel* m_label_userstyle;
ConfigBool* m_checkbox_top_window;
ConfigBool* m_checkbox_use_builtin_title_database;