Slicer  5.1
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
qSlicerExtensionDownloadTask.h
Go to the documentation of this file.
1 /*==============================================================================
2 
3  Program: 3D Slicer
4 
5  Copyright 2014 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  This file was originally developed by Matthew Woehlke, Kitware Inc.
17  and was partially funded by NIH grant 3P41RR013218-12S1
18 
19 ==============================================================================*/
20 
21 #ifndef __qSlicerExtensionDownloadTask_h
22 #define __qSlicerExtensionDownloadTask_h
23 
24 // Qt includes
25 #include <QNetworkReply>
26 
27 // QtGUI includes
28 #include "qSlicerBaseQTCoreExport.h"
29 
30 class qSlicerExtensionDownloadTaskPrivate;
31 
32 class Q_SLICER_BASE_QTCORE_EXPORT qSlicerExtensionDownloadTask : public QObject
33 {
34  Q_OBJECT
35  Q_PROPERTY(QVariantMap metadata READ metadata WRITE setMetadata)
36  Q_PROPERTY(QString extensionName READ extensionName WRITE setExtensionName)
37  Q_PROPERTY(QString archiveName READ archiveName WRITE setArchiveName)
38  Q_PROPERTY(QNetworkReply* reply READ reply)
39  Q_PROPERTY(bool installDependencies READ installDependencies WRITE setInstallDependencies)
40 
41 public:
46  explicit qSlicerExtensionDownloadTask(QNetworkReply* reply,
47  QObject* parent = nullptr);
48 
50  ~qSlicerExtensionDownloadTask() override;
51 
53  QVariantMap metadata() const;
54 
62  void setMetadata(const QVariantMap&);
63 
65  QString extensionName() const;
66 
68  void setExtensionName(const QString&);
69 
71  QString archiveName() const;
72 
74  void setArchiveName(const QString&);
75 
77  QNetworkReply* reply() const;
78 
81  bool installDependencies() const;
82  void setInstallDependencies(bool confirm);
83 
84 signals:
85  void finished(qSlicerExtensionDownloadTask*);
86  void error(qSlicerExtensionDownloadTask*, QNetworkReply::NetworkError);
87  void progress(qSlicerExtensionDownloadTask*, qint64 received, qint64 total);
88 
89 protected slots:
90  void emitFinished();
91  void emitError(QNetworkReply::NetworkError);
92  void emitProgress(qint64, qint64);
93 
94 protected:
95  QScopedPointer<qSlicerExtensionDownloadTaskPrivate> d_ptr;
96 
97 private:
98  Q_DECLARE_PRIVATE(qSlicerExtensionDownloadTask);
99  Q_DISABLE_COPY(qSlicerExtensionDownloadTask);
100 };
101 
102 #endif