Slicer  5.2
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
qSlicerApplicationUpdateManager.h
Go to the documentation of this file.
1 /*==============================================================================
2 
3  Program: 3D Slicer
4 
5  Copyright (c) Kitware Inc.
6 
7  See COPYRIGHT.txt
8  or http://www.slicer.org/copyright/copyright.txt for details.
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15 
16 ==============================================================================*/
17 
18 #ifndef __qSlicerApplicationUpdateManager_h
19 #define __qSlicerApplicationUpdateManager_h
20 
21 // Qt includes
22 #include <QObject>
23 #include <QUrl>
24 #include <QUuid>
25 
26 // QtGUI includes
27 #include "qSlicerBaseQTCoreExport.h"
28 
29 class qSlicerApplicationUpdateManagerPrivate;
30 
39 class Q_SLICER_BASE_QTCORE_EXPORT qSlicerApplicationUpdateManager : public QObject
40 {
41  Q_OBJECT
42  Q_PROPERTY(QString slicerRevision READ slicerRevision)
43  Q_PROPERTY(QString slicerOs READ slicerOs)
44  Q_PROPERTY(QString slicerArch READ slicerArch)
46  Q_PROPERTY(bool autoUpdateCheck READ autoUpdateCheck WRITE setAutoUpdateCheck NOTIFY autoUpdateCheckChanged)
47  Q_PROPERTY(bool isUpdateAvailable READ isUpdateAvailable NOTIFY updateAvailable)
48  Q_PROPERTY(QString latestReleaseVersion READ latestReleaseVersion)
49  Q_PROPERTY(QUrl applicationDownloadPageUrl READ applicationDownloadPageUrl)
50 
51 public:
53  typedef QObject Superclass;
54 
56  typedef qSlicerApplicationUpdateManagerPrivate Pimpl;
57 
60 
62  explicit qSlicerApplicationUpdateManager(QObject* parent = nullptr);
63 
66 
79  Q_INVOKABLE QUrl serverUrl()const;
80 
81  bool autoUpdateCheck()const;
82 
88  bool checkForUpdate(bool force, bool waitForCompletion);
89 
92  QDateTime lastUpdateCheckTime() const;
93 
96  bool isUpdateAvailable() const;
97 
99  QString latestReleaseVersion() const;
100 
102  QString latestReleaseRevision() const;
103 
106  QUrl applicationDownloadPageUrl() const;
107 
110  QString slicerRevision()const;
111 
114  QString slicerOs()const;
115 
118  QString slicerArch()const;
119 
130  void setSlicerRequirements(const QString& revision, const QString& os, const QString& arch);
131 
134  static bool isApplicationUpdateEnabled();
135 
136 public slots:
137 
140  void checkForUpdate();
141 
143  void setAutoUpdateCheck(bool enable);
144 
145 signals:
146 
149  void updateAvailable(bool isAvailable);
150 
152  void updateCheckCompleted(bool success);
153 
156  void slicerRequirementsChanged(const QString& revision, const QString& os, const QString& arch);
158 
160  void autoUpdateCheckChanged();
161 
162 protected slots:
163 
164  bool onReleaseInfoQueryFinished(const QUuid& requestId);
165  void refreshUpdateAvailable();
166 
167 protected:
168  QScopedPointer<qSlicerApplicationUpdateManagerPrivate> d_ptr;
169 
170 private:
171  Q_DECLARE_PRIVATE(qSlicerApplicationUpdateManager);
172  Q_DISABLE_COPY(qSlicerApplicationUpdateManager);
173 };
174 
175 #endif
qSlicerApplicationUpdateManagerPrivate Pimpl
Pimpl typedef.
Class querying application updates on the download server.