From bc2b99cc8f0bc16a60fa83afd445f4caf8cc37a4 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Sat, 26 May 2012 00:31:25 +0200 Subject: [PATCH] Added script remove function; patch from Holy Gavenkrantz (FIRE-1048) --- indra/newview/llcompilequeue.cpp | 54 +++++++++++++++++++ indra/newview/llcompilequeue.h | 20 +++++++ indra/newview/llviewerfloaterreg.cpp | 2 + indra/newview/llviewermenu.cpp | 7 +++ .../default/xui/en/floater_script_queue.xml | 4 ++ .../skins/default/xui/en/menu_viewer.xml | 9 ++++ .../newview/skins/default/xui/en/strings.xml | 2 + 7 files changed, 98 insertions(+) diff --git a/indra/newview/llcompilequeue.cpp b/indra/newview/llcompilequeue.cpp index a240e80e5a..1978384433 100644 --- a/indra/newview/llcompilequeue.cpp +++ b/indra/newview/llcompilequeue.cpp @@ -785,6 +785,60 @@ void LLFloaterNotRunQueue::handleInventory(LLViewerObject* viewer_obj, nextObject(); } +// Delete scripts +///---------------------------------------------------------------------------- +/// Class LLFloaterDeleteQueue +///---------------------------------------------------------------------------- + +LLFloaterDeleteQueue::LLFloaterDeleteQueue(const LLSD& key) + : LLFloaterScriptQueue(key) +{ + setTitle(LLTrans::getString("DeleteQueueTitle")); + setStartString(LLTrans::getString("DeleteQueueStart")); +} + +LLFloaterDeleteQueue::~LLFloaterDeleteQueue() +{ +} + +void LLFloaterDeleteQueue::handleInventory(LLViewerObject* viewer_obj, + LLInventoryObject::object_list_t* inv) +{ + // find all of the lsl, leaving off duplicates. We'll remove + // all matching asset uuids on compilation success. + LLDynamicArray names; + + LLInventoryObject::object_list_t::const_iterator it = inv->begin(); + LLInventoryObject::object_list_t::const_iterator end = inv->end(); + for ( ; it != end; ++it) + { + if((*it)->getType() == LLAssetType::AT_LSL_TEXT) + { + LLViewerObject* object = gObjectList.findObject(viewer_obj->getID()); + + if (object) + { + LLInventoryItem* item = (LLInventoryItem*)((LLInventoryObject*)(*it)); + std::string buffer; + buffer = getString("Deleting") + (": ") + item->getName(); + getChild("queue output")->addCommentText(buffer); + LLMessageSystem* msg = gMessageSystem; + msg->newMessageFast(_PREHASH_RemoveTaskInventory); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->nextBlockFast(_PREHASH_InventoryData); + msg->addU32Fast(_PREHASH_LocalID, viewer_obj->getLocalID()); + msg->addUUIDFast(_PREHASH_ItemID, (*it)->getUUID()); + msg->sendReliable(object->getRegion()->getHost()); + } + } + } + + nextObject(); +} +// Delete scripts + ///---------------------------------------------------------------------------- /// Local function definitions ///---------------------------------------------------------------------------- diff --git a/indra/newview/llcompilequeue.h b/indra/newview/llcompilequeue.h index 4ddab29d00..71fdcd3514 100644 --- a/indra/newview/llcompilequeue.h +++ b/indra/newview/llcompilequeue.h @@ -225,4 +225,24 @@ protected: LLInventoryObject::object_list_t* inv); }; +// Delete scripts +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Class LLFloaterDeleteQueue +// +// This script queue will delete each script. +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +class LLFloaterDeleteQueue : public LLFloaterScriptQueue +{ + friend class LLFloaterReg; +protected: + LLFloaterDeleteQueue(const LLSD& key); + virtual ~LLFloaterDeleteQueue(); + + // This is called by inventoryChanged + virtual void handleInventory(LLViewerObject* viewer_obj, + LLInventoryObject::object_list_t* inv); +}; +// Delete scripts + #endif // LL_LLCOMPILEQUEUE_H diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 273d7e6f23..0eba1ca060 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -400,5 +400,7 @@ void LLViewerFloaterReg::registerFloaters() // Group titles LLFloaterReg::add("group_titles", "floater_fs_group_titles.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("delete_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::registerControlVariables(); // Make sure visibility and rect controls get preserved when saving } diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index db97ad4cfc..240c70bdf8 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -7580,6 +7580,13 @@ class LLToolsSelectedScriptAction : public view_listener_t name = "stop_queue"; msg = "SetRunningNot"; } + // Delete scripts + else if (action == "delete") + { + name = "delete_queue"; + msg = "delete"; + } + // Delete scripts LLUUID id; id.generate(); LLFloaterScriptQueue* queue =LLFloaterReg::getTypedInstance(name, LLSD(id)); diff --git a/indra/newview/skins/default/xui/en/floater_script_queue.xml b/indra/newview/skins/default/xui/en/floater_script_queue.xml index f4aca7bb3d..10c6779c49 100644 --- a/indra/newview/skins/default/xui/en/floater_script_queue.xml +++ b/indra/newview/skins/default/xui/en/floater_script_queue.xml @@ -29,6 +29,10 @@ name="NotRunning"> Not running + + Deleting +