History

Cleanup BatchLoader

Ryan Huffman committed 11 years ago

Commit 667db201 parent 87653292 files · +3 −39Browse files

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

Unified · Split

libraries/script-engine/src/BatchLoader.cpp+3−38
@@ -50,47 +50,12 @@ void BatchLoader::start() { · 49 unmodified lines
5050 checkFinished();
5151 });
5252
53+ // If we end up being destroyed before the reply finishes, clean it up
54+ connect(this, &QObject::destroyed, request, &QObject::deleteLater);
55+
5356 qCDebug(scriptengine) << "Loading script at " << url;
5457
5558 request->send();
56−
57−// if (url.scheme() == "http" || url.scheme() == "https" || url.scheme() == "ftp") {
58−// QNetworkRequest request = QNetworkRequest(url);
59−// request.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT);
60−// QNetworkReply* reply = networkAccessManager.get(request);
61−//
62−// qCDebug(scriptengine) << "Downloading file at" << url;
63−//
64−// connect(reply, &QNetworkReply::finished, [=]() {
65−// if (reply->error()) {
66−// _data.insert(url, QString());
67−// } else {
68−// _data.insert(url, reply->readAll());
69−// }
70−// reply->deleteLater();
71−// checkFinished();
72−// });
73−//
74−// // If we end up being destroyed before the reply finishes, clean it up
75−// connect(this, &QObject::destroyed, reply, &QObject::deleteLater);
76−//
77−// } else {
78−// #ifdef _WIN32
79−// QString fileName = url.toString();
80−// #else
81−// QString fileName = url.toLocalFile();
82−// #endif
83−//
84−// qCDebug(scriptengine) << "Reading file at " << fileName;
85−//
86−// QFile scriptFile(fileName);
87−// if (scriptFile.open(QFile::ReadOnly | QFile::Text)) {
88−// QTextStream in(&scriptFile);
89−// _data.insert(url, in.readAll());
90−// } else {
91−// _data.insert(url, QString());
92−// }
93−// }
9459 }
9560 checkFinished();
9661 }

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