7 class Updater : public QObject {
11 /// Set a shared Updater instance
12 static void setInstance(Updater *value);
14 /// Get a shared updater instance, null by default
15 static Updater &instance();
17 Updater(QObject *parent = nullptr);
20 QPushButton *getButton();
31 Status getStatus() const { return status; }
32 // This should be protected
33 void setStatus(Status v);
35 QString getVersion() const { return version; }
36 // This should be protected
37 void setVersion(const QString &value) { version = value; }
39 QString getDisplayVersion() const { return displayVersion; }
40 // This should be protected
41 void setDisplayVersion(const QString &value) { displayVersion = value; }
43 /// true if the app can be stopped and relaunched without user interaction
44 virtual bool getImmediateInstallAndRelaunch() const { return immediateInstallAndRelaunch; }
45 virtual void setImmediateInstallAndRelaunch(bool value) { immediateInstallAndRelaunch = value; }
47 /// true if the app has to be relaunched after the update has completed
48 virtual bool getRelaunchAfterInstall() const { return relaunchAfterInstall; }
49 virtual void setRelaunchAfterInstall(bool value) { relaunchAfterInstall = value; }
51 /// when true an available update will be downloaded without user interaction
52 virtual bool getAutomaticDownload() const { return automaticDownload; }
53 virtual void setAutomaticDownload(bool value) { automaticDownload = value; }
55 virtual void checkAndShowUI() = 0;
56 virtual void checkAndMaybeShowUI() = 0;
57 virtual void checkWithoutUI() = 0;
60 virtual void update() = 0;
61 virtual void onUserAction();
64 void statusChanged(Status status);
65 void actionTextChanged(const QString &actionText);
68 QAction *action = nullptr;
69 QPushButton *button = nullptr;
70 QLabel *label = nullptr;
72 bool automaticDownload = true;
73 bool immediateInstallAndRelaunch = false;
74 bool relaunchAfterInstall = false;
75 Status status = Status::UpToDate;
77 QString displayVersion;