summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorGilbert Gonzales <gilbert@lindenlab.com>2012-09-17 10:54:02 -0700
committerGilbert Gonzales <gilbert@lindenlab.com>2012-09-17 10:54:02 -0700
commit0196ac131a409991adec862b67c93d658f4537ce (patch)
tree8c2cf08c14e8cb7b4e782cb068f5d1e3bd542b69 /indra/newview
parent0f86aa86f1780f70f125254d2108a33fcd9a7514 (diff)
parent9b0d627a06a817fc11edc4c6c718f1114aa7cfcf (diff)
merging in latest changes
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/app_settings/settings.xml11
-rwxr-xr-xindra/newview/llconversationmodel.h23
-rwxr-xr-xindra/newview/llimfloatercontainer.cpp91
-rw-r--r--indra/newview/llimfloatercontainer.h4
-rw-r--r--indra/newview/skins/default/xui/en/menu_participant_view.xml70
5 files changed, 191 insertions, 8 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 593381cb29..9ada5e5918 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -1683,6 +1683,17 @@
<key>Value</key>
<integer>100</integer>
</map>
+ <key>ConversationSortOrder</key>
+ <map>
+ <key>Comment</key>
+ <string>Specifies sort key for conversations</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>U32</string>
+ <key>Value</key>
+ <integer>131073</integer>
+ </map>
<key>NearbyChatIsNotTornOff</key>
<map>
<key>Comment</key>
diff --git a/indra/newview/llconversationmodel.h b/indra/newview/llconversationmodel.h
index c340194dd3..ef1903ab19 100755
--- a/indra/newview/llconversationmodel.h
+++ b/indra/newview/llconversationmodel.h
@@ -170,10 +170,14 @@ public:
enum ESortOrderType
{
- SO_NAME = 0, // Sort inventory by name
- SO_DATE = 0x1, // Sort inventory by date
+ SO_NAME = 0, // Sort by name
+ SO_DATE = 0x1, // Sort by date (most recent)
+ SO_SESSION_TYPE = 0x2, // Sort by type (valid only for sessions)
+ SO_DISTANCE = 0x3, // Sort by distance (valid only for participants in nearby chat)
};
-
+ // Default sort order is by type for sessions and by date for participants
+ static const U32 SO_DEFAULT = (SO_SESSION_TYPE << 16) | (SO_DATE);
+
LLConversationFilter() { mEmpty = ""; }
~LLConversationFilter() {}
@@ -211,13 +215,18 @@ private:
class LLConversationSort
{
public:
- LLConversationSort(U32 order = 0) : mSortOrder(order) { }
-
- bool isByDate() const { return (mSortOrder & LLConversationFilter::SO_DATE); }
- U32 getSortOrder() const { return mSortOrder; }
+ LLConversationSort(U32 order = LLConversationFilter::SO_DEFAULT) : mSortOrder(order) { }
+ // 16 LSB bits used for participants, 16 MSB bits for sessions
+ U32 getSortOrderSessions() const { return ((mSortOrder >> 16) & 0xFFFF); }
+ U32 getSortOrderParticipants() const { return (mSortOrder & 0xFFFF); }
+ void setSortOrderSessions(LLConversationFilter::ESortOrderType session) { mSortOrder = ((session & 0xFFFF) << 16) | (mSortOrder & 0xFFFF); }
+ void setSortOrderParticipants(LLConversationFilter::ESortOrderType participant) { mSortOrder = (mSortOrder & 0xFFFF0000) | (participant & 0xFFFF); }
+
bool operator()(const LLConversationItem* const& a, const LLConversationItem* const& b) const;
+ operator U32() const { return mSortOrder; }
private:
+ // Note: we're treating this value as a sort order bitmask as done in other places in the code (e.g. inventory)
U32 mSortOrder;
};
diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp
index 5aaf176aca..db0d760e3f 100755
--- a/indra/newview/llimfloatercontainer.cpp
+++ b/indra/newview/llimfloatercontainer.cpp
@@ -58,6 +58,7 @@ LLIMFloaterContainer::LLIMFloaterContainer(const LLSD& seed)
mInitialized(false)
{
mCommitCallbackRegistrar.add("IMFloaterContainer.Action", boost::bind(&LLIMFloaterContainer::onCustomAction, this, _2));
+ mEnableCallbackRegistrar.add("IMFloaterContainer.Check", boost::bind(&LLIMFloaterContainer::isActionChecked, this, _2));
// Firstly add our self to IMSession observers, so we catch session events
LLIMMgr::getInstance()->addSessionObserver(this);
@@ -169,6 +170,9 @@ BOOL LLIMFloaterContainer::postBuild()
mConversationsPane->handleReshape(list_size, TRUE);
}
+ // Init the sort order now that the root had been created
+ setSortOrder(LLConversationSort(gSavedSettings.getU32("ConversationSortOrder")));
+
mInitialized = true;
// Add callback: we'll take care of view updates on idle
@@ -546,6 +550,30 @@ void LLIMFloaterContainer::onCustomAction(const LLSD& userdata)
{
std::string command = userdata.asString();
+ if ("sort_sessions_by_type" == command)
+ {
+ setSortOrderSessions(LLConversationFilter::SO_SESSION_TYPE);
+ }
+ if ("sort_sessions_by_name" == command)
+ {
+ setSortOrderSessions(LLConversationFilter::SO_NAME);
+ }
+ if ("sort_sessions_by_recent" == command)
+ {
+ setSortOrderSessions(LLConversationFilter::SO_DATE);
+ }
+ if ("sort_participants_by_name" == command)
+ {
+ setSortOrderParticipants(LLConversationFilter::SO_NAME);
+ }
+ if ("sort_participants_by_recent" == command)
+ {
+ setSortOrderParticipants(LLConversationFilter::SO_DATE);
+ }
+ if ("sort_participants_by_distance" == command)
+ {
+ setSortOrderParticipants(LLConversationFilter::SO_DISTANCE);
+ }
if ("chat_preferences" == command)
{
LLFloaterPreference* floater_prefs = LLFloaterReg::showTypedInstance<LLFloaterPreference>("preferences");
@@ -561,6 +589,67 @@ void LLIMFloaterContainer::onCustomAction(const LLSD& userdata)
}
}
+BOOL LLIMFloaterContainer::isActionChecked(const LLSD& userdata)
+{
+ LLConversationSort order = mConversationViewModel.getSorter();
+ std::string command = userdata.asString();
+ if ("sort_sessions_by_type" == command)
+ {
+ return (order.getSortOrderSessions() == LLConversationFilter::SO_SESSION_TYPE);
+ }
+ if ("sort_sessions_by_name" == command)
+ {
+ return (order.getSortOrderSessions() == LLConversationFilter::SO_NAME);
+ }
+ if ("sort_sessions_by_recent" == command)
+ {
+ return (order.getSortOrderSessions() == LLConversationFilter::SO_DATE);
+ }
+ if ("sort_participants_by_name" == command)
+ {
+ return (order.getSortOrderParticipants() == LLConversationFilter::SO_NAME);
+ }
+ if ("sort_participants_by_recent" == command)
+ {
+ return (order.getSortOrderParticipants() == LLConversationFilter::SO_DATE);
+ }
+ if ("sort_participants_by_distance" == command)
+ {
+ return (order.getSortOrderParticipants() == LLConversationFilter::SO_DISTANCE);
+ }
+
+ return FALSE;
+}
+
+void LLIMFloaterContainer::setSortOrderSessions(const LLConversationFilter::ESortOrderType order)
+{
+ LLConversationSort old_order = mConversationViewModel.getSorter();
+ if (order != old_order.getSortOrderSessions())
+ {
+ old_order.setSortOrderSessions(order);
+ setSortOrder(old_order);
+ }
+}
+
+void LLIMFloaterContainer::setSortOrderParticipants(const LLConversationFilter::ESortOrderType order)
+{
+ LLConversationSort old_order = mConversationViewModel.getSorter();
+ if (order != old_order.getSortOrderParticipants())
+ {
+ old_order.setSortOrderParticipants(order);
+ setSortOrder(old_order);
+ }
+}
+
+void LLIMFloaterContainer::setSortOrder(const LLConversationSort& order)
+{
+ mConversationViewModel.setSorter(order);
+ mConversationsRoot->arrangeAll();
+ // try to keep selection onscreen, even if it wasn't to start with
+ mConversationsRoot->scrollToShowSelection();
+ gSavedSettings.setU32("ConversationSortOrder", (U32)order);
+}
+
void LLIMFloaterContainer::repositioningWidgets()
{
if (!mInitialized)
@@ -736,7 +825,7 @@ LLConversationViewParticipant* LLIMFloaterContainer::createConversationViewParti
params.root = mConversationsRoot;
params.listener = item;
- //16 and panel_rect.getWidth() are used since that is currently the values used in repositioningWidgets()
+ //24 is the the current hight of an item (itemHeight) loaded from conversation_view_participant.xml.
params.rect = LLRect (0, 24, panel_rect.getWidth(), 0);
params.tool_tip = params.name;
params.participant_id = item->getUUID();
diff --git a/indra/newview/llimfloatercontainer.h b/indra/newview/llimfloatercontainer.h
index f6048bed37..1f526091bb 100644
--- a/indra/newview/llimfloatercontainer.h
+++ b/indra/newview/llimfloatercontainer.h
@@ -105,7 +105,11 @@ private:
void onAddButtonClicked();
void onAvatarPicked(const uuid_vec_t& ids);
+ BOOL isActionChecked(const LLSD& userdata);
void onCustomAction (const LLSD& userdata);
+ void setSortOrderSessions(const LLConversationFilter::ESortOrderType order);
+ void setSortOrderParticipants(const LLConversationFilter::ESortOrderType order);
+ void setSortOrder(const LLConversationSort& order);
LLButton* mExpandCollapseBtn;
LLLayoutPanel* mMessagesPane;
diff --git a/indra/newview/skins/default/xui/en/menu_participant_view.xml b/indra/newview/skins/default/xui/en/menu_participant_view.xml
index df2700c94c..0043c14479 100644
--- a/indra/newview/skins/default/xui/en/menu_participant_view.xml
+++ b/indra/newview/skins/default/xui/en/menu_participant_view.xml
@@ -2,6 +2,76 @@
<toggleable_menu
layout="topleft"
name="participant_manu_view">
+ <menu_item_check
+ label="Sort conversations by type"
+ layout="topleft"
+ name="sort_sessions_by_type">
+ <on_click
+ function="IMFloaterContainer.Action"
+ parameter="sort_sessions_by_type" />
+ <on_check
+ function="IMFloaterContainer.Check"
+ parameter="sort_sessions_by_type" />
+ </menu_item_check>
+ <menu_item_check
+ label="Sort conversations by name"
+ layout="topleft"
+ name="sort_sessions_by_name">
+ <on_click
+ function="IMFloaterContainer.Action"
+ parameter="sort_sessions_by_name" />
+ <on_check
+ function="IMFloaterContainer.Check"
+ parameter="sort_sessions_by_name" />
+ </menu_item_check>
+ <menu_item_check
+ label="Sort conversations by recent activity"
+ layout="topleft"
+ name="sort_sessions_by_recent">
+ <on_click
+ function="IMFloaterContainer.Action"
+ parameter="sort_sessions_by_recent" />
+ <on_check
+ function="IMFloaterContainer.Check"
+ parameter="sort_sessions_by_recent" />
+ </menu_item_check>
+ <menu_item_separator
+ layout="topleft" />
+ <menu_item_check
+ label="Sort participants by name"
+ layout="topleft"
+ name="sort_participants_by_name">
+ <on_click
+ function="IMFloaterContainer.Action"
+ parameter="sort_participants_by_name" />
+ <on_check
+ function="IMFloaterContainer.Check"
+ parameter="sort_participants_by_name" />
+ </menu_item_check>
+ <menu_item_check
+ label="Sort participants by recent activity"
+ layout="topleft"
+ name="sort_participants_by_recent">
+ <on_click
+ function="IMFloaterContainer.Action"
+ parameter="sort_participants_by_recent" />
+ <on_check
+ function="IMFloaterContainer.Check"
+ parameter="sort_participants_by_recent" />
+ </menu_item_check>
+ <menu_item_check
+ label="Sort participants by distance from you"
+ layout="topleft"
+ name="sort_participants_by_distance">
+ <on_click
+ function="IMFloaterContainer.Action"
+ parameter="sort_participants_by_distance" />
+ <on_check
+ function="IMFloaterContainer.Check"
+ parameter="sort_participants_by_distance" />
+ </menu_item_check>
+ <menu_item_separator
+ layout="topleft" />
<menu_item_call
label="Chat preferences..."
name="chat_preferences">