mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 22:51:20 +02:00
Merge branch 'master' of github.com:highfidelity/hifi into controller-dispatcher-1
This commit is contained in:
commit
633870245e
5 changed files with 47 additions and 8 deletions
10
interface/resources/qml/hifi/tablet/BlocksWebView.qml
Normal file
10
interface/resources/qml/hifi/tablet/BlocksWebView.qml
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
import QtQuick 2.0
|
||||||
|
import QtWebEngine 1.2
|
||||||
|
|
||||||
|
import "../../controls" as Controls
|
||||||
|
|
||||||
|
Controls.TabletWebView {
|
||||||
|
profile: WebEngineProfile { httpUserAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36"}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ Item {
|
||||||
|
|
||||||
function loadTabletWebBase() {
|
function loadTabletWebBase() {
|
||||||
loader.source = "";
|
loader.source = "";
|
||||||
loader.source = "../../controls/TabletWebView.qml";
|
loader.source = "./BlocksWebView.qml";
|
||||||
}
|
}
|
||||||
|
|
||||||
function returnToPreviousApp() {
|
function returnToPreviousApp() {
|
||||||
|
|
|
@ -44,7 +44,7 @@ Windows.ScrollingWindow {
|
||||||
|
|
||||||
function loadTabletWebBase() {
|
function loadTabletWebBase() {
|
||||||
loader.source = "";
|
loader.source = "";
|
||||||
loader.source = "../../controls/TabletWebView.qml";
|
loader.source = "./BlocksWebView.qml";
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadWebUrl(url, injectedJavaScriptUrl) {
|
function loadWebUrl(url, injectedJavaScriptUrl) {
|
||||||
|
|
|
@ -6458,7 +6458,7 @@ void Application::addAssetToWorldFromURL(QString url) {
|
||||||
}
|
}
|
||||||
if (url.contains("vr.google.com/downloads")) {
|
if (url.contains("vr.google.com/downloads")) {
|
||||||
filename = url.section('/', -1);
|
filename = url.section('/', -1);
|
||||||
filename.remove(".zip?noDownload=false");
|
filename.remove(".zip");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!DependencyManager::get<NodeList>()->getThisNodeCanWriteAssets()) {
|
if (!DependencyManager::get<NodeList>()->getThisNodeCanWriteAssets()) {
|
||||||
|
@ -6488,7 +6488,7 @@ void Application::addAssetToWorldFromURLRequestFinished() {
|
||||||
}
|
}
|
||||||
if (url.contains("vr.google.com/downloads")) {
|
if (url.contains("vr.google.com/downloads")) {
|
||||||
filename = url.section('/', -1);
|
filename = url.section('/', -1);
|
||||||
filename.remove(".zip?noDownload=false");
|
filename.remove(".zip");
|
||||||
isBlocks = true;
|
isBlocks = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6505,6 +6505,7 @@ void Application::addAssetToWorldFromURLRequestFinished() {
|
||||||
if (tempFile.open(QIODevice::WriteOnly)) {
|
if (tempFile.open(QIODevice::WriteOnly)) {
|
||||||
tempFile.write(request->getData());
|
tempFile.write(request->getData());
|
||||||
addAssetToWorldInfoClear(filename); // Remove message from list; next one added will have a different key.
|
addAssetToWorldInfoClear(filename); // Remove message from list; next one added will have a different key.
|
||||||
|
tempFile.close();
|
||||||
qApp->getFileDownloadInterface()->runUnzip(downloadPath, url, true, false, isBlocks);
|
qApp->getFileDownloadInterface()->runUnzip(downloadPath, url, true, false, isBlocks);
|
||||||
} else {
|
} else {
|
||||||
QString errorInfo = "Couldn't open temporary file for download";
|
QString errorInfo = "Couldn't open temporary file for download";
|
||||||
|
|
|
@ -15,28 +15,56 @@
|
||||||
(function () {
|
(function () {
|
||||||
var APP_NAME = "BLOCKS";
|
var APP_NAME = "BLOCKS";
|
||||||
var APP_URL = "https://vr.google.com/objects/";
|
var APP_URL = "https://vr.google.com/objects/";
|
||||||
|
var APP_OUTDATED_URL = "https://hifi-content.s3.amazonaws.com/elisalj/blocks/updateToBlocks.html";
|
||||||
var APP_ICON = "https://hifi-content.s3.amazonaws.com/elisalj/blocks/blocks-i.svg";
|
var APP_ICON = "https://hifi-content.s3.amazonaws.com/elisalj/blocks/blocks-i.svg";
|
||||||
|
var APP_ICON_ACTIVE = "https://hifi-content.s3.amazonaws.com/elisalj/blocks/blocks-a.svg";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
print("Current Interface version: " + Window.checkVersion());
|
print("Current Interface version: " + Window.checkVersion());
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
print("Outdated Interface version does not support Blocks");
|
print("Outdated Interface version does not support Blocks");
|
||||||
APP_URL = "https://hifi-content.s3.amazonaws.com/elisalj/blocks/updateToBlocks.html";
|
APP_URL = APP_OUTDATED_URL;
|
||||||
}
|
}
|
||||||
|
|
||||||
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||||
var button = tablet.addButton({
|
var button = tablet.addButton({
|
||||||
icon: APP_ICON,
|
icon: APP_ICON,
|
||||||
|
activeIcon: APP_ICON_ACTIVE,
|
||||||
text: APP_NAME
|
text: APP_NAME
|
||||||
});
|
});
|
||||||
|
|
||||||
function onClicked() {
|
function onClicked() {
|
||||||
tablet.gotoWebScreen(APP_URL, "", true);
|
if (!shown) {
|
||||||
|
tablet.gotoWebScreen(APP_URL, "", true);
|
||||||
|
} else {
|
||||||
|
tablet.gotoHomeScreen();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
button.clicked.connect(onClicked);
|
button.clicked.connect(onClicked);
|
||||||
|
|
||||||
|
var shown = false;
|
||||||
|
|
||||||
|
function checkIfBlocks(url) {
|
||||||
|
if (url.indexOf("google") !== -1) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function onScreenChanged(type, url) {
|
||||||
|
if ((type === 'Web' && checkIfBlocks(url)) || url === APP_OUTDATED_URL) {
|
||||||
|
button.editProperties({ isActive: true });
|
||||||
|
shown = true;
|
||||||
|
} else {
|
||||||
|
button.editProperties({ isActive: false });
|
||||||
|
shown = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tablet.screenChanged.connect(onScreenChanged);
|
||||||
|
|
||||||
function cleanup() {
|
function cleanup() {
|
||||||
tablet.removeButton(button);
|
tablet.removeButton(button);
|
||||||
}
|
}
|
||||||
|
|
||||||
Script.scriptEnding.connect(cleanup);
|
Script.scriptEnding.connect(cleanup);
|
||||||
|
|
Loading…
Reference in a new issue