From a489267cec84049869e5434a7af10fd7fbaeba18 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Wed, 23 Aug 2017 10:48:47 -0700 Subject: [PATCH] Hide behind switch and remove dead code --- .../qml/hifi/commerce/SecurityImageModel.qml | 42 --- .../hifi/commerce/SecurityImageSelection.qml | 271 ------------------ scripts/system/commerce/wallet.js | 19 +- 3 files changed, 11 insertions(+), 321 deletions(-) delete mode 100644 interface/resources/qml/hifi/commerce/SecurityImageModel.qml delete mode 100644 interface/resources/qml/hifi/commerce/SecurityImageSelection.qml diff --git a/interface/resources/qml/hifi/commerce/SecurityImageModel.qml b/interface/resources/qml/hifi/commerce/SecurityImageModel.qml deleted file mode 100644 index 2fbf28683f..0000000000 --- a/interface/resources/qml/hifi/commerce/SecurityImageModel.qml +++ /dev/null @@ -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; - } -} diff --git a/interface/resources/qml/hifi/commerce/SecurityImageSelection.qml b/interface/resources/qml/hifi/commerce/SecurityImageSelection.qml deleted file mode 100644 index 7775f1ff9c..0000000000 --- a/interface/resources/qml/hifi/commerce/SecurityImageSelection.qml +++ /dev/null @@ -1,271 +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 = (imageID == 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.
If you don't see your selected image on these dialogs, do not use them!
"; - // 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).securityImageEnumValue); - } - } - } - // - // ACTION BUTTONS END - // - - // - // FUNCTION DEFINITIONS START - // - signal sendToScript(var message); - - function getImagePathFromImageID(imageID) { - return (imageID ? gridModel.get(imageID - 1).sourcePath : ""); - } - // - // FUNCTION DEFINITIONS END - // -} diff --git a/scripts/system/commerce/wallet.js b/scripts/system/commerce/wallet.js index 6045bef8ef..14954e5df6 100644 --- a/scripts/system/commerce/wallet.js +++ b/scripts/system/commerce/wallet.js @@ -119,15 +119,18 @@ var button; var buttonName = "WALLET"; var tablet = null; + var walletEnabled = Settings.getValue("inspectionMode", false); function startup() { - tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); - button = tablet.addButton({ - text: buttonName, - icon: "icons/tablet-icons/wallet-i.svg", - activeIcon: "icons/tablet-icons/wallet-a.svg" - }); - button.clicked.connect(onButtonClicked); - tablet.screenChanged.connect(onTabletScreenChanged); + if (walletEnabled) { + tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); + button = tablet.addButton({ + text: buttonName, + icon: "icons/tablet-icons/wallet-i.svg", + activeIcon: "icons/tablet-icons/wallet-a.svg" + }); + button.clicked.connect(onButtonClicked); + tablet.screenChanged.connect(onTabletScreenChanged); + } } function shutdown() { button.clicked.disconnect(onButtonClicked);