更新模块
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

77 lines
1.5 KiB

10 months ago
#ifndef UPDATERDIALOG_H
#define UPDATERDIALOG_H
#include <QDialog>
#include <QProcess>
#include "downloader.h"
extern QString APPVERSION;
extern QString ORIGIN_URL;
10 months ago
extern QString APPNAME;
extern QString CHECK_URL;
extern QString APPDATE;
extern QString MODIFYCNT;
namespace Ui
{
class UpdaterDialog;
}
class UpdaterDialog : public QDialog
{
Q_OBJECT
public:
explicit UpdaterDialog(QWidget *parent = nullptr);
~UpdaterDialog();
void showStatus(const QString &);
void calculateSizes(qint64 received, qint64 total);
void calculateTimeRemaining(qint64 received, qint64 total);
bool checkVersion(const QString & _localVersion, const QString & _remoteVersion);
private slots:
void on_btn_check_clicked();
void onCheckReply(QNetworkReply *);
void on_btn_update_clicked();
void on_btn_cancel_clicked();
void onDownloadFinished();
private:
Ui::UpdaterDialog *ui;
Downloader * m_pDownloader = nullptr;
QString m_version;
QNetworkAccessManager *m_pManager{nullptr};
QString m_platform;
QString m_changelog;
QString m_moduleName;
QString m_patchUrl;
QString m_patchVersion;
QString m_moduleVersion;
QString m_fullUrl;
QString m_fullVersion;
QString m_lastChangeTime;
QString m_modifyCnt;
QString m_fileName = "";
bool m_bDownloadFullExe = false;
uint m_startTime;
quint64 m_totalSize;
QProcess *m_UpdateProc{nullptr};
};
#endif // UPDATERDIALOG_H