Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Add Discord Join Net Play functionally
- Loading branch information
Showing
9 changed files
with
265 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Copyright 2018 Dolphin Emulator Project | ||
// Licensed under GPLv2+ | ||
// Refer to the license.txt file included. | ||
|
||
#include "DolphinQt2/DiscordHandler.h" | ||
|
||
#include "Common/Thread.h" | ||
|
||
#include "UICommon/DiscordPresence.h" | ||
|
||
DiscordHandler::DiscordHandler() = default; | ||
|
||
DiscordHandler::~DiscordHandler() | ||
{ | ||
Stop(); | ||
} | ||
|
||
void DiscordHandler::Start() | ||
{ | ||
m_stop_requested.Set(false); | ||
m_thread = std::thread(&DiscordHandler::Run, this); | ||
} | ||
|
||
void DiscordHandler::Stop() | ||
{ | ||
m_stop_requested.Set(true); | ||
|
||
if (m_thread.joinable()) | ||
m_thread.join(); | ||
} | ||
|
||
void DiscordHandler::DiscordJoin() | ||
{ | ||
emit DiscordHandler::Join(); | ||
} | ||
|
||
void DiscordHandler::Run() | ||
{ | ||
while (!m_stop_requested.IsSet()) | ||
{ | ||
Common::SleepCurrentThread(1000 * 2); | ||
|
||
Discord::CallPendingCallbacks(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright 2018 Dolphin Emulator Project | ||
// Licensed under GPLv2+ | ||
// Refer to the license.txt file included. | ||
|
||
#pragma once | ||
|
||
#include <thread> | ||
|
||
#include <QObject> | ||
|
||
#include "Common/Flag.h" | ||
|
||
class DiscordHandler : public QObject | ||
{ | ||
Q_OBJECT | ||
public: | ||
explicit DiscordHandler(); | ||
~DiscordHandler(); | ||
|
||
void Start(); | ||
void Stop(); | ||
void DiscordJoin(); | ||
signals: | ||
void Join(); | ||
|
||
private: | ||
void Run(); | ||
Common::Flag m_stop_requested; | ||
std::thread m_thread; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.