17 #ifndef hifi_ScriptsModel_h
18 #define hifi_ScriptsModel_h
20 #include <QAbstractItemModel>
22 #include <QNetworkReply>
23 #include <QFileSystemWatcher>
33 TREE_NODE_TYPE_SCRIPT,
39 TreeNodeFolder* getParent()
const {
return _parent; }
40 void setParent(TreeNodeFolder* parent) { _parent = parent; }
41 TreeNodeType getType() {
return _type; }
42 const QString& getName() {
return _name; };
43 virtual ~TreeNodeBase() =
default;
46 TreeNodeFolder* _parent;
51 TreeNodeBase(TreeNodeFolder* parent,
const QString& name, TreeNodeType type);
54 class TreeNodeScript :
public TreeNodeBase {
56 TreeNodeScript(
const QString& localPath,
const QString& fullPath, ScriptOrigin origin);
57 const QString& getLocalPath() {
return _localPath; }
58 const QString& getFullPath() {
return _fullPath; };
59 ScriptOrigin getOrigin() {
return _origin; };
67 class TreeNodeFolder :
public TreeNodeBase {
69 TreeNodeFolder(
const QString& foldername, TreeNodeFolder* parent);
135 QModelIndex index(
int row,
int column,
const QModelIndex& parent)
const override;
138 QModelIndex parent(
const QModelIndex& child)
const override;
141 QVariant data(
const QModelIndex& index,
int role = Qt::DisplayRole)
const override;
144 int rowCount(
const QModelIndex& parent = QModelIndex())
const override;
147 int columnCount(
const QModelIndex& parent = QModelIndex())
const override;
150 TreeNodeBase* getTreeNodeFromIndex(
const QModelIndex& index)
const;
153 QList<TreeNodeBase*> getFolderNodes(TreeNodeFolder* parent)
const;
156 ScriptPath = Qt::UserRole,
166 void updateScriptsLocation(
const QString& newPath);
172 void downloadFinished();
178 void reloadLocalFiles();
184 void reloadDefaultFiles();
187 void requestDefaultFiles(QString marker = QString());
188 bool parseXML(QByteArray xmlFile);
193 bool _loadingScripts;
194 QDir _localDirectory;
195 QFileSystemWatcher _fsWatcher;
196 QList<TreeNodeBase*> _treeNodes;
Provides the ScriptDiscoveryService scripting interface.
Definition: ScriptEngines.h:59
Provides script file information available from the ScriptDiscoveryService scripting interface.
Definition: ScriptsModel.h:128