diff options
Diffstat (limited to 'indra/newview/llimfloatercontainer.h')
-rw-r--r-- | indra/newview/llimfloatercontainer.h | 113 |
1 files changed, 98 insertions, 15 deletions
diff --git a/indra/newview/llimfloatercontainer.h b/indra/newview/llimfloatercontainer.h index c062127bee..0d988b5b73 100644 --- a/indra/newview/llimfloatercontainer.h +++ b/indra/newview/llimfloatercontainer.h @@ -37,7 +37,7 @@ #include "llgroupmgr.h" #include "llfolderviewitem.h" -#include "llfoldervieweventlistener.h" +#include "llfolderviewmodel.h" class LLButton; class LLLayoutPanel; @@ -53,19 +53,19 @@ typedef std::map<LLFloater*, LLFolderViewItem*> conversations_widgets_map; // Conversation items: we hold a list of those and create an LLFolderViewItem widget for each // that we tuck into the mConversationsListPanel. -class LLConversationItem : public LLFolderViewEventListener +class LLConversationItem : public LLFolderViewModelItemCommon { public: LLConversationItem(std::string name, const LLUUID& uuid, LLFloater* floaterp, LLIMFloaterContainer* containerp); + LLConversationItem(); virtual ~LLConversationItem() {} // Stub those things we won't really be using in this conversation context virtual const std::string& getName() const { return mName; } virtual const std::string& getDisplayName() const { return mName; } + virtual const std::string& getSearchableName() const { return mName; } virtual const LLUUID& getUUID() const { return mUUID; } virtual time_t getCreationDate() const { return 0; } - virtual PermissionMask getPermissionMask() const { return PERM_ALL; } - virtual LLFolderType::EType getPreferredType() const { return LLFolderType::FT_NONE; } virtual LLPointer<LLUIImage> getIcon() const { return NULL; } virtual LLPointer<LLUIImage> getOpenIcon() const { return getIcon(); } virtual LLFontGL::StyleFlags getLabelStyle() const { return LLFontGL::NORMAL; } @@ -76,8 +76,8 @@ public: virtual BOOL isItemRemovable( void ) const { return FALSE; } virtual BOOL isItemInTrash( void) const { return FALSE; } virtual BOOL removeItem() { return FALSE; } - virtual void removeBatch(LLDynamicArray<LLFolderViewEventListener*>& batch) { } - virtual void move( LLFolderViewEventListener* parent_listener ) { } + virtual void removeBatch(std::vector<LLFolderViewModelItem*>& batch) { } + virtual void move( LLFolderViewModelItem* parent_listener ) { } virtual BOOL isItemCopyable() const { return FALSE; } virtual BOOL copyToClipboard() const { return FALSE; } virtual BOOL cutToClipboard() const { return FALSE; } @@ -86,9 +86,13 @@ public: virtual void pasteLinkFromClipboard() { } virtual void buildContextMenu(LLMenuGL& menu, U32 flags) { } virtual BOOL isUpToDate() const { return TRUE; } - virtual BOOL hasChildren() const { return FALSE; } - virtual LLInventoryType::EType getInventoryType() const { return LLInventoryType::IT_NONE; } - virtual LLWearableType::EType getWearableType() const { return LLWearableType::WT_NONE; } + virtual bool hasChildren() const { return FALSE; } + + virtual bool potentiallyVisible() { return true; } + virtual bool filter( LLFolderViewFilter& filter) { return true; } + virtual bool descendantsPassedFilter(S32 filter_generation = -1) { return true; } + virtual void setPassedFilter(bool passed, bool passed_folder, S32 filter_generation) { } + virtual bool passedFilter(S32 filter_generation = -1) { return true; } // The action callbacks virtual void performAction(LLInventoryModel* model, std::string action); @@ -100,10 +104,6 @@ public: void setVisibleIfDetached(BOOL visible); - // This method should be called when a drag begins. - // Returns TRUE if the drag can begin, FALSE otherwise. - virtual BOOL startDrag(EDragAndDropType* type, LLUUID* id) const { return FALSE; } - // This method will be called to determine if a drop can be // performed, and will set drop to TRUE if a drop is // requested. @@ -121,6 +121,86 @@ private: LLFloater* mFloater; LLIMFloaterContainer* mContainer; }; + +// We don't want to ever filter conversations but we need to declare that class to create a conversation view model. +// We just stubb everything for the moment. +class LLConversationFilter : public LLFolderViewFilter +{ +public: + + enum ESortOrderType + { + SO_NAME = 0, // Sort inventory by name + SO_DATE = 0x1, // Sort inventory by date + }; + + LLConversationFilter() { mEmpty = ""; } + ~LLConversationFilter() {} + + bool check(const LLFolderViewModelItem* item) { return true; } + bool checkFolder(const LLFolderViewModelItem* folder) const { return true; } + void setEmptyLookupMessage(const std::string& message) { } + std::string getEmptyLookupMessage() const { return mEmpty; } + bool showAllResults() const { return true; } + + bool isActive() const { return false; } + bool isModified() const { return false; } + void clearModified() { } + const std::string& getName() const { return mEmpty; } + const std::string& getFilterText() { return mEmpty; } + void setModified(EFilterModified behavior = FILTER_RESTART) { } + + void setFilterCount(S32 count) { } + S32 getFilterCount() const { return 0; } + void decrementFilterCount() { } + + bool isDefault() const { return true; } + bool isNotDefault() const { return false; } + void markDefault() { } + void resetDefault() { } + + S32 getCurrentGeneration() const { return 0; } + S32 getFirstSuccessGeneration() const { return 0; } + S32 getFirstRequiredGeneration() const { return 0; } +private: + std::string mEmpty; +}; + +class LLConversationSort +{ +public: + LLConversationSort(U32 order = 0) + : mSortOrder(order), + mByDate(false), + mByName(false) + { + mByDate = (order & LLConversationFilter::SO_DATE); + mByName = (order & LLConversationFilter::SO_NAME); + } + + bool isByDate() const { return mByDate; } + U32 getSortOrder() const { return mSortOrder; } + + bool operator()(const LLConversationItem* const& a, const LLConversationItem* const& b) const; +private: + U32 mSortOrder; + bool mByDate; + bool mByName; +}; + +class LLConversationViewModel +: public LLFolderViewModel<LLConversationSort, LLConversationItem, LLConversationItem, LLConversationFilter> +{ +public: + typedef LLFolderViewModel<LLConversationSort, LLConversationItem, LLConversationItem, LLConversationFilter> base_t; + + void sort(LLFolderViewFolder* folder) { } // *TODO : implement conversation sort + bool contentsReady() { return true; } // *TODO : we need to check that participants names are available somewhat + bool startDrag(std::vector<LLFolderViewModelItem*>& items) { return false; } // We do not allow drag of conversation items + +private: +}; + // CHUI-137 : End class LLIMFloaterContainer @@ -184,17 +264,20 @@ private: LLLayoutPanel* mConversationsPane; LLLayoutStack* mConversationsStack; - // CHUI-137 : Temporary implementation of conversations list + // Conversation list implementation public: void removeConversationListItem(LLFloater* floaterp, bool change_focus = true); void addConversationListItem(std::string name, const LLUUID& uuid, LLFloater* floaterp); LLFloater* findConversationItem(LLUUID& uuid); private: LLFolderViewItem* createConversationItemWidget(LLConversationItem* item); + // Conversation list data - LLPanel* mConversationsListPanel; // This is the widget we add items to (i.e. clickable title for each conversation) + LLPanel* mConversationsListPanel; // This is the main widget we add conversation widget to conversations_items_map mConversationsItems; conversations_widgets_map mConversationsWidgets; + LLConversationViewModel mConversationViewModel; + LLFolderView* mConversationsRoot; }; #endif // LL_LLIMFLOATERCONTAINER_H |