summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/llfloaterchangeitemthumbnail.cpp253
-rw-r--r--indra/newview/llfloaterchangeitemthumbnail.h4
-rw-r--r--indra/newview/llfloatersimplesnapshot.cpp155
-rw-r--r--indra/newview/llfloatersimplesnapshot.h3
-rw-r--r--indra/newview/lloutfitgallery.cpp2
-rw-r--r--indra/newview/skins/default/xui/en/floater_simple_snapshot.xml2
6 files changed, 223 insertions, 196 deletions
diff --git a/indra/newview/llfloaterchangeitemthumbnail.cpp b/indra/newview/llfloaterchangeitemthumbnail.cpp
index b267c7e0a3..4d76194b48 100644
--- a/indra/newview/llfloaterchangeitemthumbnail.cpp
+++ b/indra/newview/llfloaterchangeitemthumbnail.cpp
@@ -34,116 +34,23 @@
#include "llinventoryicon.h"
#include "llinventorymodel.h"
#include "llinventoryobserver.h"
+#include "llfloaterreg.h"
+#include "llfloatersimplesnapshot.h"
#include "lllineeditor.h"
#include "lltextbox.h"
#include "lltexturectrl.h"
#include "llthumbnailctrl.h"
+#include "llviewerfoldertype.h"
#include "llviewermenufile.h"
#include "llviewerobjectlist.h"
#include "llwindow.h"
-//TODO: this part is likely to be moved into outfit snapshot floater
-// and flaoter is likely to become a thumbnail snapshot floater
-
-#include "llagent.h"
-#include "llnotificationsutil.h"
-#include "llviewertexturelist.h"
-
-static const std::string THUMBNAIL_ITEM_UPLOAD_CAP = "InventoryItemThumbnailUpload";
-static const std::string THUMBNAIL_CATEGORY_UPLOAD_CAP = "InventoryCategoryThumbnailUpload";
-
-void post_thumbnail_image_coro(std::string cap_url, std::string path_to_image, LLSD first_data)
-{
- LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
- LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
- httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("post_profile_image_coro", httpPolicy));
- LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);
- LLCore::HttpHeaders::ptr_t httpHeaders;
-
- LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions);
- httpOpts->setFollowRedirects(true);
-
- LLSD result = httpAdapter->postAndSuspend(httpRequest, cap_url, first_data, httpOpts, httpHeaders);
-
- LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
- LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
-
- if (!status)
- {
- // todo: notification?
- LL_WARNS("AvatarProperties") << "Failed to get uploader cap " << status.toString() << LL_ENDL;
- return;
- }
- if (!result.has("uploader"))
- {
- // todo: notification?
- LL_WARNS("AvatarProperties") << "Failed to get uploader cap, response contains no data." << LL_ENDL;
- return;
- }
- std::string uploader_cap = result["uploader"].asString();
- if (uploader_cap.empty())
- {
- LL_WARNS("AvatarProperties") << "Failed to get uploader cap, cap invalid." << LL_ENDL;
- return;
- }
-
- // Upload the image
-
- LLCore::HttpRequest::ptr_t uploaderhttpRequest(new LLCore::HttpRequest);
- LLCore::HttpHeaders::ptr_t uploaderhttpHeaders(new LLCore::HttpHeaders);
- LLCore::HttpOptions::ptr_t uploaderhttpOpts(new LLCore::HttpOptions);
- S64 length;
-
- {
- llifstream instream(path_to_image.c_str(), std::iostream::binary | std::iostream::ate);
- if (!instream.is_open())
- {
- LL_WARNS("AvatarProperties") << "Failed to open file " << path_to_image << LL_ENDL;
- return;
- }
- length = instream.tellg();
- }
-
- uploaderhttpHeaders->append(HTTP_OUT_HEADER_CONTENT_TYPE, "application/jp2"); // optional
- uploaderhttpHeaders->append(HTTP_OUT_HEADER_CONTENT_LENGTH, llformat("%d", length)); // required!
- uploaderhttpOpts->setFollowRedirects(true);
-
- result = httpAdapter->postFileAndSuspend(uploaderhttpRequest, uploader_cap, path_to_image, uploaderhttpOpts, uploaderhttpHeaders);
-
- httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
- status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
-
- LL_DEBUGS("Thumbnail") << result << LL_ENDL;
-
- if (!status)
- {
- LL_WARNS("Thumbnail") << "Failed to upload image " << status.toString() << LL_ENDL;
- return;
- }
-
- if (result["state"].asString() != "complete")
- {
- if (result.has("message"))
- {
- LL_WARNS("Thumbnail") << "Failed to upload image, state " << result["state"] << " message: " << result["message"] << LL_ENDL;
- }
- else
- {
- LL_WARNS("Thumbnail") << "Failed to upload image " << result << LL_ENDL;
- }
- return;
- }
-
- // todo: issue an inventory udpate?
- //return result["new_asset"].asUUID();
-}
-
class LLThumbnailImagePicker : public LLFilePickerThread
{
public:
- LLThumbnailImagePicker(const LLUUID &item_id, LLHandle<LLFloater> *handle);
- LLThumbnailImagePicker(const LLUUID &item_id, const LLUUID &task_id, LLHandle<LLFloater> *handle);
+ LLThumbnailImagePicker(const LLUUID &item_id);
+ LLThumbnailImagePicker(const LLUUID &item_id, const LLUUID &task_id);
~LLThumbnailImagePicker();
void notify(const std::vector<std::string>& filenames) override;
@@ -153,16 +60,14 @@ private:
LLUUID mTaskId;
};
-LLThumbnailImagePicker::LLThumbnailImagePicker(const LLUUID &item_id, LLHandle<LLFloater> *handle)
+LLThumbnailImagePicker::LLThumbnailImagePicker(const LLUUID &item_id)
: LLFilePickerThread(LLFilePicker::FFLOAD_IMAGE)
- , mHandle(handle)
, mInventoryId(item_id)
{
}
-LLThumbnailImagePicker::LLThumbnailImagePicker(const LLUUID &item_id, const LLUUID &task_id, LLHandle<LLFloater> *handle)
+LLThumbnailImagePicker::LLThumbnailImagePicker(const LLUUID &item_id, const LLUUID &task_id)
: LLFilePickerThread(LLFilePicker::FFLOAD_IMAGE)
- , mHandle(handle)
, mInventoryId(item_id)
, mTaskId(task_id)
{
@@ -170,15 +75,10 @@ LLThumbnailImagePicker::LLThumbnailImagePicker(const LLUUID &item_id, const LLUU
LLThumbnailImagePicker::~LLThumbnailImagePicker()
{
- delete mHandle;
}
void LLThumbnailImagePicker::notify(const std::vector<std::string>& filenames)
{
- if (mHandle->isDead())
- {
- return;
- }
if (filenames.empty())
{
return;
@@ -188,52 +88,8 @@ void LLThumbnailImagePicker::notify(const std::vector<std::string>& filenames)
{
return;
}
-
- // generate a temp texture file for coroutine
- std::string temp_file = gDirUtilp->getTempFilename();
- U32 codec = LLImageBase::getCodecFromExtension(gDirUtilp->getExtension(file_path));
- const S32 MAX_DIM = 256;
- if (!LLViewerTextureList::createUploadFile(file_path, temp_file, codec, MAX_DIM))
- {
- LLSD notif_args;
- notif_args["REASON"] = LLImage::getLastError().c_str();
- LLNotificationsUtil::add("CannotUploadTexture", notif_args);
- LL_WARNS("Thumbnail") << "Failed to upload thumbnail for " << mInventoryId << " " << mTaskId << ", reason: " << notif_args["REASON"].asString() << LL_ENDL;
- return;
- }
-
- std::string cap_name;
- LLSD data;
-
- if (mTaskId.notNull())
- {
- cap_name = THUMBNAIL_ITEM_UPLOAD_CAP;
- data["item_id"] = mInventoryId;
- data["task_id"] = mTaskId;
- }
- else if (gInventory.getCategory(mInventoryId))
- {
- cap_name = THUMBNAIL_CATEGORY_UPLOAD_CAP;
- data["category_id"] = mInventoryId;
- }
- else
- {
- cap_name = THUMBNAIL_ITEM_UPLOAD_CAP;
- data["item_id"] = mInventoryId;
- }
-
- std::string cap_url = gAgent.getRegionCapability(cap_name);
- if (cap_url.empty())
- {
- LLSD args;
- args["CAPABILITY"] = cap_url;
- LLNotificationsUtil::add("RegionCapabilityRequestError", args);
- LL_WARNS("Thumbnail") << "Failed to upload profile image for item " << mInventoryId << " " << mTaskId << ", no cap found" << LL_ENDL;
- return;
- }
-
- LLCoros::instance().launch("postAgentUserImageCoro",
- boost::bind(post_thumbnail_image_coro, cap_url, temp_file, data));
+
+ LLFloaterSimpleSnapshot::uploadThumbnail(file_path, mInventoryId, mTaskId);
}
LLFloaterChangeItemThumbnail::LLFloaterChangeItemThumbnail(const LLSD& key)
@@ -348,9 +204,9 @@ void LLFloaterChangeItemThumbnail::inventoryChanged(LLViewerObject* object,
refreshFromInventory();
}
-LLViewerInventoryItem* LLFloaterChangeItemThumbnail::getItem()
+LLInventoryObject* LLFloaterChangeItemThumbnail::getInventoryObject()
{
- LLViewerInventoryItem* item = NULL;
+ LLInventoryObject* obj = NULL;
if (mTaskId.isNull())
{
// it is in agent inventory
@@ -360,7 +216,7 @@ LLViewerInventoryItem* LLFloaterChangeItemThumbnail::getItem()
mObserverInitialized = true;
}
- item = gInventory.getItem(mItemId);
+ obj = gInventory.getObject(mItemId);
}
else
{
@@ -373,28 +229,24 @@ LLViewerInventoryItem* LLFloaterChangeItemThumbnail::getItem()
mObserverInitialized = false;
}
- item = static_cast<LLViewerInventoryItem*>(object->getInventoryObject(mItemId));
+ obj = object->getInventoryObject(mItemId);
}
}
- return item;
+ return obj;
}
void LLFloaterChangeItemThumbnail::refreshFromInventory()
{
- LLViewerInventoryItem* item = getItem();
- if (!item)
+ LLInventoryObject* obj = getInventoryObject();
+ if (!obj)
{
closeFloater();
}
- if (item)
+ if (obj)
{
- // This floater probably shouldn't be be possible to open
- // for imcomplete items
- llassert(item->isFinished());
-
const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
- bool in_trash = (item->getUUID() == trash_id) || gInventory.isObjectDescendentOf(item->getUUID(), trash_id);
+ bool in_trash = (obj->getUUID() == trash_id) || gInventory.isObjectDescendentOf(obj->getUUID(), trash_id);
if (in_trash)
{
// Close properties when moving to trash
@@ -403,7 +255,7 @@ void LLFloaterChangeItemThumbnail::refreshFromInventory()
}
else
{
- refreshFromItem(item);
+ refreshFromObject(obj);
}
}
else
@@ -412,17 +264,37 @@ void LLFloaterChangeItemThumbnail::refreshFromInventory()
}
}
-void LLFloaterChangeItemThumbnail::refreshFromItem(LLViewerInventoryItem* item)
+void LLFloaterChangeItemThumbnail::refreshFromObject(LLInventoryObject* obj)
{
- LLUIImagePtr icon_img = LLInventoryIcon::getIcon(item->getType(), item->getInventoryType(), item->getFlags(), FALSE);
+ LLUIImagePtr icon_img;
+ LLUUID thumbnail_id = obj->getThumbnailUUID();
+
+ LLViewerInventoryItem* item = dynamic_cast<LLViewerInventoryItem*>(obj);
+ if (item)
+ {
+ // This floater probably shouldn't be be possible to open
+ // for imcomplete items
+ llassert(item->isFinished());
+
+ icon_img = LLInventoryIcon::getIcon(item->getType(), item->getInventoryType(), item->getFlags(), FALSE);
+ mRemoveImageBtn->setEnabled(thumbnail_id.notNull() && ((item->getActualType() != LLAssetType::AT_TEXTURE) || (item->getAssetUUID() != thumbnail_id)));
+ }
+ else
+ {
+ LLViewerInventoryCategory* cat = dynamic_cast<LLViewerInventoryCategory*>(obj);
+
+ if (cat)
+ {
+ icon_img = LLUI::getUIImage(LLViewerFolderType::lookupIconName(cat->getPreferredType(), true));
+ mRemoveImageBtn->setEnabled(thumbnail_id.notNull());
+ }
+ }
mItemTypeIcon->setImage(icon_img);
- mItemNameText->setValue(item->getName());
+ mItemNameText->setValue(obj->getName());
- LLUUID thumbnail_id = item->getThumbnailUUID();
mThumbnailCtrl->setValue(thumbnail_id);
mCopyToClipboardBtn->setEnabled(thumbnail_id.notNull());
- mRemoveImageBtn->setEnabled(thumbnail_id.notNull() && ((item->getActualType() != LLAssetType::AT_TEXTURE) || (item->getAssetUUID() != thumbnail_id)));
// todo: some elements might not support setting thumbnails
// since they already have them
@@ -431,7 +303,8 @@ void LLFloaterChangeItemThumbnail::refreshFromItem(LLViewerInventoryItem* item)
void LLFloaterChangeItemThumbnail::onUploadLocal(void *userdata)
{
LLFloaterChangeItemThumbnail *self = (LLFloaterChangeItemThumbnail*)userdata;
- (new LLThumbnailImagePicker(self->mItemId, self->mTaskId, new LLHandle<LLFloater>(self->getHandle())))->getFile();
+
+ (new LLThumbnailImagePicker(self->mItemId, self->mTaskId))->getFile();
LLFloater* floaterp = self->mPickerHandle.get();
if (floaterp)
@@ -442,16 +315,24 @@ void LLFloaterChangeItemThumbnail::onUploadLocal(void *userdata)
void LLFloaterChangeItemThumbnail::onUploadSnapshot(void *userdata)
{
+ LLFloaterChangeItemThumbnail *self = (LLFloaterChangeItemThumbnail*)userdata;
+ LLFloaterReg::toggleInstanceOrBringToFront("simple_snapshot");
+ LLFloaterSimpleSnapshot* snapshot_floater = LLFloaterSimpleSnapshot::getInstance();
+ if (snapshot_floater)
+ {
+ snapshot_floater->setInventoryId(self->mItemId);
+ snapshot_floater->setTaskId(self->mTaskId);
+ }
}
void LLFloaterChangeItemThumbnail::onUseTexture(void *userdata)
{
LLFloaterChangeItemThumbnail *self = (LLFloaterChangeItemThumbnail*)userdata;
- LLViewerInventoryItem* item = self->getItem();
- if (item)
+ LLInventoryObject* obj = self->getInventoryObject();
+ if (obj)
{
- self->showTexturePicker(item->getThumbnailUUID());
+ self->showTexturePicker(obj->getThumbnailUUID());
}
}
@@ -459,10 +340,10 @@ void LLFloaterChangeItemThumbnail::onUseTexture(void *userdata)
void LLFloaterChangeItemThumbnail::onCopyToClipboard(void *userdata)
{
LLFloaterChangeItemThumbnail *self = (LLFloaterChangeItemThumbnail*)userdata;
- LLViewerInventoryItem* item = self->getItem();
- if (item)
+ LLInventoryObject* obj = self->getInventoryObject();
+ if (obj)
{
- LLClipboard::instance().addToClipboard(item->getThumbnailUUID());
+ LLClipboard::instance().addToClipboard(obj->getThumbnailUUID());
}
}
@@ -473,10 +354,10 @@ void LLFloaterChangeItemThumbnail::onPasteFromClipboard(void *userdata)
LLClipboard::instance().pasteFromClipboard(objects);
if (objects.size() > 0)
{
- LLViewerInventoryItem* item = self->getItem();
- if (item)
+ LLInventoryObject* obj = self->getInventoryObject();
+ if (obj)
{
- item->setThumbnailUUID(objects[0]);
+ obj->setThumbnailUUID(objects[0]);
}
}
}
@@ -484,7 +365,7 @@ void LLFloaterChangeItemThumbnail::onPasteFromClipboard(void *userdata)
void LLFloaterChangeItemThumbnail::onRemove(void *userdata)
{
LLFloaterChangeItemThumbnail *self = (LLFloaterChangeItemThumbnail*)userdata;
- LLViewerInventoryItem* item = self->getItem();
+ LLInventoryObject* item = self->getInventoryObject();
if (item)
{
item->setThumbnailUUID(LLUUID::null);
@@ -548,11 +429,11 @@ void LLFloaterChangeItemThumbnail::showTexturePicker(const LLUUID &thumbnail_id)
void LLFloaterChangeItemThumbnail::onTexturePickerCommit(LLUUID id)
{
LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mPickerHandle.get();
- LLViewerInventoryItem* item = getItem();
+ LLInventoryObject* obj = getInventoryObject();
- if (item && floaterp)
+ if (obj && floaterp)
{
- item->setThumbnailUUID(floaterp->getAssetID());
+ obj->setThumbnailUUID(floaterp->getAssetID());
}
}
diff --git a/indra/newview/llfloaterchangeitemthumbnail.h b/indra/newview/llfloaterchangeitemthumbnail.h
index 340d5cf05e..b3ae0a18f6 100644
--- a/indra/newview/llfloaterchangeitemthumbnail.h
+++ b/indra/newview/llfloaterchangeitemthumbnail.h
@@ -55,9 +55,9 @@ public:
private:
- LLViewerInventoryItem* getItem();
+ LLInventoryObject* getInventoryObject();
void refreshFromInventory();
- void refreshFromItem(LLViewerInventoryItem* item);
+ void refreshFromObject(LLInventoryObject* obj);
static void onUploadLocal(void*);
static void onUploadSnapshot(void*);
diff --git a/indra/newview/llfloatersimplesnapshot.cpp b/indra/newview/llfloatersimplesnapshot.cpp
index 05625e6817..ca2b9b919a 100644
--- a/indra/newview/llfloatersimplesnapshot.cpp
+++ b/indra/newview/llfloatersimplesnapshot.cpp
@@ -33,16 +33,110 @@
#include "llstatusbar.h" // can_afford_transaction()
#include "llnotificationsutil.h"
#include "lloutfitgallery.h"
+#include "llagent.h"
#include "llagentbenefits.h"
#include "llviewercontrol.h"
+#include "llviewertexturelist.h"
+
+
LLSimpleSnapshotFloaterView* gSimpleSnapshotFloaterView = NULL;
-const S32 THUMBNAIL_SNAPSHOT_WIDTH = 256;
-const S32 THUMBNAIL_SNAPSHOT_HEIGHT = 256;
+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";
+static const std::string THUMBNAIL_CATEGORY_UPLOAD_CAP = "InventoryCategoryThumbnailUpload";
+
+void post_thumbnail_image_coro(std::string cap_url, std::string path_to_image, LLSD first_data)
+{
+ LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
+ LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
+ httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("post_profile_image_coro", httpPolicy));
+ LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);
+ LLCore::HttpHeaders::ptr_t httpHeaders;
+
+ LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions);
+ httpOpts->setFollowRedirects(true);
+
+ LLSD result = httpAdapter->postAndSuspend(httpRequest, cap_url, first_data, httpOpts, httpHeaders);
+
+ LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
+ LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
+
+ if (!status)
+ {
+ // todo: notification?
+ LL_WARNS("AvatarProperties") << "Failed to get uploader cap " << status.toString() << LL_ENDL;
+ return;
+ }
+ if (!result.has("uploader"))
+ {
+ // todo: notification?
+ LL_WARNS("AvatarProperties") << "Failed to get uploader cap, response contains no data." << LL_ENDL;
+ return;
+ }
+ std::string uploader_cap = result["uploader"].asString();
+ if (uploader_cap.empty())
+ {
+ LL_WARNS("AvatarProperties") << "Failed to get uploader cap, cap invalid." << LL_ENDL;
+ return;
+ }
+
+ // Upload the image
+
+ LLCore::HttpRequest::ptr_t uploaderhttpRequest(new LLCore::HttpRequest);
+ LLCore::HttpHeaders::ptr_t uploaderhttpHeaders(new LLCore::HttpHeaders);
+ LLCore::HttpOptions::ptr_t uploaderhttpOpts(new LLCore::HttpOptions);
+ S64 length;
+
+ {
+ llifstream instream(path_to_image.c_str(), std::iostream::binary | std::iostream::ate);
+ if (!instream.is_open())
+ {
+ LL_WARNS("AvatarProperties") << "Failed to open file " << path_to_image << LL_ENDL;
+ return;
+ }
+ length = instream.tellg();
+ }
+
+ uploaderhttpHeaders->append(HTTP_OUT_HEADER_CONTENT_TYPE, "application/jp2"); // optional
+ uploaderhttpHeaders->append(HTTP_OUT_HEADER_CONTENT_LENGTH, llformat("%d", length)); // required!
+ uploaderhttpOpts->setFollowRedirects(true);
+
+ result = httpAdapter->postFileAndSuspend(uploaderhttpRequest, uploader_cap, path_to_image, uploaderhttpOpts, uploaderhttpHeaders);
+
+ httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
+ status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
+
+ LL_DEBUGS("Thumbnail") << result << LL_ENDL;
+
+ if (!status)
+ {
+ LL_WARNS("Thumbnail") << "Failed to upload image " << status.toString() << LL_ENDL;
+ return;
+ }
+
+ if (result["state"].asString() != "complete")
+ {
+ if (result.has("message"))
+ {
+ LL_WARNS("Thumbnail") << "Failed to upload image, state " << result["state"] << " message: " << result["message"] << LL_ENDL;
+ }
+ else
+ {
+ LL_WARNS("Thumbnail") << "Failed to upload image " << result << LL_ENDL;
+ }
+ return;
+ }
+
+ // todo: issue an inventory udpate?
+ //return result["new_asset"].asUUID();
+}
+
///----------------------------------------------------------------------------
/// Class LLFloaterSimpleSnapshot::Impl
///----------------------------------------------------------------------------
@@ -84,8 +178,8 @@ void LLFloaterSimpleSnapshot::Impl::updateResolution(void* data)
return;
}
- S32 width = THUMBNAIL_SNAPSHOT_WIDTH;
- S32 height = THUMBNAIL_SNAPSHOT_HEIGHT;
+ S32 width = THUMBNAIL_SNAPSHOT_DIM;
+ S32 height = THUMBNAIL_SNAPSHOT_DIM;
LLSnapshotLivePreview* previewp = getPreviewView();
if (previewp)
@@ -263,6 +357,55 @@ void LLFloaterSimpleSnapshot::postSave()
impl->setStatus(ImplBase::STATUS_WORKING);
}
+// static
+void LLFloaterSimpleSnapshot::uploadThumbnail(const std::string &file_path, const LLUUID &inventory_id, const LLUUID &task_id)
+{
+ // generate a temp texture file for coroutine
+ std::string temp_file = gDirUtilp->getTempFilename();
+ U32 codec = LLImageBase::getCodecFromExtension(gDirUtilp->getExtension(file_path));
+ if (!LLViewerTextureList::createUploadFile(file_path, temp_file, codec, THUMBNAIL_SNAPSHOT_DIM))
+ {
+ LLSD notif_args;
+ notif_args["REASON"] = LLImage::getLastError().c_str();
+ LLNotificationsUtil::add("CannotUploadTexture", notif_args);
+ LL_WARNS("Thumbnail") << "Failed to upload thumbnail for " << inventory_id << " " << task_id << ", reason: " << notif_args["REASON"].asString() << LL_ENDL;
+ return;
+ }
+
+ std::string cap_name;
+ LLSD data;
+
+ if (task_id.notNull())
+ {
+ cap_name = THUMBNAIL_ITEM_UPLOAD_CAP;
+ data["item_id"] = inventory_id;
+ data["task_id"] = task_id;
+ }
+ else if (gInventory.getCategory(inventory_id))
+ {
+ cap_name = THUMBNAIL_CATEGORY_UPLOAD_CAP;
+ data["category_id"] = inventory_id;
+ }
+ else
+ {
+ cap_name = THUMBNAIL_ITEM_UPLOAD_CAP;
+ data["item_id"] = inventory_id;
+ }
+
+ std::string cap_url = gAgent.getRegionCapability(cap_name);
+ if (cap_url.empty())
+ {
+ LLSD args;
+ args["CAPABILITY"] = cap_url;
+ LLNotificationsUtil::add("RegionCapabilityRequestError", args);
+ LL_WARNS("Thumbnail") << "Failed to upload profile image for item " << inventory_id << " " << task_id << ", no cap found" << LL_ENDL;
+ return;
+ }
+
+ LLCoros::instance().launch("postAgentUserImageCoro",
+ boost::bind(post_thumbnail_image_coro, cap_url, temp_file, data));
+}
+
// static
void LLFloaterSimpleSnapshot::update()
{
@@ -277,13 +420,13 @@ void LLFloaterSimpleSnapshot::update()
// static
LLFloaterSimpleSnapshot* LLFloaterSimpleSnapshot::findInstance()
{
- return LLFloaterReg::findTypedInstance<LLFloaterSimpleSnapshot>("simple_outfit_snapshot");
+ return LLFloaterReg::findTypedInstance<LLFloaterSimpleSnapshot>("simple_snapshot");
}
// static
LLFloaterSimpleSnapshot* LLFloaterSimpleSnapshot::getInstance()
{
- return LLFloaterReg::getTypedInstance<LLFloaterSimpleSnapshot>("simple_outfit_snapshot");
+ return LLFloaterReg::getTypedInstance<LLFloaterSimpleSnapshot>("simple_snapshot");
}
void LLFloaterSimpleSnapshot::saveTexture()
diff --git a/indra/newview/llfloatersimplesnapshot.h b/indra/newview/llfloatersimplesnapshot.h
index f9a1d9b9bf..55253b38e8 100644
--- a/indra/newview/llfloatersimplesnapshot.h
+++ b/indra/newview/llfloatersimplesnapshot.h
@@ -61,8 +61,11 @@ public:
void setOutfitID(LLUUID id) { mOutfitID = id; }
LLUUID getOutfitID() { return mOutfitID; }
void setGallery(LLOutfitGallery* gallery) { mOutfitGallery = gallery; }
+ void setInventoryId(const LLUUID &inventory_id) {}
+ void setTaskId(const LLUUID &task_id) {}
void postSave();
+ static void uploadThumbnail(const std::string &file_path, const LLUUID &inventory_id, const LLUUID &task_id);
class Impl;
friend class Impl;
diff --git a/indra/newview/lloutfitgallery.cpp b/indra/newview/lloutfitgallery.cpp
index ce1330dfe1..06dbf50bee 100644
--- a/indra/newview/lloutfitgallery.cpp
+++ b/indra/newview/lloutfitgallery.cpp
@@ -1386,7 +1386,7 @@ void LLOutfitGallery::onSelectPhoto(LLUUID selected_outfit_id)
void LLOutfitGallery::onTakeSnapshot(LLUUID selected_outfit_id)
{
- LLFloaterReg::toggleInstanceOrBringToFront("simple_outfit_snapshot");
+ LLFloaterReg::toggleInstanceOrBringToFront("simple_snapshot");
LLFloaterSimpleSnapshot* snapshot_floater = LLFloaterSimpleSnapshot::getInstance();
if (snapshot_floater)
{
diff --git a/indra/newview/skins/default/xui/en/floater_simple_snapshot.xml b/indra/newview/skins/default/xui/en/floater_simple_snapshot.xml
index 1e47a3b35d..a53d42be2e 100644
--- a/indra/newview/skins/default/xui/en/floater_simple_snapshot.xml
+++ b/indra/newview/skins/default/xui/en/floater_simple_snapshot.xml
@@ -12,7 +12,7 @@
help_topic="snapshot"
save_rect="true"
save_visibility="false"
- title="OUTFIT SNAPSHOT"
+ title="THUMBNAIL SNAPSHOT"
width="351">
<ui_ctrl
layout="topleft"