History

put audio and script-engine logging into their own QLoggingCategory

Seth Alves committed 11 years ago

Commit 7af32bd1 parent cb7ff8620 files · +126 −60Browse files

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

Unified · Split

libraries/script-engine/src/ScriptCache.cpp+6−6
@@ -17,7 +17,7 @@ · 16 unmodified lines
17 17
18#include <NetworkAccessManager.h>18#include <NetworkAccessManager.h>
19#include <SharedUtil.h>19#include <SharedUtil.h>
20 20#include "ScriptEngineLogging.h"
21#include "ScriptCache.h"21#include "ScriptCache.h"
22 22
23ScriptCache::ScriptCache(QObject* parent) {23ScriptCache::ScriptCache(QObject* parent) {
@@ -27,7 +27,7 @@ ScriptCache::ScriptCache(QObject* parent) { · 3 unmodified lines
27QString ScriptCache::getScript(const QUrl& url, ScriptUser* scriptUser, bool& isPending) {27QString ScriptCache::getScript(const QUrl& url, ScriptUser* scriptUser, bool& isPending) {
28 QString scriptContents;28 QString scriptContents;
29 if (_scriptCache.contains(url)) {29 if (_scriptCache.contains(url)) {
30 qDebug() << "Found script in cache:" << url.toString();30 qCDebug(scriptengine) << "Found script in cache:" << url.toString();
31 scriptContents = _scriptCache[url];31 scriptContents = _scriptCache[url];
32 scriptUser->scriptContentsAvailable(url, scriptContents);32 scriptUser->scriptContentsAvailable(url, scriptContents);
33 isPending = false;33 isPending = false;
@@ -37,13 +37,13 @@ QString ScriptCache::getScript(const QUrl& url, ScriptUser* scriptUser, bool& is · 3 unmodified lines
37 _scriptUsers.insert(url, scriptUser);37 _scriptUsers.insert(url, scriptUser);
38 38
39 if (alreadyWaiting) {39 if (alreadyWaiting) {
40 qDebug() << "Already downloading script at:" << url.toString();40 qCDebug(scriptengine) << "Already downloading script at:" << url.toString();
41 } else {41 } else {
42 QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance();42 QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance();
43 QNetworkRequest networkRequest = QNetworkRequest(url);43 QNetworkRequest networkRequest = QNetworkRequest(url);
44 networkRequest.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT);44 networkRequest.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT);
45 45
46 qDebug() << "Downloading script at:" << url.toString();46 qCDebug(scriptengine) << "Downloading script at:" << url.toString();
47 QNetworkReply* reply = networkAccessManager.get(networkRequest);47 QNetworkReply* reply = networkAccessManager.get(networkRequest);
48 connect(reply, &QNetworkReply::finished, this, &ScriptCache::scriptDownloaded);48 connect(reply, &QNetworkReply::finished, this, &ScriptCache::scriptDownloaded);
49 }49 }
@@ -59,13 +59,13 @@ void ScriptCache::scriptDownloaded() { · 9 unmodified lines
59 59
60 if (reply->error() == QNetworkReply::NoError && reply->attribute(QNetworkRequest::HttpStatusCodeAttribute) == 200) {60 if (reply->error() == QNetworkReply::NoError && reply->attribute(QNetworkRequest::HttpStatusCodeAttribute) == 200) {
61 _scriptCache[url] = reply->readAll();61 _scriptCache[url] = reply->readAll();
62 qDebug() << "Done downloading script at:" << url.toString();62 qCDebug(scriptengine) << "Done downloading script at:" << url.toString();
63 63
64 foreach(ScriptUser* user, scriptUsers) {64 foreach(ScriptUser* user, scriptUsers) {
65 user->scriptContentsAvailable(url, _scriptCache[url]);65 user->scriptContentsAvailable(url, _scriptCache[url]);
66 }66 }
67 } else {67 } else {
68 qDebug() << "ERROR Loading file:" << reply->url().toString();68 qCDebug(scriptengine) << "ERROR Loading file:" << reply->url().toString();
69 foreach(ScriptUser* user, scriptUsers) {69 foreach(ScriptUser* user, scriptUsers) {
70 user->errorInLoadingScript(url);70 user->errorInLoadingScript(url);
71 }71 }