summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2012-09-07 19:53:38 -0700
committerMerov Linden <merov@lindenlab.com>2012-09-07 19:53:38 -0700
commitc26867bb6d1226c82c11f2f386f73b6d8e3ed749 (patch)
tree042ad887ccb5d794cb9539b27e543f8e12eaa0fb /indra/newview
parent26ae00acf7da222b9478fedcfe5746191116991a (diff)
CHUI-285 : Implement sort, alphabetical only for the moment
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llconversationmodel.cpp38
-rw-r--r--indra/newview/llconversationmodel.h15
-rw-r--r--indra/newview/llimfloatercontainer.cpp16
-rw-r--r--indra/newview/llimfloatercontainer.h2
-rw-r--r--indra/newview/llparticipantlist.cpp2
5 files changed, 47 insertions, 26 deletions
diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp
index fa49987d15..e810bac1d9 100644
--- a/indra/newview/llconversationmodel.cpp
+++ b/indra/newview/llconversationmodel.cpp
@@ -78,14 +78,6 @@ 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);
-}
-
//
// LLConversationItemSession
//
@@ -197,12 +189,38 @@ void LLConversationItemParticipant::onAvatarNameCache(const LLAvatarName& av_nam
{
mName = av_name.mDisplayName;
// *TODO : we should also store that one, to be used in the tooltip : av_name.mUsername
- // *TODO : we need to request or initiate a list resort
mNeedsRefresh = true;
+ if (mParent)
+ {
+ mParent->requestSort();
+ }
}
void LLConversationItemParticipant::dumpDebugData()
{
llinfos << "Merov debug : participant, uuid = " << mUUID << ", name = " << mName << ", muted = " << mIsMuted << ", moderator = " << mIsModerator << llendl;
-}
+}
+
+//
+// LLConversationSort
+//
+
+bool LLConversationSort::operator()(const LLConversationItem* const& a, const LLConversationItem* const& b) const
+{
+ // For the moment, we sort only by name
+ // *TODO : Implement the sorting by date as well (most recent first)
+ // *TODO : Check the type of item (session/participants) as order should be different for both (eventually)
+ S32 compare = LLStringUtil::compareDict(a->getDisplayName(), b->getDisplayName());
+ return (compare < 0);
+}
+
+//
+// LLConversationViewModel
+//
+
+void LLConversationViewModel::sort(LLFolderViewFolder* folder)
+{
+ base_t::sort(folder);
+}
+
// EOF
diff --git a/indra/newview/llconversationmodel.h b/indra/newview/llconversationmodel.h
index 26c7a29d76..2775bf8186 100644
--- a/indra/newview/llconversationmodel.h
+++ b/indra/newview/llconversationmodel.h
@@ -208,23 +208,14 @@ private:
class LLConversationSort
{
public:
- LLConversationSort(U32 order = 0)
- : mSortOrder(order),
- mByDate(false),
- mByName(false)
- {
- mByDate = (order & LLConversationFilter::SO_DATE);
- mByName = (order & LLConversationFilter::SO_NAME);
- }
+ LLConversationSort(U32 order = 0) : mSortOrder(order) { }
- bool isByDate() const { return mByDate; }
+ bool isByDate() const { return (mSortOrder & LLConversationFilter::SO_DATE); }
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
@@ -233,7 +224,7 @@ class LLConversationViewModel
public:
typedef LLFolderViewModel<LLConversationSort, LLConversationItem, LLConversationItem, LLConversationFilter> base_t;
- void sort(LLFolderViewFolder* folder) { } // *TODO : implement conversation sort
+ void sort(LLFolderViewFolder* folder);
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
diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp
index 56648d09b5..fa0750c39c 100644
--- a/indra/newview/llimfloatercontainer.cpp
+++ b/indra/newview/llimfloatercontainer.cpp
@@ -45,6 +45,7 @@
#include "lltransientfloatermgr.h"
#include "llviewercontrol.h"
#include "llconversationview.h"
+#include "llcallbacklist.h"
//
// LLIMFloaterContainer
@@ -65,6 +66,8 @@ LLIMFloaterContainer::LLIMFloaterContainer(const LLSD& seed)
LLIMFloaterContainer::~LLIMFloaterContainer()
{
+ gIdleCallbacks.deleteFunction(idle, this);
+
mNewMessageConnection.disconnect();
LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::IM, this);
@@ -139,6 +142,9 @@ BOOL LLIMFloaterContainer::postBuild()
LLAvatarNameCache::addUseDisplayNamesCallback(
boost::bind(&LLIMConversation::processChatHistoryStyleUpdate));
+ // Add callback: we'll take care of view updates on idle
+ gIdleCallbacks.addFunction(idle, this);
+
return TRUE;
}
@@ -290,6 +296,13 @@ void LLIMFloaterContainer::setMinimized(BOOL b)
}
}
+//static
+void LLIMFloaterContainer::idle(void* user_data)
+{
+ LLIMFloaterContainer* panel = (LLIMFloaterContainer*)user_data;
+ panel->mConversationsRoot->update();
+}
+
void LLIMFloaterContainer::draw()
{
// CHUI Notes
@@ -579,7 +592,7 @@ void LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid)
}
if (!item)
{
- llinfos << "Merov debug : Couldn't create conversation session item : " << display_name << llendl;
+ llwarns << "Couldn't create conversation session item : " << display_name << llendl;
return;
}
// *TODO: Should we flag LLConversationItemSession with a mIsNearbyChat?
@@ -602,7 +615,6 @@ void LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid)
// Note: usually, we do not get an updated avatar list at that point
LLFolderViewModelItemCommon::child_list_t::const_iterator current_participant_model = item->getChildrenBegin();
LLFolderViewModelItemCommon::child_list_t::const_iterator end_participant_model = item->getChildrenEnd();
- llinfos << "Merov debug : create participant, children size = " << item->getChildrenCount() << llendl;
while (current_participant_model != end_participant_model)
{
LLConversationItem* participant_model = dynamic_cast<LLConversationItem*>(*current_participant_model);
diff --git a/indra/newview/llimfloatercontainer.h b/indra/newview/llimfloatercontainer.h
index a72a3e2221..c4dd386d7c 100644
--- a/indra/newview/llimfloatercontainer.h
+++ b/indra/newview/llimfloatercontainer.h
@@ -75,6 +75,8 @@ public:
void collapseMessagesPane(bool collapse);
+ // Callbacks
+ static void idle(void* user_data);
// LLIMSessionObserver observe triggers
/*virtual*/ void sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id);
diff --git a/indra/newview/llparticipantlist.cpp b/indra/newview/llparticipantlist.cpp
index 2282734109..0d1a37c835 100644
--- a/indra/newview/llparticipantlist.cpp
+++ b/indra/newview/llparticipantlist.cpp
@@ -675,8 +675,6 @@ void LLParticipantList::addAvatarIDExceptAgent(const LLUUID& avatar_id)
// *TODO : Merov : need to update the online/offline status of the participant.
// Hack for this: LLAvatarTracker::instance().isBuddyOnline(avatar_id))
- llinfos << "Merov debug : added participant, name = " << participant->getName() << llendl;
-
// Add the participant model to the session's children list
addParticipant(participant);