summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llui/llscrolllistcell.cpp23
-rw-r--r--indra/llui/llscrolllistcell.h7
-rw-r--r--indra/llui/llscrolllistctrl.cpp18
-rw-r--r--indra/llui/llscrolllistctrl.h4
-rw-r--r--indra/llui/llscrolllistitem.cpp3
-rw-r--r--indra/llui/llscrolllistitem.h4
-rw-r--r--indra/newview/llfloaterland.cpp5
-rw-r--r--indra/newview/llnamelistctrl.cpp1
8 files changed, 58 insertions, 7 deletions
diff --git a/indra/llui/llscrolllistcell.cpp b/indra/llui/llscrolllistcell.cpp
index 13839da400..8dd552d2ad 100644
--- a/indra/llui/llscrolllistcell.cpp
+++ b/indra/llui/llscrolllistcell.cpp
@@ -79,6 +79,14 @@ const LLSD LLScrollListCell::getValue() const
return LLStringUtil::null;
}
+
+// virtual
+const LLSD LLScrollListCell::getAltValue() const
+{
+ return LLStringUtil::null;
+}
+
+
//
// LLScrollListIcon
//
@@ -173,6 +181,7 @@ U32 LLScrollListText::sCount = 0;
LLScrollListText::LLScrollListText(const LLScrollListCell::Params& p)
: LLScrollListCell(p),
mText(p.label.isProvided() ? p.label() : p.value().asString()),
+ mAltText(p.alt_value().asString()),
mFont(p.font),
mColor(p.color),
mUseColor(p.color.isProvided()),
@@ -275,10 +284,22 @@ void LLScrollListText::setValue(const LLSD& text)
setText(text.asString());
}
+//virtual
+void LLScrollListText::setAltValue(const LLSD& text)
+{
+ mAltText = text.asString();
+}
+
//virtual
const LLSD LLScrollListText::getValue() const
{
- return LLSD(mText.getString());
+ return LLSD(mText.getString());
+}
+
+//virtual
+const LLSD LLScrollListText::getAltValue() const
+{
+ return LLSD(mAltText.getString());
}
diff --git a/indra/llui/llscrolllistcell.h b/indra/llui/llscrolllistcell.h
index 19576fb247..ede8d847d9 100644
--- a/indra/llui/llscrolllistcell.h
+++ b/indra/llui/llscrolllistcell.h
@@ -60,6 +60,7 @@ public:
Optional<void*> userdata;
Optional<LLSD> value; // state of checkbox, icon id/name, date
+ Optional<LLSD> alt_value;
Optional<std::string> label; // description or text
Optional<std::string> tool_tip;
@@ -76,6 +77,7 @@ public:
enabled("enabled", true),
visible("visible", true),
value("value"),
+ alt_value("alt_value", ""),
label("label"),
tool_tip("tool_tip", ""),
font("font", LLFontGL::getFontSansSerifSmall()),
@@ -98,7 +100,9 @@ public:
virtual S32 getContentWidth() const { return 0; }
virtual S32 getHeight() const { return 0; }
virtual const LLSD getValue() const;
+ virtual const LLSD getAltValue() const;
virtual void setValue(const LLSD& value) { }
+ virtual void setAltValue(const LLSD& value) { }
virtual const std::string &getToolTip() const { return mToolTip; }
virtual void setToolTip(const std::string &str) { mToolTip = str; }
virtual BOOL getVisible() const { return TRUE; }
@@ -138,7 +142,9 @@ public:
/*virtual*/ S32 getContentWidth() const;
/*virtual*/ S32 getHeight() const;
/*virtual*/ void setValue(const LLSD& value);
+ /*virtual*/ void setAltValue(const LLSD& value);
/*virtual*/ const LLSD getValue() const;
+ /*virtual*/ const LLSD getAltValue() const;
/*virtual*/ BOOL getVisible() const;
/*virtual*/ void highlightText(S32 offset, S32 num_chars);
@@ -156,6 +162,7 @@ public:
protected:
LLUIString mText;
+ LLUIString mAltText;
S32 mTextWidth;
const LLFontGL* mFont;
LLColor4 mColor;
diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp
index be85f1cb6a..1059190712 100644
--- a/indra/llui/llscrolllistctrl.cpp
+++ b/indra/llui/llscrolllistctrl.cpp
@@ -66,9 +66,10 @@ static LLDefaultChildRegistry::Register<LLScrollListCtrl> r("scroll_list");
// local structures & classes.
struct SortScrollListItem
{
- SortScrollListItem(const std::vector<std::pair<S32, BOOL> >& sort_orders,const LLScrollListCtrl::sort_signal_t* sort_signal)
+ SortScrollListItem(const std::vector<std::pair<S32, BOOL> >& sort_orders,const LLScrollListCtrl::sort_signal_t* sort_signal, bool alternate_sort)
: mSortOrders(sort_orders)
, mSortSignal(sort_signal)
+ , mAltSort(alternate_sort)
{}
bool operator()(const LLScrollListItem* i1, const LLScrollListItem* i2)
@@ -93,7 +94,14 @@ struct SortScrollListItem
}
else
{
- sort_result = order * LLStringUtil::compareDict(cell1->getValue().asString(), cell2->getValue().asString());
+ if (mAltSort && !cell1->getAltValue().asString().empty() && !cell2->getAltValue().asString().empty())
+ {
+ sort_result = order * LLStringUtil::compareDict(cell1->getAltValue().asString(), cell2->getAltValue().asString());
+ }
+ else
+ {
+ sort_result = order * LLStringUtil::compareDict(cell1->getValue().asString(), cell2->getValue().asString());
+ }
}
if (sort_result != 0)
{
@@ -109,6 +117,7 @@ struct SortScrollListItem
typedef std::vector<std::pair<S32, BOOL> > sort_order_t;
const LLScrollListCtrl::sort_signal_t* mSortSignal;
const sort_order_t& mSortOrders;
+ const bool mAltSort;
};
//---------------------------------------------------------------------------
@@ -213,6 +222,7 @@ LLScrollListCtrl::LLScrollListCtrl(const LLScrollListCtrl::Params& p)
mSearchColumn(p.search_column),
mColumnPadding(p.column_padding),
mRowPadding(p.row_padding),
+ mAlternateSort(false),
mContextMenuType(MENU_NONE),
mIsFriendSignal(NULL)
{
@@ -2680,7 +2690,7 @@ void LLScrollListCtrl::updateSort() const
std::stable_sort(
mItemList.begin(),
mItemList.end(),
- SortScrollListItem(mSortColumns,mSortCallback));
+ SortScrollListItem(mSortColumns,mSortCallback, mAlternateSort));
mSorted = true;
}
@@ -2696,7 +2706,7 @@ void LLScrollListCtrl::sortOnce(S32 column, BOOL ascending)
std::stable_sort(
mItemList.begin(),
mItemList.end(),
- SortScrollListItem(sort_column,mSortCallback));
+ SortScrollListItem(sort_column,mSortCallback,mAlternateSort));
}
void LLScrollListCtrl::dirtyColumns()
diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h
index 0cc481b113..08134bbfc8 100644
--- a/indra/llui/llscrolllistctrl.h
+++ b/indra/llui/llscrolllistctrl.h
@@ -398,6 +398,8 @@ public:
BOOL hasSortOrder() const;
void clearSortOrder();
+ void setAlternateSort() { mAlternateSort = true; }
+
S32 selectMultiple( uuid_vec_t ids );
// conceptually const, but mutates mItemList
void updateSort() const;
@@ -482,6 +484,8 @@ private:
bool mColumnsDirty;
bool mColumnWidthsDirty;
+ bool mAlternateSort;
+
mutable item_list mItemList;
LLScrollListItem *mLastSelected;
diff --git a/indra/llui/llscrolllistitem.cpp b/indra/llui/llscrolllistitem.cpp
index 51c615dd00..e1360f80cd 100644
--- a/indra/llui/llscrolllistitem.cpp
+++ b/indra/llui/llscrolllistitem.cpp
@@ -44,7 +44,8 @@ LLScrollListItem::LLScrollListItem( const Params& p )
mSelectedIndex(-1),
mEnabled(p.enabled),
mUserdata(p.userdata),
- mItemValue(p.value)
+ mItemValue(p.value),
+ mItemAltValue(p.alt_value)
{
}
diff --git a/indra/llui/llscrolllistitem.h b/indra/llui/llscrolllistitem.h
index d2c3dd7721..a3398305b1 100644
--- a/indra/llui/llscrolllistitem.h
+++ b/indra/llui/llscrolllistitem.h
@@ -55,6 +55,7 @@ public:
Optional<bool> enabled;
Optional<void*> userdata;
Optional<LLSD> value;
+ Optional<LLSD> alt_value;
Ignored name; // use for localization tools
Ignored type;
@@ -65,6 +66,7 @@ public:
Params()
: enabled("enabled", true),
value("value"),
+ alt_value("alt_value"),
name("name"),
type("type"),
length("length"),
@@ -97,6 +99,7 @@ public:
virtual LLUUID getUUID() const { return mItemValue.asUUID(); }
LLSD getValue() const { return mItemValue; }
+ LLSD getAltValue() const { return mItemAltValue; }
void setRect(LLRect rect) { mRectangle = rect; }
LLRect getRect() const { return mRectangle; }
@@ -131,6 +134,7 @@ private:
BOOL mEnabled;
void* mUserdata;
LLSD mItemValue;
+ LLSD mItemAltValue;
std::vector<LLScrollListCell *> mColumns;
LLRect mRectangle;
};
diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp
index af0e56e448..04133f2710 100644
--- a/indra/newview/llfloaterland.cpp
+++ b/indra/newview/llfloaterland.cpp
@@ -2468,6 +2468,7 @@ BOOL LLPanelLandAccess::postBuild()
{
mListBanned->sortByColumnIndex(0, TRUE); // ascending
mListBanned->setContextMenu(LLScrollListCtrl::MENU_AVATAR);
+ mListBanned->setAlternateSort();
}
return TRUE;
@@ -2570,11 +2571,12 @@ void LLPanelLandAccess::refresh()
{
const LLAccessEntry& entry = (*cit).second;
std::string duration;
+ S32 seconds = -1;
if (entry.mTime != 0)
{
LLStringUtil::format_map_t args;
S32 now = time(NULL);
- S32 seconds = entry.mTime - now;
+ seconds = entry.mTime - now;
if (seconds < 0) seconds = 0;
if (seconds >= 7200)
@@ -2611,6 +2613,7 @@ void LLPanelLandAccess::refresh()
columns[0]["column"] = "name"; // to be populated later
columns[1]["column"] = "duration";
columns[1]["value"] = duration;
+ columns[1]["alt_value"] = entry.mTime != 0 ? std::to_string(seconds) : "Always";
mListBanned->addElement(item);
}
mListBanned->sortByName(TRUE);
diff --git a/indra/newview/llnamelistctrl.cpp b/indra/newview/llnamelistctrl.cpp
index 3209d23e43..5215126789 100644
--- a/indra/newview/llnamelistctrl.cpp
+++ b/indra/newview/llnamelistctrl.cpp
@@ -398,6 +398,7 @@ LLScrollListItem* LLNameListCtrl::addNameItemRow(
if (cell)
{
cell->setValue(prefix + fullname);
+ cell->setAltValue(name_item.alt_value());
}
dirtyColumns();