diff options
| author | Pierre Bourdon <delroth@gmail.com> | 2018-06-25 00:06:27 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-06-25 00:06:27 +0200 |
| commit | 2cfdf89898c4689884fbffb1c693ec24a7083f66 (patch) | |
| tree | ea6424aa322c4df3c86efe8b62326c8e6ac28740 /Source/Core/DolphinWX/Config/GeneralConfigPane.cpp | |
| parent | 7388094e837dc2da9288769db689cd386c7f05bb (diff) | |
| parent | 63f03455f32ab938806216e218342fe8921eaf27 (diff) | |
Merge pull request #6983 from yourWaifu/add-discord-rpc-support
Add Discord Rich Presence support
Diffstat (limited to 'Source/Core/DolphinWX/Config/GeneralConfigPane.cpp')
| -rw-r--r-- | Source/Core/DolphinWX/Config/GeneralConfigPane.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/Source/Core/DolphinWX/Config/GeneralConfigPane.cpp b/Source/Core/DolphinWX/Config/GeneralConfigPane.cpp index da3f97f88f..3a4dfed817 100644 --- a/Source/Core/DolphinWX/Config/GeneralConfigPane.cpp +++ b/Source/Core/DolphinWX/Config/GeneralConfigPane.cpp @@ -20,10 +20,14 @@ #include "Common/Common.h" #include "Core/Analytics.h" +#include "Core/Config/UISettings.h" #include "Core/ConfigManager.h" #include "Core/Core.h" #include "Core/PowerPC/PowerPC.h" #include "DolphinWX/WxEventUtils.h" +#ifdef USE_DISCORD_PRESENCE +#include "UICommon/DiscordPresence.h" +#endif static const std::map<PowerPC::CPUCore, std::string> CPU_CORE_NAMES = { {PowerPC::CPUCore::Interpreter, _trans("Interpreter (slowest)")}, @@ -55,6 +59,9 @@ void GeneralConfigPane::InitializeGUI() m_dual_core_checkbox = new wxCheckBox(this, wxID_ANY, _("Enable Dual Core (speedup)")); m_cheats_checkbox = new wxCheckBox(this, wxID_ANY, _("Enable Cheats")); +#ifdef USE_DISCORD_PRESENCE + m_discord_presence_checkbox = new wxCheckBox(this, wxID_ANY, _("Show Current Game on Discord")); +#endif #if defined(USE_ANALYTICS) && USE_ANALYTICS m_analytics_checkbox = new wxCheckBox(this, wxID_ANY, _("Enable Usage Statistics Reporting")); #ifdef __APPLE__ @@ -74,6 +81,11 @@ void GeneralConfigPane::InitializeGUI() _("Splits the CPU and GPU threads so they can be run on separate cores.\nProvides major " "speed improvements on most modern PCs, but can cause occasional crashes/glitches.")); m_cheats_checkbox->SetToolTip(_("Enables the use of Action Replay and Gecko cheats.")); +#ifdef USE_DISCORD_PRESENCE + m_discord_presence_checkbox->SetToolTip( + _("Allow other people on Discord to see the current activity in Dolphin. Activities such as " + "the game being played, and for how long")); +#endif #if defined(USE_ANALYTICS) && USE_ANALYTICS m_analytics_checkbox->SetToolTip( _("Enables the collection and sharing of usage statistics data with the Dolphin development " @@ -106,6 +118,10 @@ void GeneralConfigPane::InitializeGUI() basic_settings_sizer->AddSpacer(space5); basic_settings_sizer->Add(m_cheats_checkbox, 0, wxLEFT | wxRIGHT, space5); basic_settings_sizer->AddSpacer(space5); +#ifdef USE_DISCORD_PRESENCE + basic_settings_sizer->Add(m_discord_presence_checkbox, 0, wxLEFT | wxRIGHT, space5); + basic_settings_sizer->AddSpacer(space5); +#endif basic_settings_sizer->Add(throttler_sizer); #if defined(USE_ANALYTICS) && USE_ANALYTICS @@ -145,6 +161,10 @@ void GeneralConfigPane::LoadGUIValues() m_dual_core_checkbox->SetValue(startup_params.bCPUThread); m_cheats_checkbox->SetValue(startup_params.bEnableCheats); +#ifdef USE_DISCORD_PRESENCE + m_discord_presence_checkbox->SetValue(Config::Get(Config::MAIN_USE_DISCORD_PRESENCE)); +#endif + #if defined(USE_ANALYTICS) && USE_ANALYTICS m_analytics_checkbox->SetValue(startup_params.m_analytics_enabled); #endif @@ -169,6 +189,11 @@ void GeneralConfigPane::BindEvents() m_cheats_checkbox->Bind(wxEVT_CHECKBOX, &GeneralConfigPane::OnCheatCheckBoxChanged, this); m_cheats_checkbox->Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreNotRunning); +#ifdef USE_DISCORD_PRESENCE + m_discord_presence_checkbox->Bind(wxEVT_CHECKBOX, + &GeneralConfigPane::OnDiscordPresenceCheckBoxChanged, this); +#endif + #if defined(USE_ANALYTICS) && USE_ANALYTICS m_analytics_checkbox->Bind(wxEVT_CHECKBOX, &GeneralConfigPane::OnAnalyticsCheckBoxChanged, this); @@ -194,6 +219,13 @@ void GeneralConfigPane::OnCheatCheckBoxChanged(wxCommandEvent& event) SConfig::GetInstance().bEnableCheats = m_cheats_checkbox->IsChecked(); } +#ifdef USE_DISCORD_PRESENCE +void GeneralConfigPane::OnDiscordPresenceCheckBoxChanged(wxCommandEvent& event) +{ + Discord::SetDiscordPresenceEnabled(m_discord_presence_checkbox->IsChecked()); +} +#endif + void GeneralConfigPane::OnThrottlerChoiceChanged(wxCommandEvent& event) { if (m_throttler_choice->GetSelection() != wxNOT_FOUND) |
