QtAutoUpdater  3.0.0
A Qt library to automatically check for updates and install them
updatecontroller.h
1 #ifndef QTAUTOUPDATER_UPDATECONTROLLER_H
2 #define QTAUTOUPDATER_UPDATECONTROLLER_H
3 
4 #include <QtCore/qobject.h>
5 #include <QtCore/qstringlist.h>
6 
7 #include <QtAutoUpdaterCore/updater.h>
8 
9 #include <QtWidgets/qaction.h>
10 
11 #include "QtAutoUpdaterWidgets/qtautoupdaterwidgets_global.h"
12 
13 namespace QtAutoUpdater
14 {
15 
16 class Updater;
17 class UpdateControllerPrivate;
19 class Q_AUTOUPDATERWIDGETS_EXPORT UpdateController : public QObject
20 {
21  Q_OBJECT
22 
24  Q_PROPERTY(QtAutoUpdater::Updater* updater READ updater WRITE setUpdater NOTIFY updaterChanged)
26  Q_PROPERTY(DisplayLevel displayLevel READ displayLevel WRITE setDisplayLevel NOTIFY displayLevelChanged)
28  Q_PROPERTY(QString desktopFileName READ desktopFileName WRITE setDesktopFileName NOTIFY desktopFileNameChanged)
30  Q_PROPERTY(QtAutoUpdater::Updater::InstallScope installScope READ installScope WRITE setInstallScope NOTIFY installScopeChanged)
32  Q_PROPERTY(bool detailedUpdateInfo READ isDetailedUpdateInfo WRITE setDetailedUpdateInfo NOTIFY detailedUpdateInfoChanged)
33 
34 public:
36  enum class DisplayLevel {
37  Automatic = 0,
38  Exit = 1,
41  Info = 2,
42  ExtendedInfo = 3,
43  Progress = 4,
44  Ask = 5
45  };
46  Q_ENUM(DisplayLevel)
47 
48 
49  explicit UpdateController(QObject *parent = nullptr);
51  explicit UpdateController(QWidget *parentWindow);
53  explicit UpdateController(Updater *updater, QObject *parent = nullptr);
55  explicit UpdateController(Updater *updater, QWidget *parentWindow);
56 
58  static QAction *createUpdateAction(Updater *updater, QObject *parent);
59 
61  QWidget* parentWindow() const;
63  DisplayLevel displayLevel() const;
65  QString desktopFileName() const;
67  Updater *updater() const;
69  Updater::InstallScope installScope() const;
71  bool isDetailedUpdateInfo() const;
72 
73 public Q_SLOTS:
75  void setDisplayLevel(DisplayLevel displayLevel);
77  void setDesktopFileName(QString desktopFileName);
79  void setUpdater(QtAutoUpdater::Updater* updater);
81  void setInstallScope(QtAutoUpdater::Updater::InstallScope installScope);
83  void setDetailedUpdateInfo(bool detailedUpdateInfo);
84 
86  bool start();
88  bool start(DisplayLevel displayLevel);
89 
90 Q_SIGNALS:
92  void displayLevelChanged(DisplayLevel displayLevel, QPrivateSignal);
94  void desktopFileNameChanged(const QString &desktopFileName, QPrivateSignal);
96  void updaterChanged(QtAutoUpdater::Updater* updater, QPrivateSignal);
98  void installScopeChanged(QtAutoUpdater::Updater::InstallScope installScope, QPrivateSignal);
100  void detailedUpdateInfoChanged(bool detailedUpdateInfo, QPrivateSignal);
101 
102 private:
103  Q_DECLARE_PRIVATE(UpdateController)
104  Q_DISABLE_COPY(UpdateController)
105 
106  Q_PRIVATE_SLOT(d_func(), void _q_updaterStateChanged(Updater::State))
107  Q_PRIVATE_SLOT(d_func(), void _q_showInstaller(UpdateInstaller *))
108  Q_PRIVATE_SLOT(d_func(), void _q_updaterDestroyed())
109 };
110 
111 }
112 
113 #endif // QTAUTOUPDATER_UPDATECONTROLLER_H
QtAutoUpdater::Updater
The main updater. Can check for updates and trigger update installations.
Definition: updater.h:26
QWidget
QtAutoUpdater::Updater::State
State
The state of the updater.
Definition: updater.h:43
QtAutoUpdater::UpdateController
A class to show a controlled update GUI to the user.
Definition: updatecontroller.h:19
QString
QtAutoUpdater::Updater::InstallScope
InstallScope
Defines the different installation scopes.
Definition: updater.h:67
QtAutoUpdater::UpdateInstaller
An interface to implement and consume custom in-process installer.
Definition: updateinstaller.h:17
QAction
QtAutoUpdater::UpdateController::DisplayLevel
DisplayLevel
Defines the different display-levels of the dialog.
Definition: updatecontroller.h:36
QObject
QtAutoUpdater
The QtAutoUpdater namespace holds all classes that are related with the updater.
Definition: adminauthoriser.h:9