Showing the changes to libraries/script-engine/src/ScriptCache.cpp (1 of 3 files). Show all
Unified · Split
| @@ -44,7 +44,7 @@ QString ScriptCache::getScript(const QUrl& url, ScriptUser* scriptUser, bool& is · 43 unmodified lines | |||
| 44 | QNetworkRequest networkRequest = QNetworkRequest(url); | 44 | QNetworkRequest networkRequest = QNetworkRequest(url); |
| 45 | networkRequest.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT); | 45 | networkRequest.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT); |
| 46 | 46 | ||
| 47 | qCDebug(scriptengine) << "Downloading script at" << url.toString(); | 47 | qCDebug(scriptengine) << "Downloading script at:" << url.toString(); |
| 48 | QNetworkReply* reply = networkAccessManager.get(networkRequest); | 48 | QNetworkReply* reply = networkAccessManager.get(networkRequest); |
| 49 | connect(reply, &QNetworkReply::finished, this, &ScriptCache::scriptDownloaded); | 49 | connect(reply, &QNetworkReply::finished, this, &ScriptCache::scriptDownloaded); |
| 50 | } | 50 | } |
| @@ -52,6 +52,13 @@ QString ScriptCache::getScript(const QUrl& url, ScriptUser* scriptUser, bool& is · 1 unmodified line | |||
| 52 | return scriptContents; | 52 | return scriptContents; |
| 53 | } | 53 | } |
| 54 | 54 | ||
| 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 | |||
| 55 | void ScriptCache::scriptDownloaded() { | 62 | void ScriptCache::scriptDownloaded() { |
| 56 | QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender()); | 63 | QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender()); |
| 57 | QUrl url = reply->url(); | 64 | QUrl url = reply->url(); |