mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 20:31:29 +02:00
In process of creating combobox for marketplace with qml
This commit is contained in:
parent
cd7706e80b
commit
d63d0ba870
6 changed files with 136 additions and 2 deletions
|
@ -1,13 +1,16 @@
|
||||||
|
|
||||||
import QtQuick 2.3
|
import QtQuick 2.5
|
||||||
import QtQuick.Controls 1.2
|
import QtQuick.Controls 1.4
|
||||||
import QtWebChannel 1.0
|
import QtWebChannel 1.0
|
||||||
|
import QtWebEngine 1.1
|
||||||
import QtWebSockets 1.0
|
import QtWebSockets 1.0
|
||||||
import "qrc:///qtwebchannel/qwebchannel.js" as WebChannel
|
import "qrc:///qtwebchannel/qwebchannel.js" as WebChannel
|
||||||
|
|
||||||
import "windows" as Windows
|
import "windows" as Windows
|
||||||
import "controls"
|
import "controls"
|
||||||
|
import "controls-uit" as Controls
|
||||||
import "styles"
|
import "styles"
|
||||||
|
import "styles-uit"
|
||||||
|
|
||||||
Windows.Window {
|
Windows.Window {
|
||||||
id: root
|
id: root
|
||||||
|
@ -23,6 +26,8 @@ Windows.Window {
|
||||||
property var eventBridge;
|
property var eventBridge;
|
||||||
property var component;
|
property var component;
|
||||||
property var dynamicContent;
|
property var dynamicContent;
|
||||||
|
|
||||||
|
|
||||||
onSourceChanged: {
|
onSourceChanged: {
|
||||||
if (dynamicContent) {
|
if (dynamicContent) {
|
||||||
dynamicContent.destroy();
|
dynamicContent.destroy();
|
||||||
|
@ -71,5 +76,6 @@ Windows.Window {
|
||||||
Item {
|
Item {
|
||||||
id: contentHolder
|
id: contentHolder
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ import "." as VrControls
|
||||||
|
|
||||||
FocusScope {
|
FocusScope {
|
||||||
id: root
|
id: root
|
||||||
|
HifiConstants { id: hifi }
|
||||||
|
|
||||||
property alias model: comboBox.model;
|
property alias model: comboBox.model;
|
||||||
property alias comboBox: comboBox
|
property alias comboBox: comboBox
|
||||||
|
|
|
@ -13,6 +13,7 @@ import QtQuick 2.5
|
||||||
import "../styles-uit"
|
import "../styles-uit"
|
||||||
|
|
||||||
RalewaySemiBold {
|
RalewaySemiBold {
|
||||||
|
HifiConstants { id: hifi }
|
||||||
property int colorScheme: hifi.colorSchemes.light
|
property int colorScheme: hifi.colorSchemes.light
|
||||||
|
|
||||||
size: hifi.fontSizes.inputLabel
|
size: hifi.fontSizes.inputLabel
|
||||||
|
|
43
interface/resources/qml/controls-uit/MarketplaceComboBox.qml
Normal file
43
interface/resources/qml/controls-uit/MarketplaceComboBox.qml
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
//
|
||||||
|
// MarketplaceComboBox.qml
|
||||||
|
//
|
||||||
|
// Created by Elisa Lupin-Jimenez on 3 Aug 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
|
||||||
|
//
|
||||||
|
|
||||||
|
import QtQuick 2.5
|
||||||
|
import QtQuick.Controls 1.4
|
||||||
|
import QtWebChannel 1.0
|
||||||
|
import QtWebEngine 1.1
|
||||||
|
import QtWebSockets 1.0
|
||||||
|
import "qrc:///qtwebchannel/qwebchannel.js" as WebChannel
|
||||||
|
|
||||||
|
import "controls"
|
||||||
|
import "controls-uit" as Controls
|
||||||
|
import "styles"
|
||||||
|
import "styles-uit"
|
||||||
|
|
||||||
|
// just temporary
|
||||||
|
Controls.WebView {
|
||||||
|
id: webview
|
||||||
|
anchors.fill: parent
|
||||||
|
url: "about:blank"
|
||||||
|
focus: true
|
||||||
|
}
|
||||||
|
|
||||||
|
Controls.ComboBox {
|
||||||
|
id: switchMarketView
|
||||||
|
//anchors.top: parent.bottom
|
||||||
|
//anchors.bottomMargin: 4
|
||||||
|
anchors.fill: parent
|
||||||
|
visible: true
|
||||||
|
model: ListModel {
|
||||||
|
id: cbItems
|
||||||
|
ListElement { text: "Banana" }
|
||||||
|
ListElement { text: "Apple" }
|
||||||
|
ListElement { text: "Coconut" }
|
||||||
|
}
|
||||||
|
}
|
82
scripts/system/marketplace - Elisa.js
Normal file
82
scripts/system/marketplace - Elisa.js
Normal file
|
@ -0,0 +1,82 @@
|
||||||
|
//
|
||||||
|
// 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 MARKETPLACE_URL = "https://metaverse.highfidelity.com/marketplace";
|
||||||
|
var CLARA_URL = "https://clara.io/library";
|
||||||
|
var marketplaceWindow = new OverlayWindow({
|
||||||
|
title: "Marketplace",
|
||||||
|
source: "about:blank",
|
||||||
|
//source: MARKETPLACE_URL,
|
||||||
|
//source: "https://s3.amazonaws.com/DreamingContent/qml/content.qml",
|
||||||
|
//source: "C:\Users\elisa\Documents\GitHub\hifi\interface\resources\qml\controls-uit\WebView.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);
|
||||||
|
});
|
|
@ -11,6 +11,7 @@
|
||||||
var toolIconUrl = Script.resolvePath("assets/images/tools/");
|
var toolIconUrl = Script.resolvePath("assets/images/tools/");
|
||||||
|
|
||||||
var MARKETPLACE_URL = "https://metaverse.highfidelity.com/marketplace";
|
var MARKETPLACE_URL = "https://metaverse.highfidelity.com/marketplace";
|
||||||
|
|
||||||
var marketplaceWindow = new OverlayWebWindow({
|
var marketplaceWindow = new OverlayWebWindow({
|
||||||
title: "Marketplace",
|
title: "Marketplace",
|
||||||
source: "about:blank",
|
source: "about:blank",
|
||||||
|
|
Loading…
Reference in a new issue