mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 16:41:02 +02:00
add check for duplicate names into 'create favorites dialog', style accordingly to mockups
This commit is contained in:
parent
a26248e1d2
commit
b7614684de
2 changed files with 37 additions and 3 deletions
|
@ -764,6 +764,7 @@ Rectangle {
|
||||||
}
|
}
|
||||||
|
|
||||||
CreateFavoriteDialog {
|
CreateFavoriteDialog {
|
||||||
|
avatars: allAvatars
|
||||||
id: createFavorite
|
id: createFavorite
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,11 +21,14 @@ Rectangle {
|
||||||
property string button2color: hifi.buttons.blue;
|
property string button2color: hifi.buttons.blue;
|
||||||
property string button2text: 'CONFIRM'
|
property string button2text: 'CONFIRM'
|
||||||
|
|
||||||
|
property var avatars;
|
||||||
property var onSaveClicked;
|
property var onSaveClicked;
|
||||||
property var onCancelClicked;
|
property var onCancelClicked;
|
||||||
|
|
||||||
function open(avatar) {
|
function open(avatar) {
|
||||||
favoriteName.text = '';
|
favoriteName.text = '';
|
||||||
|
console.debug('CreateFavoriteDialog: ', avatar.thumbnailUrl);
|
||||||
|
|
||||||
avatarImageUrl = avatar.thumbnailUrl;
|
avatarImageUrl = avatar.thumbnailUrl;
|
||||||
wearablesCount = avatar.wearables.count;
|
wearablesCount = avatar.wearables.count;
|
||||||
|
|
||||||
|
@ -88,20 +91,50 @@ Rectangle {
|
||||||
anchors.right: parent.right;
|
anchors.right: parent.right;
|
||||||
anchors.rightMargin: 30;
|
anchors.rightMargin: 30;
|
||||||
|
|
||||||
Row {
|
Item {
|
||||||
id: bodyRow
|
id: bodyRow
|
||||||
|
height: childrenRect.height
|
||||||
|
|
||||||
spacing: 44
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
|
||||||
AvatarThumbnail {
|
AvatarThumbnail {
|
||||||
imageUrl: avatarImageUrl
|
imageUrl: avatarImageUrl
|
||||||
|
onImageUrlChanged: {
|
||||||
|
console.debug('CreateFavoritesDialog: imageUrlChanged: ', imageUrl);
|
||||||
|
}
|
||||||
|
|
||||||
wearablesCount: avatarWearablesCount
|
wearablesCount: avatarWearablesCount
|
||||||
}
|
}
|
||||||
|
|
||||||
InputTextStyle4 {
|
InputTextStyle4 {
|
||||||
id: favoriteName
|
id: favoriteName
|
||||||
|
anchors.right: parent.right
|
||||||
|
width: 184
|
||||||
|
height: 40
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
placeholderText: "Enter Favorite Name"
|
placeholderText: "Enter Favorite Name"
|
||||||
|
|
||||||
|
RalewayRegular {
|
||||||
|
id: wrongName
|
||||||
|
anchors.top: parent.bottom;
|
||||||
|
anchors.topMargin: 2
|
||||||
|
|
||||||
|
anchors.right: parent.right;
|
||||||
|
text: 'Favorite name exists'
|
||||||
|
size: 15
|
||||||
|
color: 'red'
|
||||||
|
visible: {
|
||||||
|
for(var i = 0; i < avatars.count; ++i) {
|
||||||
|
var avatarName = avatars.get(i).name;
|
||||||
|
if(avatarName === favoriteName.text) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,7 +144,7 @@ Rectangle {
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
|
|
||||||
yesButton.enabled: favoriteNameText !== ''
|
yesButton.enabled: favoriteNameText !== '' && !wrongName.visible
|
||||||
yesText: root.button2text
|
yesText: root.button2text
|
||||||
noText: root.button1text
|
noText: root.button1text
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue