From 4da7f68549f531a6bec3643727cc68fb29a00bfa Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Thu, 5 Jun 2014 17:06:59 -0400 Subject: VWR-25689 Support 'older than' when inventory filtering --- indra/newview/llinventoryfilter.cpp | 37 +++++++++++++++-- indra/newview/llinventoryfilter.h | 6 ++- indra/newview/llinventorypanel.cpp | 5 +++ indra/newview/llinventorypanel.h | 1 + indra/newview/llpanelmaininventory.cpp | 12 ++++++ .../xui/en/floater_inventory_view_finder.xml | 48 ++++++++++++++++------ 6 files changed, 92 insertions(+), 17 deletions(-) (limited to 'indra') diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp index 000eee3317..25447da53b 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,20 @@ bool LLInventoryFilter::checkAgainstFilterType(const LLFolderViewModelItemInvent { earliest = 0; } - if (listener->getCreationDate() < earliest || - listener->getCreationDate() > mFilterOps.mMaxDate) - return FALSE; + +llwarns << "DBG 3 " << mFilterOps.mDateSearchDirection << llendl; + if (1 == mFilterOps.mDateSearchDirection) + { + if (listener->getCreationDate() < earliest || + listener->getCreationDate() > mFilterOps.mMaxDate) + return FALSE; + } + else + { + if (listener->getCreationDate() > earliest || + listener->getCreationDate() > mFilterOps.mMaxDate) + return FALSE; + } } //////////////////////////////////////////////////////////////////////////////// @@ -635,6 +649,13 @@ void LLInventoryFilter::setHoursAgo(U32 hours) 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); + // Toggle for older than search + if (0 == mFilterOps.mDateSearchDirection) + { + less_restrictive = !less_restrictive; + more_restrictive = !more_restrictive; + } + mFilterOps.mHoursAgo = hours; mFilterOps.mMinDate = time_min(); mFilterOps.mMaxDate = time_max(); @@ -662,6 +683,16 @@ void LLInventoryFilter::setHoursAgo(U32 hours) } } +void LLInventoryFilter::setDateSearchDirection(U32 direction) +{ +llwarns << "DBG 2 " << direction << llendl; + if (direction != mFilterOps.mDateSearchDirection) + { + mFilterOps.mDateSearchDirection = direction; + setModified(FILTER_RESTART); + } +} + void LLInventoryFilter::setFilterLinks(U64 filter_links) { if (mFilterOps.mFilterLinks != filter_links) diff --git a/indra/newview/llinventoryfilter.h b/indra/newview/llinventoryfilter.h index ce516af0b9..2a95512995 100755 --- a/indra/newview/llinventoryfilter.h +++ b/indra/newview/llinventoryfilter.h @@ -94,7 +94,8 @@ public: Optional links; Optional uuid; Optional date_range; - Optional hours_ago; + Optional hours_ago; + Optional date_search_direction; Optional show_folder_state; Optional permissions; @@ -107,6 +108,7 @@ public: uuid("uuid"), date_range("date_range"), hours_ago("hours_ago", 0), + date_search_direction("date_search_direction", 0), show_folder_state("show_folder_state", SHOW_NON_EMPTY_FOLDERS), permissions("permissions", PERM_NONE) {} @@ -124,6 +126,7 @@ public: time_t mMinDate, mMaxDate; U32 mHoursAgo; + U32 mDateSearchDirection; EFolderShow mShowFolderState; PermissionMask mPermissions; @@ -177,6 +180,7 @@ public: void setHoursAgo(U32 hours); U32 getHoursAgo() const; + void setDateSearchDirection(U32 direction); 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..310b5f5639 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); @@ -91,6 +93,7 @@ private: LLPanelMainInventory* mPanelMainInventory; LLSpinCtrl* mSpinSinceDays; LLSpinCtrl* mSpinSinceHours; + LLRadioGroup* mSinceDirection; LLInventoryFilter* mFilter; }; @@ -687,6 +690,9 @@ BOOL LLFloaterInventoryFinder::postBuild() mSpinSinceDays = getChild("spin_days_ago"); childSetCommitCallback("spin_days_ago", onTimeAgo, this); + mSinceDirection = getChild("date_search_direction"); + mSinceDirection->setSelectedIndex(0); + childSetAction("Close", onCloseBtn, this); updateElementsFromFilter(); @@ -851,6 +857,7 @@ void LLFloaterInventoryFinder::draw() mPanelMainInventory->getPanel()->setHoursAgo(hours); mPanelMainInventory->getPanel()->setSinceLogoff(getCheckSinceLogoff()); mPanelMainInventory->setFilterTextFromFilter(); + mPanelMainInventory->getPanel()->setDateSearchDirection(getDateSearchDirection()); LLPanel::draw(); } @@ -865,6 +872,11 @@ BOOL LLFloaterInventoryFinder::getCheckSinceLogoff() return getChild("check_since_logoff")->getValue(); } +U32 LLFloaterInventoryFinder::getDateSearchDirection() +{ + return mSinceDirection->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..5c7c4de9e8 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 @@ - OR - + + + + + + Date: Fri, 6 Jun 2014 14:56:11 -0400 Subject: STOMR-2034 XML adjustments and a bit of code cleanup --- indra/newview/llinventoryfilter.cpp | 6 +- indra/newview/llpanelmaininventory.cpp | 4 +- .../xui/en/floater_inventory_view_finder.xml | 66 ++++++++++++---------- 3 files changed, 42 insertions(+), 34 deletions(-) (limited to 'indra') diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp index 25447da53b..ce0f66edbb 100755 --- a/indra/newview/llinventoryfilter.cpp +++ b/indra/newview/llinventoryfilter.cpp @@ -174,6 +174,8 @@ bool LLInventoryFilter::checkAgainstFilterType(const LLFolderViewModelItemInvent const U32 filterTypes = mFilterOps.mFilterTypes; + const U32 FILTER_YOUNGER = 0; + //////////////////////////////////////////////////////////////////////////////// // FILTERTYPE_OBJECT // Pass if this item's type is of the correct filter type @@ -221,8 +223,7 @@ bool LLInventoryFilter::checkAgainstFilterType(const LLFolderViewModelItemInvent earliest = 0; } -llwarns << "DBG 3 " << mFilterOps.mDateSearchDirection << llendl; - if (1 == mFilterOps.mDateSearchDirection) + if (FILTER_YOUNGER == mFilterOps.mDateSearchDirection) { if (listener->getCreationDate() < earliest || listener->getCreationDate() > mFilterOps.mMaxDate) @@ -685,7 +686,6 @@ void LLInventoryFilter::setHoursAgo(U32 hours) void LLInventoryFilter::setDateSearchDirection(U32 direction) { -llwarns << "DBG 2 " << direction << llendl; if (direction != mFilterOps.mDateSearchDirection) { mFilterOps.mDateSearchDirection = direction; diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index 310b5f5639..862a07358b 100755 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -681,6 +681,8 @@ BOOL LLFloaterInventoryFinder::postBuild() const LLRect& viewrect = mPanelMainInventory->getRect(); setRect(LLRect(viewrect.mLeft - getRect().getWidth(), viewrect.mTop, viewrect.mLeft, viewrect.mTop - getRect().getHeight())); + const U32 FILTER_NEWER = 0; + childSetAction("All", selectAllTypes, this); childSetAction("None", selectNoTypes, this); @@ -691,7 +693,7 @@ BOOL LLFloaterInventoryFinder::postBuild() childSetCommitCallback("spin_days_ago", onTimeAgo, this); mSinceDirection = getChild("date_search_direction"); - mSinceDirection->setSelectedIndex(0); + mSinceDirection->setSelectedIndex(FILTER_NEWER); childSetAction("Close", onCloseBtn, this); 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 5c7c4de9e8..54e08822f1 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 @@ -223,25 +223,33 @@ top="262" width="100" />