Implement avatar browser for tablet avatar settings

This commit is contained in:
David Rowe 2017-03-14 15:36:51 +13:00
parent 2e96b8a59b
commit f3a99a2437
2 changed files with 99 additions and 6 deletions

View file

@ -10,8 +10,8 @@
import QtQuick 2.5
import "../../dialogs"
import "../../controls-uit"
import "../../hifi/tablet/tabletWindows/preferences"
Preference {
id: root
@ -82,12 +82,26 @@ Preference {
verticalCenter: dataTextField.verticalCenter
}
onClicked: {
// Load dialog via OffscreenUi so that JavaScript EventBridge is available.
root.browser = OffscreenUi.load("dialogs/preferences/AvatarBrowser.qml");
root.browser.windowDestroyed.connect(function(){
root.browser = null;
});
if (typeof desktop !== "undefined") {
// Load dialog via OffscreenUi so that JavaScript EventBridge is available.
root.browser = OffscreenUi.load("dialogs/preferences/AvatarBrowser.qml");
root.browser.windowDestroyed.connect(function(){
root.browser = null;
});
} else {
root.browser = tabletAvatarBrowserBuilder.createObject(tabletRoot, {
createGlobalEventBridgeSource: eventBridgeJavaScriptToInject
});
// Make dialog modal.
tabletRoot.openModal = root.browser;
}
}
}
Component {
id: tabletAvatarBrowserBuilder;
TabletAvatarBrowser { }
}
}
}

View file

@ -0,0 +1,79 @@
//
// 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 var result
signal selected(var modelUrl)
signal canceled()
anchors.fill: parent
/*
Rectangle {
id: pane // Surrogate for ScrollingWindow's pane.
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
}
}
Rectangle {
id: footer
height: 40
anchors {
left: parent.left
right: parent.right
bottom: parent.bottom
}
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();
}
}
}
}