History

Re-download scripts upon Reload All

David Rowe committed 11 years ago

Commit f220d401 parent 2ab3f423 files · +12 −1Browse files

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

Unified · Split

libraries/script-engine/src/ScriptCache.cpp+8−1
@@ -44,7 +44,7 @@ QString ScriptCache::getScript(const QUrl& url, ScriptUser* scriptUser, bool& is · 43 unmodified lines
4444 QNetworkRequest networkRequest = QNetworkRequest(url);
4545 networkRequest.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT);
4646
47− qCDebug(scriptengine) << "Downloading script at" << url.toString();
47+ qCDebug(scriptengine) << "Downloading script at:" << url.toString();
4848 QNetworkReply* reply = networkAccessManager.get(networkRequest);
4949 connect(reply, &QNetworkReply::finished, this, &ScriptCache::scriptDownloaded);
5050 }
@@ -52,6 +52,13 @@ QString ScriptCache::getScript(const QUrl& url, ScriptUser* scriptUser, bool& is · 1 unmodified line
5252 return scriptContents;
5353 }
5454
55+void ScriptCache::deleteScript(const QUrl& url) {
56+ if (_scriptCache.contains(url)) {
57+ qCDebug(scriptengine) << "Delete script from cache:" << url.toString();
58+ _scriptCache.remove(url);
59+ }
60+}
61+
5562 void ScriptCache::scriptDownloaded() {
5663 QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());
5764 QUrl url = reply->url();