mirror of
https://github.com/overte-org/overte.git
synced 2025-04-19 15:43:50 +02:00
Merge branch 'master' of https://github.com/highfidelity/hifi into import-export-parents
This commit is contained in:
commit
3f18e0cd09
5 changed files with 20 additions and 36 deletions
1
examples/utilities/tools/render/plotperf/qmldir
Normal file
1
examples/utilities/tools/render/plotperf/qmldir
Normal file
|
@ -0,0 +1 @@
|
|||
PlotPerf 1.0 PlotPerf.qml
|
|
@ -10,7 +10,7 @@
|
|||
//
|
||||
import QtQuick 2.5
|
||||
import QtQuick.Controls 1.4
|
||||
|
||||
import "plotperf"
|
||||
|
||||
Item {
|
||||
id: statsUI
|
||||
|
|
|
@ -2930,14 +2930,7 @@ void Application::saveSettings() {
|
|||
bool Application::importEntities(const QString& urlOrFilename) {
|
||||
_entityClipboard->eraseAllOctreeElements();
|
||||
|
||||
QUrl url(urlOrFilename);
|
||||
|
||||
// if the URL appears to be invalid or relative, then it is probably a local file
|
||||
if (!url.isValid() || url.isRelative()) {
|
||||
url = QUrl::fromLocalFile(urlOrFilename);
|
||||
}
|
||||
|
||||
bool success = _entityClipboard->readFromURL(url.toString());
|
||||
bool success = _entityClipboard->readFromURL(urlOrFilename);
|
||||
if (success) {
|
||||
// FIXME _entityClipboard->remapIDs();
|
||||
_entityClipboard->reaverageOctreeElements();
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include <NetworkAccessManager.h>
|
||||
#include <OctalCode.h>
|
||||
#include <udt/PacketHeaders.h>
|
||||
#include <ResourceManager.h>
|
||||
#include <SharedUtil.h>
|
||||
#include <PathUtils.h>
|
||||
#include <Gzip.h>
|
||||
|
@ -1674,35 +1675,24 @@ bool Octree::readJSONFromGzippedFile(QString qFileName) {
|
|||
}
|
||||
|
||||
bool Octree::readFromURL(const QString& urlString) {
|
||||
bool readOk = false;
|
||||
auto request = std::unique_ptr<ResourceRequest>(ResourceManager::createResourceRequest(this, urlString));
|
||||
|
||||
// determine if this is a local file or a network resource
|
||||
QUrl url(urlString);
|
||||
|
||||
if (url.isLocalFile()) {
|
||||
readOk = readFromFile(qPrintable(url.toLocalFile()));
|
||||
} else {
|
||||
QNetworkRequest request;
|
||||
request.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT);
|
||||
request.setUrl(url);
|
||||
|
||||
QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance();
|
||||
QNetworkReply* reply = networkAccessManager.get(request);
|
||||
|
||||
qCDebug(octree) << "Downloading svo at" << qPrintable(urlString);
|
||||
|
||||
QEventLoop loop;
|
||||
QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit()));
|
||||
loop.exec();
|
||||
|
||||
if (reply->error() == QNetworkReply::NoError) {
|
||||
int resourceSize = reply->bytesAvailable();
|
||||
QDataStream inputStream(reply);
|
||||
readOk = readFromStream(resourceSize, inputStream);
|
||||
}
|
||||
delete reply;
|
||||
if (!request) {
|
||||
return false;
|
||||
}
|
||||
return readOk;
|
||||
|
||||
QEventLoop loop;
|
||||
connect(request.get(), &ResourceRequest::finished, &loop, &QEventLoop::quit);
|
||||
request->send();
|
||||
loop.exec();
|
||||
|
||||
if (request->getResult() != ResourceRequest::Success) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto data = request->getData();
|
||||
QDataStream inputStream(data);
|
||||
return readFromStream(data.size(), inputStream);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue