summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2012-08-06 18:07:56 -0700
committerMerov Linden <merov@lindenlab.com>2012-08-06 18:07:56 -0700
commit25855962a86331a337c4baff2754c63850605aea (patch)
tree1d21598182659a3331674abbad608bc115fce006 /indra
parent02bdceb5808b670fdb16784f11488c12c09e1b4b (diff)
CHUI-98 : Isolate LLConversationItem and LLConversationViewModel in their own file
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/CMakeLists.txt2
-rw-r--r--indra/newview/llconversationmodel.cpp106
-rw-r--r--indra/newview/llconversationmodel.h202
-rw-r--r--indra/newview/llimfloatercontainer.cpp73
-rw-r--r--indra/newview/llimfloatercontainer.h164
5 files changed, 311 insertions, 236 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index 626fb8caa5..08325daaab 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -134,6 +134,7 @@ set(viewer_SOURCE_FILES
llconversationlog.cpp
llconversationloglist.cpp
llconversationloglistitem.cpp
+ llconversationmodel.cpp
llcurrencyuimanager.cpp
llcylinder.cpp
lldateutil.cpp
@@ -699,6 +700,7 @@ set(viewer_HEADER_FILES
llconversationlog.h
llconversationloglist.h
llconversationloglistitem.h
+ llconversationmodel.h
llcurrencyuimanager.h
llcylinder.h
lldateutil.h
diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp
new file mode 100644
index 0000000000..bd314588a0
--- /dev/null
+++ b/indra/newview/llconversationmodel.cpp
@@ -0,0 +1,106 @@
+/**
+ * @file llconversationmodel.cpp
+ * @brief Implementation of conversations list
+ *
+ * $LicenseInfo:firstyear=2009&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+
+#include "llviewerprecompiledheaders.h"
+
+#include "llconversationmodel.h"
+#include "llimfloatercontainer.h"
+
+// Conversation items
+LLConversationItem::LLConversationItem(std::string name, const LLUUID& uuid, LLFloater* floaterp, LLIMFloaterContainer* containerp) :
+ LLFolderViewModelItemCommon(containerp->getRootViewModel()),
+ mName(name),
+ mUUID(uuid),
+ mFloater(floaterp),
+ mContainer(containerp)
+{
+}
+
+LLConversationItem::LLConversationItem(LLIMFloaterContainer* containerp) :
+ LLFolderViewModelItemCommon(containerp->getRootViewModel()),
+ mName(""),
+ mUUID(),
+ mFloater(NULL),
+ mContainer(NULL)
+{
+}
+
+
+// Virtual action callbacks
+void LLConversationItem::selectItem(void)
+{
+ LLMultiFloater* host_floater = mFloater->getHost();
+ if (host_floater == mContainer)
+ {
+ // Always expand the message pane if the panel is hosted by the container
+ mContainer->collapseMessagesPane(false);
+ // Switch to the conversation floater that is being selected
+ mContainer->selectFloater(mFloater);
+ }
+ // Set the focus on the selected floater
+ mFloater->setFocus(TRUE);
+}
+
+void LLConversationItem::setVisibleIfDetached(BOOL visible)
+{
+ // Do this only if the conversation floater has been torn off (i.e. no multi floater host) and is not minimized
+ // Note: minimized dockable floaters are brought to front hence unminimized when made visible and we don't want that here
+ if (!mFloater->getHost() && !mFloater->isMinimized())
+ {
+ mFloater->setVisible(visible);
+ }
+}
+
+void LLConversationItem::performAction(LLInventoryModel* model, std::string action)
+{
+}
+
+void LLConversationItem::openItem( void )
+{
+}
+
+void LLConversationItem::closeItem( void )
+{
+}
+
+void LLConversationItem::previewItem( void )
+{
+}
+
+void LLConversationItem::showProperties(void)
+{
+}
+
+bool LLConversationSort::operator()(const LLConversationItem* const& a, const LLConversationItem* const& b) const
+{
+ // We compare only by name for the moment
+ // *TODO : Implement the sorting by date
+ S32 compare = LLStringUtil::compareDict(a->getDisplayName(), b->getDisplayName());
+ return (compare < 0);
+}
+
+// EOF
diff --git a/indra/newview/llconversationmodel.h b/indra/newview/llconversationmodel.h
new file mode 100644
index 0000000000..85760eb1a8
--- /dev/null
+++ b/indra/newview/llconversationmodel.h
@@ -0,0 +1,202 @@
+/**
+ * @file llconversationmodel.h
+ * @brief Implementation of conversations list
+ *
+ * $LicenseInfo:firstyear=2009&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_LLCONVERSATIONMODEL_H
+#define LL_LLCONVERSATIONMODEL_H
+
+//#include <map>
+//#include <vector>
+
+#include "llfolderviewitem.h"
+#include "llfolderviewmodel.h"
+
+class LLButton;
+class LLFloater;
+class LLLayoutPanel;
+class LLLayoutStack;
+class LLTabContainer;
+class LLIMFloaterContainer;
+
+// Implementation of conversations list
+
+class LLConversationItem;
+
+typedef std::map<LLFloater*, LLConversationItem*> conversations_items_map;
+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 LLFolderViewModelItemCommon
+{
+public:
+ LLConversationItem(std::string name, const LLUUID& uuid, LLFloater* floaterp, LLIMFloaterContainer* containerp);
+ LLConversationItem(LLIMFloaterContainer* containerp);
+ 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 LLPointer<LLUIImage> getIcon() const { return NULL; }
+ virtual LLPointer<LLUIImage> getOpenIcon() const { return getIcon(); }
+ virtual LLFontGL::StyleFlags getLabelStyle() const { return LLFontGL::NORMAL; }
+ virtual std::string getLabelSuffix() const { return LLStringUtil::null; }
+ virtual BOOL isItemRenameable() const { return FALSE; }
+ virtual BOOL renameItem(const std::string& new_name) { return FALSE; }
+ virtual BOOL isItemMovable( void ) const { return FALSE; }
+ virtual BOOL isItemRemovable( void ) const { return FALSE; }
+ virtual BOOL isItemInTrash( void) const { return FALSE; }
+ virtual BOOL removeItem() { return FALSE; }
+ 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; }
+ virtual BOOL isClipboardPasteable() const { return FALSE; }
+ virtual void pasteFromClipboard() { }
+ virtual void pasteLinkFromClipboard() { }
+ virtual void buildContextMenu(LLMenuGL& menu, U32 flags) { }
+ virtual BOOL isUpToDate() const { return TRUE; }
+ virtual bool hasChildren() const { return FALSE; }
+
+ virtual bool potentiallyVisible() { return true; }
+ virtual bool filter( LLFolderViewFilter& filter) { return false; }
+ virtual bool descendantsPassedFilter(S32 filter_generation = -1) { return true; }
+ virtual void setPassedFilter(bool passed, S32 filter_generation, std::string::size_type string_offset = std::string::npos, std::string::size_type string_size = 0) { }
+ virtual bool passedFilter(S32 filter_generation = -1) { return true; }
+
+ // The action callbacks
+ virtual void performAction(LLInventoryModel* model, std::string action);
+ virtual void openItem( void );
+ virtual void closeItem( void );
+ virtual void previewItem( void );
+ virtual void selectItem(void);
+ virtual void showProperties(void);
+
+ void setVisibleIfDetached(BOOL visible);
+
+ // This method will be called to determine if a drop can be
+ // performed, and will set drop to TRUE if a drop is
+ // requested.
+ // Returns TRUE if a drop is possible/happened, FALSE otherwise.
+ virtual BOOL dragOrDrop(MASK mask, BOOL drop,
+ EDragAndDropType cargo_type,
+ void* cargo_data,
+ std::string& tooltip_msg) { return FALSE; }
+
+ bool hasSameValues(std::string name, const LLUUID& uuid) { return ((name == mName) && (uuid == mUUID)); }
+ bool hasSameValue(const LLUUID& uuid) { return (uuid == mUUID); }
+private:
+ std::string mName;
+ const LLUUID mUUID;
+ 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; }
+ std::string::size_type getStringMatchOffset(LLFolderViewModelItem* item) const { return std::string::npos; }
+ std::string::size_type getFilterStringSize() const { return 0; }
+
+ 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:
+};
+
+#endif // LL_LLCONVERSATIONMODEL_H
diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp
index d618e7491a..c2c0ddddea 100644
--- a/indra/newview/llimfloatercontainer.cpp
+++ b/indra/newview/llimfloatercontainer.cpp
@@ -536,77 +536,4 @@ LLFolderViewItem* LLIMFloaterContainer::createConversationItemWidget(LLConversat
return LLUICtrlFactory::create<LLFolderViewItem>(params);
}
-// Conversation items
-LLConversationItem::LLConversationItem(std::string name, const LLUUID& uuid, LLFloater* floaterp, LLIMFloaterContainer* containerp) :
- LLFolderViewModelItemCommon(containerp->getRootViewModel()),
- mName(name),
- mUUID(uuid),
- mFloater(floaterp),
- mContainer(containerp)
-{
-}
-
-LLConversationItem::LLConversationItem(LLIMFloaterContainer* containerp) :
- LLFolderViewModelItemCommon(containerp->getRootViewModel()),
- mName(""),
- mUUID(),
- mFloater(NULL),
- mContainer(NULL)
-{
-}
-
-
-// Virtual action callbacks
-void LLConversationItem::selectItem(void)
-{
- LLMultiFloater* host_floater = mFloater->getHost();
- if (host_floater == mContainer)
- {
- // Always expand the message pane if the panel is hosted by the container
- mContainer->collapseMessagesPane(false);
- // Switch to the conversation floater that is being selected
- mContainer->selectFloater(mFloater);
- }
- // Set the focus on the selected floater
- mFloater->setFocus(TRUE);
-}
-
-void LLConversationItem::setVisibleIfDetached(BOOL visible)
-{
- // Do this only if the conversation floater has been torn off (i.e. no multi floater host) and is not minimized
- // Note: minimized dockable floaters are brought to front hence unminimized when made visible and we don't want that here
- if (!mFloater->getHost() && !mFloater->isMinimized())
- {
- mFloater->setVisible(visible);
- }
-}
-
-void LLConversationItem::performAction(LLInventoryModel* model, std::string action)
-{
-}
-
-void LLConversationItem::openItem( void )
-{
-}
-
-void LLConversationItem::closeItem( void )
-{
-}
-
-void LLConversationItem::previewItem( void )
-{
-}
-
-void LLConversationItem::showProperties(void)
-{
-}
-
-bool LLConversationSort::operator()(const LLConversationItem* const& a, const LLConversationItem* const& b) const
-{
- // We compare only by name for the moment
- // *TODO : Implement the sorting by date
- S32 compare = LLStringUtil::compareDict(a->getDisplayName(), b->getDisplayName());
- return (compare < 0);
-}
-
// EOF
diff --git a/indra/newview/llimfloatercontainer.h b/indra/newview/llimfloatercontainer.h
index 5154b02dd6..161c6d9806 100644
--- a/indra/newview/llimfloatercontainer.h
+++ b/indra/newview/llimfloatercontainer.h
@@ -35,9 +35,7 @@
#include "llmultifloater.h"
#include "llavatarpropertiesprocessor.h"
#include "llgroupmgr.h"
-
-#include "llfolderviewitem.h"
-#include "llfolderviewmodel.h"
+#include "llconversationmodel.h"
class LLButton;
class LLLayoutPanel;
@@ -45,166 +43,6 @@ class LLLayoutStack;
class LLTabContainer;
class LLIMFloaterContainer;
-// CHUI-137 : Temporary implementation of conversations list
-class LLConversationItem;
-
-typedef std::map<LLFloater*, LLConversationItem*> conversations_items_map;
-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 LLFolderViewModelItemCommon
-{
-public:
- LLConversationItem(std::string name, const LLUUID& uuid, LLFloater* floaterp, LLIMFloaterContainer* containerp);
- LLConversationItem(LLIMFloaterContainer* containerp);
- 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 LLPointer<LLUIImage> getIcon() const { return NULL; }
- virtual LLPointer<LLUIImage> getOpenIcon() const { return getIcon(); }
- virtual LLFontGL::StyleFlags getLabelStyle() const { return LLFontGL::NORMAL; }
- virtual std::string getLabelSuffix() const { return LLStringUtil::null; }
- virtual BOOL isItemRenameable() const { return FALSE; }
- virtual BOOL renameItem(const std::string& new_name) { return FALSE; }
- virtual BOOL isItemMovable( void ) const { return FALSE; }
- virtual BOOL isItemRemovable( void ) const { return FALSE; }
- virtual BOOL isItemInTrash( void) const { return FALSE; }
- virtual BOOL removeItem() { return FALSE; }
- 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; }
- virtual BOOL isClipboardPasteable() const { return FALSE; }
- virtual void pasteFromClipboard() { }
- virtual void pasteLinkFromClipboard() { }
- virtual void buildContextMenu(LLMenuGL& menu, U32 flags) { }
- virtual BOOL isUpToDate() const { return TRUE; }
- virtual bool hasChildren() const { return FALSE; }
-
- virtual bool potentiallyVisible() { return true; }
- virtual bool filter( LLFolderViewFilter& filter) { return false; }
- virtual bool descendantsPassedFilter(S32 filter_generation = -1) { return true; }
- virtual void setPassedFilter(bool passed, S32 filter_generation, std::string::size_type string_offset = std::string::npos, std::string::size_type string_size = 0) { }
- virtual bool passedFilter(S32 filter_generation = -1) { return true; }
-
- // The action callbacks
- virtual void performAction(LLInventoryModel* model, std::string action);
- virtual void openItem( void );
- virtual void closeItem( void );
- virtual void previewItem( void );
- virtual void selectItem(void);
- virtual void showProperties(void);
-
- void setVisibleIfDetached(BOOL visible);
-
- // This method will be called to determine if a drop can be
- // performed, and will set drop to TRUE if a drop is
- // requested.
- // Returns TRUE if a drop is possible/happened, FALSE otherwise.
- virtual BOOL dragOrDrop(MASK mask, BOOL drop,
- EDragAndDropType cargo_type,
- void* cargo_data,
- std::string& tooltip_msg) { return FALSE; }
-
- bool hasSameValues(std::string name, const LLUUID& uuid) { return ((name == mName) && (uuid == mUUID)); }
- bool hasSameValue(const LLUUID& uuid) { return (uuid == mUUID); }
-private:
- std::string mName;
- const LLUUID mUUID;
- 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; }
- std::string::size_type getStringMatchOffset(LLFolderViewModelItem* item) const { return std::string::npos; }
- std::string::size_type getFilterStringSize() const { return 0; }
-
- 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
: public LLMultiFloater
, public LLIMSessionObserver