Add option to disable Discord Presence in Qt UI
This commit is contained in:
parent
d9351a5b45
commit
ae2337aff6
|
@ -19,6 +19,10 @@
|
||||||
#include "DolphinQt2/Settings.h"
|
#include "DolphinQt2/Settings.h"
|
||||||
#include "InputCommon/InputConfig.h"
|
#include "InputCommon/InputConfig.h"
|
||||||
|
|
||||||
|
#ifdef USE_DISCORD_PRESENCE
|
||||||
|
#include "UICommon/DiscordPresence.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
Settings::Settings()
|
Settings::Settings()
|
||||||
{
|
{
|
||||||
qRegisterMetaType<Core::State>();
|
qRegisterMetaType<Core::State>();
|
||||||
|
@ -476,3 +480,19 @@ void Settings::SetBatchModeEnabled(bool batch)
|
||||||
{
|
{
|
||||||
m_batch = batch;
|
m_batch = batch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef USE_DISCORD_PRESENCE
|
||||||
|
void Settings::SetDiscordPresenceEnabled(bool enabled)
|
||||||
|
{
|
||||||
|
if (SConfig::GetInstance().bUseDiscordPresence == enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (SConfig::GetInstance().bUseDiscordPresence)
|
||||||
|
Discord::Shutdown();
|
||||||
|
|
||||||
|
SConfig::GetInstance().bUseDiscordPresence = enabled;
|
||||||
|
|
||||||
|
if (SConfig::GetInstance().bUseDiscordPresence)
|
||||||
|
Discord::Init();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
|
@ -127,6 +127,9 @@ public:
|
||||||
|
|
||||||
// Other
|
// Other
|
||||||
GameListModel* GetGameListModel() const;
|
GameListModel* GetGameListModel() const;
|
||||||
|
#ifdef USE_DISCORD_PRESENCE
|
||||||
|
void SetDiscordPresenceEnabled(bool enabled);
|
||||||
|
#endif
|
||||||
signals:
|
signals:
|
||||||
void ConfigChanged();
|
void ConfigChanged();
|
||||||
void EmulationStateChanged(Core::State new_state);
|
void EmulationStateChanged(Core::State new_state);
|
||||||
|
|
|
@ -85,6 +85,9 @@ void GeneralPane::ConnectLayout()
|
||||||
{
|
{
|
||||||
connect(m_checkbox_dualcore, &QCheckBox::toggled, this, &GeneralPane::OnSaveConfig);
|
connect(m_checkbox_dualcore, &QCheckBox::toggled, this, &GeneralPane::OnSaveConfig);
|
||||||
connect(m_checkbox_cheats, &QCheckBox::toggled, this, &GeneralPane::OnSaveConfig);
|
connect(m_checkbox_cheats, &QCheckBox::toggled, this, &GeneralPane::OnSaveConfig);
|
||||||
|
#ifdef USE_DISCORD_PRESENCE
|
||||||
|
connect(m_checkbox_discord_presence, &QCheckBox::toggled, this, &GeneralPane::OnSaveConfig);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (AutoUpdateChecker::SystemSupportsAutoUpdates())
|
if (AutoUpdateChecker::SystemSupportsAutoUpdates())
|
||||||
{
|
{
|
||||||
|
@ -123,6 +126,11 @@ void GeneralPane::CreateBasic()
|
||||||
m_checkbox_cheats = new QCheckBox(tr("Enable Cheats"));
|
m_checkbox_cheats = new QCheckBox(tr("Enable Cheats"));
|
||||||
basic_group_layout->addWidget(m_checkbox_cheats);
|
basic_group_layout->addWidget(m_checkbox_cheats);
|
||||||
|
|
||||||
|
#ifdef USE_DISCORD_PRESENCE
|
||||||
|
m_checkbox_discord_presence = new QCheckBox(tr("Show Activity in Your Discord Status"));
|
||||||
|
basic_group_layout->addWidget(m_checkbox_discord_presence);
|
||||||
|
#endif
|
||||||
|
|
||||||
auto* speed_limit_layout = new QFormLayout;
|
auto* speed_limit_layout = new QFormLayout;
|
||||||
basic_group_layout->addLayout(speed_limit_layout);
|
basic_group_layout->addLayout(speed_limit_layout);
|
||||||
|
|
||||||
|
@ -215,6 +223,9 @@ void GeneralPane::LoadConfig()
|
||||||
#endif
|
#endif
|
||||||
m_checkbox_dualcore->setChecked(SConfig::GetInstance().bCPUThread);
|
m_checkbox_dualcore->setChecked(SConfig::GetInstance().bCPUThread);
|
||||||
m_checkbox_cheats->setChecked(Settings::Instance().GetCheatsEnabled());
|
m_checkbox_cheats->setChecked(Settings::Instance().GetCheatsEnabled());
|
||||||
|
#ifdef USE_DISCORD_PRESENCE
|
||||||
|
m_checkbox_discord_presence->setChecked(SConfig::GetInstance().bUseDiscordPresence);
|
||||||
|
#endif
|
||||||
int selection = qRound(SConfig::GetInstance().m_EmulationSpeed * 10);
|
int selection = qRound(SConfig::GetInstance().m_EmulationSpeed * 10);
|
||||||
if (selection < m_combobox_speedlimit->count())
|
if (selection < m_combobox_speedlimit->count())
|
||||||
m_combobox_speedlimit->setCurrentIndex(selection);
|
m_combobox_speedlimit->setCurrentIndex(selection);
|
||||||
|
@ -260,6 +271,10 @@ void GeneralPane::OnSaveConfig()
|
||||||
UpdateTrackFromIndex(m_combobox_update_track->currentIndex()));
|
UpdateTrackFromIndex(m_combobox_update_track->currentIndex()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef USE_DISCORD_PRESENCE
|
||||||
|
Settings::Instance().SetDiscordPresenceEnabled(m_checkbox_discord_presence->isChecked());
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(USE_ANALYTICS) && USE_ANALYTICS
|
#if defined(USE_ANALYTICS) && USE_ANALYTICS
|
||||||
Settings::Instance().SetAnalyticsEnabled(m_checkbox_enable_analytics->isChecked());
|
Settings::Instance().SetAnalyticsEnabled(m_checkbox_enable_analytics->isChecked());
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -44,6 +44,9 @@ private:
|
||||||
QComboBox* m_combobox_update_track;
|
QComboBox* m_combobox_update_track;
|
||||||
QCheckBox* m_checkbox_dualcore;
|
QCheckBox* m_checkbox_dualcore;
|
||||||
QCheckBox* m_checkbox_cheats;
|
QCheckBox* m_checkbox_cheats;
|
||||||
|
#ifdef USE_DISCORD_PRESENCE
|
||||||
|
QCheckBox* m_checkbox_discord_presence;
|
||||||
|
#endif
|
||||||
QLabel* m_label_speedlimit;
|
QLabel* m_label_speedlimit;
|
||||||
|
|
||||||
std::vector<QRadioButton*> m_cpu_cores;
|
std::vector<QRadioButton*> m_cpu_cores;
|
||||||
|
|
|
@ -51,6 +51,7 @@ void Shutdown()
|
||||||
if (!SConfig::GetInstance().bUseDiscordPresence)
|
if (!SConfig::GetInstance().bUseDiscordPresence)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Discord_ClearPresence();
|
||||||
Discord_Shutdown();
|
Discord_Shutdown();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue