Fix build when -DENABLE_DISCORD_RPC=OFF (#1551)
Some checks are pending
Build and Release / reuse (push) Waiting to run
Build and Release / clang-format (push) Waiting to run
Build and Release / get-info (push) Waiting to run
Build and Release / windows-sdl (push) Blocked by required conditions
Build and Release / windows-qt (push) Blocked by required conditions
Build and Release / macos-sdl (push) Blocked by required conditions
Build and Release / macos-qt (push) Blocked by required conditions
Build and Release / linux-sdl (push) Blocked by required conditions
Build and Release / linux-qt (push) Blocked by required conditions
Build and Release / pre-release (push) Blocked by required conditions

* added ifdef for discordrpc

* replaced discordrpc include correctly
This commit is contained in:
Alexander Y. 2024-11-20 07:41:35 +01:00 committed by GitHub
parent 17c47bcd96
commit 9f42a12baf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 8 additions and 3 deletions

View File

@ -3,7 +3,7 @@
#include <cstring>
#include <ctime>
#include "src/common/discord_rpc_handler.h"
#include "discord_rpc_handler.h"
namespace DiscordRPCHandler {

View File

@ -22,6 +22,9 @@
#include "main_window.h"
#include "settings_dialog.h"
#include "video_core/renderer_vulkan/vk_instance.h"
#ifdef ENABLE_DISCORD_RPC
#include "common/discord_rpc_handler.h"
#endif
MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent), ui(new Ui::MainWindow) {
ui->setupUi(this);
@ -76,12 +79,13 @@ bool MainWindow::Init() {
"Games: " + QString::number(numGames) + " (" + QString::number(duration.count()) + "ms)";
statusBar->showMessage(statusMessage);
// Initialize Discord RPC
#ifdef ENABLE_DISCORD_RPC
if (Config::getEnableDiscordRPC()) {
auto* rpc = Common::Singleton<DiscordRPCHandler::RPC>::Instance();
rpc->init();
rpc->setStatusIdling();
}
#endif
return true;
}

View File

@ -9,7 +9,6 @@
#include "background_music_player.h"
#include "common/config.h"
#include "common/discord_rpc_handler.h"
#include "common/path_util.h"
#include "core/file_format/psf.h"
#include "core/file_sys/fs.h"

View File

@ -173,6 +173,7 @@ SettingsDialog::SettingsDialog(std::span<const QString> physical_devices, QWidge
BackgroundMusicPlayer::getInstance().setVolume(val);
});
#ifdef ENABLE_DISCORD_RPC
connect(ui->discordRPCCheckbox, &QCheckBox::stateChanged, this, [](int val) {
Config::setEnableDiscordRPC(val);
auto* rpc = Common::Singleton<DiscordRPCHandler::RPC>::Instance();
@ -183,6 +184,7 @@ SettingsDialog::SettingsDialog(std::span<const QString> physical_devices, QWidge
rpc->shutdown();
}
});
#endif
}
// Input TAB