diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2023-02-21 23:03:00 +0200 |
---|---|---|
committer | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2023-02-21 23:04:36 +0200 |
commit | 2d68a7c33622aa28c49989e959c2a9be1f053d03 (patch) | |
tree | 3e3bc627a0586e291b2d52d7753faa006521a81e /indra/newview/llfloatersimplesnapshot.cpp | |
parent | d6c0e40559fa090495b237bbbacf30578ac10aac (diff) |
SL-19108 Update Simple snapshot floater
Diffstat (limited to 'indra/newview/llfloatersimplesnapshot.cpp')
-rw-r--r-- | indra/newview/llfloatersimplesnapshot.cpp | 42 |
1 files changed, 17 insertions, 25 deletions
diff --git a/indra/newview/llfloatersimplesnapshot.cpp b/indra/newview/llfloatersimplesnapshot.cpp index ca2b9b919a..096db132ac 100644 --- a/indra/newview/llfloatersimplesnapshot.cpp +++ b/indra/newview/llfloatersimplesnapshot.cpp @@ -30,9 +30,9 @@ #include "llfloaterreg.h" #include "llimagefiltersmanager.h" +#include "llinventorymodel.h" #include "llstatusbar.h" // can_afford_transaction() #include "llnotificationsutil.h" -#include "lloutfitgallery.h" #include "llagent.h" #include "llagentbenefits.h" #include "llviewercontrol.h" @@ -44,8 +44,6 @@ LLSimpleSnapshotFloaterView* gSimpleSnapshotFloaterView = NULL; const S32 THUMBNAIL_SNAPSHOT_DIM = 256; -static LLDefaultChildRegistry::Register<LLSimpleSnapshotFloaterView> r("simple_snapshot_floater_view"); - // Thumbnail posting coro static const std::string THUMBNAIL_ITEM_UPLOAD_CAP = "InventoryItemThumbnailUpload"; @@ -229,8 +227,7 @@ void LLFloaterSimpleSnapshot::Impl::setStatus(EStatus status, bool ok, const std ///---------------------------------------------------------------------------- LLFloaterSimpleSnapshot::LLFloaterSimpleSnapshot(const LLSD& key) - : LLFloaterSnapshotBase(key), - mOutfitGallery(NULL) + : LLFloaterSnapshotBase(key) { impl = new Impl(this); } @@ -241,8 +238,6 @@ LLFloaterSimpleSnapshot::~LLFloaterSimpleSnapshot() BOOL LLFloaterSimpleSnapshot::postBuild() { - getChild<LLUICtrl>("save_btn")->setLabelArg("[UPLOAD_COST]", std::to_string(LLAgentBenefitsMgr::current().getTextureUploadCost())); - childSetAction("new_snapshot_btn", ImplBase::onClickNewSnapshot, this); childSetAction("save_btn", boost::bind(&LLFloaterSimpleSnapshot::onSend, this)); childSetAction("cancel_btn", boost::bind(&LLFloaterSimpleSnapshot::onCancel, this)); @@ -337,18 +332,18 @@ void LLFloaterSimpleSnapshot::onCancel() void LLFloaterSimpleSnapshot::onSend() { - S32 expected_upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost(); - if (can_afford_transaction(expected_upload_cost)) + LLSnapshotLivePreview* previewp = getPreviewView(); + + std::string temp_file = gDirUtilp->getTempFilename(); + if (previewp->createUploadFile(temp_file, THUMBNAIL_SNAPSHOT_DIM)) { - saveTexture(); - postSave(); + uploadImageUploadFile(temp_file, mInventoryId, mTaskId); } else { - LLSD args; - args["COST"] = llformat("%d", expected_upload_cost); - LLNotificationsUtil::add("ErrorPhotoCannotAfford", args); - inventorySaveFailed(); + LLSD notif_args; + notif_args["REASON"] = LLImage::getLastError().c_str(); + LLNotificationsUtil::add("CannotUploadTexture", notif_args); } } @@ -371,7 +366,12 @@ void LLFloaterSimpleSnapshot::uploadThumbnail(const std::string &file_path, cons LL_WARNS("Thumbnail") << "Failed to upload thumbnail for " << inventory_id << " " << task_id << ", reason: " << notif_args["REASON"].asString() << LL_ENDL; return; } + uploadImageUploadFile(temp_file, inventory_id, task_id); +} +// static +void LLFloaterSimpleSnapshot::uploadImageUploadFile(const std::string &temp_file, const LLUUID &inventory_id, const LLUUID &task_id) +{ std::string cap_name; LLSD data; @@ -431,22 +431,14 @@ LLFloaterSimpleSnapshot* LLFloaterSimpleSnapshot::getInstance() void LLFloaterSimpleSnapshot::saveTexture() { - LLSnapshotLivePreview* previewp = getPreviewView(); + LLSnapshotLivePreview* previewp = getPreviewView(); if (!previewp) { llassert(previewp != NULL); return; } - if (mOutfitGallery) - { - mOutfitGallery->onBeforeOutfitSnapshotSave(); - } - previewp->saveTexture(TRUE, getOutfitID().asString()); - if (mOutfitGallery) - { - mOutfitGallery->onAfterOutfitSnapshotSave(); - } + previewp->saveTexture(TRUE, getInventoryId().asString()); closeFloater(); } |