mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 18:00:41 +02:00
Merge branch 'commerce_walletApp' of https://github.com/zfox23/hifi into dk/encryptFile
This commit is contained in:
commit
f655bf2713
3 changed files with 11 additions and 322 deletions
|
@ -1,42 +0,0 @@
|
||||||
//
|
|
||||||
// SecurityImageModel.qml
|
|
||||||
// qml/hifi/commerce
|
|
||||||
//
|
|
||||||
// SecurityImageModel
|
|
||||||
//
|
|
||||||
// Created by Zach Fox on 2017-08-15
|
|
||||||
// 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
|
|
||||||
|
|
||||||
ListModel {
|
|
||||||
id: root;
|
|
||||||
ListElement{
|
|
||||||
sourcePath: "images/01cat.jpg"
|
|
||||||
securityImageEnumValue: 1;
|
|
||||||
}
|
|
||||||
ListElement{
|
|
||||||
sourcePath: "images/02car.jpg"
|
|
||||||
securityImageEnumValue: 2;
|
|
||||||
}
|
|
||||||
ListElement{
|
|
||||||
sourcePath: "images/03dog.jpg"
|
|
||||||
securityImageEnumValue: 3;
|
|
||||||
}
|
|
||||||
ListElement{
|
|
||||||
sourcePath: "images/04stars.jpg"
|
|
||||||
securityImageEnumValue: 4;
|
|
||||||
}
|
|
||||||
ListElement{
|
|
||||||
sourcePath: "images/05plane.jpg"
|
|
||||||
securityImageEnumValue: 5;
|
|
||||||
}
|
|
||||||
ListElement{
|
|
||||||
sourcePath: "images/06gingerbread.jpg"
|
|
||||||
securityImageEnumValue: 6;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,272 +0,0 @@
|
||||||
//
|
|
||||||
// SecurityImageSelection.qml
|
|
||||||
// qml/hifi/commerce
|
|
||||||
//
|
|
||||||
// SecurityImageSelection
|
|
||||||
//
|
|
||||||
// Created by Zach Fox on 2017-08-15
|
|
||||||
// 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 Hifi 1.0 as Hifi
|
|
||||||
import QtQuick 2.5
|
|
||||||
import QtQuick.Controls 1.4
|
|
||||||
import "../../styles-uit"
|
|
||||||
import "../../controls-uit" as HifiControlsUit
|
|
||||||
import "../../controls" as HifiControls
|
|
||||||
|
|
||||||
// references XXX from root context
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
HifiConstants { id: hifi; }
|
|
||||||
|
|
||||||
id: securityImageSelectionRoot;
|
|
||||||
property string referrerURL: "";
|
|
||||||
property bool isManuallyChangingSecurityImage: false;
|
|
||||||
anchors.fill: parent;
|
|
||||||
// Style
|
|
||||||
color: hifi.colors.baseGray;
|
|
||||||
z:999; // On top of everything else
|
|
||||||
visible: false;
|
|
||||||
|
|
||||||
Hifi.QmlCommerce {
|
|
||||||
id: commerce;
|
|
||||||
onSecurityImageResult: {
|
|
||||||
if (!isManuallyChangingSecurityImage) {
|
|
||||||
securityImageSelectionRoot.visible = true;
|
|
||||||
}
|
|
||||||
securityImageGrid.currentIndex = 0
|
|
||||||
//if (imageID > 0) {
|
|
||||||
// for (var itr = 0; itr < gridModel.count; itr++) {
|
|
||||||
// var thisValue = gridModel.get(itr).securityImageEnumValue;
|
|
||||||
// if (thisValue === imageID) {
|
|
||||||
// securityImageGrid.currentIndex = itr;
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
|
||||||
commerce.getSecurityImage();
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// TITLE BAR START
|
|
||||||
//
|
|
||||||
Item {
|
|
||||||
id: titleBarContainer;
|
|
||||||
// Size
|
|
||||||
width: securityImageSelectionRoot.width;
|
|
||||||
height: 30;
|
|
||||||
// Anchors
|
|
||||||
anchors.left: parent.left;
|
|
||||||
anchors.top: parent.top;
|
|
||||||
|
|
||||||
// Title Bar text
|
|
||||||
RalewaySemiBold {
|
|
||||||
id: titleBarText;
|
|
||||||
text: "Select a Security Image";
|
|
||||||
// Text size
|
|
||||||
size: hifi.fontSizes.overlayTitle;
|
|
||||||
// Anchors
|
|
||||||
anchors.fill: parent;
|
|
||||||
anchors.leftMargin: 16;
|
|
||||||
// Style
|
|
||||||
color: hifi.colors.lightGrayText;
|
|
||||||
// Alignment
|
|
||||||
horizontalAlignment: Text.AlignHLeft;
|
|
||||||
verticalAlignment: Text.AlignVCenter;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Separator
|
|
||||||
HifiControlsUit.Separator {
|
|
||||||
anchors.left: parent.left;
|
|
||||||
anchors.right: parent.right;
|
|
||||||
anchors.bottom: parent.bottom;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// TITLE BAR END
|
|
||||||
//
|
|
||||||
|
|
||||||
//
|
|
||||||
// EXPLANATION START
|
|
||||||
//
|
|
||||||
Item {
|
|
||||||
id: explanationContainer;
|
|
||||||
// Size
|
|
||||||
width: securityImageSelectionRoot.width;
|
|
||||||
height: 85;
|
|
||||||
// Anchors
|
|
||||||
anchors.top: titleBarContainer.bottom;
|
|
||||||
anchors.left: parent.left;
|
|
||||||
anchors.right: parent.right;
|
|
||||||
|
|
||||||
RalewayRegular {
|
|
||||||
id: explanationText;
|
|
||||||
text: "This image will be displayed on secure Inventory and Marketplace Checkout dialogs.<b><br>If you don't see your selected image on these dialogs, do not use them!</b>";
|
|
||||||
// Text size
|
|
||||||
size: 16;
|
|
||||||
// Anchors
|
|
||||||
anchors.top: parent.top;
|
|
||||||
anchors.topMargin: 4;
|
|
||||||
anchors.left: parent.left;
|
|
||||||
anchors.leftMargin: 16;
|
|
||||||
anchors.right: parent.right;
|
|
||||||
anchors.rightMargin: 16;
|
|
||||||
// Style
|
|
||||||
color: hifi.colors.lightGrayText;
|
|
||||||
wrapMode: Text.WordWrap;
|
|
||||||
// Alignment
|
|
||||||
horizontalAlignment: Text.AlignHLeft;
|
|
||||||
verticalAlignment: Text.AlignVCenter;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Separator
|
|
||||||
HifiControlsUit.Separator {
|
|
||||||
anchors.left: parent.left;
|
|
||||||
anchors.right: parent.right;
|
|
||||||
anchors.bottom: parent.bottom;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// EXPLANATION END
|
|
||||||
//
|
|
||||||
|
|
||||||
//
|
|
||||||
// SECURITY IMAGE GRID START
|
|
||||||
//
|
|
||||||
Item {
|
|
||||||
id: securityImageGridContainer;
|
|
||||||
// Anchors
|
|
||||||
anchors.left: parent.left;
|
|
||||||
anchors.leftMargin: 8;
|
|
||||||
anchors.right: parent.right;
|
|
||||||
anchors.rightMargin: 8;
|
|
||||||
anchors.top: explanationContainer.bottom;
|
|
||||||
anchors.topMargin: 8;
|
|
||||||
anchors.bottom: actionButtonsContainer.top;
|
|
||||||
anchors.bottomMargin: 8;
|
|
||||||
|
|
||||||
SecurityImageModel {
|
|
||||||
id: gridModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
GridView {
|
|
||||||
id: securityImageGrid;
|
|
||||||
clip: true;
|
|
||||||
// Anchors
|
|
||||||
anchors.fill: parent;
|
|
||||||
currentIndex: -1;
|
|
||||||
cellWidth: width / 2;
|
|
||||||
cellHeight: height / 3;
|
|
||||||
model: gridModel;
|
|
||||||
delegate: Item {
|
|
||||||
width: securityImageGrid.cellWidth;
|
|
||||||
height: securityImageGrid.cellHeight;
|
|
||||||
Item {
|
|
||||||
anchors.fill: parent;
|
|
||||||
Image {
|
|
||||||
width: parent.width - 8;
|
|
||||||
height: parent.height - 8;
|
|
||||||
source: sourcePath;
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter;
|
|
||||||
anchors.verticalCenter: parent.verticalCenter;
|
|
||||||
fillMode: Image.PreserveAspectFit;
|
|
||||||
mipmap: true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MouseArea {
|
|
||||||
anchors.fill: parent;
|
|
||||||
onClicked: {
|
|
||||||
securityImageGrid.currentIndex = index;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
highlight: Rectangle {
|
|
||||||
width: securityImageGrid.cellWidth;
|
|
||||||
height: securityImageGrid.cellHeight;
|
|
||||||
color: hifi.colors.blueHighlight;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// SECURITY IMAGE GRID END
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// ACTION BUTTONS START
|
|
||||||
//
|
|
||||||
Item {
|
|
||||||
id: actionButtonsContainer;
|
|
||||||
// Size
|
|
||||||
width: securityImageSelectionRoot.width;
|
|
||||||
height: 40;
|
|
||||||
// Anchors
|
|
||||||
anchors.left: parent.left;
|
|
||||||
anchors.bottom: parent.bottom;
|
|
||||||
anchors.bottomMargin: 8;
|
|
||||||
|
|
||||||
// "Cancel" button
|
|
||||||
HifiControlsUit.Button {
|
|
||||||
id: cancelButton;
|
|
||||||
color: hifi.buttons.black;
|
|
||||||
colorScheme: hifi.colorSchemes.dark;
|
|
||||||
anchors.top: parent.top;
|
|
||||||
anchors.topMargin: 3;
|
|
||||||
anchors.bottom: parent.bottom;
|
|
||||||
anchors.bottomMargin: 3;
|
|
||||||
anchors.left: parent.left;
|
|
||||||
anchors.leftMargin: 20;
|
|
||||||
width: parent.width/2 - anchors.leftMargin*2;
|
|
||||||
text: "Cancel"
|
|
||||||
onClicked: {
|
|
||||||
if (!securityImageSelectionRoot.isManuallyChangingSecurityImage) {
|
|
||||||
sendToScript({method: 'securityImageSelection_cancelClicked', referrerURL: securityImageSelectionRoot.referrerURL});
|
|
||||||
} else {
|
|
||||||
securityImageSelectionRoot.visible = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// "Confirm" button
|
|
||||||
HifiControlsUit.Button {
|
|
||||||
id: confirmButton;
|
|
||||||
color: hifi.buttons.black;
|
|
||||||
colorScheme: hifi.colorSchemes.dark;
|
|
||||||
anchors.top: parent.top;
|
|
||||||
anchors.topMargin: 3;
|
|
||||||
anchors.bottom: parent.bottom;
|
|
||||||
anchors.bottomMargin: 3;
|
|
||||||
anchors.right: parent.right;
|
|
||||||
anchors.rightMargin: 20;
|
|
||||||
width: parent.width/2 - anchors.rightMargin*2;
|
|
||||||
text: "Confirm";
|
|
||||||
onClicked: {
|
|
||||||
securityImageSelectionRoot.isManuallyChangingSecurityImage = false;
|
|
||||||
commerce.chooseSecurityImage(gridModel.get(securityImageGrid.currentIndex).sourcePath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// ACTION BUTTONS END
|
|
||||||
//
|
|
||||||
|
|
||||||
//
|
|
||||||
// FUNCTION DEFINITIONS START
|
|
||||||
//
|
|
||||||
signal sendToScript(var message);
|
|
||||||
|
|
||||||
function getImagePathFromImageID(imageID) {
|
|
||||||
return (imageID ? gridModel.get(imageID - 1).sourcePath : "");
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// FUNCTION DEFINITIONS END
|
|
||||||
//
|
|
||||||
}
|
|
|
@ -119,7 +119,9 @@
|
||||||
var button;
|
var button;
|
||||||
var buttonName = "WALLET";
|
var buttonName = "WALLET";
|
||||||
var tablet = null;
|
var tablet = null;
|
||||||
|
var walletEnabled = Settings.getValue("inspectionMode", false);
|
||||||
function startup() {
|
function startup() {
|
||||||
|
if (walletEnabled) {
|
||||||
tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||||
button = tablet.addButton({
|
button = tablet.addButton({
|
||||||
text: buttonName,
|
text: buttonName,
|
||||||
|
@ -129,6 +131,7 @@
|
||||||
button.clicked.connect(onButtonClicked);
|
button.clicked.connect(onButtonClicked);
|
||||||
tablet.screenChanged.connect(onTabletScreenChanged);
|
tablet.screenChanged.connect(onTabletScreenChanged);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
function shutdown() {
|
function shutdown() {
|
||||||
button.clicked.disconnect(onButtonClicked);
|
button.clicked.disconnect(onButtonClicked);
|
||||||
tablet.removeButton(button);
|
tablet.removeButton(button);
|
||||||
|
|
Loading…
Reference in a new issue