Getting closer

This commit is contained in:
Zach Fox 2017-08-15 15:02:28 -07:00
parent b7282cc776
commit 768eb7f91c
3 changed files with 38 additions and 10 deletions

View file

@ -43,12 +43,18 @@ Rectangle {
inventoryContentsList.model = inventory.assets;
}
}
onSecurityImageResult: {
securityImage.source = imageID ? gridModel.get(imageID - 1).sourcePath : "";
}
}
SecurityImageSelection {
id: securityImageSelection;
referrerURL: inventoryRoot.referrerURL;
}
SecurityImageModel {
id: gridModel;
}
//
// TITLE BAR START
@ -56,7 +62,7 @@ Rectangle {
Item {
id: titleBarContainer;
// Size
width: inventoryRoot.width;
width: parent.width;
height: 50;
// Anchors
anchors.left: parent.left;
@ -69,8 +75,11 @@ Rectangle {
// Text size
size: hifi.fontSizes.overlayTitle;
// Anchors
anchors.fill: parent;
anchors.top: parent.top;
anchors.left: parent.left;
anchors.leftMargin: 16;
anchors.bottom: parent.bottom;
width: paintedWidth;
// Style
color: hifi.colors.lightGrayText;
// Alignment
@ -78,6 +87,20 @@ Rectangle {
verticalAlignment: Text.AlignVCenter;
}
// Security Image
Image {
id: securityImage;
// Anchors
anchors.top: parent.top;
anchors.left: titleBarText.right;
anchors.leftMargin: 16;
height: parent.height - 5;
width: height;
anchors.horizontalCenter: parent.horizontalCenter;
anchors.verticalCenter: parent.verticalCenter;
fillMode: Image.PreserveAspectFit;
}
// "Change Security Image" button
HifiControlsUit.Button {
id: changeSecurityImageButton;
@ -286,6 +309,7 @@ Rectangle {
referrerURL = message.referrerURL;
commerce.balance();
commerce.inventory();
commerce.getSecurityImage();
break;
default:
console.log('Unrecognized message from marketplaces.js:', JSON.stringify(message));

View file

@ -17,26 +17,26 @@ ListModel {
id: root;
ListElement{
sourcePath: "images/01cat.jpg"
securityImageEnumIndex: 1;
securityImageEnumValue: 1;
}
ListElement{
sourcePath: "images/02car.jpg"
securityImageEnumIndex: 2;
securityImageEnumValue: 2;
}
ListElement{
sourcePath: "images/03dog.jpg"
securityImageEnumIndex: 3;
securityImageEnumValue: 3;
}
ListElement{
sourcePath: "images/04stars.jpg"
securityImageEnumIndex: 4;
securityImageEnumValue: 4;
}
ListElement{
sourcePath: "images/05plane.jpg"
securityImageEnumIndex: 5;
securityImageEnumValue: 5;
}
ListElement{
sourcePath: "images/06gingerbread.jpg"
securityImageEnumIndex: 6;
securityImageEnumValue: 6;
}
}

View file

@ -26,6 +26,7 @@ Rectangle {
id: securityImageSelectionRoot;
property string referrerURL: "";
property bool isManuallyChangingSecurityImage: false;
property int imageEnumValue: 0;
anchors.fill: parent;
// Style
color: hifi.colors.baseGray;
@ -40,8 +41,11 @@ Rectangle {
}
if (imageID !== 0) {
for (var itr = 0; itr < gridModel.count; itr++) {
if (gridModel.get(itr).securityImageEnumIndex === imageID) {
var thisValue = gridModel.get(itr).securityImageEnumValue;
if (thisValue === imageID) {
securityImageSelectionRoot.imageEnumValue = thisValue;
securityImageGrid.currentIndex = itr;
return;
}
}
}
@ -252,7 +256,7 @@ Rectangle {
text: "Confirm";
onClicked: {
securityImageSelectionRoot.isManuallyChangingSecurityImage = false;
commerce.chooseSecurityImage(gridModel.get(securityImageGrid.currentIndex).securityImageEnumIndex);
commerce.chooseSecurityImage(gridModel.get(securityImageGrid.currentIndex).securityImageEnumValue);
}
}
}