1 #ifndef UPDATEMANAGER_H
2 #define UPDATEMANAGER_H
3 
4 #ifdef PORTABLE_CONFIG
5 
6 #include "common/global.h"
7 #include "sqlitestudio.h"
8 #include <QObject>
9 #include <functional>
10 #include <QProcess>
11 
12 class QNetworkReply;
13 class QNetworkAccessManager;
14 class QTemporaryDir;
15 class QFile;
16 
17 class API_EXPORT UpdateManager : public QObject
18 {
19         Q_OBJECT
20     public:
21         explicit UpdateManager(QObject *parent = 0);
22         ~UpdateManager();
23 
24         void checkForUpdates();
25         bool isPlatformEligibleForUpdate() const;
26 
27     private:
28         QString updateBinaryAbsolutePath;
29         QNetworkAccessManager *netManager = nullptr;
30 
31         void handleUpdatesResponse(QNetworkReply* response);
32 
33     private slots:
34         void handleUpdatingError(const QString& errorMessage);
35 
36     signals:
37         void updateAvailable(const QString& version, const QString& url);
38         void noUpdatesAvailable();
39         void updatingError(const QString& errorMessage);
40 };
41 
42 #define UPDATES SQLITESTUDIO->getUpdateManager()
43 
44 #endif // PORTABLE_CONFIG
45 #endif // UPDATEMANAGER_H
46