llfloaterproject.h

Go to the documentation of this file.
00001 
00029 #ifndef LL_LLFLOATERPROJECT_H
00030 #define LL_LLFLOATERPROJECT_H
00031 
00032 #define DG_INCLUDE_WHITEBOARD 1
00033 
00034 
00035 #include "llfloater.h"
00036 #include "llfolderview.h"
00037 #include "llviewercommunication.h"
00038 
00044 class LLNetwork2080Bridge : public LLFolderViewEventListener
00045 {
00046 protected:
00047         U32 mID;
00048         LLUUID mUUID;
00049         LLString mName;
00050         S32 mSortOrder;
00051 
00052         LLInventoryItem* findItem() const;
00053 
00054 public:
00055         LLNetwork2080Bridge(const U32 id, const LLString& name) : mID(id), mName(name), mSortOrder(0)
00056         {
00057                 // Generate a random ID if none is defined
00058                 if ( 0 == mID )
00059                 {
00060                         mUUID = getRandomID();
00061                 }
00062                 else
00063                 {
00064                         mUUID = makeID(mID);
00065                 }
00066         }
00067 
00073         S32 getID() const { return mID; }
00074 
00075         virtual ~LLNetwork2080Bridge( void ) {}
00076 
00077         virtual LLFontGL::StyleFlags getLabelStyle() const { return LLFontGL::NORMAL; }
00078         virtual LLString getLabelSuffix() const { return LLString::null; }
00079         virtual void showProperties() {}
00080 
00081         // LLFolderViewEventListener functionality
00082         virtual const LLString& getName() const { return mName; }
00083         virtual const LLString& getDisplayName() const { return mName; }
00084         virtual PermissionMask getPermissionMask() const { return PERM_NONE; }
00085         virtual const LLUUID& getUUID() const { return mUUID; }
00086         virtual U32 getCreationDate() const {return 0; }
00087         virtual LLViewerImage* getIcon() const { return NULL; }
00088         virtual void openItem();
00089         virtual void previewItem();
00090         virtual void selectItem() {}
00091         virtual BOOL isItemRenameable() const { return FALSE; }
00092         virtual BOOL renameItem(const LLString& new_name);
00093         virtual BOOL isItemMovable() { return FALSE; }
00094         virtual BOOL isItemRemovable() { return FALSE; }
00095         virtual BOOL removeItem();
00096         virtual void removeBatch(LLDynamicArray<LLFolderViewEventListener*>& batch);
00097         virtual void move(LLFolderViewEventListener* parent_listener);
00098         virtual BOOL isItemCopyable() const { return FALSE; }
00099         virtual BOOL copyToClipboard() const { return FALSE; }
00100         virtual void cutToClipboard();
00101         virtual BOOL isClipboardPasteable() const { return FALSE; }
00102         virtual void pasteFromClipboard();
00103         virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
00104         virtual void performAction(LLFolderView* folder, LLInventoryModel* model, LLString action);
00105 
00114         virtual BOOL isUpToDate() const { return TRUE; }
00115 
00125         virtual BOOL hasChildren() const { return FALSE; }
00126 
00127         virtual LLInventoryType::EType getInventoryType() const { return LLInventoryType::IT_NONE; }
00128         // LLDragAndDropBridge functionality
00129         virtual BOOL startDrag(EDragAndDropType* type, LLUUID* id);
00130         virtual BOOL dragOrDrop(MASK mask, BOOL drop,
00131                                                         EDragAndDropType cargo_type,
00132                                                         void* cargo_data);
00133 
00139         static LLUUID getRandomID() 
00140         {
00141                 LLUUID ret;
00142                 ret.generate();
00143                 return ret;
00144         }
00145 
00153         static LLUUID makeID(S32 id)
00154         {
00155                 LLUUID ret; 
00156                 ret.mData[0] = id & 0xFF;
00157                 ret.mData[1] = (id >> 8) & 0xFF;
00158                 ret.mData[2] = (id >> 16) & 0xFF;
00159                 ret.mData[3] = (id >> 24) & 0xFF;
00160                 return ret;
00161         }
00162         
00167         virtual LLString getChildrenURL() const { return ""; }
00168 
00173         virtual LLString getURL() const { return ""; }
00174         
00179         virtual bool getQueueButtonsEnabled() const { return FALSE; }
00180         
00185         void setSortOrder(S32 order) { mSortOrder = order; }
00186 
00191         S32 getSortOrder() const { return mSortOrder; }
00192 };
00193 
00194 
00198 class LLNetwork2080FolderBridge : public LLNetwork2080Bridge
00199 {
00200 private:
00201         S32 mChildren;
00202         bool mLoaded;
00203         bool mLoading;
00204 
00205 public:
00206         LLNetwork2080FolderBridge(const U32 id, const LLString& name, S32 children): LLNetwork2080Bridge(id, name), mChildren(children), mLoaded(false), mLoading(false) {}
00207         virtual LLViewerImage* getIcon() const;
00208         virtual void openItem();
00209         virtual LLString getChildrenURL() const;
00210         virtual BOOL hasChildren() const { return mChildren > 0; }
00211         virtual BOOL isUpToDate() const { return mLoaded; }
00212 
00213         bool isLoaded() const { return mLoaded; }
00214         bool isLoading() const { return mLoading && !mLoaded; }
00215 
00216         void setLoading(bool loading) { mLoading = loading; }
00217         void setLoaded(bool loaded) { mLoaded = loaded; if ( mLoaded ) mLoading = false; }
00218 };
00219 
00223 class LLNetwork2080PlayableContentBridge : public LLNetwork2080Bridge
00224 {
00225 private:
00226 public:
00227         LLNetwork2080PlayableContentBridge(const S32 id, const LLString&name) : LLNetwork2080Bridge(id, name) {}
00228         virtual LLViewerImage* getIcon() const;
00229         virtual LLString getURL() const;
00230         virtual bool getQueueButtonsEnabled() const { return TRUE; }
00231 };
00232 
00233 
00237 class LLNetwork2080PageBridge : public LLNetwork2080Bridge
00238 {
00239 private:
00240 public:
00241         LLNetwork2080PageBridge(const S32 id, const LLString&name) : LLNetwork2080Bridge(id, name) {}
00242         virtual LLViewerImage* getIcon() const;
00243         virtual LLString getURL() const;
00244 };
00245 
00249 class LLFloaterNetwork2080 : public LLFloater
00250 {
00251 public:
00252         LLFloaterNetwork2080();
00253         virtual ~LLFloaterNetwork2080();
00254 
00255         static void toggle(void*);
00256 
00260         virtual void onClose(bool app_quitting) { setVisible(FALSE); }
00261 
00269         //void addCategoryChild(S32 parent, S32 id, const LLString &name, bool has_children = false);
00270         void addNode(S32 parent, LLNetwork2080Bridge *bridge);
00271         
00272         void show();
00273         static void idle(void* user_data);
00274 
00281         static void selectionCallback(const std::deque< LLFolderViewItem * > &items, BOOL user_action, void *data);
00282 
00287         void doIdle ();
00288 
00292         void requestRoot();
00293 
00298         void requestChildren(S32 parent_id);
00299 
00304         void setWhiteboardText(const LLString &text);
00305 
00310         void setQueueButtonsStatus(bool status);
00311 
00319         LLString buildURL(const LLString &baseurl, S32 id, bool send_key = false);
00320 
00321 
00326         void doSelectedPageCommand(const LLString &baseurl);
00327 
00328         static void onClickQueue(void *userdata);
00329         static void onClickExitQueue(void *userdata);
00330         static void onClickMyInfo(void *userdata);
00331         static void onClickNotecard(void *userdata);
00332         static void onClickQueueStatus(void *userdata);
00333 
00343         static bool compare(LLInventorySort*self, LLFolderViewItem* a, LLFolderViewItem* b);
00344 
00345         static void viewerCommCallback(LLString& data, LLViewerCircuit& circuit, void* userdata);
00346 private:
00347         LLFolderView *mTree;
00348         LLFolderViewFolder *mRoot;
00349         LLScrollableContainerView* mScroller;
00350         LLTextEditor *mWhiteboard;
00351         LLString mPassword; // Web backend password
00352         
00353         S32 mSelectedID; // Current selection
00354         U32 mNodeCount; // For sort order
00355 };
00356 
00357 
00358 extern LLFloaterNetwork2080* gFloaterProject;
00359 
00360 #endif

Generated on Thu Jul 1 06:08:35 2010 for Second Life Viewer by  doxygen 1.4.7