mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 06:44:06 +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-uit"
|
||||
|
||||
Item {
|
||||
Rectangle {
|
||||
HifiConstants { id: hifi }
|
||||
id: marketplaceComboBox
|
||||
anchors.fill: parent
|
||||
color: hifi.colors.baseGrayShadow
|
||||
property var currentUrl: "https://metaverse.highfidelity.com/marketplace"
|
||||
Controls.WebView {
|
||||
id: webview
|
||||
url: currentUrl
|
||||
anchors.top: parent.top
|
||||
anchors.top: switchMarketView.bottom
|
||||
width: parent.width
|
||||
height: parent.height - 50
|
||||
//anchors.bottom: switchMarketView.top
|
||||
height: parent.height - 40
|
||||
focus: true
|
||||
}
|
||||
|
||||
Controls.ComboBox {
|
||||
id: switchMarketView
|
||||
anchors.bottom: parent.bottom
|
||||
width: parent.width
|
||||
height: 50
|
||||
anchors.top: parent.top
|
||||
anchors.right: parent.right
|
||||
width: 200
|
||||
height: 40
|
||||
visible: true
|
||||
label: "Market View: "
|
||||
model: ["Marketplace", "Clara.io"]
|
||||
onCurrentIndexChanged: {
|
||||
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 qml = Script.resolvePath("../../resources/qml/MarketplaceComboBox.qml")
|
||||
|
||||
var MARKETPLACE_URL = "https://metaverse.highfidelity.com/marketplace";
|
||||
|
||||
var marketplaceWindow = new OverlayWebWindow({
|
||||
var marketplaceWindow = new OverlayWindow({
|
||||
title: "Marketplace",
|
||||
source: "about:blank",
|
||||
source: qml,
|
||||
width: 900,
|
||||
height: 700,
|
||||
visible: false
|
||||
toolWindow: false,
|
||||
visible: false,
|
||||
});
|
||||
|
||||
var toolHeight = 50;
|
||||
|
@ -30,7 +32,6 @@ function showMarketplace(marketplaceID) {
|
|||
if (marketplaceID) {
|
||||
url = url + "/items/" + marketplaceID;
|
||||
}
|
||||
marketplaceWindow.setURL(url);
|
||||
marketplaceWindow.setVisible(true);
|
||||
|
||||
UserActivityLogger.openedMarketplace();
|
||||
|
@ -38,7 +39,6 @@ function showMarketplace(marketplaceID) {
|
|||
|
||||
function hideMarketplace() {
|
||||
marketplaceWindow.setVisible(false);
|
||||
marketplaceWindow.setURL("about:blank");
|
||||
}
|
||||
|
||||
function toggleMarketplace() {
|
||||
|
|
Loading…
Reference in a new issue