diff options
author | Oz Linden <oz@lindenlab.com> | 2014-07-21 10:00:09 -0400 |
---|---|---|
committer | Oz Linden <oz@lindenlab.com> | 2014-07-21 10:00:09 -0400 |
commit | 8192a3c5b2addd63e1d5c12269eec7e6de2adde0 (patch) | |
tree | e0db7750e6e14b122e183d0bca5a1ab2047353a2 /indra | |
parent | f4783697812428e3c0f4c5fba4ed91a6d19d8b34 (diff) | |
parent | e2c4d2a0a10e1f69bb074e3be620ce3ecd613969 (diff) |
merge changes for STORM-2034
Diffstat (limited to 'indra')
-rwxr-xr-x | indra/newview/llinventoryfilter.cpp | 51 | ||||
-rwxr-xr-x | indra/newview/llinventoryfilter.h | 13 | ||||
-rwxr-xr-x | indra/newview/llinventorypanel.cpp | 5 | ||||
-rwxr-xr-x | indra/newview/llinventorypanel.h | 1 | ||||
-rwxr-xr-x | indra/newview/llpanelmaininventory.cpp | 43 | ||||
-rwxr-xr-x | indra/newview/skins/default/xui/en/floater_inventory_view_finder.xml | 96 | ||||
-rwxr-xr-x | indra/newview/skins/default/xui/en/menu_inventory_gear_default.xml | 2 |
7 files changed, 177 insertions, 34 deletions
diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp index 000eee3317..0bbb4aeeff 100755 --- a/indra/newview/llinventoryfilter.cpp +++ b/indra/newview/llinventoryfilter.cpp @@ -37,6 +37,7 @@ #include "llfolderview.h" #include "llinventorybridge.h" #include "llviewerfoldertype.h" +#include "llradiogroup.h" // linden library includes #include "llclipboard.h" @@ -51,6 +52,7 @@ LLInventoryFilter::FilterOps::FilterOps(const Params& p) mMinDate(p.date_range.min_date), mMaxDate(p.date_range.max_date), mHoursAgo(p.hours_ago), + mDateSearchDirection(p.date_search_direction), mShowFolderState(p.show_folder_state), mPermissions(p.permissions), mFilterTypes(p.types), @@ -209,6 +211,7 @@ bool LLInventoryFilter::checkAgainstFilterType(const LLFolderViewModelItemInvent { const U16 HOURS_TO_SECONDS = 3600; time_t earliest = time_corrected() - mFilterOps.mHoursAgo * HOURS_TO_SECONDS; + if (mFilterOps.mMinDate > time_min() && mFilterOps.mMinDate < earliest) { earliest = mFilterOps.mMinDate; @@ -217,9 +220,19 @@ bool LLInventoryFilter::checkAgainstFilterType(const LLFolderViewModelItemInvent { earliest = 0; } - if (listener->getCreationDate() < earliest || - listener->getCreationDate() > mFilterOps.mMaxDate) - return FALSE; + + if (FILTERDATEDIRECTION_NEWER == mFilterOps.mDateSearchDirection || isSinceLogoff()) + { + if (listener->getCreationDate() < earliest || + listener->getCreationDate() > mFilterOps.mMaxDate) + return FALSE; + } + else + { + if (listener->getCreationDate() > earliest || + listener->getCreationDate() > mFilterOps.mMaxDate) + return FALSE; + } } //////////////////////////////////////////////////////////////////////////////// @@ -629,11 +642,22 @@ void LLInventoryFilter::setHoursAgo(U32 hours) bool are_date_limits_valid = mFilterOps.mMinDate == time_min() && mFilterOps.mMaxDate == time_max(); bool is_increasing = hours > mFilterOps.mHoursAgo; + bool is_decreasing = hours < mFilterOps.mHoursAgo; bool is_increasing_from_zero = is_increasing && !mFilterOps.mHoursAgo && !isSinceLogoff(); // *NOTE: need to cache last filter time, in case filter goes stale - BOOL less_restrictive = (are_date_limits_valid && ((is_increasing && mFilterOps.mHoursAgo)) || !hours); - BOOL more_restrictive = (are_date_limits_valid && (!is_increasing && hours) || is_increasing_from_zero); + BOOL less_restrictive; + BOOL more_restrictive; + if (FILTERDATEDIRECTION_NEWER == mFilterOps.mDateSearchDirection) + { + less_restrictive = (are_date_limits_valid && ((is_increasing && mFilterOps.mHoursAgo)) || !hours); + more_restrictive = (are_date_limits_valid && (!is_increasing && hours) || is_increasing_from_zero); + } + else + { + less_restrictive = (are_date_limits_valid && ((is_decreasing && mFilterOps.mHoursAgo)) || !hours); + more_restrictive = (are_date_limits_valid && (!is_decreasing && hours) || is_increasing_from_zero); + } mFilterOps.mHoursAgo = hours; mFilterOps.mMinDate = time_min(); @@ -662,6 +686,20 @@ void LLInventoryFilter::setHoursAgo(U32 hours) } } +void LLInventoryFilter::setDateSearchDirection(U32 direction) +{ + if (direction != mFilterOps.mDateSearchDirection) + { + mFilterOps.mDateSearchDirection = direction; + setModified(FILTER_RESTART); + } +} + +U32 LLInventoryFilter::getDateSearchDirection() const +{ + return mFilterOps.mDateSearchDirection; +} + void LLInventoryFilter::setFilterLinks(U64 filter_links) { if (mFilterOps.mFilterLinks != filter_links) @@ -926,6 +964,7 @@ LLInventoryFilter& LLInventoryFilter::operator=( const LLInventoryFilter& othe setFilterObjectTypes(other.getFilterObjectTypes()); setDateRange(other.getMinDate(), other.getMaxDate()); setHoursAgo(other.getHoursAgo()); + setDateSearchDirection(other.getDateSearchDirection()); setShowFolderState(other.getShowFolderState()); setFilterPermissions(other.getFilterPermissions()); setFilterSubString(other.getFilterSubString()); @@ -945,6 +984,7 @@ void LLInventoryFilter::toParams(Params& params) const params.filter_ops.date_range.min_date = getMinDate(); params.filter_ops.date_range.max_date = getMaxDate(); params.filter_ops.hours_ago = getHoursAgo(); + params.filter_ops.date_search_direction = getDateSearchDirection(); params.filter_ops.show_folder_state = getShowFolderState(); params.filter_ops.permissions = getFilterPermissions(); params.substring = getFilterSubString(); @@ -966,6 +1006,7 @@ void LLInventoryFilter::fromParams(const Params& params) } setDateRange(params.filter_ops.date_range.min_date, params.filter_ops.date_range.max_date); setHoursAgo(params.filter_ops.hours_ago); + setDateSearchDirection(params.filter_ops.date_search_direction); setShowFolderState(params.filter_ops.show_folder_state); setFilterPermissions(params.filter_ops.permissions); setFilterSubString(params.substring); diff --git a/indra/newview/llinventoryfilter.h b/indra/newview/llinventoryfilter.h index ce516af0b9..0d3d3889cb 100755 --- a/indra/newview/llinventoryfilter.h +++ b/indra/newview/llinventoryfilter.h @@ -55,6 +55,12 @@ public: FILTERTYPE_EMPTYFOLDERS = 0x1 << 5 // pass if folder is not a system folder to be hidden if }; + enum EFilterDateDirection + { + FILTERDATEDIRECTION_NEWER, + FILTERDATEDIRECTION_OLDER + }; + enum EFilterLink { FILTERLINK_INCLUDE_LINKS, // show links too @@ -94,7 +100,8 @@ public: Optional<EFilterLink> links; Optional<LLUUID> uuid; Optional<DateRange> date_range; - Optional<S32> hours_ago; + Optional<U32> hours_ago; + Optional<U32> date_search_direction; Optional<EFolderShow> show_folder_state; Optional<PermissionMask> permissions; @@ -107,6 +114,7 @@ public: uuid("uuid"), date_range("date_range"), hours_ago("hours_ago", 0), + date_search_direction("date_search_direction", FILTERDATEDIRECTION_NEWER), show_folder_state("show_folder_state", SHOW_NON_EMPTY_FOLDERS), permissions("permissions", PERM_NONE) {} @@ -124,6 +132,7 @@ public: time_t mMinDate, mMaxDate; U32 mHoursAgo; + U32 mDateSearchDirection; EFolderShow mShowFolderState; PermissionMask mPermissions; @@ -177,6 +186,8 @@ public: void setHoursAgo(U32 hours); U32 getHoursAgo() const; + void setDateSearchDirection(U32 direction); + U32 getDateSearchDirection() const; void setFilterLinks(U64 filter_link); U64 getFilterLinks() const; diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index e74e58015a..1a3710afe7 100755 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -400,6 +400,11 @@ void LLInventoryPanel::setHoursAgo(U32 hours) getFilter().setHoursAgo(hours); } +void LLInventoryPanel::setDateSearchDirection(U32 direction) +{ + getFilter().setDateSearchDirection(direction); +} + void LLInventoryPanel::setFilterLinks(U64 filter_links) { getFilter().setFilterLinks(filter_links); diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h index 91c3efd8f0..a490dfce5d 100755 --- a/indra/newview/llinventorypanel.h +++ b/indra/newview/llinventorypanel.h @@ -173,6 +173,7 @@ public: const std::string getFilterSubString(); void setSinceLogoff(BOOL sl); void setHoursAgo(U32 hours); + void setDateSearchDirection(U32 direction); BOOL getSinceLogoff(); void setFilterLinks(U64 filter_links); diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index b02298090a..6c8765c62d 100755 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -55,6 +55,7 @@ #include "llviewertexturelist.h" #include "llsidepanelinventory.h" #include "llfolderview.h" +#include "llradiogroup.h" const std::string FILTERS_FILENAME("filters.xml"); @@ -82,6 +83,7 @@ public: void updateElementsFromFilter(); BOOL getCheckShowEmpty(); BOOL getCheckSinceLogoff(); + U32 getDateSearchDirection(); static void onTimeAgo(LLUICtrl*, void *); static void onCloseBtn(void* user_data); @@ -700,6 +702,30 @@ void LLFloaterInventoryFinder::onTimeAgo(LLUICtrl *ctrl, void *user_data) if ( self->mSpinSinceDays->get() || self->mSpinSinceHours->get() ) { self->getChild<LLUICtrl>("check_since_logoff")->setValue(false); + + U32 days = (U32)self->mSpinSinceDays->get(); + U32 hours = (U32)self->mSpinSinceHours->get(); + if (hours >= 24) + { + // Try to handle both cases of spinner clicking and text input in a sensible fashion as best as possible. + // There is no way to tell if someone has clicked the spinner to get to 24 or input 24 manually, so in + // this case add to days. Any value > 24 means they have input the hours manually, so do not add to the + // current day value. + if (24 == hours) // Got to 24 via spinner clicking or text input of 24 + { + days = days + hours / 24; + } + else // Text input, so do not add to days + { + days = hours / 24; + } + hours = (U32)hours % 24; + self->mSpinSinceHours->setFocus(false); + self->mSpinSinceDays->setFocus(false); + self->mSpinSinceDays->set((F32)days); + self->mSpinSinceHours->set((F32)hours); + self->mSpinSinceHours->setFocus(true); + } } } @@ -719,6 +745,7 @@ void LLFloaterInventoryFinder::updateElementsFromFilter() std::string filter_string = mFilter->getFilterSubString(); LLInventoryFilter::EFolderShow show_folders = mFilter->getShowFolderState(); U32 hours = mFilter->getHoursAgo(); + U32 date_search_direction = mFilter->getDateSearchDirection(); // update the ui elements setTitle(mFilter->getName()); @@ -740,6 +767,7 @@ void LLFloaterInventoryFinder::updateElementsFromFilter() getChild<LLUICtrl>("check_since_logoff")->setValue(mFilter->isSinceLogoff()); mSpinSinceHours->set((F32)(hours % 24)); mSpinSinceDays->set((F32)(hours / 24)); + getChild<LLRadioGroup>("date_search_direction")->setSelectedIndex(date_search_direction); } void LLFloaterInventoryFinder::draw() @@ -840,17 +868,23 @@ void LLFloaterInventoryFinder::draw() } U32 days = (U32)mSpinSinceDays->get(); U32 hours = (U32)mSpinSinceHours->get(); - if (hours > 24) + if (hours >= 24) { - days += hours / 24; + days = hours / 24; hours = (U32)hours % 24; + // A UI element that has focus will not display a new value set to it + mSpinSinceHours->setFocus(false); + mSpinSinceDays->setFocus(false); mSpinSinceDays->set((F32)days); mSpinSinceHours->set((F32)hours); + mSpinSinceHours->setFocus(true); } hours += days * 24; + mPanelMainInventory->getPanel()->setHoursAgo(hours); mPanelMainInventory->getPanel()->setSinceLogoff(getCheckSinceLogoff()); mPanelMainInventory->setFilterTextFromFilter(); + mPanelMainInventory->getPanel()->setDateSearchDirection(getDateSearchDirection()); LLPanel::draw(); } @@ -865,6 +899,11 @@ BOOL LLFloaterInventoryFinder::getCheckSinceLogoff() return getChild<LLUICtrl>("check_since_logoff")->getValue(); } +U32 LLFloaterInventoryFinder::getDateSearchDirection() +{ + return getChild<LLRadioGroup>("date_search_direction")->getSelectedIndex(); +} + void LLFloaterInventoryFinder::onCloseBtn(void* user_data) { LLFloaterInventoryFinder* finderp = (LLFloaterInventoryFinder*)user_data; diff --git a/indra/newview/skins/default/xui/en/floater_inventory_view_finder.xml b/indra/newview/skins/default/xui/en/floater_inventory_view_finder.xml index c86ed595a7..17bc818cc1 100755 --- a/indra/newview/skins/default/xui/en/floater_inventory_view_finder.xml +++ b/indra/newview/skins/default/xui/en/floater_inventory_view_finder.xml @@ -2,7 +2,7 @@ <floater legacy_header_height="18" can_minimize="false" - height="408" + height="440" layout="topleft" name="Inventory Finder" help_topic="inventory_finder" @@ -95,36 +95,36 @@ width="126" /> <icon height="16" - image_name="Inv_Mesh" + image_name="Inv_Notecard" layout="topleft" left="8" mouse_opaque="true" - name="icon_mesh" - top="142" + name="icon_notecard" + top="122" width="16" /> <check_box height="16" - label="Meshes" + label="Notecards" layout="topleft" left_pad="2" - name="check_mesh" + name="check_notecard" top_delta="0" width="126" /> <icon height="16" - image_name="Inv_Notecard" + image_name="Inv_Mesh" layout="topleft" left="8" mouse_opaque="true" - name="icon_notecard" - top="122" + name="icon_mesh" + top="142" width="16" /> <check_box height="16" - label="Notecards" + label="Meshes" layout="topleft" left_pad="2" - name="check_notecard" + name="check_mesh" top_delta="0" width="126" /> <icon @@ -223,25 +223,33 @@ top="262" width="100" /> <button - follows="left|top" height="20" label="None" label_selected="None" - layout="topleft" left_delta="0" name="None" - top_pad="4" + left_pad="10" width="100" /> <check_box height="16" label="Always show folders" layout="topleft" - left_delta="0" + left="8" name="check_show_empty" - top_pad="4" + top_pad="6" width="144" /> + <view_border + bevel_style="none" + follows="top|left" + height="0" + layout="topleft" + left="10" + name="horiz_separator" + top_pad="8" + width="260"/> <check_box height="16" + top="324" label="Since Logoff" layout="topleft" left_delta="0" @@ -257,36 +265,74 @@ layout="topleft" left_delta="0" name="- OR -" - top_delta="16" + top="342" width="144"> - OR - </text> + <radio_group + height="16" + layout="topleft" + name="date_search_direction" + top="360" + left="8" + width="270"> + <radio_item + label="Newer than" + layout="topleft" + name="newer" + top_pad="6" + left="0" /> + <radio_item + label="Older than" + layout="topleft" + name="older" + top_delta="0" + left="120" /> + </radio_group> <spinner follows="left|top" height="16" increment="1" initial_value="0" - label="Hours Ago" - label_width="64" layout="topleft" left_delta="0" max_val="240000" name="spin_hours_ago" top_pad="4" - width="144" /> + width="64" /> + <text + type="string" + length="1" + follows="left|top" + height="16" + layout="topleft" + left_pad="3" + top_delta="4" + width="80"> + Hours + </text> <spinner follows="left|top" height="16" increment="1" initial_value="0" - label="Days Ago" - label_width="64" layout="topleft" - left_delta="0" max_val="10000" name="spin_days_ago" top_pad="4" - width="144" /> + left="8" + width="64" /> + <text + type="string" + length="1" + follows="left|top" + height="16" + layout="topleft" + left_pad="3" + top_delta="4" + width="80"> + Days + </text> <button follows="top|right" height="20" @@ -295,6 +341,6 @@ layout="topleft" name="Close" right="-6" - top="382" + top="406" width="76" /> </floater> diff --git a/indra/newview/skins/default/xui/en/menu_inventory_gear_default.xml b/indra/newview/skins/default/xui/en/menu_inventory_gear_default.xml index d2519a5aa4..06d0b849a3 100755 --- a/indra/newview/skins/default/xui/en/menu_inventory_gear_default.xml +++ b/indra/newview/skins/default/xui/en/menu_inventory_gear_default.xml @@ -63,7 +63,7 @@ <menu_item_separator layout="topleft" /> <menu_item_call - label="Show Filters" + label="Show Filters..." layout="topleft" name="show_filters"> <on_click |