2015-06-03 18:13:01 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 10:23:14 +00:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2015-06-03 18:13:01 +00:00
|
|
|
|
2018-01-03 10:23:14 +00:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2015-06-03 18:13:01 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2015-08-19 22:00:37 +00:00
|
|
|
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
|
|
|
|
2015-06-03 18:13:01 +00:00
|
|
|
#include <QtNetwork/QLocalSocket>
|
|
|
|
#include <QtNetwork/QLocalServer>
|
|
|
|
#include <QtNetwork/QNetworkReply>
|
|
|
|
|
2016-01-11 15:43:29 +00:00
|
|
|
class UpdateChecker : public QObject {
|
2015-06-03 18:13:01 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2016-01-11 15:43:29 +00:00
|
|
|
UpdateChecker(QThread *thread, const QString &url);
|
2015-06-03 18:13:01 +00:00
|
|
|
|
|
|
|
void unpackUpdate();
|
|
|
|
|
|
|
|
int32 ready();
|
|
|
|
int32 size();
|
|
|
|
|
|
|
|
static void clearAll();
|
|
|
|
|
2016-01-11 15:43:29 +00:00
|
|
|
~UpdateChecker();
|
2015-06-03 18:13:01 +00:00
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
|
|
|
void start();
|
|
|
|
void partMetaGot();
|
|
|
|
void partFinished(qint64 got, qint64 total);
|
|
|
|
void partFailed(QNetworkReply::NetworkError e);
|
|
|
|
void sendRequest();
|
|
|
|
|
|
|
|
private:
|
|
|
|
void initOutput();
|
|
|
|
|
|
|
|
void fatalFail();
|
|
|
|
|
|
|
|
QString updateUrl;
|
|
|
|
QNetworkAccessManager manager;
|
|
|
|
QNetworkReply *reply;
|
|
|
|
int32 already, full;
|
|
|
|
QFile outputFile;
|
|
|
|
|
|
|
|
QMutex mutex;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
bool checkReadyUpdate();
|
2015-08-19 22:00:37 +00:00
|
|
|
|
2016-08-28 19:16:23 +00:00
|
|
|
#else // TDESKTOP_DISABLE_AUTOUPDATE
|
2016-01-11 15:43:29 +00:00
|
|
|
class UpdateChecker : public QObject {
|
2015-12-18 01:48:29 +00:00
|
|
|
Q_OBJECT
|
|
|
|
};
|
2015-12-03 18:16:34 +00:00
|
|
|
|
2016-08-28 19:16:23 +00:00
|
|
|
#endif // TDESKTOP_DISABLE_AUTOUPDATE
|
2015-12-18 01:48:29 +00:00
|
|
|
|
|
|
|
QString countBetaVersionSignature(uint64 version);
|