STORM-2034 Add persistence for new setting, more XML formatting changes,

Fix two issues with how hours and days are calculated and displayed
meow-7.2.2
Jonathan Yap 2014-06-07 05:16:56 -04:00
parent f759b3b912
commit 481f3cc54b
4 changed files with 54 additions and 24 deletions

View File

@ -174,8 +174,6 @@ 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
@ -223,7 +221,7 @@ bool LLInventoryFilter::checkAgainstFilterType(const LLFolderViewModelItemInvent
earliest = 0;
}
if (FILTER_YOUNGER == mFilterOps.mDateSearchDirection || isSinceLogoff())
if (FILTERDATEDIRECTION_NEWER == mFilterOps.mDateSearchDirection || isSinceLogoff())
{
if (listener->getCreationDate() < earliest ||
listener->getCreationDate() > mFilterOps.mMaxDate)
@ -641,8 +639,6 @@ void LLInventoryFilter::setHoursAgo(U32 hours)
{
if (mFilterOps.mHoursAgo != hours)
{
const U32 FILTER_NEWER = 1;
bool are_date_limits_valid = mFilterOps.mMinDate == time_min() && mFilterOps.mMaxDate == time_max();
bool is_increasing = hours > mFilterOps.mHoursAgo;
@ -653,7 +649,7 @@ void LLInventoryFilter::setHoursAgo(U32 hours)
BOOL more_restrictive = (are_date_limits_valid && (!is_increasing && hours) || is_increasing_from_zero);
// Toggle for newer than search
if (FILTER_NEWER == mFilterOps.mDateSearchDirection)
if (FILTERDATEDIRECTION_NEWER == mFilterOps.mDateSearchDirection)
{
less_restrictive = !less_restrictive;
more_restrictive = !more_restrictive;
@ -695,6 +691,11 @@ void LLInventoryFilter::setDateSearchDirection(U32 direction)
}
}
U32 LLInventoryFilter::getDateSearchDirection() const
{
return mFilterOps.mDateSearchDirection;
}
void LLInventoryFilter::setFilterLinks(U64 filter_links)
{
if (mFilterOps.mFilterLinks != filter_links)
@ -959,6 +960,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());
@ -978,6 +980,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();
@ -999,6 +1002,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);

View File

@ -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
@ -108,7 +114,7 @@ public:
uuid("uuid"),
date_range("date_range"),
hours_ago("hours_ago", 0),
date_search_direction("date_search_direction", 0),
date_search_direction("date_search_direction", FILTERDATEDIRECTION_NEWER),
show_folder_state("show_folder_state", SHOW_NON_EMPTY_FOLDERS),
permissions("permissions", PERM_NONE)
{}
@ -181,6 +187,7 @@ public:
void setHoursAgo(U32 hours);
U32 getHoursAgo() const;
void setDateSearchDirection(U32 direction);
U32 getDateSearchDirection() const;
void setFilterLinks(U64 filter_link);
U64 getFilterLinks() const;

View File

@ -56,6 +56,7 @@
#include "llsidepanelinventory.h"
#include "llfolderview.h"
#include "llradiogroup.h"
//#include "llinventoryfilter.h"
const std::string FILTERS_FILENAME("filters.xml");
@ -93,7 +94,6 @@ private:
LLPanelMainInventory* mPanelMainInventory;
LLSpinCtrl* mSpinSinceDays;
LLSpinCtrl* mSpinSinceHours;
LLRadioGroup* mSinceDirection;
LLInventoryFilter* mFilter;
};
@ -681,8 +681,6 @@ 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);
@ -692,9 +690,6 @@ BOOL LLFloaterInventoryFinder::postBuild()
mSpinSinceDays = getChild<LLSpinCtrl>("spin_days_ago");
childSetCommitCallback("spin_days_ago", onTimeAgo, this);
mSinceDirection = getChild<LLRadioGroup>("date_search_direction");
mSinceDirection->setSelectedIndex(FILTER_NEWER);
childSetAction("Close", onCloseBtn, this);
updateElementsFromFilter();
@ -727,6 +722,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());
@ -748,6 +744,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()
@ -850,10 +847,14 @@ void LLFloaterInventoryFinder::draw()
U32 hours = (U32)mSpinSinceHours->get();
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);
@ -876,7 +877,7 @@ BOOL LLFloaterInventoryFinder::getCheckSinceLogoff()
U32 LLFloaterInventoryFinder::getDateSearchDirection()
{
return mSinceDirection->getSelectedIndex();
return getChild<LLRadioGroup>("date_search_direction")->getSelectedIndex();
}
void LLFloaterInventoryFinder::onCloseBtn(void* user_data)

View File

@ -294,27 +294,45 @@
height="16"
increment="1"
initial_value="0"
label="Hours"
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"
label_width="64"
layout="topleft"
left_delta="0"
max_val="10000"
name="spin_days_ago"
top_pad="14"
width="144" />
top_pad="4"
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"
@ -323,6 +341,6 @@
layout="topleft"
name="Close"
right="-6"
top="412"
top="406"
width="76" />
</floater>