-
Notifications
You must be signed in to change notification settings - Fork 8
/
urtupdater.h
160 lines (127 loc) · 3.76 KB
/
urtupdater.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
/**
* Urban Terror Updater
*
* This software is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* @version 4.0.3
* @author Charles 'Barbatos' Duprey
* @email barbatos@urbanterror.info
* @copyright 2013-2023 Frozensand Games Limited
*/
#ifndef URTUPDATER_H
#define URTUPDATER_H
#include <QMainWindow>
#include <QCloseEvent>
#include "common.h"
#include "download.h"
#include "settings.h"
namespace Ui {
class UrTUpdater;
}
class UrTUpdater : public QMainWindow
{
Q_OBJECT
public:
explicit UrTUpdater(QWidget *parent = 0);
~UrTUpdater();
QNetworkReply *apiAnswer;
public slots:
bool init();
void startDlThread();
void work();
void updateCheckStatus(int progress, QString status);
void setDLValueP(qint64 r, qint64 t);
QString getPlatform();
QString getCurrentPath();
QString getBundlePath();
void parseAPIAnswer();
void getManifest(QString query);
void parseManifest(QString data);
QString getServerUrlById(int);
QString getEngineLaunchStringById(int id);
QString getSize(int *bytes);
int getTotalSizeToDl();
void parseLocalConfig();
void saveLocalConfig();
void checkDownloadServer();
void checkGameEngine();
void checkVersion();
void checkAPIVersion();
void checkFiles();
void openSettings();
void openHelpPage();
void openAboutPage();
void openChangelogPage();
void openLicencePage();
void setSettings(int, int, int, int);
void drawNews();
void bytesDownloaded(qint64, QString, int, int);
void downloadFiles();
void fileDownloaded();
void setLoadingIcon(int);
void setPlayIcon(int);
void folderError(QString);
void networkError(QNetworkReply::NetworkError);
void apiError();
void launchGame();
void updateDlLabel(QString);
signals:
void dlFile(QString, QString, int, QString);
void checkingChanged(int percent, QString status);
void requestNewDlLabel(QString);
private:
Ui::UrTUpdater *ui;
void closeEvent(QCloseEvent*);
bool updateInProgress;
bool readyToProcess;
bool firstLaunch;
QString updaterPath;
QString changelog;
QString licenceText;
QString updaterVersion;
QString password;
QString apiVersion;
QThread* dlThread;
Download* dl;
bool threadStarted;
int downloadServer;
int gameEngine;
int currentVersion;
int askBeforeUpdating;
bool configFileExists;
int nbFilesToDl;
int nbFilesDled;
int downloadedBytes;
int totalSizeToDl;
QProgressBar* dlBar;
QProgressBar* globalDlBar;
QLabel* globalDlText;
QLabel* dlText;
QLabel* currentChecksum;
QLabel* dlSpeed;
QLabel* dlSize;
QPushButton* playButton;
QPushButton* changelogButton;
QList<fileInfo_s> filesToDownload;
QList<serverInfo_s> downloadServers;
QList<engineInfo_s> enginesList;
QList<versionInfo_s> versionsList;
QList<QString> newsList;
QList<QString> packsList;
fileInfo_s currentFile;
QMovie* loaderAnim;
QMovie* playAnim;
};
#endif // URTUPDATER_H