forked from Dust1404/Project_LemonPlus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
contestserver.h
52 lines (44 loc) · 1.32 KB
/
contestserver.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
#ifndef CONTESTSERVER_H
#define CONTESTSERVER_H
#include "contest.h"
#include <QObject>
#include <QTcpServer>
#include <QSet>
#include <QString>
#include <QSignalMapper>
class ContestServer : public QTcpServer
{
Q_OBJECT
public:
explicit ContestServer(QObject *parent = nullptr);
explicit ContestServer(QObject *parent = nullptr, Contest *contest = nullptr);
QSet<QString> failure;
Contest *getContest() const;
void setContest(Contest *value);
bool isContestantOnline(const QString &name);
void appendOnline(const QString &);
void removeOnline(const QString &);
int onlineCount() const;
QSet<QString>* getFailure() const;
signals:
void collectCodeSignal();
void sendCollectRequest();
void showStartCollecting(const QString &);
void showFinishCollecting(const QString &);
void stopAllClients();
public slots:
void startServer();
void stopServer();
protected:
void incomingConnection(qintptr socketDescriptor) override;
private:
QThread *workerThread;
Contest *contest = nullptr;
QSet<QString> onlineContestant;
private slots:
void collectCode();
void startCollecting(const QString &);
void finishCollecting(const QString &);
void appendFailure(const QString &);
};
#endif // CONTESTSERVER_H