30 lines
677 B
C++
30 lines
677 B
C++
#ifndef UPDATECHECKER_H
|
|
#define UPDATECHECKER_H
|
|
|
|
#include <QObject>
|
|
#include <QJsonObject>
|
|
|
|
class QNetworkAccessManager;
|
|
class QNetworkReply;
|
|
|
|
#define APP_VERSION "1.0.2"
|
|
|
|
class UpdateChecker : public QObject {
|
|
Q_OBJECT
|
|
public:
|
|
static UpdateChecker& instance();
|
|
void checkForUpdate(const QString& serverBaseUrl, bool silent = false);
|
|
|
|
private:
|
|
explicit UpdateChecker(QObject* parent = nullptr);
|
|
void onCheckFinished(QNetworkReply* reply, bool silent);
|
|
void showUpdateDialog(const QJsonObject& info);
|
|
void downloadAndInstall(const QString& urlPath);
|
|
|
|
QNetworkAccessManager* _nam = nullptr;
|
|
QString _baseUrl;
|
|
QString _httpBase;
|
|
};
|
|
|
|
#endif
|