dolphin/Source/Core/DolphinQt/DiscordHandler.h

52 lines
1.2 KiB
C
Raw Normal View History

// Copyright 2018 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include <list>
2018-08-06 15:56:40 -06:00
#include <mutex>
#include <thread>
#include <QObject>
#include "Common/Event.h"
#include "Common/Flag.h"
#include "UICommon/DiscordPresence.h"
2018-08-06 15:56:40 -06:00
class DiscordJoinRequestDialog;
class DiscordHandler : public QObject, public Discord::Handler
{
Q_OBJECT
2018-08-06 15:56:40 -06:00
#ifdef USE_DISCORD_PRESENCE
public:
explicit DiscordHandler(QWidget* parent);
~DiscordHandler();
void Start();
void Stop();
void DiscordJoin() override;
void DiscordJoinRequest(const char* id, const std::string& discord_tag,
const char* avatar) override;
2018-08-06 15:56:40 -06:00
void ShowNewJoinRequest(const std::string& id, const std::string& discord_tag,
const std::string& avatar);
#endif
signals:
void Join();
2018-08-06 15:56:40 -06:00
void JoinRequest(const std::string id, const std::string discord_tag, const std::string avatar);
2018-08-06 15:56:40 -06:00
#ifdef USE_DISCORD_PRESENCE
private:
void Run();
QWidget* m_parent;
Common::Flag m_stop_requested;
Common::Event m_wakeup_event;
std::thread m_thread;
std::list<DiscordJoinRequestDialog> m_request_dialogs;
2018-08-06 15:56:40 -06:00
std::mutex m_request_dialogs_mutex;
#endif
};