mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 10:07:58 +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 2.5
|
||||||
import QtQuick.Controls 1.4
|
import QtQuick.Controls 1.4
|
||||||
|
import "plotperf"
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: statsUI
|
id: statsUI
|
||||||
|
|
|
@ -2930,14 +2930,7 @@ void Application::saveSettings() {
|
||||||
bool Application::importEntities(const QString& urlOrFilename) {
|
bool Application::importEntities(const QString& urlOrFilename) {
|
||||||
_entityClipboard->eraseAllOctreeElements();
|
_entityClipboard->eraseAllOctreeElements();
|
||||||
|
|
||||||
QUrl url(urlOrFilename);
|
bool success = _entityClipboard->readFromURL(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());
|
|
||||||
if (success) {
|
if (success) {
|
||||||
// FIXME _entityClipboard->remapIDs();
|
// FIXME _entityClipboard->remapIDs();
|
||||||
_entityClipboard->reaverageOctreeElements();
|
_entityClipboard->reaverageOctreeElements();
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include <NetworkAccessManager.h>
|
#include <NetworkAccessManager.h>
|
||||||
#include <OctalCode.h>
|
#include <OctalCode.h>
|
||||||
#include <udt/PacketHeaders.h>
|
#include <udt/PacketHeaders.h>
|
||||||
|
#include <ResourceManager.h>
|
||||||
#include <SharedUtil.h>
|
#include <SharedUtil.h>
|
||||||
#include <PathUtils.h>
|
#include <PathUtils.h>
|
||||||
#include <Gzip.h>
|
#include <Gzip.h>
|
||||||
|
@ -1674,35 +1675,24 @@ bool Octree::readJSONFromGzippedFile(QString qFileName) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Octree::readFromURL(const QString& urlString) {
|
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
|
if (!request) {
|
||||||
QUrl url(urlString);
|
return false;
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
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