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
7070
7171 ~ScriptEngine();
7272
73+ // Useful for QSharePointer<ScriptEngine>
74+ static void doDeleteLater(ScriptEngine* obj) { obj->deleteLater(); }
75+
7376 /// run the script in a dedicated thread. This will have the side effect of evalulating
7477 /// the current script contents and calling run(). Callers will likely want to register the script with external
7578 /// services before calling this.
@@ -124,7 +127,10 @@ public: · 48 unmodified lines
124127 Q_INVOKABLE QUrl resolvePath(const QString& path) const;
125128
126129 // Entity Script Related methods
127− Q_INVOKABLE void loadEntityScript(const EntityItemID& entityID, const QString& entityScript, bool forceRedownload = false); // will call the preload method once loaded
130+ //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+
128134 Q_INVOKABLE void unloadEntityScript(const EntityItemID& entityID); // will call unload method
129135 Q_INVOKABLE void unloadAllEntityScripts();
130136 Q_INVOKABLE void callEntityScriptMethod(const EntityItemID& entityID, const QString& methodName, const QStringList& params = QStringList());
@@ -224,4 +230,11 @@ protected: · 93 unmodified lines
224230 static std::atomic<bool> _stoppingAllScripts;
225231 };
226232
233+/*
234+class ScriptEngine : public QObject {
235+ Q_OBJECT
236+};
237+*/
238+
239+
227240 #endif // hifi_ScriptEngine_h