[App] Initialize/Shutdown discord presence on program start/quit
This commit is contained in:
parent
3726089246
commit
333f55d27a
|
@ -23,6 +23,7 @@
|
||||||
#include <QFontDatabase>
|
#include <QFontDatabase>
|
||||||
#include <QtPlugin>
|
#include <QtPlugin>
|
||||||
|
|
||||||
|
#include "discord/discord_presence.h"
|
||||||
#include "xenia/base/logging.h"
|
#include "xenia/base/logging.h"
|
||||||
#include "xenia/config.h"
|
#include "xenia/config.h"
|
||||||
#include "xenia/ui/qt/loop_qt.h"
|
#include "xenia/ui/qt/loop_qt.h"
|
||||||
|
@ -65,6 +66,7 @@ DEFINE_transient_bool(portable, false,
|
||||||
DEFINE_bool(discord, true, "Enable Discord rich presence", "General");
|
DEFINE_bool(discord, true, "Enable Discord rich presence", "General");
|
||||||
|
|
||||||
DECLARE_bool(debug);
|
DECLARE_bool(debug);
|
||||||
|
|
||||||
namespace xe {
|
namespace xe {
|
||||||
namespace app {
|
namespace app {
|
||||||
|
|
||||||
|
@ -102,6 +104,11 @@ int xenia_main(const std::vector<std::string>& args) {
|
||||||
|
|
||||||
Config::Instance().SetupConfig(storage_root);
|
Config::Instance().SetupConfig(storage_root);
|
||||||
|
|
||||||
|
if (cvars::discord) {
|
||||||
|
discord::DiscordPresence::Initialize();
|
||||||
|
discord::DiscordPresence::NotPlaying();
|
||||||
|
}
|
||||||
|
|
||||||
int argc = 1;
|
int argc = 1;
|
||||||
char* argv[] = {"xenia", nullptr};
|
char* argv[] = {"xenia", nullptr};
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
@ -120,6 +127,11 @@ int xenia_main(const std::vector<std::string>& args) {
|
||||||
main_wnd->SetIcon(QIcon(":/resources/graphics/icon.ico"));
|
main_wnd->SetIcon(QIcon(":/resources/graphics/icon.ico"));
|
||||||
main_wnd->Resize(1280, 720);
|
main_wnd->Resize(1280, 720);
|
||||||
|
|
||||||
|
loop.on_quit.AddListener([](ui::UIEvent*) {
|
||||||
|
if (cvars::discord) {
|
||||||
|
discord::DiscordPresence::Shutdown();
|
||||||
|
}
|
||||||
|
});
|
||||||
/*
|
/*
|
||||||
if (FLAGS_mount_scratch) {
|
if (FLAGS_mount_scratch) {
|
||||||
auto scratch_device = std::make_unique<xe::vfs::HostPathDevice>(
|
auto scratch_device = std::make_unique<xe::vfs::HostPathDevice>(
|
||||||
|
|
Loading…
Reference in New Issue