This repository has been archived by the owner on Oct 31, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
xdcc.h
161 lines (120 loc) · 3.47 KB
/
xdcc.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
/*
Copyright 2011 Gene Chen
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#ifndef XDCC_H
#define XDCC_H
#ifdef WIN32
#include <Windows.h>
#ifdef _DEBUG
#include <vld.h>
#endif
#endif
#include "ui_xdcc_main.h"
#include <QtGui>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QXmlStreamReader>
#include <QDebug>
#include <QMessageBox>
#include <QTimer>
#include <qlocalserver.h>
#include <qlocalsocket.h>
#include <QSettings>
#include <QStringList>
#include <QSystemTrayIcon>
class GameRequester;
class CGProxy;
class UpdateForm;
class LoginForm;
class SettingsForm;
class ApiFetcher;
struct GameInfo;
struct QueueInfo;
struct PlayerInfo;
class XDCC : public QMainWindow
{
Q_OBJECT
public:
explicit XDCC(QWidget *parent = 0, Qt::WFlags flags = 0);
~XDCC();
bool createConnection();
void SetUsername(QString nUsername) { m_Username = nUsername; ui.lbl_Account->setText(m_Username); }
void SetScore(quint32 nScore) { m_Score = nScore; ui.lbl_Rating->setText(QString::number(m_Score)); }
void SetRank(quint32 nRank) { m_Rank = nRank; ui.lbl_Rank->setText(QString::number(m_Rank)); }
void SetSessionID(QString nSessionID) { m_SessionID = nSessionID; }
QString GetUsername() { return m_Username; }
quint32 GetScore() { return m_Score; }
quint32 GetRank() { return m_Rank; }
QString GetSessionID() { return m_SessionID; }
void activate();
QSystemTrayIcon *trayIcon;
public slots:
void tick();
void newConnection();
void readData();
void handleChat();
void gameDoubleClicked(int, int);
void gameClicked(int, int);
void parseGamesXml(QString&);
void parseQueueXml(QString&);
void parsePlayersXml(QString&);
void showMessage(QString, int);
void notifyMessage(QString title, QString message, int);
void checkForUpdates();
void showAbout();
void showSettings();
void requestGame(QString);
void updateFromURL(QString&);
private slots:
void messageClicked();
void trayIconClicked(QSystemTrayIcon::ActivationReason);
void showHideWindow();
private:
Ui::xDCCClass ui;
// Tray Icon Functions
void createTrayActions();
void createTrayIcon();
void setTrayIcon();
void closeEvent(QCloseEvent *);
void changeEvent(QEvent *);
UpdateForm* m_UpdateForm;
LoginForm* m_LoginForm;
SettingsForm* m_SettingsForm;
QSettings* m_Settings;
QString m_Username;
quint32 m_Score;
quint32 m_Rank;
QString m_SessionID;
QTimer* m_Timer;
QLocalServer* m_LocalServer;
QLocalSocket* m_ClientConnection;
CGProxy* m_CGProxy;
QVector<GameInfo*> m_GameInfos;
QVector<QueueInfo*> m_QueueInfos;
QVector<PlayerInfo*> m_PlayerInfos;
int m_CurrentType;
QString m_CurrentID;
QString m_Skin;
bool m_Active;
bool eventFilter(QObject *obj, QEvent *event);
ApiFetcher* m_PlayersFetcher;
ApiFetcher* m_GamesFetcher;
ApiFetcher* m_QueueFetcher;
QAction *minimizeAction;
QAction *maximizeAction;
QAction *restoreAction;
QAction *quitAction;
QMenu *trayIconMenu;
QAction *showHideTray;
QAction *closeTray;
};
#endif // XDCC_H