summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2024-02-20 01:13:58 +0200
committerAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2024-02-20 19:05:54 +0200
commit11ded7b9a2451b711534f10187cd0d72628d9da0 (patch)
tree58a519e823e7f084a7ecf8ecd540a8a7a561b245
parenta657b9b52d2818e2ba5b36ab3c58d0025dcb08e3 (diff)
jira-archive-internal#71115 Add Images to Objects in Bulk #2
UI integration
-rw-r--r--indra/newview/llfloaterchangeitemthumbnail.cpp101
-rw-r--r--indra/newview/llfloaterchangeitemthumbnail.h4
-rw-r--r--indra/newview/skins/default/xui/en/floater_change_item_thumbnail.xml20
-rw-r--r--indra/newview/skins/default/xui/en/notifications.xml11
4 files changed, 119 insertions, 17 deletions
diff --git a/indra/newview/llfloaterchangeitemthumbnail.cpp b/indra/newview/llfloaterchangeitemthumbnail.cpp
index c328c0b8f6..cfdd7aa834 100644
--- a/indra/newview/llfloaterchangeitemthumbnail.cpp
+++ b/indra/newview/llfloaterchangeitemthumbnail.cpp
@@ -103,6 +103,7 @@ void LLThumbnailImagePicker::notify(const std::vector<std::string>& filenames)
LLFloaterChangeItemThumbnail::LLFloaterChangeItemThumbnail(const LLSD& key)
: LLFloater(key)
, mObserverInitialized(false)
+ , mMultipleThumbnails(false)
, mTooltipState(TOOLTIP_NONE)
{
}
@@ -119,9 +120,11 @@ BOOL LLFloaterChangeItemThumbnail::postBuild()
mItemTypeIcon = getChild<LLIconCtrl>("item_type_icon");
mThumbnailCtrl = getChild<LLThumbnailCtrl>("item_thumbnail");
mToolTipTextBox = getChild<LLTextBox>("tooltip_text");
+ mMultipleTextBox = getChild<LLTextBox>("multiple_lbl");
LLSD tooltip_text;
mToolTipTextBox->setValue(tooltip_text);
+ mMultipleTextBox->setVisible(FALSE);
LLButton *upload_local = getChild<LLButton>("upload_local");
upload_local->setClickedCallback(onUploadLocal, (void*)this);
@@ -163,20 +166,33 @@ void LLFloaterChangeItemThumbnail::onOpen(const LLSD& key)
closeFloater();
}
-
mItemList.clear();
+ mMultipleThumbnails = false;
if (key.isArray())
{
- if (key.size() > 30)
+ if (key.size() > 50)
{
// incident avoidance
- // Todo: Show notification
+ LLNotificationsUtil::add("ThumbnailSelectionTooLarge");
closeFloater();
}
+ LLUUID image_id;
for (LLSD::array_const_iterator it = key.beginArray(); it != key.endArray(); ++it)
{
- mItemList.insert(it->asUUID());
+ LLInventoryObject* obj = gInventory.getObject(it->asUUID());
+ if (obj)
+ {
+ if (mItemList.empty())
+ {
+ image_id = obj->getThumbnailUUID();
+ }
+ mItemList.insert(it->asUUID());
+ if (image_id != obj->getThumbnailUUID())
+ {
+ mMultipleThumbnails = true;
+ }
+ }
}
}
else if (key.isUUID())
@@ -189,6 +205,11 @@ void LLFloaterChangeItemThumbnail::onOpen(const LLSD& key)
mTaskId = key["task_id"].asUUID();
}
+ if (mItemList.size() == 0)
+ {
+ closeFloater();
+ }
+
refreshFromInventory();
}
@@ -412,12 +433,44 @@ void LLFloaterChangeItemThumbnail::refreshFromObject(LLInventoryObject* obj)
mRemoveImageBtn->setEnabled(thumbnail_id.notNull());
}
}
- mItemTypeIcon->setImage(icon_img);
- mItemNameText->setValue(obj->getName());
+ if (mItemList.size() == 1)
+ {
+ mItemTypeIcon->setImage(icon_img);
+ mItemTypeIcon->setVisible(TRUE);
+ mMultipleTextBox->setVisible(FALSE);
+ mItemNameText->setValue(obj->getName());
+ mItemNameText->setToolTip(std::string());
+ }
+ else
+ {
+ mItemTypeIcon->setVisible(FALSE);
+ mMultipleTextBox->setVisible(mMultipleThumbnails);
+ mItemNameText->setValue(getString("multiple_item_names"));
+
+ // Display first five names as a tooltip
+ const S32 ITEMS_TO_SHOW = 5;
+ std::string items_str;
+ uuid_set_t::iterator iter = mItemList.begin();
+ uuid_set_t::iterator end = mItemList.end();
+ for (S32 i = 0; (iter != end) && (i < ITEMS_TO_SHOW); iter++, i++)
+ {
+ LLInventoryObject* pobj = gInventory.getObject(*iter);
+ if (pobj)
+ {
+ items_str += pobj->getName();
+ items_str += '\n';
+ }
+ }
+ if (mItemList.size() > ITEMS_TO_SHOW)
+ {
+ items_str += "...";
+ }
+ mItemNameText->setToolTip(items_str);
+ }
mThumbnailCtrl->setValue(thumbnail_id);
- mCopyToClipboardBtn->setEnabled(thumbnail_id.notNull());
+ mCopyToClipboardBtn->setEnabled(thumbnail_id.notNull() && !mMultipleThumbnails);
mPasteFromClipboardBtn->setEnabled(LLClipboard::instance().hasContents());
// todo: some elements might not support setting thumbnails
@@ -431,12 +484,13 @@ void LLFloaterChangeItemThumbnail::onUploadLocal(void *userdata)
LLUUID task_id = self->mTaskId;
uuid_set_t inventory_ids = self->mItemList;
+ LLHandle<LLFloater> handle = self->getHandle();
(new LLThumbnailImagePicker(
*self->mItemList.begin(),
self->mTaskId,
- [inventory_ids, task_id](const LLUUID& asset_id)
+ [inventory_ids, task_id, handle](const LLUUID& asset_id)
{
- onUploadComplete(asset_id, task_id, inventory_ids);
+ onUploadComplete(asset_id, task_id, inventory_ids, handle);
}
))->getFile();
@@ -475,10 +529,11 @@ void LLFloaterChangeItemThumbnail::onUploadSnapshot(void *userdata)
snapshot_floater->setOwner(self);
LLUUID task_id = self->mTaskId;
uuid_set_t inventory_ids = self->mItemList;
+ LLHandle<LLFloater> handle = self->getHandle();
snapshot_floater->setComplectionCallback(
- [inventory_ids, task_id](const LLUUID& asset_id)
+ [inventory_ids, task_id, handle](const LLUUID& asset_id)
{
- onUploadComplete(asset_id, task_id, inventory_ids);
+ onUploadComplete(asset_id, task_id, inventory_ids, handle);
});
}
}
@@ -767,12 +822,13 @@ void LLFloaterChangeItemThumbnail::onFullImageLoaded(
{
LLUUID task_id = data->mTaskId;
uuid_set_t inventory_ids = data->mItemIds;
+ LLHandle<LLFloater> handle = data->mFloaterHandle;
LLFloaterSimpleSnapshot::uploadThumbnail(src,
*data->mItemIds.begin(),
task_id,
- [inventory_ids, task_id](const LLUUID& asset_id)
+ [inventory_ids, task_id, handle](const LLUUID& asset_id)
{
- onUploadComplete(asset_id, task_id, inventory_ids);
+ onUploadComplete(asset_id, task_id, inventory_ids, handle);
});
}
else
@@ -899,10 +955,11 @@ void LLFloaterChangeItemThumbnail::onTexturePickerCommit()
{
LLUUID task_id = mTaskId;
uuid_set_t inventory_ids = mItemList;
+ LLHandle<LLFloater> handle = getHandle();
LLFloaterSimpleSnapshot::completion_t callback =
- [inventory_ids, task_id](const LLUUID& asset_id)
+ [inventory_ids, task_id, handle](const LLUUID& asset_id)
{
- onUploadComplete(asset_id, task_id, inventory_ids);
+ onUploadComplete(asset_id, task_id, inventory_ids, handle);
};
if (texturep->isRawImageValid())
{
@@ -948,7 +1005,10 @@ void LLFloaterChangeItemThumbnail::onTexturePickerCommit()
}
//static
-void LLFloaterChangeItemThumbnail::onUploadComplete(const LLUUID& asset_id, const LLUUID& task_id, const uuid_set_t& inventory_ids)
+void LLFloaterChangeItemThumbnail::onUploadComplete(const LLUUID& asset_id,
+ const LLUUID& task_id,
+ const uuid_set_t& inventory_ids,
+ LLHandle<LLFloater> handle)
{
if (asset_id.isNull())
{
@@ -969,6 +1029,15 @@ void LLFloaterChangeItemThumbnail::onUploadComplete(const LLUUID& asset_id, cons
setThumbnailId(asset_id, task_id, *iter);
}
}
+ if (!handle.isDead())
+ {
+ LLFloaterChangeItemThumbnail* floater = (LLFloaterChangeItemThumbnail*)handle.get();
+ if (floater)
+ {
+ floater->mMultipleThumbnails = false;
+ floater->mMultipleTextBox->setVisible(FALSE);
+ }
+ }
}
void LLFloaterChangeItemThumbnail::setThumbnailId(const LLUUID &new_thumbnail_id)
diff --git a/indra/newview/llfloaterchangeitemthumbnail.h b/indra/newview/llfloaterchangeitemthumbnail.h
index 16d60ab56a..c817ffb268 100644
--- a/indra/newview/llfloaterchangeitemthumbnail.h
+++ b/indra/newview/llfloaterchangeitemthumbnail.h
@@ -100,7 +100,7 @@ private:
void showTexturePicker(const LLUUID &thumbnail_id);
void onTexturePickerCommit();
- static void onUploadComplete(const LLUUID& asset_id, const LLUUID& task_id, const uuid_set_t& inventory_ids);
+ static void onUploadComplete(const LLUUID& asset_id, const LLUUID& task_id, const uuid_set_t& inventory_ids, LLHandle<LLFloater> handle);
void setThumbnailId(const LLUUID &new_thumbnail_id);
static void setThumbnailId(const LLUUID& new_thumbnail_id, const LLUUID& task_id, const LLUUID& inv_obj_id);
@@ -121,6 +121,7 @@ private:
void onButtonMouseLeave(LLUICtrl* button, const LLSD& param, EToolTipState state);
bool mObserverInitialized;
+ bool mMultipleThumbnails; // for multiselection
EToolTipState mTooltipState;
uuid_set_t mItemList;
LLUUID mTaskId;
@@ -130,6 +131,7 @@ private:
LLUICtrl *mItemNameText;
LLThumbnailCtrl *mThumbnailCtrl;
LLTextBox *mToolTipTextBox;
+ LLTextBox *mMultipleTextBox;
LLButton *mCopyToClipboardBtn;
LLButton *mPasteFromClipboardBtn;
LLButton *mRemoveImageBtn;
diff --git a/indra/newview/skins/default/xui/en/floater_change_item_thumbnail.xml b/indra/newview/skins/default/xui/en/floater_change_item_thumbnail.xml
index 726cb38481..b0ee6f6171 100644
--- a/indra/newview/skins/default/xui/en/floater_change_item_thumbnail.xml
+++ b/indra/newview/skins/default/xui/en/floater_change_item_thumbnail.xml
@@ -9,6 +9,10 @@
width="319">
<floater.string
+ name="multiple_item_names">
+ Multiple items selected
+ </floater.string>
+ <floater.string
name="title_item_thumbnail">
CHANGE ITEM IMAGE
</floater.string>
@@ -72,6 +76,22 @@
height="256"
width="256"
/>
+ <text
+ name="multiple_lbl"
+ font="SansSerifBig"
+ text_color="White"
+ halign="center"
+ valign="center"
+ use_ellipses="true"
+ follows="top|left"
+ layout="topleft"
+ height="256"
+ width="256"
+ top_delta="0"
+ left_delta="0"
+ visible =" false">
+ Multiple thumbnails
+ </text>
<button
follows="right|bottom"
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index d642ea162c..e94ec6cc7f 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -6217,6 +6217,17 @@ Are you sure you want to delete them?
yestext="OK"/>
</notification>
+ <notification
+ icon="alertmodal.tga"
+ name="ThumbnailSelectionTooLarge"
+ type="alertmodal">
+ <unique/>
+ You can only modify up to 50 thumbnails at a time.
+ <usetemplate
+ name="okbutton"
+ yestext="OK"/>
+ </notification>
+
<notification
icon="alertmodal.tga"
name="ConfirmUnlink"