forked from ic005k/OCAuxiliaryTools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
autoupdatedialog.h
82 lines (64 loc) · 1.63 KB
/
autoupdatedialog.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
#ifndef AUTOUPDATEDIALOG_H
#define AUTOUPDATEDIALOG_H
#include <QDebug>
#include <QDialog>
#include <QDir>
#include <QElapsedTimer>
#include <QFile>
#include <QMessageBox>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QNetworkRequest>
#include <QProcess>
#include <QTextCursor>
#include <QTextEdit>
#include <QTextStream>
#include <QtMath>
namespace Ui {
class AutoUpdateDialog;
}
class AutoUpdateDialog : public QDialog {
Q_OBJECT
public:
explicit AutoUpdateDialog(QWidget* parent = nullptr);
~AutoUpdateDialog();
Ui::AutoUpdateDialog* ui;
QString strUrlOrg;
QString tempDir;
QString filename;
QNetworkAccessManager* managerDownLoad;
QNetworkReply* reply;
QFile* myfile;
void Init();
void doProcessReadyRead();
void doProcessFinished();
void doProcessDownloadProgress(qint64, qint64);
void startUpdate();
void startDownload(bool Database);
QString strUrl;
QString strWinUrl;
QString strMacUrl;
QString strDatabaseUrl;
QString strMacClassicalUrl;
QString strLinuxUrl;
QString strLinuxTargetFile;
void TextEditToFile(QTextEdit* txtEdit, QString fileName);
QString GetFileSize(const qint64& size, int precision);
QString GetFileSize(qint64 size);
void startWgetDownload();
protected:
void closeEvent(QCloseEvent* event);
void keyPressEvent(QKeyEvent* event);
private slots:
void on_btnStartUpdate_clicked();
void readResult(int exitCode);
void onReadData();
void UpdateTextShow();
void on_btnShowLog_clicked();
private:
QElapsedTimer downloadTimer;
bool blCanBeUpdate = false;
QProcess* processWget;
QTimer* tmrUpdateShow;
};
#endif // AUTOUPDATEDIALOG_H