History

first cut at moving entity scripts into ScriptEngine

Brad Hefta-Gaub committed 11 years ago

Commit 18fbf891 parent 56118e46 files · +283 −316Browse files

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

Unified · Split

libraries/script-engine/src/ScriptCache.h+12−2
@@ -20,23 +20,33 @@ public: · 19 unmodified lines
2020 virtual void errorInLoadingScript(const QUrl& url) = 0;
2121 };
2222
23+using contentAvailableCallback = std::function<void(const QString& scriptOrURL, const QString& contents, bool isURL, bool contentAvailable)>;
24+
2325 /// Interface for loading scripts
2426 class ScriptCache : public QObject, public Dependency {
2527 Q_OBJECT
2628 SINGLETON_DEPENDENCY
2729
2830 public:
31+ void getScriptContents(const QString& scriptOrURL, contentAvailableCallback contentAvailable, bool forceDownload = false);
32+
33+
2934 QString getScript(const QUrl& unnormalizedURL, ScriptUser* scriptUser, bool& isPending, bool redownload = false);
3035 void deleteScript(const QUrl& unnormalizedURL);
36+
37+ // FIXME - how do we remove a script from the bad script list in the case of a redownload?
3138 void addScriptToBadScriptList(const QUrl& url) { _badScripts.insert(url); }
3239 bool isInBadScriptList(const QUrl& url) { return _badScripts.contains(url); }
3340
3441 private slots:
35− void scriptDownloaded();
36−
42+ void scriptDownloaded(); // old version
43+ void scriptContentAvailable(); // new version
44+
3745 private:
3846 ScriptCache(QObject* parent = NULL);
3947
48+ QMultiMap<QUrl, contentAvailableCallback> _contentCallbacks;
49+
4050 QHash<QUrl, QString> _scriptCache;
4151 QMultiMap<QUrl, ScriptUser*> _scriptUsers;
4252 QSet<QUrl> _badScripts;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t