add link to 'external avatar' dialog

This commit is contained in:
Alexander Ivash 2018-05-17 01:57:35 +03:00
parent 235b0e9f4d
commit 764dc6d156
3 changed files with 14 additions and 4 deletions

View file

@ -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})
});
}
}

View file

@ -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. <a href="#">Learn to make a custom avatar by opening this link on your desktop.</a>'
'(“.fst” extension) here. <a href="https://docs.highfidelity.com/create-and-explore/avatars/create-avatars">Learn to make a custom avatar by opening this link on your desktop.</a>'
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();
}

View file

@ -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));