mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 03:19:24 +02:00
Merge pull request #9881 from ctrlaltdavid/21197
Browse for avatar in Marketplace from tablet avatar settings dialog
This commit is contained in:
commit
f8a6a82371
2 changed files with 137 additions and 10 deletions
|
@ -10,8 +10,8 @@
|
||||||
|
|
||||||
import QtQuick 2.5
|
import QtQuick 2.5
|
||||||
|
|
||||||
import "../../dialogs"
|
|
||||||
import "../../controls-uit"
|
import "../../controls-uit"
|
||||||
|
import "../../hifi/tablet/tabletWindows/preferences"
|
||||||
|
|
||||||
Preference {
|
Preference {
|
||||||
id: root
|
id: root
|
||||||
|
@ -23,10 +23,7 @@ Preference {
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
dataTextField.text = preference.value;
|
dataTextField.text = preference.value;
|
||||||
// FIXME: MyAvatar object isn't available in HMD mode for some reason.
|
console.log("MyAvatar modelName " + MyAvatar.getFullAvatarModelName())
|
||||||
if (typeof MyAvatar !== "undefined") {
|
|
||||||
console.log("MyAvatar modelName " + MyAvatar.getFullAvatarModelName())
|
|
||||||
}
|
|
||||||
console.log("Application : " + ApplicationInterface)
|
console.log("Application : " + ApplicationInterface)
|
||||||
ApplicationInterface.fullAvatarURLChanged.connect(processNewAvatar);
|
ApplicationInterface.fullAvatarURLChanged.connect(processNewAvatar);
|
||||||
}
|
}
|
||||||
|
@ -85,11 +82,25 @@ Preference {
|
||||||
verticalCenter: dataTextField.verticalCenter
|
verticalCenter: dataTextField.verticalCenter
|
||||||
}
|
}
|
||||||
onClicked: {
|
onClicked: {
|
||||||
// Load dialog via OffscreenUi so that JavaScript EventBridge is available.
|
if (typeof desktop !== "undefined") {
|
||||||
root.browser = OffscreenUi.load("dialogs/preferences/AvatarBrowser.qml");
|
// Load dialog via OffscreenUi so that JavaScript EventBridge is available.
|
||||||
root.browser.windowDestroyed.connect(function(){
|
root.browser = OffscreenUi.load("dialogs/preferences/AvatarBrowser.qml");
|
||||||
root.browser = null;
|
root.browser.windowDestroyed.connect(function(){
|
||||||
});
|
root.browser = null;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
root.browser = tabletAvatarBrowserBuilder.createObject(tabletRoot);
|
||||||
|
|
||||||
|
// Make dialog modal.
|
||||||
|
tabletRoot.openModal = root.browser;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: tabletAvatarBrowserBuilder;
|
||||||
|
TabletAvatarBrowser {
|
||||||
|
eventBridge: tabletRoot.eventBridge
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,116 @@
|
||||||
|
//
|
||||||
|
// TabletAvatarBrowser.qml
|
||||||
|
//
|
||||||
|
// Created by David Rowe on 14 Mar 2017
|
||||||
|
// Copyright 2017 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
import QtQuick 2.5
|
||||||
|
import QtQuick.Controls 1.4
|
||||||
|
import QtWebChannel 1.0
|
||||||
|
import QtWebEngine 1.2
|
||||||
|
|
||||||
|
import "../../../../windows"
|
||||||
|
import "../../../../controls-uit"
|
||||||
|
import "../../../../styles-uit"
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
objectName: "ModelBrowserDialog"
|
||||||
|
|
||||||
|
property string title: "Attachment Model"
|
||||||
|
|
||||||
|
property bool keyboardEnabled: false
|
||||||
|
property bool keyboardRaised: false
|
||||||
|
property bool punctuationMode: false
|
||||||
|
|
||||||
|
property alias eventBridge: eventBridgeWrapper.eventBridge
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
BaseWebView {
|
||||||
|
id: webview
|
||||||
|
url: "https://metaverse.highfidelity.com/marketplace?category=avatars"
|
||||||
|
focus: true
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
top: parent.top
|
||||||
|
left: parent.left
|
||||||
|
right: parent.right
|
||||||
|
bottom: footer.top
|
||||||
|
}
|
||||||
|
|
||||||
|
QtObject {
|
||||||
|
id: eventBridgeWrapper
|
||||||
|
WebChannel.id: "eventBridgeWrapper"
|
||||||
|
property var eventBridge;
|
||||||
|
}
|
||||||
|
|
||||||
|
webChannel.registeredObjects: [eventBridgeWrapper]
|
||||||
|
|
||||||
|
// Create a global EventBridge object for raiseAndLowerKeyboard.
|
||||||
|
WebEngineScript {
|
||||||
|
id: createGlobalEventBridge
|
||||||
|
sourceCode: eventBridgeJavaScriptToInject
|
||||||
|
injectionPoint: WebEngineScript.DocumentCreation
|
||||||
|
worldId: WebEngineScript.MainWorld
|
||||||
|
}
|
||||||
|
|
||||||
|
// Detect when may want to raise and lower keyboard.
|
||||||
|
WebEngineScript {
|
||||||
|
id: raiseAndLowerKeyboard
|
||||||
|
injectionPoint: WebEngineScript.Deferred
|
||||||
|
sourceUrl: resourceDirectoryUrl + "html/raiseAndLowerKeyboard.js"
|
||||||
|
worldId: WebEngineScript.MainWorld
|
||||||
|
}
|
||||||
|
|
||||||
|
userScripts: [ createGlobalEventBridge, raiseAndLowerKeyboard ]
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: footer
|
||||||
|
height: 40
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
left: parent.left
|
||||||
|
right: parent.right
|
||||||
|
bottom: keyboard.top
|
||||||
|
}
|
||||||
|
|
||||||
|
color: hifi.colors.baseGray
|
||||||
|
|
||||||
|
Row {
|
||||||
|
anchors {
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
right: parent.right
|
||||||
|
rightMargin: hifi.dimensions.contentMargin.x
|
||||||
|
}
|
||||||
|
|
||||||
|
Button {
|
||||||
|
text: "Cancel"
|
||||||
|
color: hifi.buttons.white
|
||||||
|
onClicked: root.destroy();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Keyboard {
|
||||||
|
id: keyboard
|
||||||
|
|
||||||
|
raised: parent.keyboardEnabled && parent.keyboardRaised
|
||||||
|
numeric: parent.punctuationMode
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
left: parent.left
|
||||||
|
right: parent.right
|
||||||
|
bottom: parent.bottom
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
keyboardEnabled = HMD.active;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue