mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 07:37:20 +02:00
Lots of progress
This commit is contained in:
parent
f4e2b48dbb
commit
95e9eb8e4a
12 changed files with 174 additions and 53 deletions
Binary file not shown.
|
@ -37,11 +37,14 @@ Rectangle {
|
||||||
property double balanceAfterPurchase;
|
property double balanceAfterPurchase;
|
||||||
property bool alreadyOwned: false;
|
property bool alreadyOwned: false;
|
||||||
property int itemPrice: -1;
|
property int itemPrice: -1;
|
||||||
property bool itemIsJson: true;
|
property bool isCertified;
|
||||||
|
property string itemType;
|
||||||
|
property var itemTypesArray: ["entity", "wearable", "contentSet", "app", "avatar"];
|
||||||
|
property var buttonTextNormal: ["REZ IT", "WEAR IT", "SWAP CONTENT SET", "INSTALL IT", "WEAR IT"];
|
||||||
|
property var buttonTextClicked: ["REZZED", "WORN", "SWAPPED", "INSTALLED", "WORN"]
|
||||||
property bool shouldBuyWithControlledFailure: false;
|
property bool shouldBuyWithControlledFailure: false;
|
||||||
property bool debugCheckoutSuccess: false;
|
property bool debugCheckoutSuccess: false;
|
||||||
property bool canRezCertifiedItems: Entities.canRezCertified() || Entities.canRezTmpCertified();
|
property bool canRezCertifiedItems: Entities.canRezCertified() || Entities.canRezTmpCertified();
|
||||||
property bool isWearable;
|
|
||||||
property string referrer;
|
property string referrer;
|
||||||
// Style
|
// Style
|
||||||
color: hifi.colors.white;
|
color: hifi.colors.white;
|
||||||
|
@ -85,7 +88,9 @@ Rectangle {
|
||||||
UserActivityLogger.commercePurchaseFailure(root.itemId, root.itemAuthor, root.itemPrice, !root.alreadyOwned, result.message);
|
UserActivityLogger.commercePurchaseFailure(root.itemId, root.itemAuthor, root.itemPrice, !root.alreadyOwned, result.message);
|
||||||
} else {
|
} else {
|
||||||
root.itemHref = result.data.download_url;
|
root.itemHref = result.data.download_url;
|
||||||
root.isWearable = result.data.categories.indexOf("Wearables") > -1;
|
if (result.data.categories.indexOf("Wearables") > -1) {
|
||||||
|
root.itemType = "wearable";
|
||||||
|
}
|
||||||
root.activeView = "checkoutSuccess";
|
root.activeView = "checkoutSuccess";
|
||||||
UserActivityLogger.commercePurchaseSuccess(root.itemId, root.itemAuthor, root.itemPrice, !root.alreadyOwned);
|
UserActivityLogger.commercePurchaseSuccess(root.itemId, root.itemAuthor, root.itemPrice, !root.alreadyOwned);
|
||||||
}
|
}
|
||||||
|
@ -122,7 +127,25 @@ Rectangle {
|
||||||
}
|
}
|
||||||
|
|
||||||
onItemHrefChanged: {
|
onItemHrefChanged: {
|
||||||
itemIsJson = root.itemHref.endsWith('.json');
|
if (root.itemHref.indexOf(".fst") > -1) {
|
||||||
|
root.itemType = "avatar";
|
||||||
|
} else if (root.itemHref.endsWith('.json.gz')) {
|
||||||
|
root.itemType = "contentSet";
|
||||||
|
} else if (root.itemHref.endsWith('.json')) {
|
||||||
|
root.itemType = "entity"; // "wearable" type handled later
|
||||||
|
} else if (root.itemHref.endsWith('.js')) {
|
||||||
|
root.itemType = "app";
|
||||||
|
} else {
|
||||||
|
root.itemType = "entity";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onItemTypeChanged: {
|
||||||
|
if (root.itemType === "entity" || root.itemType === "wearable" || root.itemType === "contentSet") {
|
||||||
|
root.isCertified = true;
|
||||||
|
} else {
|
||||||
|
root.isCertified = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onItemPriceChanged: {
|
onItemPriceChanged: {
|
||||||
|
@ -464,7 +487,7 @@ Rectangle {
|
||||||
// "Buy" button
|
// "Buy" button
|
||||||
HifiControlsUit.Button {
|
HifiControlsUit.Button {
|
||||||
id: buyButton;
|
id: buyButton;
|
||||||
enabled: (root.balanceAfterPurchase >= 0 && purchasesReceived && balanceReceived) || !itemIsJson;
|
enabled: (root.balanceAfterPurchase >= 0 && purchasesReceived && balanceReceived) || (!root.isCertified);
|
||||||
color: hifi.buttons.blue;
|
color: hifi.buttons.blue;
|
||||||
colorScheme: hifi.colorSchemes.light;
|
colorScheme: hifi.colorSchemes.light;
|
||||||
anchors.top: checkoutActionButtonsContainer.top;
|
anchors.top: checkoutActionButtonsContainer.top;
|
||||||
|
@ -472,9 +495,9 @@ Rectangle {
|
||||||
height: 40;
|
height: 40;
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left;
|
||||||
anchors.right: parent.right;
|
anchors.right: parent.right;
|
||||||
text: (itemIsJson ? ((purchasesReceived && balanceReceived) ? "Confirm Purchase" : "--") : "Get Item");
|
text: ((root.isCertified) ? ((purchasesReceived && balanceReceived) ? "Confirm Purchase" : "--") : "Get Item");
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (itemIsJson) {
|
if (root.isCertified) {
|
||||||
buyButton.enabled = false;
|
buyButton.enabled = false;
|
||||||
if (!root.shouldBuyWithControlledFailure) {
|
if (!root.shouldBuyWithControlledFailure) {
|
||||||
Commerce.buy(itemId, itemPrice);
|
Commerce.buy(itemId, itemPrice);
|
||||||
|
@ -576,7 +599,7 @@ Rectangle {
|
||||||
|
|
||||||
RalewayBold {
|
RalewayBold {
|
||||||
anchors.fill: parent;
|
anchors.fill: parent;
|
||||||
text: "REZZED";
|
text: (root.buttonTextClicked)[itemTypesArray.indexOf(root.itemType)];
|
||||||
size: 18;
|
size: 18;
|
||||||
color: hifi.colors.white;
|
color: hifi.colors.white;
|
||||||
verticalAlignment: Text.AlignVCenter;
|
verticalAlignment: Text.AlignVCenter;
|
||||||
|
@ -592,7 +615,7 @@ Rectangle {
|
||||||
// "Rez" button
|
// "Rez" button
|
||||||
HifiControlsUit.Button {
|
HifiControlsUit.Button {
|
||||||
id: rezNowButton;
|
id: rezNowButton;
|
||||||
enabled: root.canRezCertifiedItems || root.isWearable;
|
enabled: root.canRezCertifiedItems || root.itemType === "wearable";
|
||||||
buttonGlyph: hifi.glyphs.lightning;
|
buttonGlyph: hifi.glyphs.lightning;
|
||||||
color: hifi.buttons.red;
|
color: hifi.buttons.red;
|
||||||
colorScheme: hifi.colorSchemes.light;
|
colorScheme: hifi.colorSchemes.light;
|
||||||
|
@ -601,17 +624,27 @@ Rectangle {
|
||||||
height: 50;
|
height: 50;
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left;
|
||||||
anchors.right: parent.right;
|
anchors.right: parent.right;
|
||||||
text: root.isWearable ? "Wear It" : "Rez It"
|
text: (root.buttonTextNormal)[itemTypesArray.indexOf(root.itemType)];
|
||||||
onClicked: {
|
onClicked: {
|
||||||
sendToScript({method: 'checkout_rezClicked', itemHref: root.itemHref, isWearable: root.isWearable});
|
if (root.itemType === "contentSet") {
|
||||||
rezzedNotifContainer.visible = true;
|
lightboxPopup.titleText = "Replace Content";
|
||||||
rezzedNotifContainerTimer.start();
|
lightboxPopup.bodyText = "Rezzing this content set will replace the existing environment and all of the items in this domain.";
|
||||||
UserActivityLogger.commerceEntityRezzed(root.itemId, "checkout", root.isWearable ? "rez" : "wear");
|
lightboxPopup.button1text = "CANCEL";
|
||||||
|
lightboxPopup.button1method = "root.visible = false;"
|
||||||
|
lightboxPopup.button2text = "CONFIRM";
|
||||||
|
lightboxPopup.button2method = "sendToScript({method: 'checkout_rezClicked', itemHref: " + root.itemHref + ", itemType: " + root.itemType + "});";
|
||||||
|
lightboxPopup.visible = true;
|
||||||
|
} else {
|
||||||
|
sendToScript({method: 'checkout_rezClicked', itemHref: root.itemHref, itemType: root.itemType});
|
||||||
|
rezzedNotifContainer.visible = true;
|
||||||
|
rezzedNotifContainerTimer.start();
|
||||||
|
UserActivityLogger.commerceEntityRezzed(root.itemId, "checkout", root.itemType);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RalewaySemiBold {
|
RalewaySemiBold {
|
||||||
id: noPermissionText;
|
id: noPermissionText;
|
||||||
visible: !root.canRezCertifiedItems && !root.isWearable;
|
visible: !root.canRezCertifiedItems && root.itemType !== "wearable";
|
||||||
text: '<font color="' + hifi.colors.redAccent + '"><a href="#">You do not have Certified Rez permissions in this domain.</a></font>'
|
text: '<font color="' + hifi.colors.redAccent + '"><a href="#">You do not have Certified Rez permissions in this domain.</a></font>'
|
||||||
// Text size
|
// Text size
|
||||||
size: 16;
|
size: 16;
|
||||||
|
@ -640,7 +673,7 @@ Rectangle {
|
||||||
}
|
}
|
||||||
RalewaySemiBold {
|
RalewaySemiBold {
|
||||||
id: explainRezText;
|
id: explainRezText;
|
||||||
visible: !root.isWearable;
|
visible: root.itemType === "entity";
|
||||||
text: '<font color="' + hifi.colors.redAccent + '"><a href="#">What does "Rez" mean?</a></font>'
|
text: '<font color="' + hifi.colors.redAccent + '"><a href="#">What does "Rez" mean?</a></font>'
|
||||||
// Text size
|
// Text size
|
||||||
size: 16;
|
size: 16;
|
||||||
|
@ -851,7 +884,7 @@ Rectangle {
|
||||||
buyButton.color = hifi.buttons.red;
|
buyButton.color = hifi.buttons.red;
|
||||||
root.shouldBuyWithControlledFailure = true;
|
root.shouldBuyWithControlledFailure = true;
|
||||||
} else {
|
} else {
|
||||||
buyButton.text = (itemIsJson ? ((purchasesReceived && balanceReceived) ? (root.alreadyOwned ? "Buy Another" : "Buy"): "--") : "Get Item");
|
buyButton.text = (root.isCertified ? ((purchasesReceived && balanceReceived) ? (root.alreadyOwned ? "Buy Another" : "Buy"): "--") : "Get Item");
|
||||||
buyButton.color = hifi.buttons.blue;
|
buyButton.color = hifi.buttons.blue;
|
||||||
root.shouldBuyWithControlledFailure = false;
|
root.shouldBuyWithControlledFailure = false;
|
||||||
}
|
}
|
||||||
|
@ -901,7 +934,7 @@ Rectangle {
|
||||||
}
|
}
|
||||||
|
|
||||||
function setBuyText() {
|
function setBuyText() {
|
||||||
if (root.itemIsJson) {
|
if (root.isCertified) {
|
||||||
if (root.purchasesReceived && root.balanceReceived) {
|
if (root.purchasesReceived && root.balanceReceived) {
|
||||||
if (root.balanceAfterPurchase < 0) {
|
if (root.balanceAfterPurchase < 0) {
|
||||||
if (root.alreadyOwned) {
|
if (root.alreadyOwned) {
|
||||||
|
|
|
@ -41,8 +41,11 @@ Item {
|
||||||
property int limitedRun;
|
property int limitedRun;
|
||||||
property string itemType;
|
property string itemType;
|
||||||
property var itemTypesArray: ["entity", "wearable", "contentSet", "app", "avatar"];
|
property var itemTypesArray: ["entity", "wearable", "contentSet", "app", "avatar"];
|
||||||
property var buttonTextNormal: ["REZ", "WEAR", "SWAP", "INSTALL", "WEAR"];
|
property var buttonTextNormal: ["REZ", "WEAR", "REPLACE", "INSTALL", "WEAR"];
|
||||||
property var buttonTextClicked: ["REZZED", "WORN", "SWAPPED", "INSTALLED", "WORN"]
|
property var buttonTextClicked: ["REZZED", "WORN", "REPLACED", "INSTALLED", "WORN"]
|
||||||
|
property var buttonGlyph: [hifi.glyphs.wand, hifi.glyphs.hat, hifi.glyphs.globe, hifi.glyphs.install, hifi.glyphs.avatar];
|
||||||
|
property bool showConfirmation: false;
|
||||||
|
property bool hasPermissionToRezThis;
|
||||||
|
|
||||||
property string originalStatusText;
|
property string originalStatusText;
|
||||||
property string originalStatusColor;
|
property string originalStatusColor;
|
||||||
|
@ -50,6 +53,23 @@ Item {
|
||||||
height: 110;
|
height: 110;
|
||||||
width: parent.width;
|
width: parent.width;
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: Commerce;
|
||||||
|
|
||||||
|
onContentSetChanged: {
|
||||||
|
if (contentSetMarketplaceID === root.itemId) {
|
||||||
|
showConfirmation = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onItemTypeChanged: {
|
||||||
|
if ((itemType === "entity" && (!Entities.canRezCertified() && !Entities.canRezTmpCertified())) ||
|
||||||
|
(itemType === "contentSet" && !Entities.canReplaceContent())) {
|
||||||
|
root.hasPermissionToRezThis = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onPurchaseStatusChangedChanged: {
|
onPurchaseStatusChangedChanged: {
|
||||||
if (root.purchaseStatusChanged === true && root.purchaseStatus === "confirmed") {
|
if (root.purchaseStatusChanged === true && root.purchaseStatus === "confirmed") {
|
||||||
root.originalStatusText = statusText.text;
|
root.originalStatusText = statusText.text;
|
||||||
|
@ -60,6 +80,15 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onShowConfirmationChanged: {
|
||||||
|
if (root.showConfirmation) {
|
||||||
|
rezzedNotifContainer.visible = true;
|
||||||
|
rezzedNotifContainerTimer.start();
|
||||||
|
UserActivityLogger.commerceEntityRezzed(root.itemId, "purchases", root.itemType);
|
||||||
|
root.showConfirmation = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
id: confirmedTimer;
|
id: confirmedTimer;
|
||||||
interval: 3000;
|
interval: 3000;
|
||||||
|
@ -325,7 +354,7 @@ Item {
|
||||||
RalewayBold {
|
RalewayBold {
|
||||||
anchors.fill: parent;
|
anchors.fill: parent;
|
||||||
text: (root.buttonTextClicked)[itemTypesArray.indexOf(root.itemType)];
|
text: (root.buttonTextClicked)[itemTypesArray.indexOf(root.itemType)];
|
||||||
size: 18;
|
size: 15;
|
||||||
color: hifi.colors.white;
|
color: hifi.colors.white;
|
||||||
verticalAlignment: Text.AlignVCenter;
|
verticalAlignment: Text.AlignVCenter;
|
||||||
horizontalAlignment: Text.AlignHCenter;
|
horizontalAlignment: Text.AlignHCenter;
|
||||||
|
@ -353,10 +382,12 @@ Item {
|
||||||
enabled: (root.canRezCertifiedItems || root.itemType === "wearable") && root.purchaseStatus !== "invalidated";
|
enabled: (root.canRezCertifiedItems || root.itemType === "wearable") && root.purchaseStatus !== "invalidated";
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
sendToPurchases({method: 'purchases_rezClicked', itemHref: root.itemHref, itemType: root.itemType});
|
if (root.itemType === "contentSet") {
|
||||||
rezzedNotifContainer.visible = true;
|
sendToPurchases({method: 'showReplaceContentLightbox', itemId: root.itemId, itemHref: root.itemHref});
|
||||||
rezzedNotifContainerTimer.start();
|
} else {
|
||||||
UserActivityLogger.commerceEntityRezzed(root.itemId, "purchases", root.itemType === "wearable" ? "rez" : "wear");
|
sendToPurchases({method: 'purchases_rezClicked', itemHref: root.itemHref, itemType: root.itemType});
|
||||||
|
root.showConfirmation = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
style: ButtonStyle {
|
style: ButtonStyle {
|
||||||
|
@ -396,13 +427,13 @@ Item {
|
||||||
|
|
||||||
label: Item {
|
label: Item {
|
||||||
HiFiGlyphs {
|
HiFiGlyphs {
|
||||||
id: lightningIcon;
|
id: rezIcon;
|
||||||
text: hifi.glyphs.lightning;
|
text: (root.buttonGlyph)[itemTypesArray.indexOf(root.itemType)];
|
||||||
// Size
|
// Size
|
||||||
size: 32;
|
size: 60;
|
||||||
// Anchors
|
// Anchors
|
||||||
anchors.top: parent.top;
|
anchors.top: parent.top;
|
||||||
anchors.topMargin: 12;
|
anchors.topMargin: 0;
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left;
|
||||||
anchors.right: parent.right;
|
anchors.right: parent.right;
|
||||||
horizontalAlignment: Text.AlignHCenter;
|
horizontalAlignment: Text.AlignHCenter;
|
||||||
|
@ -411,8 +442,8 @@ Item {
|
||||||
: hifi.buttons.disabledTextColor[control.colorScheme]
|
: hifi.buttons.disabledTextColor[control.colorScheme]
|
||||||
}
|
}
|
||||||
RalewayBold {
|
RalewayBold {
|
||||||
anchors.top: lightningIcon.bottom;
|
anchors.top: rezIcon.bottom;
|
||||||
anchors.topMargin: -20;
|
anchors.topMargin: -4;
|
||||||
anchors.right: parent.right;
|
anchors.right: parent.right;
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left;
|
||||||
anchors.bottom: parent.bottom;
|
anchors.bottom: parent.bottom;
|
||||||
|
|
|
@ -455,10 +455,16 @@ Rectangle {
|
||||||
limitedRun: model.limited_run;
|
limitedRun: model.limited_run;
|
||||||
displayedItemCount: model.displayedItemCount;
|
displayedItemCount: model.displayedItemCount;
|
||||||
itemType: {
|
itemType: {
|
||||||
if (model.download_url.indexOf(".fst") > -1) {
|
if (model.root_file_url.indexOf(".fst") > -1) {
|
||||||
"avatar";
|
"avatar";
|
||||||
} else if (model.categories.indexOf("Wearables") > -1) {
|
} else if (model.categories.indexOf("Wearables") > -1) {
|
||||||
"wearable";
|
"wearable";
|
||||||
|
} else if (model.root_file_url.endsWith('.json.gz')) {
|
||||||
|
"contentSet";
|
||||||
|
} else if (model.root_file_url.endsWith('.json')) {
|
||||||
|
"entity";
|
||||||
|
} else if (model.root_file_url.endsWith('.js')) {
|
||||||
|
"app";
|
||||||
} else {
|
} else {
|
||||||
"entity";
|
"entity";
|
||||||
}
|
}
|
||||||
|
@ -490,6 +496,14 @@ Rectangle {
|
||||||
lightboxPopup.button1text = "CLOSE";
|
lightboxPopup.button1text = "CLOSE";
|
||||||
lightboxPopup.button1method = "root.visible = false;"
|
lightboxPopup.button1method = "root.visible = false;"
|
||||||
lightboxPopup.visible = true;
|
lightboxPopup.visible = true;
|
||||||
|
} else if (msg.method === "showReplaceContentLightbox") {
|
||||||
|
lightboxPopup.titleText = "Replace Content";
|
||||||
|
lightboxPopup.bodyText = "Rezzing this content set will replace the existing environment and all of the items in this domain.";
|
||||||
|
lightboxPopup.button1text = "CANCEL";
|
||||||
|
lightboxPopup.button1method = "root.visible = false;"
|
||||||
|
lightboxPopup.button2text = "CONFIRM";
|
||||||
|
lightboxPopup.button2method = "Commerce.replaceContentSet('" + msg.itemId + "', '" + msg.itemHref + "'); root.visible = false;";
|
||||||
|
lightboxPopup.visible = true;
|
||||||
} else if (msg.method === "setFilterText") {
|
} else if (msg.method === "setFilterText") {
|
||||||
filterBar.text = msg.filterText;
|
filterBar.text = msg.filterText;
|
||||||
}
|
}
|
||||||
|
|
|
@ -354,5 +354,9 @@ Item {
|
||||||
readonly property string wallet: "\ue027"
|
readonly property string wallet: "\ue027"
|
||||||
readonly property string paperPlane: "\ue028"
|
readonly property string paperPlane: "\ue028"
|
||||||
readonly property string passphrase: "\ue029"
|
readonly property string passphrase: "\ue029"
|
||||||
|
readonly property string globe: "\ue02c"
|
||||||
|
readonly property string wand: "\ue02d"
|
||||||
|
readonly property string hat: "\ue02e"
|
||||||
|
readonly property string install: "\ue02f"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6176,6 +6176,24 @@ bool Application::askToWearAvatarAttachmentUrl(const QString& url) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Application::replaceDomainContent(const QString& url) {
|
||||||
|
qCDebug(interfaceapp) << "Attempting to replace domain content: " << url;
|
||||||
|
QByteArray urlData(url.toUtf8());
|
||||||
|
auto limitedNodeList = DependencyManager::get<LimitedNodeList>();
|
||||||
|
limitedNodeList->eachMatchingNode([](const SharedNodePointer& node) {
|
||||||
|
return node->getType() == NodeType::EntityServer && node->getActiveSocket();
|
||||||
|
}, [&urlData, limitedNodeList](const SharedNodePointer& octreeNode) {
|
||||||
|
auto octreeFilePacket = NLPacket::create(PacketType::OctreeFileReplacementFromUrl, urlData.size(), true);
|
||||||
|
octreeFilePacket->write(urlData);
|
||||||
|
limitedNodeList->sendPacket(std::move(octreeFilePacket), *octreeNode);
|
||||||
|
});
|
||||||
|
auto addressManager = DependencyManager::get<AddressManager>();
|
||||||
|
addressManager->handleLookupString(DOMAIN_SPAWNING_POINT);
|
||||||
|
QString newHomeAddress = addressManager->getHost() + DOMAIN_SPAWNING_POINT;
|
||||||
|
qCDebug(interfaceapp) << "Setting new home bookmark to: " << newHomeAddress;
|
||||||
|
DependencyManager::get<LocationBookmarks>()->setHomeLocationToAddress(newHomeAddress);
|
||||||
|
}
|
||||||
|
|
||||||
bool Application::askToReplaceDomainContent(const QString& url) {
|
bool Application::askToReplaceDomainContent(const QString& url) {
|
||||||
QString methodDetails;
|
QString methodDetails;
|
||||||
const int MAX_CHARACTERS_PER_LINE = 90;
|
const int MAX_CHARACTERS_PER_LINE = 90;
|
||||||
|
@ -6195,21 +6213,7 @@ bool Application::askToReplaceDomainContent(const QString& url) {
|
||||||
QString details;
|
QString details;
|
||||||
if (static_cast<QMessageBox::StandardButton>(answer.toInt()) == QMessageBox::Yes) {
|
if (static_cast<QMessageBox::StandardButton>(answer.toInt()) == QMessageBox::Yes) {
|
||||||
// Given confirmation, send request to domain server to replace content
|
// Given confirmation, send request to domain server to replace content
|
||||||
qCDebug(interfaceapp) << "Attempting to replace domain content: " << url;
|
replaceDomainContent(url);
|
||||||
QByteArray urlData(url.toUtf8());
|
|
||||||
auto limitedNodeList = DependencyManager::get<LimitedNodeList>();
|
|
||||||
limitedNodeList->eachMatchingNode([](const SharedNodePointer& node) {
|
|
||||||
return node->getType() == NodeType::EntityServer && node->getActiveSocket();
|
|
||||||
}, [&urlData, limitedNodeList](const SharedNodePointer& octreeNode) {
|
|
||||||
auto octreeFilePacket = NLPacket::create(PacketType::OctreeFileReplacementFromUrl, urlData.size(), true);
|
|
||||||
octreeFilePacket->write(urlData);
|
|
||||||
limitedNodeList->sendPacket(std::move(octreeFilePacket), *octreeNode);
|
|
||||||
});
|
|
||||||
auto addressManager = DependencyManager::get<AddressManager>();
|
|
||||||
addressManager->handleLookupString(DOMAIN_SPAWNING_POINT);
|
|
||||||
QString newHomeAddress = addressManager->getHost() + DOMAIN_SPAWNING_POINT;
|
|
||||||
qCDebug(interfaceapp) << "Setting new home bookmark to: " << newHomeAddress;
|
|
||||||
DependencyManager::get<LocationBookmarks>()->setHomeLocationToAddress(newHomeAddress);
|
|
||||||
details = "SuccessfulRequestToReplaceContent";
|
details = "SuccessfulRequestToReplaceContent";
|
||||||
} else {
|
} else {
|
||||||
details = "UserDeclinedToReplaceContent";
|
details = "UserDeclinedToReplaceContent";
|
||||||
|
|
|
@ -284,6 +284,8 @@ public:
|
||||||
bool getSaveAvatarOverrideUrl() { return _saveAvatarOverrideUrl; }
|
bool getSaveAvatarOverrideUrl() { return _saveAvatarOverrideUrl; }
|
||||||
void saveNextPhysicsStats(QString filename);
|
void saveNextPhysicsStats(QString filename);
|
||||||
|
|
||||||
|
void replaceDomainContent(const QString& url);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void svoImportRequested(const QString& url);
|
void svoImportRequested(const QString& url);
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
#include "Ledger.h"
|
#include "Ledger.h"
|
||||||
#include "Wallet.h"
|
#include "Wallet.h"
|
||||||
#include <AccountManager.h>
|
#include <AccountManager.h>
|
||||||
|
#include <Application.h>
|
||||||
|
#include <UserActivityLogger.h>
|
||||||
|
|
||||||
QmlCommerce::QmlCommerce() {
|
QmlCommerce::QmlCommerce() {
|
||||||
auto ledger = DependencyManager::get<Ledger>();
|
auto ledger = DependencyManager::get<Ledger>();
|
||||||
|
@ -163,3 +165,14 @@ void QmlCommerce::transferHfcToUsername(const QString& username, const int& amou
|
||||||
QString key = keys[0];
|
QString key = keys[0];
|
||||||
ledger->transferHfcToUsername(key, username, amount, optionalMessage);
|
ledger->transferHfcToUsername(key, username, amount, optionalMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QmlCommerce::replaceContentSet(const QString& id, const QString& url) {
|
||||||
|
qApp->replaceDomainContent(url);
|
||||||
|
QJsonObject messageProperties = {
|
||||||
|
{ "status", "SuccessfulRequestToReplaceContent" },
|
||||||
|
{ "content_set_url", url }
|
||||||
|
};
|
||||||
|
UserActivityLogger::getInstance().logAction("replace_domain_content", messageProperties);
|
||||||
|
|
||||||
|
emit contentSetChanged(id);
|
||||||
|
}
|
||||||
|
|
|
@ -48,6 +48,8 @@ signals:
|
||||||
void transferHfcToNodeResult(QJsonObject result);
|
void transferHfcToNodeResult(QJsonObject result);
|
||||||
void transferHfcToUsernameResult(QJsonObject result);
|
void transferHfcToUsernameResult(QJsonObject result);
|
||||||
|
|
||||||
|
void contentSetChanged(const QString& contentSetMarketplaceID);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Q_INVOKABLE void getWalletStatus();
|
Q_INVOKABLE void getWalletStatus();
|
||||||
|
|
||||||
|
@ -71,6 +73,8 @@ protected:
|
||||||
|
|
||||||
Q_INVOKABLE void transferHfcToNode(const QString& nodeID, const int& amount, const QString& optionalMessage);
|
Q_INVOKABLE void transferHfcToNode(const QString& nodeID, const int& amount, const QString& optionalMessage);
|
||||||
Q_INVOKABLE void transferHfcToUsername(const QString& username, const int& amount, const QString& optionalMessage);
|
Q_INVOKABLE void transferHfcToUsername(const QString& username, const int& amount, const QString& optionalMessage);
|
||||||
|
|
||||||
|
Q_INVOKABLE void replaceContentSet(const QString& id, const QString& url);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_QmlCommerce_h
|
#endif // hifi_QmlCommerce_h
|
||||||
|
|
|
@ -101,6 +101,11 @@ bool EntityScriptingInterface::canWriteAssets() {
|
||||||
return nodeList->getThisNodeCanWriteAssets();
|
return nodeList->getThisNodeCanWriteAssets();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool EntityScriptingInterface::canReplaceContent() {
|
||||||
|
auto nodeList = DependencyManager::get<NodeList>();
|
||||||
|
return nodeList->getThisNodeCanReplaceContent();
|
||||||
|
}
|
||||||
|
|
||||||
void EntityScriptingInterface::setEntityTree(EntityTreePointer elementTree) {
|
void EntityScriptingInterface::setEntityTree(EntityTreePointer elementTree) {
|
||||||
if (_entityTree) {
|
if (_entityTree) {
|
||||||
disconnect(_entityTree.get(), &EntityTree::addingEntity, this, &EntityScriptingInterface::addingEntity);
|
disconnect(_entityTree.get(), &EntityTree::addingEntity, this, &EntityScriptingInterface::addingEntity);
|
||||||
|
|
|
@ -144,6 +144,12 @@ public slots:
|
||||||
*/
|
*/
|
||||||
Q_INVOKABLE bool canWriteAssets();
|
Q_INVOKABLE bool canWriteAssets();
|
||||||
|
|
||||||
|
/**jsdoc
|
||||||
|
* @function Entities.canReplaceContent
|
||||||
|
* @return {bool} `true` if the DomainServer will allow this Node/Avatar to replace the domain's content set
|
||||||
|
*/
|
||||||
|
Q_INVOKABLE bool canReplaceContent();
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Add a new entity with the specified properties. If `clientOnly` is true, the entity will
|
* Add a new entity with the specified properties. If `clientOnly` is true, the entity will
|
||||||
* not be sent to the server and will only be visible/accessible on the local client.
|
* not be sent to the server and will only be visible/accessible on the local client.
|
||||||
|
|
|
@ -65,7 +65,7 @@ var selectionDisplay = null; // for gridTool.js to ignore
|
||||||
var onMarketplaceScreen = false;
|
var onMarketplaceScreen = false;
|
||||||
var onCommerceScreen = false;
|
var onCommerceScreen = false;
|
||||||
|
|
||||||
var debugCheckout = false;
|
var debugCheckout = true;
|
||||||
var debugError = false;
|
var debugError = false;
|
||||||
function showMarketplace() {
|
function showMarketplace() {
|
||||||
if (!debugCheckout) {
|
if (!debugCheckout) {
|
||||||
|
@ -75,11 +75,11 @@ var selectionDisplay = null; // for gridTool.js to ignore
|
||||||
tablet.pushOntoStack(MARKETPLACE_CHECKOUT_QML_PATH);
|
tablet.pushOntoStack(MARKETPLACE_CHECKOUT_QML_PATH);
|
||||||
tablet.sendToQml({
|
tablet.sendToQml({
|
||||||
method: 'updateCheckoutQML', params: {
|
method: 'updateCheckoutQML', params: {
|
||||||
itemId: '0d90d21c-ce7a-4990-ad18-e9d2cf991027',
|
itemId: 'e197e3d7-eafc-4aa5-9341-acee57174fe9',
|
||||||
itemName: 'Test Flaregun',
|
itemName: 'Oasis',
|
||||||
itemPrice: (debugError ? 10 : 17),
|
itemPrice: (debugError ? 10 : 11),
|
||||||
itemHref: 'http://mpassets.highfidelity.com/0d90d21c-ce7a-4990-ad18-e9d2cf991027-v1/flaregun.json',
|
itemHref: 'http://mpassets-staging.highfidelity.com/e197e3d7-eafc-4aa5-9341-acee57174fe9-v1/oasis_Aug15.json.gz',
|
||||||
categories: ["Wearables", "Miscellaneous"]
|
categories: ["Miscellaneous"]
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -240,6 +240,11 @@ var selectionDisplay = null; // for gridTool.js to ignore
|
||||||
var wearableLocalDimensions = null;
|
var wearableLocalDimensions = null;
|
||||||
var wearableDimensions = null;
|
var wearableDimensions = null;
|
||||||
|
|
||||||
|
if (itemType === "contentSet") {
|
||||||
|
console.log("Item is a content set; codepath shouldn't go here.")
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (isWearable) {
|
if (isWearable) {
|
||||||
var wearableTransforms = Settings.getValue("io.highfidelity.avatarStore.checkOut.transforms");
|
var wearableTransforms = Settings.getValue("io.highfidelity.avatarStore.checkOut.transforms");
|
||||||
if (!wearableTransforms) {
|
if (!wearableTransforms) {
|
||||||
|
|
Loading…
Reference in a new issue