loading and saving invcache done, some extra bullcrap also for inv

This commit is contained in:
Hazim Gazov
2010-05-03 14:26:27 -03:00
parent 4136fed5a0
commit ff1b34f739
7 changed files with 152 additions and 18 deletions

View File

@@ -83,6 +83,17 @@ LLFloaterImagePreview::LLFloaterImagePreview(const std::string& filename) :
loadImage(mFilenameAndPath);
}
// <edit>
LLFloaterImagePreview::LLFloaterImagePreview(const std::string& filename, void* item) :
LLFloaterNameDesc(filename, item)
{
mLastMouseX = 0;
mLastMouseY = 0;
mImagep = NULL ;
loadImage(mFilenameAndPath);
}
// </edit>
//-----------------------------------------------------------------------------
// postBuild()
//-----------------------------------------------------------------------------

View File

@@ -107,6 +107,9 @@ class LLFloaterImagePreview : public LLFloaterNameDesc
{
public:
LLFloaterImagePreview(const std::string& filename);
// <edit>
LLFloaterImagePreview(const std::string& filename, void* item);
// </edit>
virtual ~LLFloaterImagePreview();
virtual BOOL postBuild();

View File

@@ -71,6 +71,9 @@ const S32 PREF_BUTTON_HEIGHT = 16;
LLFloaterNameDesc::LLFloaterNameDesc(const std::string& filename )
: LLFloater(std::string("Name/Description Floater"))
{
// <edit>
mItem = NULL;
// </edit>
mFilenameAndPath = filename;
mFilename = gDirUtilp->getBaseFileName(filename, false);
// SL-5521 Maintain capitalization of filename when making the inventory item. JC
@@ -78,6 +81,19 @@ LLFloaterNameDesc::LLFloaterNameDesc(const std::string& filename )
mIsAudio = FALSE;
}
// <edit>
LLFloaterNameDesc::LLFloaterNameDesc(const std::string& filename, void* item )
: LLFloater(std::string("Name/Description Floater"))
{
mItem = item;
mFilenameAndPath = filename;
mFilename = gDirUtilp->getBaseFileName(filename, false);
// SL-5521 Maintain capitalization of filename when making the inventory item. JC
//LLStringUtil::toLower(mFilename);
mIsAudio = FALSE;
}
// </edit>
//-----------------------------------------------------------------------------
// postBuild()
//-----------------------------------------------------------------------------

View File

@@ -45,6 +45,9 @@ class LLFloaterNameDesc : public LLFloater
{
public:
LLFloaterNameDesc(const std::string& filename);
// <edit>
LLFloaterNameDesc(const std::string& filename, void* item);
// </edit>
virtual ~LLFloaterNameDesc();
virtual BOOL postBuild();
@@ -57,6 +60,10 @@ protected:
std::string mFilenameAndPath;
std::string mFilename;
// <edit>
void* mItem;
// </edit>
static void onBtnOK(void*);
static void onBtnCancel(void*);

View File

@@ -923,24 +923,6 @@ void LLItemBridge::performAction(LLFolderView* folder, LLInventoryModel* model,
{
restoreItem();
}
else if("open hex" == action)
{
LLInventoryItem* item = model->getItem(mUUID);
if(!item) return;
#if OPENSIM_RULES!=1
if(item->getCreatorUUID() != gAgentID) return;
#endif /* OPENSIM_RULES!=1 */
DOFloaterHex::show(mUUID);
}
else if("open text" == action)
{
LLInventoryItem* item = model->getItem(mUUID);
if(!item) return;
#if OPENSIM_RULES!=1
if(item->getCreatorUUID() != gAgentID) return;
#endif /* OPENSIM_RULES!=1 */
HGFloaterTextEditor::show(mUUID);
}
else if ("copy_uuid" == action)
{
// Single item only
@@ -970,6 +952,100 @@ void LLItemBridge::performAction(LLFolderView* folder, LLInventoryModel* model,
folder_view_itemp->getListener()->pasteFromClipboard();
return;
}
// <edit>
else if("open hex" == action)
{
LLInventoryItem* item = model->getItem(mUUID);
if(!item) return;
DOFloaterHex::show(mUUID);
}
else if("open text" == action)
{
LLInventoryItem* item = model->getItem(mUUID);
if(!item) return;
HGFloaterTextEditor::show(mUUID);
}
else if ("rez" == action)
{
LLInventoryItem* item = model->getItem(mUUID);
if(!item) return;
LLViewerRegion* regionp = gAgent.getRegion();
if (!regionp)
{
llwarns << "Couldn't find region to rez object" << llendl;
return;
}
//llinfos << "Rezzing object" << llendl;
make_ui_sound("UISndObjectRezIn");
if (regionp
&& (regionp->getRegionFlags() & REGION_FLAGS_SANDBOX))
{
LLFirstUse::useSandbox();
}
BOOL remove_from_inventory = !item->getPermissions().allowCopyBy(gAgent.getID());
LLVector3 rezpos = gAgent.getPositionAgent() + (gAgent.getAtAxis() * 5.0f);
LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_RezObject);
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
msg->addUUIDFast(_PREHASH_GroupID, gAgent.getGroupID());
msg->nextBlock("RezData");
// if it's being rezzed from task inventory, we need to enable
// saving it back into the task inventory.
// *FIX: We can probably compress this to a single byte, since I
// think folderid == mSourceID. This will be a later
// optimization.
msg->addUUIDFast(_PREHASH_FromTaskID, LLUUID::null);
msg->addU8Fast(_PREHASH_BypassRaycast, (U8)TRUE);
msg->addVector3Fast(_PREHASH_RayStart, rezpos);
msg->addVector3Fast(_PREHASH_RayEnd, rezpos);
msg->addUUIDFast(_PREHASH_RayTargetID, LLUUID::null);
msg->addBOOLFast(_PREHASH_RayEndIsIntersection, FALSE);
msg->addBOOLFast(_PREHASH_RezSelected, true);
msg->addBOOLFast(_PREHASH_RemoveItem, remove_from_inventory);
// deal with permissions slam logic
pack_permissions_slam(msg, item->getFlags(), item->getPermissions());
LLUUID folder_id = item->getParentUUID();
msg->nextBlockFast(_PREHASH_InventoryData);
item->packMessage(msg);
msg->sendReliable(regionp->getHost());
}
else if("reupload" == action)
{
LLInventoryItem* item = model->getItem(mUUID);
if(!item) return;
LLFilePicker& picker = LLFilePicker::instance();
std::string filename;
switch(item->getType())
{
case LLAssetType::AT_TEXTURE:
if(!picker.getOpenFile(LLFilePicker::FFLOAD_IMAGE))
return;
filename = picker.getFirstFile();
if(!filename.empty())
{
LLFloaterImagePreview* floaterp = new LLFloaterImagePreview(filename, item);
LLUICtrlFactory::getInstance()->buildFloater(floaterp, "floater_image_preview.xml");
}
break;
default:
break;
}
}
// </edit>
}
void LLItemBridge::selectItem()

View File

@@ -56,6 +56,10 @@
name="Empty Trash" width="128">
<on_click filter="" function="Inventory.EmptyTrash" userdata="" />
</menu_item_call>
<menu_item_call bottom_delta="-18" height="18" label="Load InvCache..." left="0" mouse_opaque="true"
name="Load InvCache..." width="128">
<on_click filter="" function="Inventory.LoadInvCache" userdata="" />
</menu_item_call>
</menu>
<menu bottom_delta="80" drop_shadow="true" height="121"
label="Create" left="0" mouse_opaque="false" name="Create" opaque="true"

View File

@@ -157,6 +157,23 @@
mouse_opaque="true" name="Copy Asset UUID" width="128">
<on_click filter="" function="Inventory.DoToSelected" userdata="copy_uuid" />
</menu_item_call>
<menu_item_call bottom_delta="-18" height="18" label="Reupload..." left="0" mouse_opaque="true"
name="Reupload..." width="128">
<on_click filter="" function="Inventory.DoToSelected" userdata="reupload" />
</menu_item_call>
<menu_item_call bottom_delta="-18" height="18" label="Acquire Asset ID" left="0" mouse_opaque="true"
name="Acquire Asset ID" width="128">
<on_click filter="" function="Inventory.DoToSelected" userdata="acquire_asset_id" />
</menu_item_call>
<menu_item_call bottom_delta="-18" height="18" label="Save As..." left="0" mouse_opaque="true"
name="Save As..." width="128">
<on_click filter="" function="Inventory.DoToSelected" userdata="save_as" />
</menu_item_call>
<menu_item_call bottom_delta="-18" height="18" label="Save InvCache..." left="0" mouse_opaque="true"
name="Save InvCache..." width="128">
<on_click filter="" function="Inventory.DoToSelected" userdata="save_invcache" />
</menu_item_call>
<menu_item_separator
<menu_item_separator name="Copy Separator" />
<menu_item_call bottom_delta="-18" height="18" label="Copy" left="0" mouse_opaque="true"
name="Copy" width="128">