-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathdiscordmanager.h
102 lines (82 loc) · 2.18 KB
/
discordmanager.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#ifndef DISCORDMANAGER_H
#define DISCORDMANAGER_H
#ifdef DISCORD_ENABLED
#include <QString>
#include <QObject>
#include <QMutex>
namespace discord {
class Core;
class User;
}
class QTimer;
class QSettings;
namespace Yate {
class DiscordManager : public QObject
{
Q_OBJECT
public:
explicit DiscordManager(QObject *parent = nullptr);
~DiscordManager();
const QString &activityDetails() const;
const QString &activityState() const;
bool running() const;
bool isHost() const;
void setIsHost(bool newIsHost);
const QString &getLobbyId() const;
void setLobbyId(const QString &newLobbyId);
const QString &getPeerLobbyId() const;
void setPeerLobbyId(const QString &newPeerLobbyId);
public slots:
void start();
void stop();
void update();
void updateActivity();
void clearActivity();
void setActivityState(const QString &newActivityState);
void setActivityDetails(const QString &newActivityDetails);
void setSquadString(QString msg);
signals:
void ready();
void failed(QString err);
void onLobbyIdChange(QString id);
void onPeerIdChange(QString id);
void onUserConnected(QString name);
void connectionSucceeded();
void connectionFailed();
void onLobbyDisconnect();
void onInviteAccepted(QString secret);
private:
void setup(bool emitErrors = true);
discord::Core* core_;
discord::User* currentUser_;
QTimer *updateTimer_;
QTimer *messageBufferTimer_;
QString currentActivityDetails_;
QString currentActivityState_;
QString currentActivityImageText_;
QString activityDetails_;
QString activityState_;
QString activityImageText_;
QSettings *settings_;
QString ch1Buffer;
QString ch2Buffer;
QString ch3Buffer;
QMutex bufferMutex_;
QAtomicInt ready_;
QAtomicInt failed_;
QAtomicInt running_;
QAtomicInt activityInit_;
int currentPartySize_;
int activityPartySize_;
QString activityLobbyId_;
QString lobbyId_;
QString lobbyUsername_;
QString peerLobbyId_;
char appCommand[2048];
bool isHost_;
bool activityIsHost_;
bool commandRegistered_;
};
}
#endif
#endif // DISCORDMANAGER_H