Slicer  4.11
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
qSlicerExtensionsInstallWidget.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  This file was originally developed by Jean-Christophe Fillion-Robin, Kitware Inc.
17  and was partially funded by NIH grant 3P41RR013218-12S1
18 
19 ==============================================================================*/
20 
21 #ifndef __qSlicerExtensionsInstallWidget_h
22 #define __qSlicerExtensionsInstallWidget_h
23 
24 // CTK includes
25 #include <ctkErrorLogModel.h>
26 
27 // QtGUI includes
28 #include "qSlicerBaseQTGUIExport.h"
29 #include "qSlicerWebWidget.h"
30 
31 class qSlicerExtensionsInstallWidgetPrivate;
33 
34 class Q_SLICER_BASE_QTGUI_EXPORT qSlicerExtensionsInstallWidget
35  : public qSlicerWebWidget
36 {
37  Q_OBJECT
38  Q_PROPERTY(QString slicerRevision READ slicerRevision WRITE setSlicerRevision)
39  Q_PROPERTY(QString slicerOs READ slicerOs WRITE setSlicerOs)
40  Q_PROPERTY(QString slicerArch READ slicerArch WRITE setSlicerArch)
41  Q_PROPERTY(bool browsingEnabled READ isBrowsingEnabled WRITE setBrowsingEnabled)
42 public:
45 
47  explicit qSlicerExtensionsInstallWidget(QWidget* parent = nullptr);
48 
51 
52  Q_INVOKABLE qSlicerExtensionsManagerModel* extensionsManagerModel()const;
53  Q_INVOKABLE void setExtensionsManagerModel(qSlicerExtensionsManagerModel* model);
54 
55  QString slicerRevision()const;
56  void setSlicerRevision(const QString& revision);
57 
58  QString slicerOs()const;
59  void setSlicerOs(const QString& os);
60 
61  QString slicerArch()const;
62  void setSlicerArch(const QString& arch);
63 
64  bool isBrowsingEnabled() const;
65  void setBrowsingEnabled(bool state);
66 
67 public slots:
69  void refresh();
70 
71  void onExtensionInstalled(const QString& extensionName);
72 
73  void onExtensionScheduledForUninstall(const QString& extensionName);
74 
75  void onExtensionCancelledScheduleForUninstall(const QString& extensionName);
76 
77  void onSlicerRequirementsChanged(const QString& revision,const QString& os,const QString& arch);
78 
79  void onMessageLogged(const QString& text, ctkErrorLogLevel::LogLevels level);
80 
81 protected:
82  bool acceptNavigationRequest(const QUrl & url, QWebEnginePage::NavigationType type, bool isMainFrame) override;
83 
84 protected slots:
85  void initJavascript() override;
86  void onLoadFinished(bool ok) override;
87  void onLoadStarted() override;
88 
89 private:
90  Q_DECLARE_PRIVATE(qSlicerExtensionsInstallWidget);
91  Q_DISABLE_COPY(qSlicerExtensionsInstallWidget);
92 };
93 
94 #endif