-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdater.h
More file actions
63 lines (53 loc) · 1.87 KB
/
Copy pathupdater.h
File metadata and controls
63 lines (53 loc) · 1.87 KB
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
#ifndef UPDATER_H
#define UPDATER_H
#include <QObject>
#include "external/QSimpleUpdater/include/QSimpleUpdater.h"
#include "QProcess"
class updater: public QObject
{
public:
Q_OBJECT
Q_PROPERTY(QString currentVersion READ currentVersion WRITE setCurrentVersion NOTIFY currentVersionChanged)
Q_PROPERTY(bool updateAvailable READ updateAvailable NOTIFY updateAvailableChanged)
Q_PROPERTY(bool isDownloading READ isDownloading NOTIFY isDownloadingChanged)
Q_PROPERTY(int downloadProgress READ downloadProgress NOTIFY downloadProgressChanged)
Q_PROPERTY(QString latestVersion READ latestVersion NOTIFY latestVersionChanged)
Q_PROPERTY(QString changelog READ changelog NOTIFY changelogChanged)
public:
explicit updater(QObject *parent = nullptr);
~updater();
// Méthodes exposées à QML
Q_INVOKABLE void checkForUpdates();
Q_INVOKABLE void downloadUpdate();
Q_INVOKABLE void installUpdate();
// Getters/Setters
QString currentVersion() const;
void setCurrentVersion(const QString &version);
bool updateAvailable() const;
bool isDownloading() const;
int downloadProgress() const;
QString latestVersion() const;
QString changelog() const;
signals:
void currentVersionChanged();
void updateAvailableChanged();
void isDownloadingChanged();
void downloadProgressChanged();
void latestVersionChanged();
void changelogChanged();
void updateError(const QString &error);
private slots:
void handleUpdateAvailable();
void handleUpdateDownloaded();
void handleDownloadProgress(qint64 bytesReceived, qint64 bytesTotal);
void handleUpdateError(const QString &error);
private:
QSimpleUpdater *m_updater;
QString m_currentVersion;
bool m_updateAvailable;
bool m_isDownloading;
int m_downloadProgress;
QString m_latestVersion;
QString m_changelog;
};
#endif // UPDATER_H