summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llfloaterchangeitemthumbnail.cpp125
-rw-r--r--indra/newview/llfloaterchangeitemthumbnail.h9
-rw-r--r--indra/newview/llsidepaneliteminfo.cpp12
-rw-r--r--indra/newview/llsidepaneliteminfo.h1
-rw-r--r--indra/newview/skins/default/xui/en/floater_change_item_thumbnail.xml4
-rw-r--r--indra/newview/skins/default/xui/en/sidepanel_item_info.xml22
6 files changed, 145 insertions, 28 deletions
diff --git a/indra/newview/llfloaterchangeitemthumbnail.cpp b/indra/newview/llfloaterchangeitemthumbnail.cpp
index 05b9b89dd3..90fecd07ba 100644
--- a/indra/newview/llfloaterchangeitemthumbnail.cpp
+++ b/indra/newview/llfloaterchangeitemthumbnail.cpp
@@ -29,14 +29,17 @@
#include "llfloaterchangeitemthumbnail.h"
#include "llbutton.h"
+#include "llclipboard.h"
#include "lliconctrl.h"
#include "llinventoryicon.h"
#include "llinventorymodel.h"
#include "llinventoryobserver.h"
#include "lllineeditor.h"
#include "lltextbox.h"
+#include "lltexturectrl.h"
#include "llthumbnailctrl.h"
#include "llviewerobjectlist.h"
+#include "llwindow.h"
LLFloaterChangeItemThumbnail::LLFloaterChangeItemThumbnail(const LLSD& key)
@@ -151,7 +154,7 @@ void LLFloaterChangeItemThumbnail::inventoryChanged(LLViewerObject* object,
refreshFromInventory();
}
-void LLFloaterChangeItemThumbnail::refreshFromInventory()
+LLViewerInventoryItem* LLFloaterChangeItemThumbnail::getItem()
{
LLViewerInventoryItem* item = NULL;
if (mTaskId.isNull())
@@ -178,10 +181,16 @@ void LLFloaterChangeItemThumbnail::refreshFromInventory()
item = static_cast<LLViewerInventoryItem*>(object->getInventoryObject(mItemId));
}
- else
- {
- closeFloater();
- }
+ }
+ return item;
+}
+
+void LLFloaterChangeItemThumbnail::refreshFromInventory()
+{
+ LLViewerInventoryItem* item = getItem();
+ if (!item)
+ {
+ closeFloater();
}
if (item)
@@ -220,16 +229,9 @@ void LLFloaterChangeItemThumbnail::refreshFromItem(LLViewerInventoryItem* item)
mCopyToClipboardBtn->setEnabled(thumbnail_id.notNull());
mRemoveImageBtn->setEnabled(thumbnail_id.notNull() && (item->getActualType() != LLAssetType::AT_TEXTURE) || (item->getAssetUUID() != thumbnail_id));
-}
-
-void LLFloaterChangeItemThumbnail::startObjectInventoryObserver()
-{
-
-}
-
-void LLFloaterChangeItemThumbnail::stopObjectInventoryObserver()
-{
+ // todo: some elements might not support setting thumbnails
+ // since they already have them
}
void LLFloaterChangeItemThumbnail::onUploadLocal(void *userdata)
@@ -244,22 +246,113 @@ void LLFloaterChangeItemThumbnail::onUploadSnapshot(void *userdata)
void LLFloaterChangeItemThumbnail::onUseTexture(void *userdata)
{
+ LLFloaterChangeItemThumbnail *self = (LLFloaterChangeItemThumbnail*)userdata;
+ LLViewerInventoryItem* item = self->getItem();
+ if (item)
+ {
+ self->showTexturePicker(item->getThumbnailUUID());
+ }
}
void LLFloaterChangeItemThumbnail::onCopyToClipboard(void *userdata)
{
-
+ LLFloaterChangeItemThumbnail *self = (LLFloaterChangeItemThumbnail*)userdata;
+ LLViewerInventoryItem* item = self->getItem();
+ if (item)
+ {
+ LLClipboard::instance().addToClipboard(item->getThumbnailUUID());
+ }
}
void LLFloaterChangeItemThumbnail::onPasteFromClipboard(void *userdata)
{
-
+ LLFloaterChangeItemThumbnail *self = (LLFloaterChangeItemThumbnail*)userdata;
+ std::vector<LLUUID> objects;
+ LLClipboard::instance().pasteFromClipboard(objects);
+ if (objects.size() > 0)
+ {
+ LLViewerInventoryItem* item = self->getItem();
+ if (item)
+ {
+ item->setThumbnailUUID(objects[0]);
+ }
+ }
}
void LLFloaterChangeItemThumbnail::onRemove(void *userdata)
{
+ LLFloaterChangeItemThumbnail *self = (LLFloaterChangeItemThumbnail*)userdata;
+ LLViewerInventoryItem* item = self->getItem();
+ if (item)
+ {
+ item->setThumbnailUUID(LLUUID::null);
+ }
+}
+
+void LLFloaterChangeItemThumbnail::showTexturePicker(const LLUUID &thumbnail_id)
+{
+ // show hourglass cursor when loading inventory window
+ getWindow()->setCursor(UI_CURSOR_WAIT);
+ LLFloater* floaterp = mPickerHandle.get();
+ // Show the dialog
+ if (floaterp)
+ {
+ floaterp->openFloater();
+ }
+ else
+ {
+ floaterp = new LLFloaterTexturePicker(
+ this,
+ thumbnail_id,
+ thumbnail_id,
+ thumbnail_id,
+ FALSE,
+ TRUE,
+ "SELECT PHOTO",
+ PERM_NONE,
+ PERM_NONE,
+ PERM_NONE,
+ FALSE,
+ NULL);
+
+ mPickerHandle = floaterp->getHandle();
+
+ LLFloaterTexturePicker* texture_floaterp = dynamic_cast<LLFloaterTexturePicker*>(floaterp);
+ if (texture_floaterp)
+ {
+ //texture_floaterp->setTextureSelectedCallback();
+ //texture_floaterp->setOnUpdateImageStatsCallback();
+ texture_floaterp->setOnFloaterCommitCallback([this](LLTextureCtrl::ETexturePickOp op, LLUUID id)
+ {
+ if (op == LLTextureCtrl::TEXTURE_SELECT)
+ {
+ onTexturePickerCommit(id);
+ }
+ }
+ );
+
+ texture_floaterp->setLocalTextureEnabled(FALSE);
+ texture_floaterp->setBakeTextureEnabled(FALSE);
+ texture_floaterp->setCanApplyImmediately(false);
+ texture_floaterp->setCanApply(false, true);
+ }
+
+ floaterp->openFloater();
+ }
+ floaterp->setFocus(TRUE);
+}
+
+void LLFloaterChangeItemThumbnail::onTexturePickerCommit(LLUUID id)
+{
+ LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mPickerHandle.get();
+ LLViewerInventoryItem* item = getItem();
+
+ if (item && floaterp)
+ {
+ item->setThumbnailUUID(floaterp->getAssetID());
+ }
}
void LLFloaterChangeItemThumbnail::onButtonMouseEnter(LLUICtrl* button, const LLSD& param, EToolTipState state)
diff --git a/indra/newview/llfloaterchangeitemthumbnail.h b/indra/newview/llfloaterchangeitemthumbnail.h
index a219adb6f5..340d5cf05e 100644
--- a/indra/newview/llfloaterchangeitemthumbnail.h
+++ b/indra/newview/llfloaterchangeitemthumbnail.h
@@ -55,12 +55,10 @@ public:
private:
+ LLViewerInventoryItem* getItem();
void refreshFromInventory();
void refreshFromItem(LLViewerInventoryItem* item);
- void startObjectInventoryObserver();
- void stopObjectInventoryObserver();
-
static void onUploadLocal(void*);
static void onUploadSnapshot(void*);
static void onUseTexture(void*);
@@ -68,6 +66,9 @@ private:
static void onPasteFromClipboard(void*);
static void onRemove(void*);
+ void showTexturePicker(const LLUUID &thumbnail_id);
+ void onTexturePickerCommit(LLUUID id);
+
enum EToolTipState
{
TOOLTIP_NONE,
@@ -94,5 +95,7 @@ private:
LLButton *mCopyToClipboardBtn;
LLButton *mPasteFromClipboardBtn;
LLButton *mRemoveImageBtn;
+
+ LLHandle<LLFloater> mPickerHandle;
};
#endif // LL_LLFLOATERCHANGEITEMTHUMBNAIL_H
diff --git a/indra/newview/llsidepaneliteminfo.cpp b/indra/newview/llsidepaneliteminfo.cpp
index 7d9fb6565c..312dee8c93 100644
--- a/indra/newview/llsidepaneliteminfo.cpp
+++ b/indra/newview/llsidepaneliteminfo.cpp
@@ -36,6 +36,7 @@
#include "llcallbacklist.h"
#include "llcombobox.h"
#include "llfloater.h"
+#include "llfloaterreg.h"
#include "llgroupactions.h"
#include "llgroupmgr.h"
#include "lliconctrl.h"
@@ -160,6 +161,8 @@ BOOL LLSidepanelItemInfo::postBuild()
getChild<LLLineEditor>("LabelItemName")->setPrevalidate(&LLTextValidate::validateASCIIPrintableNoPipe);
getChild<LLUICtrl>("LabelItemName")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitName,this));
getChild<LLUICtrl>("LabelItemDesc")->setCommitCallback(boost::bind(&LLSidepanelItemInfo:: onCommitDescription, this));
+ // Thumnail edition
+ getChild<LLUICtrl>("change_thumbnail_btn")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onEditThumbnail, this));
// acquired date
// owner permissions
// Permissions debug text
@@ -1022,7 +1025,14 @@ void LLSidepanelItemInfo::updatePermissions()
}
}
-// static
+void LLSidepanelItemInfo::onEditThumbnail()
+{
+ LLSD data;
+ data["task_id"] = mObjectID;
+ data["item_id"] = mItemID;
+ LLFloaterReg::showInstance("change_item_thumbnail", data);
+}
+
void LLSidepanelItemInfo::onCommitSaleInfo(LLUICtrl* ctrl)
{
if (ctrl)
diff --git a/indra/newview/llsidepaneliteminfo.h b/indra/newview/llsidepaneliteminfo.h
index d75de34fb8..ba1d5c263a 100644
--- a/indra/newview/llsidepaneliteminfo.h
+++ b/indra/newview/llsidepaneliteminfo.h
@@ -115,6 +115,7 @@ protected:
void onCommitDescription();
void onCommitPermissions(LLUICtrl* ctrl);
void updatePermissions();
+ void onEditThumbnail();
void onCommitSaleInfo(LLUICtrl* ctrl);
void updateSaleInfo();
void onCommitChanges(LLPointer<LLViewerInventoryItem> item);
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 f177ed0c0b..c30a3ba761 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
@@ -41,7 +41,7 @@
left="5"
mouse_opaque="true"
name="item_type_icon"
- top="5"
+ top="4"
width="16" />
<line_editor
border_style="line"
@@ -50,7 +50,7 @@
font="SansSerif"
height="19"
layout="topleft"
- top_delta="-2"
+ top_delta="-1"
left_pad="5"
max_length_bytes="127"
name="item_name"
diff --git a/indra/newview/skins/default/xui/en/sidepanel_item_info.xml b/indra/newview/skins/default/xui/en/sidepanel_item_info.xml
index 8b0f8f7550..f755ec0ec4 100644
--- a/indra/newview/skins/default/xui/en/sidepanel_item_info.xml
+++ b/indra/newview/skins/default/xui/en/sidepanel_item_info.xml
@@ -89,14 +89,14 @@
name="layout_item_details"
layout="topleft"
follows="all"
- height="130">
+ height="133">
<thumbnail
name="item_thumbnail"
follows="top|left"
layout="topleft"
left="5"
- top="0"
+ top="2"
height="128"
width="128"
/>
@@ -105,7 +105,7 @@
type="string"
length="1"
follows="left|top"
- height="17"
+ height="16"
layout="topleft"
left_pad="5"
name="LabelOwnerTitle"
@@ -131,7 +131,7 @@ TestString PleaseIgnore
type="string"
length="1"
follows="left|top"
- height="17"
+ height="16"
layout="topleft"
left_delta="0"
name="LabelCreatorTitle"
@@ -157,7 +157,7 @@ TestString PleaseIgnore
type="string"
length="1"
follows="left|top"
- height="17"
+ height="16"
layout="topleft"
left_delta="0"
name="LabelAcquiredTitle"
@@ -169,13 +169,23 @@ TestString PleaseIgnore
type="string"
length="1"
follows="left|top|right"
- height="23"
+ height="18"
layout="topleft"
left_delta="0"
name="LabelAcquiredDate"
top_pad="0"
width="187">
+ 00/00/00
</text>
+ <button
+ follows="left|top"
+ height="21"
+ label="Image..."
+ layout="topleft"
+ left_delta="0"
+ name="change_thumbnail_btn"
+ top_pad="0"
+ width="120" />
</layout_panel>
<layout_panel