mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 07:37:20 +02:00
Fix 'Browse Avatars' button from Avatar Settings
This commit is contained in:
parent
3c36b8ffee
commit
e627925bd3
5 changed files with 11 additions and 213 deletions
|
@ -1,85 +0,0 @@
|
||||||
//
|
|
||||||
// AvatarBrowser.qml
|
|
||||||
//
|
|
||||||
// Created by Bradley Austin Davis on 30 Aug 2015
|
|
||||||
// Copyright 2015 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"
|
|
||||||
|
|
||||||
Window {
|
|
||||||
id: root
|
|
||||||
HifiConstants { id: hifi }
|
|
||||||
width: 900; height: 700
|
|
||||||
resizable: true
|
|
||||||
modality: Qt.ApplicationModal
|
|
||||||
|
|
||||||
Item {
|
|
||||||
anchors.fill: parent
|
|
||||||
|
|
||||||
property bool keyboardEnabled: false
|
|
||||||
property bool keyboardRaised: true
|
|
||||||
property bool punctuationMode: false
|
|
||||||
|
|
||||||
BaseWebView {
|
|
||||||
id: webview
|
|
||||||
url: Account.metaverseServerURL + "/marketplace?category=avatars"
|
|
||||||
focus: true
|
|
||||||
|
|
||||||
anchors {
|
|
||||||
top: parent.top
|
|
||||||
left: parent.left
|
|
||||||
right: parent.right
|
|
||||||
bottom: keyboard.top
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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 ]
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
|
||||||
webChannel.registerObject("eventBridge", eventBridge);
|
|
||||||
webChannel.registerObject("eventBridgeWrapper", eventBridgeWrapper);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -99,25 +99,9 @@ Preference {
|
||||||
leftMargin: dataTextField.acceptableInput ? hifi.dimensions.contentSpacing.x : 0
|
leftMargin: dataTextField.acceptableInput ? hifi.dimensions.contentSpacing.x : 0
|
||||||
}
|
}
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (typeof desktop !== "undefined") {
|
ApplicationInterface.loadAvatarBrowser();
|
||||||
// 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);
|
|
||||||
|
|
||||||
// Make dialog modal.
|
|
||||||
tabletRoot.openModal = root.browser;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Component {
|
|
||||||
id: tabletAvatarBrowserBuilder;
|
|
||||||
TabletAvatarBrowser { }
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,111 +0,0 @@
|
||||||
//
|
|
||||||
// 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
|
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
|
|
||||||
BaseWebView {
|
|
||||||
id: webview
|
|
||||||
url: (Account.metaverseServerURL + "/marketplace?category=avatars")
|
|
||||||
focus: true
|
|
||||||
|
|
||||||
anchors {
|
|
||||||
top: parent.top
|
|
||||||
left: parent.left
|
|
||||||
right: parent.right
|
|
||||||
bottom: footer.top
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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 ]
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
|
||||||
webChannel.registerObject("eventBridge", eventBridge);
|
|
||||||
webChannel.registerObject("eventBridgeWrapper", eventBridgeWrapper);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -6776,6 +6776,15 @@ void Application::loadAddAvatarBookmarkDialog() const {
|
||||||
avatarBookmarks->addBookmark();
|
avatarBookmarks->addBookmark();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Application::loadAvatarBrowser() const {
|
||||||
|
auto tablet = dynamic_cast<TabletProxy*>(DependencyManager::get<TabletScriptingInterface>()->getTablet("com.highfidelity.interface.tablet.system"));
|
||||||
|
// construct the url to the marketplace item
|
||||||
|
QString url = NetworkingConstants::METAVERSE_SERVER_URL().toString() + "/marketplace?category=avatars";
|
||||||
|
QString MARKETPLACES_INJECT_SCRIPT_PATH = "file:///" + qApp->applicationDirPath() + "/scripts/system/html/js/marketplacesInject.js";
|
||||||
|
tablet->gotoWebScreen(url, MARKETPLACES_INJECT_SCRIPT_PATH);
|
||||||
|
DependencyManager::get<HMDScriptingInterface>()->openTablet();
|
||||||
|
}
|
||||||
|
|
||||||
void Application::takeSnapshot(bool notify, bool includeAnimated, float aspectRatio) {
|
void Application::takeSnapshot(bool notify, bool includeAnimated, float aspectRatio) {
|
||||||
postLambdaEvent([notify, includeAnimated, aspectRatio, this] {
|
postLambdaEvent([notify, includeAnimated, aspectRatio, this] {
|
||||||
// Get a screenshot and save it
|
// Get a screenshot and save it
|
||||||
|
|
|
@ -309,6 +309,7 @@ public slots:
|
||||||
void toggleEntityScriptServerLogDialog();
|
void toggleEntityScriptServerLogDialog();
|
||||||
Q_INVOKABLE void showAssetServerWidget(QString filePath = "");
|
Q_INVOKABLE void showAssetServerWidget(QString filePath = "");
|
||||||
Q_INVOKABLE void loadAddAvatarBookmarkDialog() const;
|
Q_INVOKABLE void loadAddAvatarBookmarkDialog() const;
|
||||||
|
Q_INVOKABLE void loadAvatarBrowser() const;
|
||||||
Q_INVOKABLE SharedSoundPointer getSampleSound() const;
|
Q_INVOKABLE SharedSoundPointer getSampleSound() const;
|
||||||
|
|
||||||
void showDialog(const QUrl& widgetUrl, const QUrl& tabletUrl, const QString& name) const;
|
void showDialog(const QUrl& widgetUrl, const QUrl& tabletUrl, const QString& name) const;
|
||||||
|
|
Loading…
Reference in a new issue