mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 17:29:47 +02:00
Finalized combobox feature
This commit is contained in:
parent
b39c8c52ab
commit
90a1325f65
3 changed files with 22 additions and 94 deletions
|
@ -20,27 +20,28 @@ import "controls-uit" as Controls
|
||||||
import "styles"
|
import "styles"
|
||||||
import "styles-uit"
|
import "styles-uit"
|
||||||
|
|
||||||
Item {
|
Rectangle {
|
||||||
|
HifiConstants { id: hifi }
|
||||||
id: marketplaceComboBox
|
id: marketplaceComboBox
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
color: hifi.colors.baseGrayShadow
|
||||||
property var currentUrl: "https://metaverse.highfidelity.com/marketplace"
|
property var currentUrl: "https://metaverse.highfidelity.com/marketplace"
|
||||||
Controls.WebView {
|
Controls.WebView {
|
||||||
id: webview
|
id: webview
|
||||||
url: currentUrl
|
url: currentUrl
|
||||||
anchors.top: parent.top
|
anchors.top: switchMarketView.bottom
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: parent.height - 50
|
height: parent.height - 40
|
||||||
//anchors.bottom: switchMarketView.top
|
|
||||||
focus: true
|
focus: true
|
||||||
}
|
}
|
||||||
|
|
||||||
Controls.ComboBox {
|
Controls.ComboBox {
|
||||||
id: switchMarketView
|
id: switchMarketView
|
||||||
anchors.bottom: parent.bottom
|
anchors.top: parent.top
|
||||||
width: parent.width
|
anchors.right: parent.right
|
||||||
height: 50
|
width: 200
|
||||||
|
height: 40
|
||||||
visible: true
|
visible: true
|
||||||
label: "Market View: "
|
|
||||||
model: ["Marketplace", "Clara.io"]
|
model: ["Marketplace", "Clara.io"]
|
||||||
onCurrentIndexChanged: {
|
onCurrentIndexChanged: {
|
||||||
if (currentIndex === 0) { webview.url = "https://metaverse.highfidelity.com/marketplace"; }
|
if (currentIndex === 0) { webview.url = "https://metaverse.highfidelity.com/marketplace"; }
|
||||||
|
@ -49,4 +50,12 @@ Item {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Controls.Label {
|
||||||
|
id: switchMarketLabel
|
||||||
|
anchors.verticalCenter: switchMarketView.verticalCenter
|
||||||
|
anchors.right: switchMarketView.left
|
||||||
|
color: hifi.colors.white
|
||||||
|
text: "Explore interesting content from: "
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,81 +0,0 @@
|
||||||
//
|
|
||||||
// marketplace.js
|
|
||||||
//
|
|
||||||
// Created by Eric Levin on 8 Jan 2016
|
|
||||||
// Copyright 2016 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
|
|
||||||
//
|
|
||||||
|
|
||||||
var toolIconUrl = Script.resolvePath("assets/images/tools/");
|
|
||||||
var qml = Script.resolvePath("../../interface/resources/qml/MarketplaceComboBox.qml")
|
|
||||||
|
|
||||||
var MARKETPLACE_URL = "https://metaverse.highfidelity.com/marketplace";
|
|
||||||
var CLARA_URL = "https://clara.io/library";
|
|
||||||
var marketplaceWindow = new OverlayWindow({
|
|
||||||
title: "Marketplace",
|
|
||||||
//source: "about:blank",
|
|
||||||
source: qml,
|
|
||||||
width: 900,
|
|
||||||
height: 700,
|
|
||||||
toolWindow: false,
|
|
||||||
visible: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
var toolHeight = 50;
|
|
||||||
var toolWidth = 50;
|
|
||||||
var TOOLBAR_MARGIN_Y = 0;
|
|
||||||
|
|
||||||
|
|
||||||
function showMarketplace(marketplaceID) {
|
|
||||||
var url = MARKETPLACE_URL;
|
|
||||||
if (marketplaceID) {
|
|
||||||
url = url + "/items/" + marketplaceID;
|
|
||||||
}
|
|
||||||
marketplaceWindow.setVisible(true);
|
|
||||||
//marketplaceWindow.webview.url = url;
|
|
||||||
|
|
||||||
UserActivityLogger.openedMarketplace();
|
|
||||||
}
|
|
||||||
|
|
||||||
function hideMarketplace() {
|
|
||||||
marketplaceWindow.setVisible(false);
|
|
||||||
//marketplaceWindow.webview.url = "about:blank";
|
|
||||||
}
|
|
||||||
|
|
||||||
function toggleMarketplace() {
|
|
||||||
if (marketplaceWindow.visible) {
|
|
||||||
hideMarketplace();
|
|
||||||
} else {
|
|
||||||
showMarketplace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var toolBar = Toolbars.getToolbar("com.highfidelity.interface.toolbar.system");
|
|
||||||
|
|
||||||
var browseExamplesButton = toolBar.addButton({
|
|
||||||
imageURL: toolIconUrl + "market.svg",
|
|
||||||
objectName: "marketplace",
|
|
||||||
buttonState: 1,
|
|
||||||
defaultState: 1,
|
|
||||||
hoverState: 3,
|
|
||||||
alpha: 0.9
|
|
||||||
});
|
|
||||||
|
|
||||||
function onExamplesWindowVisibilityChanged() {
|
|
||||||
browseExamplesButton.writeProperty('buttonState', marketplaceWindow.visible ? 0 : 1);
|
|
||||||
browseExamplesButton.writeProperty('defaultState', marketplaceWindow.visible ? 0 : 1);
|
|
||||||
browseExamplesButton.writeProperty('hoverState', marketplaceWindow.visible ? 2 : 3);
|
|
||||||
}
|
|
||||||
function onClick() {
|
|
||||||
toggleMarketplace();
|
|
||||||
}
|
|
||||||
browseExamplesButton.clicked.connect(onClick);
|
|
||||||
marketplaceWindow.visibleChanged.connect(onExamplesWindowVisibilityChanged);
|
|
||||||
|
|
||||||
Script.scriptEnding.connect(function () {
|
|
||||||
toolBar.removeButton("marketplace");
|
|
||||||
browseExamplesButton.clicked.disconnect(onClick);
|
|
||||||
marketplaceWindow.visibleChanged.disconnect(onExamplesWindowVisibilityChanged);
|
|
||||||
});
|
|
|
@ -9,15 +9,17 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
var toolIconUrl = Script.resolvePath("assets/images/tools/");
|
var toolIconUrl = Script.resolvePath("assets/images/tools/");
|
||||||
|
var qml = Script.resolvePath("../../resources/qml/MarketplaceComboBox.qml")
|
||||||
|
|
||||||
var MARKETPLACE_URL = "https://metaverse.highfidelity.com/marketplace";
|
var MARKETPLACE_URL = "https://metaverse.highfidelity.com/marketplace";
|
||||||
|
|
||||||
var marketplaceWindow = new OverlayWebWindow({
|
var marketplaceWindow = new OverlayWindow({
|
||||||
title: "Marketplace",
|
title: "Marketplace",
|
||||||
source: "about:blank",
|
source: qml,
|
||||||
width: 900,
|
width: 900,
|
||||||
height: 700,
|
height: 700,
|
||||||
visible: false
|
toolWindow: false,
|
||||||
|
visible: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
var toolHeight = 50;
|
var toolHeight = 50;
|
||||||
|
@ -30,7 +32,6 @@ function showMarketplace(marketplaceID) {
|
||||||
if (marketplaceID) {
|
if (marketplaceID) {
|
||||||
url = url + "/items/" + marketplaceID;
|
url = url + "/items/" + marketplaceID;
|
||||||
}
|
}
|
||||||
marketplaceWindow.setURL(url);
|
|
||||||
marketplaceWindow.setVisible(true);
|
marketplaceWindow.setVisible(true);
|
||||||
|
|
||||||
UserActivityLogger.openedMarketplace();
|
UserActivityLogger.openedMarketplace();
|
||||||
|
@ -38,7 +39,6 @@ function showMarketplace(marketplaceID) {
|
||||||
|
|
||||||
function hideMarketplace() {
|
function hideMarketplace() {
|
||||||
marketplaceWindow.setVisible(false);
|
marketplaceWindow.setVisible(false);
|
||||||
marketplaceWindow.setURL("about:blank");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleMarketplace() {
|
function toggleMarketplace() {
|
||||||
|
|
Loading…
Reference in a new issue