forked from markopoloparadox/ProjectPerun
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainWindow.h
102 lines (82 loc) · 3.01 KB
/
MainWindow.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 MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QTcpSocket>
#include <QtDebug>
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonArray>
#include <QUdpSocket>
#include <QSound>
#include <thread>
#include <QListWidgetItem>
#include <QMutex>
#include <QMap>
#include "ui_AddFriendWindow.h"
#include "ChatWindow.h"
#include "GameDetection.h"
#include "GameLibraryWindow.h"
#include "UsefulFunctions.h"
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QTcpSocket* socket, bool adminMode, QString username, QWidget *parent = 0);
~MainWindow();
void checkGameStatus();
void refreshGamesList();
void checkIfNewerGamesListExist();
Ui::MainWindow *ui;
QSound *snd;
QMutex fileHandlingMutex;
const QString username;
QMap<QString, ChatWindow*> groupChatMap;
GameLibraryWindow* gameLibWin = NULL;
Ui::AddFriendWindow* addFriendBox = NULL;
public slots:
private slots:
void on_addFriendButton_clicked();
void on_actionConfigureGameLibrary_triggered();
void on_currentStatusCBox_activated(const QString &arg1);
void on_listWidget_itemDoubleClicked(QListWidgetItem *item);
void on_userStatsButton_clicked();
void on_joinFriendButton_clicked();
void on_actionMyStats_triggered();
void on_actionMyScreenshots_triggered();
void on_instantChatButton_clicked();
void on_actionDisconnect_triggered();
void on_actionExit_triggered();
void on_tableWidget_cellDoubleClicked(int row, int column);
void onTcpMessageReceived();
private:
QTcpSocket* socket;
QString customStatus; //defines custom status message which can user set and other can see (AFK, Selling piglets, Looking for match 2 vs 2)
QString currentGame; //defines game which user currently plays - empty string if none is played
QMap<QString, ChatWindow*> privateChatMap;
std::thread *gameActivityListenerThread;
std::thread *globalShortcutListenerThread;
bool adminMode;
bool initialGamesListCheckingDone = false;
static QMap<QString, tPath> detectedGames;
void sendNotificationMessage (short tID, const char* customStatus, const char* playedGameName, const char* gameserverInfo);
void showGameStats (QJsonObject object);
void handleNewChatMessage (QJsonObject message);
void refreshFriendsList (QJsonObject message);
void requestGameActivityInfo (QString email);
void requestFriendsList ();
void getFriendsList(QJsonObject message);
void updateSupportedGamesList(QJsonObject message, int packetSize);
QString getFileLocationFromRegistryKey(QString registryKey);
void autoDetectGames();
void startProgram (const char* progName, const tGames& gameRecord, const char* ip=NULL, const char* port=NULL);
void processFriendRequest(QString username);
#if defined (_WIN32)
static void handleHotkeys (void *arg);
static HBITMAP getScreenBmp(HDC hdc);
#endif
static void listenGameActivity (void *arg);
};
#endif // MAINWINDOW_H