diff --git a/interface/resources/qml/hifi/AvatarApp.qml b/interface/resources/qml/hifi/AvatarApp.qml
index ff0dfde425..a6edf4b1cb 100644
--- a/interface/resources/qml/hifi/AvatarApp.qml
+++ b/interface/resources/qml/hifi/AvatarApp.qml
@@ -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. Learn to make a custom avatar by opening this link on your desktop.'
- 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 Marketplace' + '\n' +
- 'Wear wearable from My Purchases' + '\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 Marketplace' + '\n' +
- 'Wear avatars from My Purchases' + '\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
}
diff --git a/interface/resources/qml/hifi/avatarapp/MessageBoxes.qml b/interface/resources/qml/hifi/avatarapp/MessageBoxes.qml
new file mode 100644
index 0000000000..28a2e695d6
--- /dev/null
+++ b/interface/resources/qml/hifi/avatarapp/MessageBoxes.qml
@@ -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. Learn to make a custom avatar by opening this link on your desktop.'
+ 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 Marketplace' + '\n' +
+ 'Wear wearable from My Purchases' + '\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 Marketplace' + '\n' +
+ 'Wear avatars from My Purchases' + '\n' +
+ 'You can visit the domain “BodyMart”' + '\n' +
+ 'to get avatars'
+
+ popup.imageSource = getAvatarsUrl;
+ popup.onButton2Clicked = function() {
+ popup.close();
+
+ if(callback)
+ callback();
+ }
+ popup.open();
+ }
+}
+