History

switch to using QSharedPointer for _entitiesScriptEngine

Brad Hefta-Gaub committed 10 years ago

Commit 9db0fe01 parent a3221f34 files · +54 −23Browse files

Showing the changes to libraries/script-engine/src/ScriptEngine.h (1 of 4 files). Show all

Unified · Split

libraries/script-engine/src/ScriptEngine.h+14−1
@@ -70,6 +70,9 @@ public: · 69 unmodified lines
70 70
71 ~ScriptEngine();71 ~ScriptEngine();
72 72
73 // Useful for QSharePointer<ScriptEngine>
74 static void doDeleteLater(ScriptEngine* obj) { obj->deleteLater(); }
75
73 /// run the script in a dedicated thread. This will have the side effect of evalulating76 /// run the script in a dedicated thread. This will have the side effect of evalulating
74 /// the current script contents and calling run(). Callers will likely want to register the script with external77 /// the current script contents and calling run(). Callers will likely want to register the script with external
75 /// services before calling this.78 /// services before calling this.
@@ -124,7 +127,10 @@ public: · 48 unmodified lines
124 Q_INVOKABLE QUrl resolvePath(const QString& path) const;127 Q_INVOKABLE QUrl resolvePath(const QString& path) const;
125 128
126 // Entity Script Related methods129 // Entity Script Related methods
127 Q_INVOKABLE void loadEntityScript(const EntityItemID& entityID, const QString& entityScript, bool forceRedownload = false); // will call the preload method once loaded130 //Q_INVOKABLE void loadEntityScript(const EntityItemID& entityID, const QString& entityScript, bool forceRedownload = false); // will call the preload method once loaded
131
132 static void loadEntityScript(QWeakPointer<ScriptEngine> theEngine, const EntityItemID& entityID, const QString& entityScript, bool forceRedownload);
133
128 Q_INVOKABLE void unloadEntityScript(const EntityItemID& entityID); // will call unload method134 Q_INVOKABLE void unloadEntityScript(const EntityItemID& entityID); // will call unload method
129 Q_INVOKABLE void unloadAllEntityScripts();135 Q_INVOKABLE void unloadAllEntityScripts();
130 Q_INVOKABLE void callEntityScriptMethod(const EntityItemID& entityID, const QString& methodName, const QStringList& params = QStringList());136 Q_INVOKABLE void callEntityScriptMethod(const EntityItemID& entityID, const QString& methodName, const QStringList& params = QStringList());
@@ -224,4 +230,11 @@ protected: · 93 unmodified lines
224 static std::atomic<bool> _stoppingAllScripts;230 static std::atomic<bool> _stoppingAllScripts;
225};231};
226 232
233/*
234class ScriptEngine : public QObject {
235 Q_OBJECT
236};
237*/
238
239
227#endif // hifi_ScriptEngine_h240#endif // hifi_ScriptEngine_h