Move Discord Rich Presence behind a compile-time option

This commit is contained in:
David Hrdlička
2023-02-01 17:17:56 +01:00
parent 4ebbeec488
commit 7490bb12c9
27 changed files with 90 additions and 6 deletions

View File

@@ -39,7 +39,9 @@ extern "C" {
#include <86box/keyboard.h>
#include <86box/plat.h>
#include <86box/ui.h>
#include <86box/discord.h>
#ifdef DISCORD
# include <86box/discord.h>
#endif
#include <86box/device.h>
#include <86box/video.h>
#include <86box/machine.h>
@@ -305,6 +307,10 @@ MainWindow::MainWindow(QWidget *parent)
ui->actionEnable_Discord_integration->setChecked(enable_discord);
ui->actionApply_fullscreen_stretch_mode_when_maximized->setChecked(video_fullscreen_scale_maximized);
#ifndef DISCORD
ui->actionEnable_Discord_integration->setVisible(false);
#endif
#if defined Q_OS_WINDOWS || defined Q_OS_MACOS
/* Make the option visible only if ANGLE is loaded. */
ui->actionHardware_Renderer_OpenGL_ES->setVisible(QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGLES);
@@ -2292,11 +2298,13 @@ void
MainWindow::on_actionEnable_Discord_integration_triggered(bool checked)
{
enable_discord = checked;
#ifdef DISCORD
if (enable_discord) {
discord_init();
discord_update_activity(dopause);
} else
discord_close();
#endif
}
void