]> git.sur5r.net Git - minitube/blob - lib/updater/src/impl/defaultupdater.h
New upstream version 3.5
[minitube] / lib / updater / src / impl / defaultupdater.h
1 #ifndef UPDATER_IMPL_UPDATER_H
2 #define UPDATER_IMPL_UPDATER_H
3
4 #include "updater.h"
5
6 namespace updater {
7
8 class Downloader;
9 class Dialog;
10 class Installer;
11 class Parser;
12
13 class DefaultUpdater : public ::Updater {
14     Q_OBJECT
15
16 public:
17     DefaultUpdater();
18
19     QString getAppName() const { return appName; }
20     void setAppName(const QString &value) { appName = value; }
21
22     QIcon getIcon() const { return icon; }
23     void setIcon(const QIcon &value) { icon = value; }
24
25     QString getLocalVersion() const { return localVersion; }
26     void setLocalVersion(const QString &value) { localVersion = value; }
27
28     QUrl getManifestUrl() const { return manifestUrl; }
29     void setManifestUrl(const QUrl &value) { manifestUrl = value; }
30
31     void setCheckInterval(const qint64 &value);
32
33     /// A fixed download url. In alternative, the Parser impl can set the download url from the
34     /// manifest
35     void setDownloadUrl(const QUrl &value) { downloadUrl = value; }
36
37     void setInstaller(Installer *value);
38
39     Parser *getParser() const { return parser; }
40     void setParser(Parser *value);
41
42     Downloader *downloadUpdate();
43     Downloader *getDownloader() const { return downloader; }
44
45     void checkAndShowUI();
46     void checkAndMaybeShowUI();
47     void checkWithoutUI();
48
49 protected slots:
50     void update();
51
52 private:
53     void showDialog();
54
55     QString appName = QGuiApplication::applicationDisplayName();
56     QIcon icon = QGuiApplication::windowIcon();
57     QString localVersion = QCoreApplication::applicationVersion();
58
59     QUrl manifestUrl;
60     qint64 checkInterval = 86400;
61
62     Downloader *downloader = nullptr;
63     QUrl downloadUrl;
64     QString downloadedFilename;
65
66     Installer *installer = nullptr;
67     Parser *parser = nullptr;
68
69     Dialog *dialog = nullptr;
70
71     QTimer *checkTimer;
72 };
73
74 } // namespace updater
75
76 #endif // UPDATER_IMPL_UPDATER_H