move all messagebox-es into dedicated component

This commit is contained in:
Alexander Ivash 2018-05-11 01:23:15 +03:00
parent d1bf80b50c
commit 6ff397e9e0
2 changed files with 104 additions and 68 deletions

View file

@ -393,18 +393,8 @@ Rectangle {
MouseArea {
anchors.fill: parent
onClicked: {
popup.titleText = 'Specify Avatar URL'
popup.bodyText = 'If you want to add a custom avatar, you can specify the URL of the avatar file' +
'(“.fst” extension) here. <a href="#">Learn to make a custom avatar by opening this link on your desktop.</a>'
popup.inputText.visible = true;
popup.inputText.placeholderText = 'Enter Avatar Url';
popup.button1text = 'CANCEL';
popup.button2text = 'CONFIRM';
popup.onButton2Clicked = function() {
popup.close();
}
popup.open();
popup.showSpecifyAvatarUrl(function() {
});
}
}
}
@ -437,7 +427,6 @@ Rectangle {
MouseArea {
anchors.fill: parent
property url getWearablesUrl: '../../images/samples/hifi-place-77312e4b-6f48-4eb4-87e2-50444d8e56d1.png'
// debug only
acceptedButtons: Qt.LeftButton | Qt.RightButton
@ -471,20 +460,9 @@ Rectangle {
return;
}
popup.button2text = 'AvatarIsland'
popup.button1text = 'CANCEL'
popup.titleText = 'Get Wearables'
popup.bodyText = 'Buy wearables from <a href="https://fake.link">Marketplace</a>' + '\n' +
'Wear wearable from <a href="https://fake.link">My Purchases</a>' + '\n' +
'You can visit the domain “AvatarIsland”' + '\n' +
'to get wearables'
popup.imageSource = getWearablesUrl;
popup.onButton2Clicked = function() {
popup.close();
popup.showGetWearables(function() {
gotoAvatarAppPanel.visible = true;
}
popup.open();
})
}
}
}
@ -703,16 +681,7 @@ Rectangle {
onClicked: {
if(isInManageState) {
var currentItem = delegateRoot.GridView.view.model.get(index);
popup.titleText = 'Delete Favorite: {AvatarName}'.replace('{AvatarName}', currentItem.name)
popup.bodyText = 'This will delete your favorite. You will retain access to the wearables and avatar that made up the favorite from My Purchases.'
popup.imageSource = null;
popup.button1text = 'CANCEL'
popup.button2text = 'DELETE'
popup.onButton2Clicked = function() {
popup.close();
popup.showDeleteFavorite(currentItem.name, function() {
pageOfAvatars.isUpdating = true;
console.debug('removing ', index)
@ -738,24 +707,13 @@ Rectangle {
console.debug('removed ', absoluteIndex, 'newItemIndex: ', newItemIndex, 'allAvatars.count:', allAvatars.count, 'pageOfAvatars.count:', pageOfAvatars.count)
pageOfAvatars.isUpdating = false;
};
popup.open();
});
} else {
if(delegateRoot.GridView.view.currentIndex !== index) {
var currentItem = delegateRoot.GridView.view.model.get(index);
popup.button2text = 'CONFIRM'
popup.button1text = 'CANCEL'
popup.titleText = 'Load Favorite: {AvatarName}'.replace('{AvatarName}', currentItem.name)
popup.bodyText = 'This will switch your current avatar and wearables that you are wearing with a new avatar and wearables.'
popup.imageSource = null;
popup.onButton2Clicked = function() {
popup.close();
popup.showLoadFavorite(currentItem.name, function() {
view.selectAvatar(currentItem);
}
popup.open();
});
}
}
}
@ -795,26 +753,11 @@ Rectangle {
MouseArea {
anchors.fill: parent
property url getAvatarsUrl: '../../images/samples/hifi-place-get-avatars.png'
onClicked: {
console.debug('getAvatarsUrl: ', getAvatarsUrl);
popup.button2text = 'BodyMart'
popup.button1text = 'CANCEL'
popup.titleText = 'Get Avatars'
popup.bodyText = 'Buy avatars from <a href="https://fake.link">Marketplace</a>' + '\n' +
'Wear avatars from <a href="https://fake.link">My Purchases</a>' + '\n' +
'You can visit the domain “BodyMart”' + '\n' +
'to get avatars'
popup.imageSource = getAvatarsUrl;
popup.onButton2Clicked = function() {
popup.close();
popup.showBuyAvatars(function() {
gotoAvatarAppPanel.visible = true;
}
popup.open();
});
}
}
}
@ -874,7 +817,7 @@ Rectangle {
}
}
MessageBox {
MessageBoxes {
id: popup
}

View file

@ -0,0 +1,93 @@
import QtQuick 2.5
MessageBox {
id: popup
function showSpecifyAvatarUrl(callback) {
popup.onButton2Clicked = callback;
popup.titleText = 'Specify Avatar URL'
popup.bodyText = 'If you want to add a custom avatar, you can specify the URL of the avatar file' +
'(“.fst” extension) here. <a href="#">Learn to make a custom avatar by opening this link on your desktop.</a>'
popup.inputText.visible = true;
popup.inputText.placeholderText = 'Enter Avatar Url';
popup.button1text = 'CANCEL';
popup.button2text = 'CONFIRM';
popup.open();
}
property url getWearablesUrl: '../../../images/samples/hifi-place-77312e4b-6f48-4eb4-87e2-50444d8e56d1.png'
function showGetWearables(callback) {
popup.button2text = 'AvatarIsland'
popup.button1text = 'CANCEL'
popup.titleText = 'Get Wearables'
popup.bodyText = 'Buy wearables from <a href="https://fake.link">Marketplace</a>' + '\n' +
'Wear wearable from <a href="https://fake.link">My Purchases</a>' + '\n' +
'You can visit the domain “AvatarIsland”' + '\n' +
'to get wearables'
popup.imageSource = getWearablesUrl;
popup.onButton2Clicked = function() {
popup.close();
if(callback)
callback();
}
popup.open();
}
function showDeleteFavorite(favoriteName, callback) {
popup.titleText = 'Delete Favorite: {AvatarName}'.replace('{AvatarName}', favoriteName)
popup.bodyText = 'This will delete your favorite. You will retain access to the wearables and avatar that made up the favorite from My Purchases.'
popup.imageSource = null;
popup.button1text = 'CANCEL'
popup.button2text = 'DELETE'
popup.onButton2Clicked = function() {
popup.close();
if(callback)
callback();
}
popup.open();
}
function showLoadFavorite(favoriteName, callback) {
popup.button2text = 'CONFIRM'
popup.button1text = 'CANCEL'
popup.titleText = 'Load Favorite: {AvatarName}'.replace('{AvatarName}', favoriteName)
popup.bodyText = 'This will switch your current avatar and wearables that you are wearing with a new avatar and wearables.'
popup.imageSource = null;
popup.onButton2Clicked = function() {
popup.close();
if(callback)
callback();
}
popup.open();
}
property url getAvatarsUrl: '../../../images/samples/hifi-place-get-avatars.png'
function showBuyAvatars(callback) {
popup.button2text = 'BodyMart'
popup.button1text = 'CANCEL'
popup.titleText = 'Get Avatars'
popup.bodyText = 'Buy avatars from <a href="https://fake.link">Marketplace</a>' + '\n' +
'Wear avatars from <a href="https://fake.link">My Purchases</a>' + '\n' +
'You can visit the domain “BodyMart”' + '\n' +
'to get avatars'
popup.imageSource = getAvatarsUrl;
popup.onButton2Clicked = function() {
popup.close();
if(callback)
callback();
}
popup.open();
}
}