Merge pull request #12829 from Dentomologist/generalpane_add_balloontips

GeneralPane: Add BalloonTips
This commit is contained in:
JosJuice 2024-08-04 15:22:18 +02:00 committed by GitHub
commit c824ee9758
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 137 additions and 57 deletions

View File

@ -266,7 +266,7 @@ void AchievementSettingsWidget::ToggleHardcore()
if (Config::Get(Config::MAIN_EMULATION_SPEED) < 1.0f) if (Config::Get(Config::MAIN_EMULATION_SPEED) < 1.0f)
Config::SetBaseOrCurrent(Config::MAIN_EMULATION_SPEED, 1.0f); Config::SetBaseOrCurrent(Config::MAIN_EMULATION_SPEED, 1.0f);
Config::SetBaseOrCurrent(Config::FREE_LOOK_ENABLED, false); Config::SetBaseOrCurrent(Config::FREE_LOOK_ENABLED, false);
Settings::Instance().SetCheatsEnabled(false); Config::SetBaseOrCurrent(Config::MAIN_ENABLE_CHEATS, false);
Settings::Instance().SetDebugModeEnabled(false); Settings::Instance().SetDebugModeEnabled(false);
} }
emit Settings::Instance().EmulationStateChanged(Core::GetState(Core::System::GetInstance())); emit Settings::Instance().EmulationStateChanged(Core::GetState(Core::System::GetInstance()));

View File

@ -539,15 +539,6 @@ bool Settings::GetCheatsEnabled() const
return Config::Get(Config::MAIN_ENABLE_CHEATS); 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) void Settings::SetDebugModeEnabled(bool enabled)
{ {
if (AchievementManager::GetInstance().IsHardcoreModeActive()) if (AchievementManager::GetInstance().IsHardcoreModeActive())

View File

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

View File

@ -24,8 +24,11 @@
#include "Core/PowerPC/PowerPC.h" #include "Core/PowerPC/PowerPC.h"
#include "Core/System.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/ModalMessageBox.h"
#include "DolphinQt/QtUtils/NonDefaultQPushButton.h"
#include "DolphinQt/QtUtils/SetWindowDecorations.h" #include "DolphinQt/QtUtils/SetWindowDecorations.h"
#include "DolphinQt/QtUtils/SignalBlocking.h" #include "DolphinQt/QtUtils/SignalBlocking.h"
#include "DolphinQt/Settings.h" #include "DolphinQt/Settings.h"
@ -52,6 +55,7 @@ GeneralPane::GeneralPane(QWidget* parent) : QWidget(parent)
{ {
CreateLayout(); CreateLayout();
LoadConfig(); LoadConfig();
AddDescriptions();
ConnectLayout(); ConnectLayout();
@ -97,11 +101,8 @@ void GeneralPane::OnEmulationStateChanged(Core::State state)
void GeneralPane::ConnectLayout() void GeneralPane::ConnectLayout()
{ {
connect(m_checkbox_dualcore, &QCheckBox::toggled, this, &GeneralPane::OnSaveConfig); connect(m_checkbox_cheats, &QCheckBox::toggled, &Settings::Instance(),
connect(m_checkbox_cheats, &QCheckBox::toggled, this, &GeneralPane::OnSaveConfig); &Settings::EnableCheatsChanged);
connect(m_checkbox_override_region_settings, &QCheckBox::stateChanged, this,
&GeneralPane::OnSaveConfig);
connect(m_checkbox_auto_disc_change, &QCheckBox::toggled, this, &GeneralPane::OnSaveConfig);
#ifdef USE_DISCORD_PRESENCE #ifdef USE_DISCORD_PRESENCE
connect(m_checkbox_discord_presence, &QCheckBox::toggled, this, &GeneralPane::OnSaveConfig); connect(m_checkbox_discord_presence, &QCheckBox::toggled, this, &GeneralPane::OnSaveConfig);
#endif #endif
@ -140,20 +141,22 @@ void GeneralPane::CreateBasic()
basic_group->setLayout(basic_group_layout); basic_group->setLayout(basic_group_layout);
m_main_layout->addWidget(basic_group); m_main_layout->addWidget(basic_group);
m_checkbox_dualcore = new QCheckBox(tr("Enable Dual Core (speedhack)")); m_checkbox_dualcore = new ConfigBool(tr("Enable Dual Core (speedhack)"), Config::MAIN_CPU_THREAD);
basic_group_layout->addWidget(m_checkbox_dualcore); basic_group_layout->addWidget(m_checkbox_dualcore);
m_checkbox_cheats = new QCheckBox(tr("Enable Cheats")); m_checkbox_cheats = new ConfigBool(tr("Enable Cheats"), Config::MAIN_ENABLE_CHEATS);
basic_group_layout->addWidget(m_checkbox_cheats); basic_group_layout->addWidget(m_checkbox_cheats);
m_checkbox_override_region_settings = new QCheckBox(tr("Allow Mismatched Region Settings")); m_checkbox_override_region_settings =
new ConfigBool(tr("Allow Mismatched Region Settings"), Config::MAIN_OVERRIDE_REGION_SETTINGS);
basic_group_layout->addWidget(m_checkbox_override_region_settings); basic_group_layout->addWidget(m_checkbox_override_region_settings);
m_checkbox_auto_disc_change = new QCheckBox(tr("Change Discs Automatically")); m_checkbox_auto_disc_change =
new ConfigBool(tr("Change Discs Automatically"), Config::MAIN_AUTO_DISC_CHANGE);
basic_group_layout->addWidget(m_checkbox_auto_disc_change); basic_group_layout->addWidget(m_checkbox_auto_disc_change);
#ifdef USE_DISCORD_PRESENCE #ifdef USE_DISCORD_PRESENCE
m_checkbox_discord_presence = new QCheckBox(tr("Show Current Game on Discord")); m_checkbox_discord_presence = new ToolTipCheckBox(tr("Show Current Game on Discord"));
basic_group_layout->addWidget(m_checkbox_discord_presence); basic_group_layout->addWidget(m_checkbox_discord_presence);
#endif #endif
@ -162,7 +165,7 @@ void GeneralPane::CreateBasic()
speed_limit_layout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow); speed_limit_layout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
basic_group_layout->addLayout(speed_limit_layout); basic_group_layout->addLayout(speed_limit_layout);
m_combobox_speedlimit = new QComboBox(); m_combobox_speedlimit = new ToolTipComboBox();
m_combobox_speedlimit->addItem(tr("Unlimited")); m_combobox_speedlimit->addItem(tr("Unlimited"));
for (int i = 10; i <= 200; i += 10) // from 10% to 200% for (int i = 10; i <= 200; i += 10) // from 10% to 200%
@ -189,7 +192,7 @@ void GeneralPane::CreateAutoUpdate()
auto_update_group_layout->setFormAlignment(Qt::AlignLeft | Qt::AlignTop); auto_update_group_layout->setFormAlignment(Qt::AlignLeft | Qt::AlignTop);
auto_update_group_layout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow); auto_update_group_layout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
m_combobox_update_track = new QComboBox(this); m_combobox_update_track = new ToolTipComboBox();
auto_update_group_layout->addRow(tr("&Auto Update:"), m_combobox_update_track); auto_update_group_layout->addRow(tr("&Auto Update:"), m_combobox_update_track);
@ -210,17 +213,11 @@ void GeneralPane::CreateFallbackRegion()
fallback_region_dropdown_layout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow); fallback_region_dropdown_layout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
fallback_region_group_layout->addLayout(fallback_region_dropdown_layout); fallback_region_group_layout->addLayout(fallback_region_dropdown_layout);
m_combobox_fallback_region = new QComboBox(this); m_combobox_fallback_region = new ToolTipComboBox();
fallback_region_dropdown_layout->addRow(tr("Fallback Region:"), m_combobox_fallback_region); 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")}) for (const QString& option : {tr("NTSC-J"), tr("NTSC-U"), tr("PAL"), tr("NTSC-K")})
m_combobox_fallback_region->addItem(option); 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 #if defined(USE_ANALYTICS) && USE_ANALYTICS
@ -231,9 +228,8 @@ void GeneralPane::CreateAnalytics()
analytics_group->setLayout(analytics_group_layout); analytics_group->setLayout(analytics_group_layout);
m_main_layout->addWidget(analytics_group); m_main_layout->addWidget(analytics_group);
m_checkbox_enable_analytics = new QCheckBox(tr("Enable Usage Statistics Reporting")); m_checkbox_enable_analytics = new ToolTipCheckBox(tr("Enable Usage Statistics Reporting"));
m_button_generate_new_identity = m_button_generate_new_identity = new ToolTipPushButton(tr("Generate a New Statistics Identity"));
new NonDefaultQPushButton(tr("Generate a New Statistics Identity"));
analytics_group_layout->addWidget(m_checkbox_enable_analytics); analytics_group_layout->addWidget(m_checkbox_enable_analytics);
analytics_group_layout->addWidget(m_button_generate_new_identity); analytics_group_layout->addWidget(m_button_generate_new_identity);
} }
@ -261,12 +257,6 @@ void GeneralPane::LoadConfig()
SignalBlocking(m_checkbox_enable_analytics) SignalBlocking(m_checkbox_enable_analytics)
->setChecked(Settings::Instance().IsAnalyticsEnabled()); ->setChecked(Settings::Instance().IsAnalyticsEnabled());
#endif #endif
SignalBlocking(m_checkbox_dualcore)->setChecked(Config::Get(Config::MAIN_CPU_THREAD));
SignalBlocking(m_checkbox_cheats)->setChecked(Settings::Instance().GetCheatsEnabled());
SignalBlocking(m_checkbox_override_region_settings)
->setChecked(Config::Get(Config::MAIN_OVERRIDE_REGION_SETTINGS));
SignalBlocking(m_checkbox_auto_disc_change)
->setChecked(Config::Get(Config::MAIN_AUTO_DISC_CHANGE));
#ifdef USE_DISCORD_PRESENCE #ifdef USE_DISCORD_PRESENCE
SignalBlocking(m_checkbox_discord_presence) SignalBlocking(m_checkbox_discord_presence)
@ -353,12 +343,6 @@ void GeneralPane::OnSaveConfig()
Settings::Instance().SetAnalyticsEnabled(m_checkbox_enable_analytics->isChecked()); Settings::Instance().SetAnalyticsEnabled(m_checkbox_enable_analytics->isChecked());
DolphinAnalytics::Instance().ReloadConfig(); DolphinAnalytics::Instance().ReloadConfig();
#endif #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( Settings::Instance().SetFallbackRegion(
UpdateFallbackRegionFromIndex(m_combobox_fallback_region->currentIndex())); UpdateFallbackRegionFromIndex(m_combobox_fallback_region->currentIndex()));
@ -378,3 +362,105 @@ void GeneralPane::GenerateNewIdentity()
message_box.exec(); message_box.exec();
} }
#endif #endif
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(
"Sets the maximum time scale of emulation. Values higher than 100% will accelerate emulated "
"time by processing faster than the original hardware, while values lower than 100% will "
"slow emulated time. Unlimited will emulate as fast as your host hardware can run."
"<br><br>Higher speeds are proportionally more costly to emulate. Depending on the title, "
"your settings, and your host hardware, some of these values may not be sustainable."
"<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.");
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.");
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));
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));
}

View File

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