From 764dc6d156dbe817e0e1dcd0f2293f02ca65ed9f Mon Sep 17 00:00:00 2001 From: Alexander Ivash Date: Thu, 17 May 2018 01:57:35 +0300 Subject: [PATCH] add link to 'external avatar' dialog --- interface/resources/qml/hifi/AvatarApp.qml | 3 +++ interface/resources/qml/hifi/avatarapp/MessageBoxes.qml | 9 +++++++-- scripts/system/avatarapp.js | 6 ++++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/interface/resources/qml/hifi/AvatarApp.qml b/interface/resources/qml/hifi/AvatarApp.qml index 7fca8be1a9..21d93274da 100644 --- a/interface/resources/qml/hifi/AvatarApp.qml +++ b/interface/resources/qml/hifi/AvatarApp.qml @@ -382,6 +382,9 @@ Rectangle { popup.showSpecifyAvatarUrl(function() { var url = popup.inputText.text; emitSendToScript({'method' : 'applyExternalAvatar', 'avatarURL' : url}) + }, function(link) { + console.debug('link clicked', link); + emitSendToScript({'method' : 'navigate', 'url' : link}) }); } } diff --git a/interface/resources/qml/hifi/avatarapp/MessageBoxes.qml b/interface/resources/qml/hifi/avatarapp/MessageBoxes.qml index 8cf73b7ed3..fd433c8701 100644 --- a/interface/resources/qml/hifi/avatarapp/MessageBoxes.qml +++ b/interface/resources/qml/hifi/avatarapp/MessageBoxes.qml @@ -3,11 +3,11 @@ import QtQuick 2.5 MessageBox { id: popup - function showSpecifyAvatarUrl(callback) { + function showSpecifyAvatarUrl(callback, linkCallback) { popup.onButton2Clicked = callback; popup.titleText = 'Specify Avatar URL' popup.bodyText = 'If you want to add a custom avatar, you can specify the URL of the avatar file' + - '(“.fst” extension) here. Learn to make a custom avatar by opening this link on your desktop.' + '(“.fst” extension) here. Learn to make a custom avatar by opening this link on your desktop.' popup.inputText.visible = true; popup.inputText.placeholderText = 'Enter Avatar Url'; popup.inputText.forceActiveFocus(); @@ -21,6 +21,11 @@ MessageBox { popup.close(); } + popup.onLinkClicked = function(link) { + if(linkCallback) + linkCallback(link); + } + popup.open(); } diff --git a/scripts/system/avatarapp.js b/scripts/system/avatarapp.js index 7611fe782d..0abb91d62b 100644 --- a/scripts/system/avatarapp.js +++ b/scripts/system/avatarapp.js @@ -245,9 +245,8 @@ function fromQml(message) { // messages are {method, params}, like json-rpc. See break; case 'navigate': console.debug('avatarapp.js: navigate: ', message.url); + var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system") if(message.url.indexOf('app://') === 0) { - var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system") - if(message.url === 'app://marketplace') { tablet.gotoWebScreen(MARKETPLACE_URL, MARKETPLACES_INJECT_SCRIPT_URL); } else if(message.url === 'app://purchases') { @@ -256,7 +255,10 @@ function fromQml(message) { // messages are {method, params}, like json-rpc. See } else if(message.url.indexOf('hifi://') === 0) { AddressManager.handleLookupString(message.url, false); + } else if(message.url.indexOf('https://') === 0 || message.url.indexOf('http://') === 0) { + tablet.gotoWebScreen(message.url); } + break; case 'saveSettings': console.debug('avatarapp.js: saveSettings: ', JSON.stringify(message.settings, 0, 4));