Annotation of /trunk/indra/newview/llcompilequeue.h
Parent Directory
|
Revision Log
Revision 135 - (view) (download)
| 1 : | mjm | 135 | /** |
| 2 : | * @file llcompilequeue.h | ||
| 3 : | * @brief LLCompileQueue class header file | ||
| 4 : | * | ||
| 5 : | * $LicenseInfo:firstyear=2002&license=viewergpl$ | ||
| 6 : | * | ||
| 7 : | * Copyright (c) 2002-2009, Linden Research, Inc. | ||
| 8 : | * | ||
| 9 : | * Second Life Viewer Source Code | ||
| 10 : | * The source code in this file ("Source Code") is provided by Linden Lab | ||
| 11 : | * to you under the terms of the GNU General Public License, version 2.0 | ||
| 12 : | * ("GPL"), unless you have obtained a separate licensing agreement | ||
| 13 : | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
| 14 : | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
| 15 : | * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 | ||
| 16 : | * | ||
| 17 : | * There are special exceptions to the terms and conditions of the GPL as | ||
| 18 : | * it is applied to this Source Code. View the full text of the exception | ||
| 19 : | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
| 20 : | * online at | ||
| 21 : | * http://secondlifegrid.net/programs/open_source/licensing/flossexception | ||
| 22 : | * | ||
| 23 : | * By copying, modifying or distributing this software, you acknowledge | ||
| 24 : | * that you have read and understood your obligations described above, | ||
| 25 : | * and agree to abide by those obligations. | ||
| 26 : | * | ||
| 27 : | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
| 28 : | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
| 29 : | * COMPLETENESS OR PERFORMANCE. | ||
| 30 : | * $/LicenseInfo$ | ||
| 31 : | */ | ||
| 32 : | |||
| 33 : | #ifndef LL_LLCOMPILEQUEUE_H | ||
| 34 : | #define LL_LLCOMPILEQUEUE_H | ||
| 35 : | |||
| 36 : | #include "lldarray.h" | ||
| 37 : | #include "llinventory.h" | ||
| 38 : | #include "llviewerobject.h" | ||
| 39 : | #include "llvoinventorylistener.h" | ||
| 40 : | #include "llmap.h" | ||
| 41 : | #include "lluuid.h" | ||
| 42 : | |||
| 43 : | #include "llfloater.h" | ||
| 44 : | #include "llscrolllistctrl.h" | ||
| 45 : | |||
| 46 : | #include "llviewerinventory.h" | ||
| 47 : | |||
| 48 : | //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 49 : | // Class LLFloaterScriptQueue | ||
| 50 : | // | ||
| 51 : | // This class provides a mechanism of adding objects to a list that | ||
| 52 : | // will go through and execute action for the scripts on each object. The | ||
| 53 : | // objects will be accessed serially and the scripts may be | ||
| 54 : | // manipulated in parallel. For example, selecting two objects each | ||
| 55 : | // with three scripts will result in the first object having all three | ||
| 56 : | // scripts manipulated. | ||
| 57 : | //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 58 : | |||
| 59 : | class LLFloaterScriptQueue : public LLFloater, public LLVOInventoryListener | ||
| 60 : | { | ||
| 61 : | public: | ||
| 62 : | // addObject() accepts an object id. | ||
| 63 : | void addObject(const LLUUID& id); | ||
| 64 : | |||
| 65 : | // start() returns TRUE if the queue has started, otherwise FALSE. | ||
| 66 : | BOOL start(); | ||
| 67 : | |||
| 68 : | // find an instance by ID. Return NULL if it does not exist. | ||
| 69 : | static LLFloaterScriptQueue* findInstance(const LLUUID& id); | ||
| 70 : | |||
| 71 : | protected: | ||
| 72 : | LLFloaterScriptQueue(const std::string& name, const LLRect& rect, | ||
| 73 : | const std::string& title, const std::string& start_string); | ||
| 74 : | virtual ~LLFloaterScriptQueue(); | ||
| 75 : | |||
| 76 : | // This is the callback method for the viewer object currently | ||
| 77 : | // being worked on. | ||
| 78 : | /*virtual*/ void inventoryChanged(LLViewerObject* obj, | ||
| 79 : | InventoryObjectList* inv, | ||
| 80 : | S32 serial_num, | ||
| 81 : | void* queue); | ||
| 82 : | |||
| 83 : | // This is called by inventoryChanged | ||
| 84 : | virtual void handleInventory(LLViewerObject* viewer_obj, | ||
| 85 : | InventoryObjectList* inv) = 0; | ||
| 86 : | |||
| 87 : | static void onCloseBtn(void* user_data); | ||
| 88 : | |||
| 89 : | // returns true if this is done | ||
| 90 : | BOOL isDone() const; | ||
| 91 : | |||
| 92 : | // go to the next object. If no objects left, it falls out | ||
| 93 : | // silently and waits to be killed by the deleteIfDone() callback. | ||
| 94 : | BOOL nextObject(); | ||
| 95 : | BOOL popNext(); | ||
| 96 : | |||
| 97 : | // Get this instances ID. | ||
| 98 : | const LLUUID& getID() const { return mID; } | ||
| 99 : | |||
| 100 : | protected: | ||
| 101 : | // UI | ||
| 102 : | LLScrollListCtrl* mMessages; | ||
| 103 : | LLButton* mCloseBtn; | ||
| 104 : | |||
| 105 : | // Object Queue | ||
| 106 : | LLDynamicArray<LLUUID> mObjectIDs; | ||
| 107 : | LLUUID mCurrentObjectID; | ||
| 108 : | BOOL mDone; | ||
| 109 : | |||
| 110 : | LLUUID mID; | ||
| 111 : | static LLMap<LLUUID, LLFloaterScriptQueue*> sInstances; | ||
| 112 : | |||
| 113 : | std::string mStartString; | ||
| 114 : | }; | ||
| 115 : | |||
| 116 : | //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 117 : | // Class LLFloaterCompileQueue | ||
| 118 : | // | ||
| 119 : | // This script queue will recompile each script. | ||
| 120 : | //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 121 : | |||
| 122 : | struct LLCompileQueueData | ||
| 123 : | { | ||
| 124 : | LLUUID mQueueID; | ||
| 125 : | LLUUID mItemId; | ||
| 126 : | LLCompileQueueData(const LLUUID& q_id, const LLUUID& item_id) : | ||
| 127 : | mQueueID(q_id), mItemId(item_id) {} | ||
| 128 : | }; | ||
| 129 : | |||
| 130 : | class LLAssetUploadQueue; | ||
| 131 : | |||
| 132 : | class LLFloaterCompileQueue : public LLFloaterScriptQueue | ||
| 133 : | { | ||
| 134 : | public: | ||
| 135 : | // Use this method to create a compile queue. Once created, it | ||
| 136 : | // will be responsible for it's own destruction. | ||
| 137 : | static LLFloaterCompileQueue* create(BOOL mono); | ||
| 138 : | |||
| 139 : | static void onSaveBytecodeComplete(const LLUUID& asset_id, | ||
| 140 : | void* user_data, | ||
| 141 : | S32 status); | ||
| 142 : | |||
| 143 : | // remove any object in mScriptScripts with the matching uuid. | ||
| 144 : | void removeItemByItemID(const LLUUID& item_id); | ||
| 145 : | |||
| 146 : | protected: | ||
| 147 : | LLFloaterCompileQueue(const std::string& name, const LLRect& rect); | ||
| 148 : | virtual ~LLFloaterCompileQueue(); | ||
| 149 : | |||
| 150 : | // This is called by inventoryChanged | ||
| 151 : | virtual void handleInventory(LLViewerObject* viewer_obj, | ||
| 152 : | InventoryObjectList* inv); | ||
| 153 : | |||
| 154 : | // This is the callback for when each script arrives | ||
| 155 : | static void scriptArrived(LLVFS *vfs, const LLUUID& asset_id, | ||
| 156 : | LLAssetType::EType type, | ||
| 157 : | void* user_data, S32 status, LLExtStat ext_status); | ||
| 158 : | |||
| 159 : | static void onSaveTextComplete(const LLUUID& asset_id, void* user_data, S32 status, LLExtStat ext_status); | ||
| 160 : | |||
| 161 : | static void onSaveBytecodeComplete(const LLUUID& asset_id, | ||
| 162 : | void* user_data, | ||
| 163 : | S32 status, LLExtStat ext_status); | ||
| 164 : | |||
| 165 : | // compile the file given and save it out. | ||
| 166 : | void compile(const std::string& filename, const LLUUID& asset_id); | ||
| 167 : | |||
| 168 : | // remove any object in mScriptScripts with the matching uuid. | ||
| 169 : | void removeItemByAssetID(const LLUUID& asset_id); | ||
| 170 : | |||
| 171 : | // save the items indicated by the item id. | ||
| 172 : | void saveItemByItemID(const LLUUID& item_id); | ||
| 173 : | |||
| 174 : | // find InventoryItem given item id. | ||
| 175 : | const LLInventoryItem* findItemByItemID(const LLUUID& item_id) const; | ||
| 176 : | |||
| 177 : | protected: | ||
| 178 : | LLViewerInventoryItem::item_array_t mCurrentScripts; | ||
| 179 : | |||
| 180 : | private: | ||
| 181 : | BOOL mMono; // Compile to mono. | ||
| 182 : | LLAssetUploadQueue* mUploadQueue; | ||
| 183 : | }; | ||
| 184 : | |||
| 185 : | //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 186 : | // Class LLFloaterResetQueue | ||
| 187 : | // | ||
| 188 : | // This script queue will reset each script. | ||
| 189 : | //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 190 : | |||
| 191 : | class LLFloaterResetQueue : public LLFloaterScriptQueue | ||
| 192 : | { | ||
| 193 : | public: | ||
| 194 : | // Use this method to create a reset queue. Once created, it | ||
| 195 : | // will be responsible for it's own destruction. | ||
| 196 : | static LLFloaterResetQueue* create(); | ||
| 197 : | |||
| 198 : | protected: | ||
| 199 : | LLFloaterResetQueue(const std::string& name, const LLRect& rect); | ||
| 200 : | virtual ~LLFloaterResetQueue(); | ||
| 201 : | |||
| 202 : | // This is called by inventoryChanged | ||
| 203 : | virtual void handleInventory(LLViewerObject* viewer_obj, | ||
| 204 : | InventoryObjectList* inv); | ||
| 205 : | |||
| 206 : | protected: | ||
| 207 : | }; | ||
| 208 : | |||
| 209 : | //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 210 : | // Class LLFloaterRunQueue | ||
| 211 : | // | ||
| 212 : | // This script queue will set each script as running. | ||
| 213 : | //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 214 : | |||
| 215 : | class LLFloaterRunQueue : public LLFloaterScriptQueue | ||
| 216 : | { | ||
| 217 : | public: | ||
| 218 : | // Use this method to create a run queue. Once created, it | ||
| 219 : | // will be responsible for it's own destruction. | ||
| 220 : | static LLFloaterRunQueue* create(); | ||
| 221 : | |||
| 222 : | protected: | ||
| 223 : | LLFloaterRunQueue(const std::string& name, const LLRect& rect); | ||
| 224 : | virtual ~LLFloaterRunQueue(); | ||
| 225 : | |||
| 226 : | // This is called by inventoryChanged | ||
| 227 : | virtual void handleInventory(LLViewerObject* viewer_obj, | ||
| 228 : | InventoryObjectList* inv); | ||
| 229 : | |||
| 230 : | protected: | ||
| 231 : | }; | ||
| 232 : | |||
| 233 : | //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 234 : | // Class LLFloaterNotRunQueue | ||
| 235 : | // | ||
| 236 : | // This script queue will set each script as not running. | ||
| 237 : | //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 238 : | |||
| 239 : | class LLFloaterNotRunQueue : public LLFloaterScriptQueue | ||
| 240 : | { | ||
| 241 : | public: | ||
| 242 : | // Use this method to create a not run queue. Once created, it | ||
| 243 : | // will be responsible for it's own destruction. | ||
| 244 : | static LLFloaterNotRunQueue* create(); | ||
| 245 : | |||
| 246 : | protected: | ||
| 247 : | LLFloaterNotRunQueue(const std::string& name, const LLRect& rect); | ||
| 248 : | virtual ~LLFloaterNotRunQueue(); | ||
| 249 : | |||
| 250 : | // This is called by inventoryChanged | ||
| 251 : | virtual void handleInventory(LLViewerObject* viewer_obj, | ||
| 252 : | InventoryObjectList* inv); | ||
| 253 : | |||
| 254 : | protected: | ||
| 255 : | }; | ||
| 256 : | |||
| 257 : | #endif // LL_LLCOMPILEQUEUE_H |
| ViewVC Help | |
| Powered by ViewVC 1.0.0 |

