-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathupdateform.h
47 lines (38 loc) · 1.35 KB
/
updateform.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
#ifndef UPDATEFORM_H
#define UPDATEFORM_H
#include <QWidget>
#include <QDialog>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QSslSocket>
#include <QtDebug>
#include <functional>
#include "Utils/systemapi.h"
#include <QWinTaskbarButton>
#include <QWinTaskbarProgress>
namespace Ui {
class UpdateForm;
}
class UpdateForm : public QDialog {
Q_OBJECT
public:
explicit UpdateForm(QWidget *parent = nullptr);
~UpdateForm();
QUrl getRedirectTarget(QNetworkReply* reply);
void download(const QUrl& url, const QString& path, std::function<void(bool)> todo);
void getDownloadUrl(const QString& htmlUrl, std::function<void(QMap<QString, QString>)> todo);
QMap<QString, QString> parseHtml(const QString& html);
void updateLatestGiteeRelease(const QString& releaseUrl, const QString& filePath);
void writeBat(const QString& batPath, const QString& zipPath, const QString& folder);
private:
Ui::UpdateForm *ui;
QNetworkAccessManager* manager = nullptr;
const QString releaseUrl = "https://gitee.com/caiqihang2024/follower-v2.0/releases";
QWinTaskbarButton* taskBarBtn = nullptr;
QWinTaskbarProgress* taskBarProgress = nullptr;
const QString ver = QStringLiteral("v") + qApp->applicationVersion();
// QWidget interface
protected:
void showEvent(QShowEvent* event) override;
};
#endif // UPDATEFORM_H