mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 20:31:29 +02:00
Working download and unpackage from Clara.io
This commit is contained in:
parent
49712060ed
commit
615627e981
5 changed files with 28 additions and 11 deletions
|
@ -225,6 +225,9 @@ ScrollingWindow {
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
desktop.initWebviewProfileHandlers(webview.profile)
|
desktop.initWebviewProfileHandlers(webview.profile)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//profile: desktop.browserProfile
|
//profile: desktop.browserProfile
|
||||||
|
|
|
@ -25,6 +25,8 @@ WebEngineView {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// FIXME hack to get the URL with the auth token included. Remove when we move to Qt 5.6
|
// FIXME hack to get the URL with the auth token included. Remove when we move to Qt 5.6
|
||||||
Timer {
|
Timer {
|
||||||
id: urlReplacementTimer
|
id: urlReplacementTimer
|
||||||
|
@ -68,9 +70,17 @@ WebEngineView {
|
||||||
request.openIn(newWindow.webView);
|
request.openIn(newWindow.webView);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
property var myScript: 'var element = $("a.download-file");
|
||||||
|
element.removeClass("download-file");
|
||||||
|
element.removeAttr("download _target");'
|
||||||
|
|
||||||
onLinkHovered: {
|
onLinkHovered: {
|
||||||
desktop.currentUrl = hoveredUrl
|
desktop.currentUrl = hoveredUrl
|
||||||
console.log("my url in WebView: " + desktop.currentUrl)
|
console.log("my url in WebView: " + desktop.currentUrl)
|
||||||
|
if (File.testUrl(desktop.currentUrl)) {
|
||||||
|
runJavaScript(myScript, function() {console.log("ran the JS"); });
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This breaks the webchannel used for passing messages. Fixed in Qt 5.6
|
// This breaks the webchannel used for passing messages. Fixed in Qt 5.6
|
||||||
|
|
|
@ -19,7 +19,9 @@ OriginalDesktop.Desktop {
|
||||||
scrollGestureEnabled: false // we don't need/want these
|
scrollGestureEnabled: false // we don't need/want these
|
||||||
onEntered: ApplicationCompositor.reticleOverDesktop = true
|
onEntered: ApplicationCompositor.reticleOverDesktop = true
|
||||||
onExited: ApplicationCompositor.reticleOverDesktop = false
|
onExited: ApplicationCompositor.reticleOverDesktop = false
|
||||||
acceptedButtons: Qt.NoButton
|
acceptedButtons: Qt.NoButtonMouseArea
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// The tool window, one instance
|
// The tool window, one instance
|
||||||
|
@ -82,11 +84,11 @@ OriginalDesktop.Desktop {
|
||||||
|
|
||||||
profile.downloadRequested.connect(function(download){
|
profile.downloadRequested.connect(function(download){
|
||||||
console.log("Download start: " + download.state)
|
console.log("Download start: " + download.state)
|
||||||
if (!File.testUrl(currentUrl)) {
|
//if (!File.testUrl(currentUrl)) {
|
||||||
console.log("This file type is not accepted. Look for a zip file")
|
//console.log("This file type is not accepted. Look for a zip file")
|
||||||
download.cancel()
|
//download.cancel()
|
||||||
return
|
//return
|
||||||
}
|
//}
|
||||||
adaptedPath = File.convertUrlToPath(currentUrl)
|
adaptedPath = File.convertUrlToPath(currentUrl)
|
||||||
download.path = "C:/Users/elisa/Downloads/" + adaptedPath
|
download.path = "C:/Users/elisa/Downloads/" + adaptedPath
|
||||||
console.log("Path where it should download: " + download.path)
|
console.log("Path where it should download: " + download.path)
|
||||||
|
|
|
@ -38,7 +38,8 @@ void FileScriptingInterface::runUnzip(QString path, QUrl url) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FileScriptingInterface::testUrl(QUrl url) {
|
bool FileScriptingInterface::testUrl(QUrl url) {
|
||||||
if (url.toString().contains(".zip")) return true;
|
if (url.toString().contains(".zip") && url.toString().contains("fbx")) return true;
|
||||||
|
qDebug() << "This model is not a .fbx packaged in a .zip. Please try with another model.";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,14 +81,14 @@ void FileScriptingInterface::unzipFile(QString path) {
|
||||||
|
|
||||||
//QString zipFileName = QFile::decodeName(compressedFileContent);
|
//QString zipFileName = QFile::decodeName(compressedFileContent);
|
||||||
QString dirName = dir.path();
|
QString dirName = dir.path();
|
||||||
QDir testPath("C:/Users/elisa/Downloads/banana.zip");
|
//QDir testPath("C:/Users/elisa/Downloads/banana.zip");
|
||||||
qDebug() << "Zip directory is stored at: " + dirName;
|
qDebug() << "Zip directory is stored at: " + dirName;
|
||||||
QStringList list = JlCompress::extractDir(testPath.path(), "C:/Users/elisa/Downloads/test");
|
QStringList list = JlCompress::extractDir(dirName, "C:/Users/elisa/Downloads/test");
|
||||||
|
|
||||||
qDebug() << list;
|
qDebug() << list;
|
||||||
|
|
||||||
//QFileInfoList files = dir.entryInfoList();
|
//QFileInfoList files = dir.entryInfoList();
|
||||||
QFileInfoList files = testPath.entryInfoList();
|
QFileInfoList files = dir.entryInfoList();
|
||||||
foreach(QFileInfo file, files) {
|
foreach(QFileInfo file, files) {
|
||||||
qDebug() << "My file: " + file.fileName();
|
qDebug() << "My file: " + file.fileName();
|
||||||
recursiveFileScan(file, &dirName);
|
recursiveFileScan(file, &dirName);
|
||||||
|
|
|
@ -12,7 +12,8 @@
|
||||||
var toolIconUrl = Script.resolvePath("assets/images/tools/");
|
var toolIconUrl = Script.resolvePath("assets/images/tools/");
|
||||||
|
|
||||||
//var EXAMPLES_URL = "https://metaverse.highfidelity.com/examples";
|
//var EXAMPLES_URL = "https://metaverse.highfidelity.com/examples";
|
||||||
var EXAMPLES_URL = "https://clara.io/view/c1c4d926-5648-4fd3-9673-6d9018ad4627";
|
//var EXAMPLES_URL = "https://clara.io/view/c1c4d926-5648-4fd3-9673-6d9018ad4627";
|
||||||
|
var EXAMPLES_URL = "https://clara.io/library";
|
||||||
//var EXAMPLES_URL = "http://s3.amazonaws.com/DreamingContent/test.html";
|
//var EXAMPLES_URL = "http://s3.amazonaws.com/DreamingContent/test.html";
|
||||||
//var EXAMPLES_URL = "https://hifi-content.s3.amazonaws.com/elisalj/test.html";
|
//var EXAMPLES_URL = "https://hifi-content.s3.amazonaws.com/elisalj/test.html";
|
||||||
//var EXAMPLES_URL = "https://hifi-content.s3.amazonaws.com/elisalj/test_download.html";
|
//var EXAMPLES_URL = "https://hifi-content.s3.amazonaws.com/elisalj/test_download.html";
|
||||||
|
|
Loading…
Reference in a new issue