Request: Allow filtering nonlinks or links in the custom inventory filter

This commit is contained in:
Lirusaito
2019-01-16 22:34:22 -05:00
parent dcc8013028
commit bba6ecba65
3 changed files with 26 additions and 1 deletions

View File

@@ -917,6 +917,7 @@ void LLInventoryFilter::toLLSD(LLSD& data) const
data["substring"] = (LLSD::String)getFilterSubString();
data["sort_order"] = (LLSD::Integer)getSortOrder();
data["since_logoff"] = (LLSD::Boolean)isSinceLogoff();
data["filter_links"] = (LLSD::Integer)getFilterLinks();
}
void LLInventoryFilter::fromLLSD(LLSD& data)
@@ -960,6 +961,11 @@ void LLInventoryFilter::fromLLSD(LLSD& data)
{
setDateRangeLastLogoff((bool)data["since_logoff"].asBoolean());
}
if (data.has("filter_links"))
{
setFilterLinks(data["filter_links"].asInteger());
}
}
U64 LLInventoryFilter::getFilterTypes() const

View File

@@ -72,6 +72,7 @@ public:
BOOL getCheckShowEmpty();
BOOL getCheckSinceLogoff();
void onLinks(const LLSD& val);
static void onTimeAgo(LLUICtrl*, void *);
static void onCloseBtn(void* user_data);
static void selectAllTypes(void* user_data);
@@ -81,6 +82,7 @@ protected:
LLPanelMainInventory* mPanelMainInventory;
LLSpinCtrl* mSpinSinceDays;
LLSpinCtrl* mSpinSinceHours;
LLUICtrl* mRadioLinks;
LLInventoryFilter* mFilter;
};
@@ -918,12 +920,21 @@ BOOL LLFloaterInventoryFinder::postBuild()
mSpinSinceDays = getChild<LLSpinCtrl>("spin_days_ago");
childSetCommitCallback("spin_days_ago", onTimeAgo, this);
mRadioLinks = getChild<LLUICtrl>("radio_links");
mRadioLinks->setCommitCallback(std::bind(&LLFloaterInventoryFinder::onLinks, this, std::placeholders::_2));
childSetAction("Close", onCloseBtn, this);
updateElementsFromFilter();
return TRUE;
}
void LLFloaterInventoryFinder::onLinks(const LLSD& val)
{
auto value = val.asInteger();
mFilter->setFilterLinks(value == 0 ? LLInventoryFilter::FILTERLINK_INCLUDE_LINKS : value == 1 ? LLInventoryFilter::FILTERLINK_EXCLUDE_LINKS : LLInventoryFilter::FILTERLINK_ONLY_LINKS);
}
void LLFloaterInventoryFinder::onTimeAgo(LLUICtrl *ctrl, void *user_data)
{
LLFloaterInventoryFinder *self = (LLFloaterInventoryFinder *)user_data;
@@ -995,6 +1006,8 @@ void LLFloaterInventoryFinder::updateElementsFromFilter()
getChild<LLUICtrl>("check_since_logoff")->setValue(mFilter->isSinceLogoff());
mSpinSinceHours->set((F32)(hours % 24));
mSpinSinceDays->set((F32)(hours / 24));
auto value = mFilter->getFilterLinks();
mRadioLinks->setValue(value == LLInventoryFilter::FILTERLINK_INCLUDE_LINKS ? 0 : value == LLInventoryFilter::FILTERLINK_EXCLUDE_LINKS ? 1 : 2);
}
void LLFloaterInventoryFinder::draw()

View File

@@ -76,6 +76,12 @@
<button bottom_delta="-24" enabled="true" follows="left|top" font="SansSerif"
halign="center" height="20" label="None" label_selected="None" left="8"
mouse_opaque="true" name="None" scale_image="true" width="100" />
<text bottom_delta="-16" left="3" follows="left|top" value="Links: "/>
<radio_group bottom_delta="-6" left_delta="27" follows="left|top" height="16" draw_border="false" name="radio_links">
<radio_item bottom_delta="-8" name="Any" label="Any" value="0"/>
<radio_item bottom_delta="0" left_delta="19" name="Only" label="Only" value="2"/>
<radio_item bottom_delta="0" left_delta="21" name="None" label="None" value="1"/>
</radio_group>
<check_box bottom_delta="-20" enabled="true" follows="left|top" font="SansSerifSmall"
height="16" initial_value="false" label="Always show folders" left="8"
mouse_opaque="true" name="check_show_empty" radio_style="false" width="144" />
@@ -96,7 +102,7 @@
<spinner bottom_delta="-20" enabled="true" follows="left|top" height="16" increment="1"
initial_val="0" label="Days Ago" label_width="64" left="8" max_val="10000"
min_val="0" mouse_opaque="true" name="spin_days_ago" width="144" />
<button bottom_delta="-24" enabled="true" follows="top|right" font="SansSerif"
<button bottom_delta="-24" enabled="true" visible="false" follows="top|right" font="SansSerif"
halign="center" height="20" label="Close" label_selected="Close"
mouse_opaque="true" name="Close" right="-6" scale_image="true" width="76" />
</floater>