21 #ifndef __qSlicerExtensionsManagerModel_h 22 #define __qSlicerExtensionsManagerModel_h 26 #include <QStringList> 30 #include <QVariantMap> 33 #include <ctkErrorLogModel.h> 36 #include "qSlicerBaseQTCoreExport.h" 40 class qSlicerExtensionsManagerModelPrivate;
41 class QStandardItemModel;
46 Q_PROPERTY(
int numberOfInstalledExtensions READ numberOfInstalledExtensions)
47 Q_PROPERTY(QStringList installedExtensions READ installedExtensions)
48 Q_PROPERTY(QStringList enabledExtensions READ enabledExtensions)
49 Q_PROPERTY(QUrl serverUrl READ serverUrl)
50 Q_PROPERTY(QUrl serverUrlWithPackagePath READ serverUrlWithPackagePath)
51 Q_PROPERTY(QUrl serverUrlWithExtensionsStorePath READ serverUrlWithExtensionsStorePath)
52 Q_PROPERTY(QString extensionsInstallPath READ extensionsInstallPath)
53 Q_PROPERTY(
bool newExtensionEnabledByDefault READ newExtensionEnabledByDefault WRITE setNewExtensionEnabledByDefault)
54 Q_PROPERTY(QString extensionsSettingsFilePath READ extensionsSettingsFilePath WRITE setExtensionsSettingsFilePath)
55 Q_PROPERTY(QString slicerRevision READ slicerRevision WRITE setSlicerRevision)
56 Q_PROPERTY(QString slicerOs READ slicerOs WRITE setSlicerOs)
57 Q_PROPERTY(QString slicerArch READ slicerArch WRITE setSlicerArch)
58 Q_PROPERTY(QString slicerVersion READ slicerVersion WRITE setSlicerVersion)
64 typedef qSlicerExtensionsManagerModelPrivate
Pimpl;
78 QUrl serverUrl()const;
79 QUrl serverUrlWithPackagePath()const;
80 QUrl serverUrlWithExtensionsStorePath()const;
82 QString extensionsInstallPath()const;
84 Q_INVOKABLE QString extensionInstallPath(const QString& extensionName) const;
86 Q_INVOKABLE QStringList extensionModulePaths(const QString& extensionName)const;
88 Q_INVOKABLE QString extensionDescriptionFile(const QString& extensionName) const;
90 void setNewExtensionEnabledByDefault(
bool value);
91 bool newExtensionEnabledByDefault()const;
93 Q_INVOKABLE ExtensionMetadataType extensionMetadata(const QString& extensionName)const;
97 Q_INVOKABLE
bool isExtensionInstalled(const QString& extensionName)const;
101 int numberOfInstalledExtensions()const;
105 QStringList installedExtensions()const;
109 Q_INVOKABLE
bool isExtensionEnabled(const QString& extensionName)const;
115 QStringList scheduledForUpdateExtensions() const;
123 Q_INVOKABLE
bool isExtensionUpdateAvailable(const QString& extensionName)const;
130 Q_INVOKABLE
bool isExtensionScheduledForUpdate(const QString& extensionName)const;
134 QStringList scheduledForUninstallExtensions() const;
138 Q_INVOKABLE
bool isExtensionScheduledForUninstall(const QString& extensionName)const;
142 QStringList enabledExtensions()const;
144 QString extensionsSettingsFilePath()const;
145 void setExtensionsSettingsFilePath(const QString& extensionsSettingsFilePath);
147 QString slicerRevision()const;
148 void setSlicerRevision(const QString& revision);
150 QString slicerOs()const;
151 void setSlicerOs(const QString& os);
153 QString slicerArch()const;
154 void setSlicerArch(const QString& arch);
156 void setSlicerRequirements(const QString& revision, const QString& os, const QString& arch);
158 QString slicerVersion()const;
159 void setSlicerVersion(const QString& version);
165 Q_INVOKABLE QStringList isExtensionCompatible(const QString& extensionName, const QString& slicerRevision,
166 const QString& slicerOs, const QString& slicerArch) const;
174 Q_INVOKABLE QStringList isExtensionCompatible(const QString& extensionName) const;
178 Q_INVOKABLE ExtensionMetadataType retrieveExtensionMetadata(const QString& extensionId);
187 Q_INVOKABLE
bool installExtension(const QString &archiveFile);
196 Q_INVOKABLE
bool installExtension(const QString& extensionName,
197 ExtensionMetadataType extensionMetadata,
198 const QString &archiveFile);
201 Q_INVOKABLE
bool extractExtensionArchive(const QString& extensionName,
202 const QString& archiveFile,
203 const QString &destinationPath);
206 Q_INVOKABLE const QStandardItemModel * model()const;
208 static QHash<QString, QString> serverToExtensionDescriptionKey();
210 static QStringList serverKeysToIgnore();
212 static ExtensionMetadataType filterExtensionMetadata(const ExtensionMetadataType &extensionMetadata);
214 static QStringList readArrayValues(QSettings& settings,
215 const QString& arrayName, const QString fieldName);
217 static
void writeArrayValues(QSettings& settings, const QStringList& values,
218 const QString& arrayName, const QString fieldName);
220 static
bool writeExtensionDescriptionFile(const QString& file,
221 const ExtensionMetadataType& metadata);
223 static ExtensionMetadataType parseExtensionDescriptionFile(const QString& file);
230 void setExtensionEnabled(const QString& extensionName,
bool value);
235 bool downloadAndInstallExtension(const QString& extensionId);
242 bool scheduleExtensionForUninstall(const QString& extensionName);
247 bool cancelExtensionScheduledForUninstall(const QString& extensionName);
254 void checkForUpdates(
bool installUpdates);
262 bool scheduleExtensionForUpdate(const QString& extensionName);
267 bool cancelExtensionScheduledForUpdate(const QString& extensionName);
277 bool updateScheduledExtensions(QStringList &updatedExtensions);
284 bool updateScheduledExtensions();
294 bool uninstallScheduledExtensions(QStringList &uninstalledExtensions);
301 bool uninstallScheduledExtensions();
303 void identifyIncompatibleExtensions();
305 bool exportExtensionList(QString& exportFilePath);
307 QStringList checkInstallPrerequisites() const;
313 void downloadStarted(QNetworkReply * reply);
315 void downloadFinished(QNetworkReply * reply);
317 void updateDownloadProgress(const QString& extensionName,
318 qint64 received, qint64 total);
322 void extensionUpdateAvailable(const QString& extensionName);
324 void extensionInstalled(const QString& extensionName);
326 void extensionUpdated(const QString& extensionName);
328 void extensionScheduledForUninstall(const QString& extensionName);
330 void extensionCancelledScheduleForUninstall(const QString& extensionName);
332 void extensionScheduledForUpdate(const QString& extensionName);
334 void extensionCancelledScheduleForUpdate(const QString& extensionName);
336 void extensionUninstalled(const QString& extensionName);
338 void extensionEnabledChanged(const QString& extensionName,
bool value);
340 void extensionIdentifedAsIncompatible(const QString& extensionName);
342 void slicerRequirementsChanged(const QString& revision, const QString& os, const QString& arch);
344 void messageLogged(const QString& text, ctkErrorLogLevel::LogLevels level) const;
355 qint64 received, qint64 total);
357 void onUpdateCheckComplete(const QUuid& requestId,
359 void onUpdateCheckFailed(const QUuid& requestId);
362 QScopedPointer<qSlicerExtensionsManagerModelPrivate> d_ptr;
365 Q_DECLARE_PRIVATE(qSlicerExtensionsManagerModel);
366 Q_DISABLE_COPY(qSlicerExtensionsManagerModel);
QObject Superclass
Superclass typedef.
qSlicerExtensionsManagerModelPrivate Pimpl
Pimpl typedef.