Add Discord Presence setting to Achievement Settings dialog
Setting is only enabled when Rich Presence is enabled. Toggling either Rich Presence or Discord Presence will immediately update the Discord status.
This commit is contained in:
parent
57c8ea12ed
commit
2328539a76
|
@ -13,9 +13,11 @@
|
|||
#include "Core/Config/AchievementSettings.h"
|
||||
#include "Core/Config/FreeLookSettings.h"
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/Config/UISettings.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/Movie.h"
|
||||
#include "Core/System.h"
|
||||
#include "UICommon/DiscordPresence.h"
|
||||
|
||||
#include "DolphinQt/Config/ControllerInterface/ControllerInterfaceWindow.h"
|
||||
#include "DolphinQt/Config/ToolTipControls/ToolTipCheckBox.h"
|
||||
|
@ -94,6 +96,10 @@ void AchievementSettingsWidget::CreateLayout()
|
|||
"submitted to the server.<br><br>If this is on at game launch, it will not be turned off "
|
||||
"until game close, because a RetroAchievements session will not be created.<br><br>If "
|
||||
"this is off at game launch, it can be toggled freely while the game is running."));
|
||||
m_common_discord_presence_enabled_input = new ToolTipCheckBox(tr("Enable Discord Presence"));
|
||||
m_common_discord_presence_enabled_input->SetDescription(
|
||||
tr("Use RetroAchievements rich presence in your Discord status.<br><br>Show Current Game on "
|
||||
"Discord must be enabled."));
|
||||
m_common_progress_enabled_input = new ToolTipCheckBox(tr("Enable Progress Notifications"));
|
||||
m_common_progress_enabled_input->SetDescription(
|
||||
tr("Enable progress notifications on achievements.<br><br>Displays a brief popup message "
|
||||
|
@ -119,6 +125,9 @@ void AchievementSettingsWidget::CreateLayout()
|
|||
m_common_layout->addWidget(m_common_encore_enabled_input);
|
||||
m_common_layout->addWidget(m_common_spectator_enabled_input);
|
||||
m_common_layout->addWidget(new QLabel(tr("Display Settings")));
|
||||
#ifdef USE_DISCORD_PRESENCE
|
||||
m_common_layout->addWidget(m_common_discord_presence_enabled_input);
|
||||
#endif // USE_DISCORD_PRESENCE
|
||||
m_common_layout->addWidget(m_common_progress_enabled_input);
|
||||
m_common_layout->addWidget(m_common_badges_enabled_input);
|
||||
|
||||
|
@ -140,6 +149,8 @@ void AchievementSettingsWidget::ConnectWidgets()
|
|||
&AchievementSettingsWidget::ToggleEncore);
|
||||
connect(m_common_spectator_enabled_input, &QCheckBox::toggled, this,
|
||||
&AchievementSettingsWidget::ToggleSpectator);
|
||||
connect(m_common_discord_presence_enabled_input, &QCheckBox::toggled, this,
|
||||
&AchievementSettingsWidget::ToggleDiscordPresence);
|
||||
connect(m_common_progress_enabled_input, &QCheckBox::toggled, this,
|
||||
&AchievementSettingsWidget::ToggleProgress);
|
||||
connect(m_common_badges_enabled_input, &QCheckBox::toggled, this,
|
||||
|
@ -195,6 +206,11 @@ void AchievementSettingsWidget::LoadSettings()
|
|||
->setChecked(Config::Get(Config::RA_SPECTATOR_ENABLED));
|
||||
SignalBlocking(m_common_spectator_enabled_input)->setEnabled(enabled);
|
||||
|
||||
SignalBlocking(m_common_discord_presence_enabled_input)
|
||||
->setChecked(Config::Get(Config::RA_DISCORD_PRESENCE_ENABLED));
|
||||
SignalBlocking(m_common_discord_presence_enabled_input)
|
||||
->setEnabled(enabled && Config::Get(Config::MAIN_USE_DISCORD_PRESENCE));
|
||||
|
||||
SignalBlocking(m_common_progress_enabled_input)
|
||||
->setChecked(Config::Get(Config::RA_PROGRESS_ENABLED));
|
||||
SignalBlocking(m_common_progress_enabled_input)->setEnabled(enabled);
|
||||
|
@ -215,6 +231,8 @@ void AchievementSettingsWidget::SaveSettings()
|
|||
Config::SetBaseOrCurrent(Config::RA_ENCORE_ENABLED, m_common_encore_enabled_input->isChecked());
|
||||
Config::SetBaseOrCurrent(Config::RA_SPECTATOR_ENABLED,
|
||||
m_common_spectator_enabled_input->isChecked());
|
||||
Config::SetBaseOrCurrent(Config::RA_DISCORD_PRESENCE_ENABLED,
|
||||
m_common_discord_presence_enabled_input->isChecked());
|
||||
Config::SetBaseOrCurrent(Config::RA_PROGRESS_ENABLED,
|
||||
m_common_progress_enabled_input->isChecked());
|
||||
Config::SetBaseOrCurrent(Config::RA_BADGES_ENABLED, m_common_badges_enabled_input->isChecked());
|
||||
|
@ -279,6 +297,12 @@ void AchievementSettingsWidget::ToggleSpectator()
|
|||
AchievementManager::GetInstance().SetSpectatorMode();
|
||||
}
|
||||
|
||||
void AchievementSettingsWidget::ToggleDiscordPresence()
|
||||
{
|
||||
SaveSettings();
|
||||
Discord::UpdateDiscordPresence();
|
||||
}
|
||||
|
||||
void AchievementSettingsWidget::ToggleProgress()
|
||||
{
|
||||
SaveSettings();
|
||||
|
|
|
@ -36,6 +36,7 @@ private:
|
|||
void ToggleUnofficial();
|
||||
void ToggleEncore();
|
||||
void ToggleSpectator();
|
||||
void ToggleDiscordPresence();
|
||||
void ToggleProgress();
|
||||
void ToggleBadges();
|
||||
|
||||
|
@ -53,6 +54,7 @@ private:
|
|||
ToolTipCheckBox* m_common_unofficial_enabled_input;
|
||||
ToolTipCheckBox* m_common_encore_enabled_input;
|
||||
ToolTipCheckBox* m_common_spectator_enabled_input;
|
||||
ToolTipCheckBox* m_common_discord_presence_enabled_input;
|
||||
ToolTipCheckBox* m_common_progress_enabled_input;
|
||||
ToolTipCheckBox* m_common_badges_enabled_input;
|
||||
};
|
||||
|
|
|
@ -351,6 +351,9 @@ void GeneralPane::OnSaveConfig()
|
|||
|
||||
#ifdef USE_DISCORD_PRESENCE
|
||||
Discord::SetDiscordPresenceEnabled(m_checkbox_discord_presence->isChecked());
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
emit Settings::Instance().ConfigChanged();
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
#endif
|
||||
|
||||
#if defined(USE_ANALYTICS) && USE_ANALYTICS
|
||||
|
|
Loading…
Reference in New Issue