summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rwxr-xr-xindra/llcommon/llinitparam.h32
-rwxr-xr-xindra/llui/llfolderview.cpp12
-rwxr-xr-xindra/llui/llfolderviewmodel.h33
-rw-r--r--indra/newview/llconversationmodel.h3
-rwxr-xr-xindra/newview/llfolderviewmodelinventory.h4
-rwxr-xr-xindra/newview/llinventorypanel.cpp3
-rwxr-xr-xindra/newview/llpanelobjectinventory.cpp3
7 files changed, 55 insertions, 35 deletions
diff --git a/indra/llcommon/llinitparam.h b/indra/llcommon/llinitparam.h
index 03ab0fb67f..4bad0062a7 100755
--- a/indra/llcommon/llinitparam.h
+++ b/indra/llcommon/llinitparam.h
@@ -497,25 +497,25 @@ namespace LLInitParam
virtual ~Parser();
template <typename T> bool readValue(T& param, typename boost::disable_if<boost::is_enum<T> >::type* dummy = 0)
- {
+ {
parser_read_func_map_t::iterator found_it = mParserReadFuncs->find(&typeid(T));
if (found_it != mParserReadFuncs->end())
- {
+ {
return found_it->second(*this, (void*)&param);
- }
-
- return false;
}
-
+
+ return false;
+ }
+
template <typename T> bool readValue(T& param, typename boost::enable_if<boost::is_enum<T> >::type* dummy = 0)
- {
+ {
parser_read_func_map_t::iterator found_it = mParserReadFuncs->find(&typeid(T));
if (found_it != mParserReadFuncs->end())
- {
+ {
return found_it->second(*this, (void*)&param);
- }
+ }
else
- {
+ {
found_it = mParserReadFuncs->find(&typeid(S32));
if (found_it != mParserReadFuncs->end())
{
@@ -523,20 +523,20 @@ namespace LLInitParam
bool parsed = found_it->second(*this, (void*)&int_value);
param = (T)int_value;
return parsed;
- }
}
- return false;
}
+ return false;
+ }
template <typename T> bool writeValue(const T& param, name_stack_t& name_stack)
- {
+ {
parser_write_func_map_t::iterator found_it = mParserWriteFuncs->find(&typeid(T));
if (found_it != mParserWriteFuncs->end())
- {
+ {
return found_it->second(*this, (const void*)&param, name_stack);
- }
- return false;
}
+ return false;
+ }
// dispatch inspection to registered inspection functions, for each parameter in a param block
template <typename T> bool inspectValue(name_stack_t& name_stack, S32 min_count, S32 max_count, const possible_values_t* possible_values)
diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp
index f32a52e6c6..884fd0ed0f 100755
--- a/indra/llui/llfolderview.cpp
+++ b/indra/llui/llfolderview.cpp
@@ -1599,19 +1599,21 @@ void LLFolderView::update()
// until that inventory is loaded up.
LLFastTimer t2(FTM_INVENTORY);
- if (getFolderViewModel()->getFilter().isModified() && getFolderViewModel()->getFilter().isNotDefault())
+ LLFolderViewFilter& filter_object = getFolderViewModel()->getFilter();
+
+ if (filter_object.isModified() && filter_object.isNotDefault())
{
mNeedsAutoSelect = TRUE;
}
// Filter to determine visibility before arranging
- filter(getFolderViewModel()->getFilter());
+ filter(filter_object);
// Clear the modified setting on the filter only if the filter finished after running the filter process
// Note: if the filter count has timed out, that means the filter halted before completing the entire set of items
- if (getFolderViewModel()->getFilter().isModified() && (!getFolderViewModel()->getFilter().isTimedOut()))
+ if (filter_object.isModified() && (!filter_object.isTimedOut()))
{
- getFolderViewModel()->getFilter().clearModified();
+ filter_object.clearModified();
}
// automatically show matching items, and select first one if we had a selection
@@ -1630,7 +1632,7 @@ void LLFolderView::update()
// Open filtered folders for folder views with mAutoSelectOverride=TRUE.
// Used by LLPlacesFolderView.
- if (getFolderViewModel()->getFilter().showAllResults())
+ if (filter_object.showAllResults())
{
// these are named variables to get around gcc not binding non-const references to rvalues
// and functor application is inherently non-const to allow for stateful functors
diff --git a/indra/llui/llfolderviewmodel.h b/indra/llui/llfolderviewmodel.h
index b1bcc8bbb4..a909d13f97 100755
--- a/indra/llui/llfolderviewmodel.h
+++ b/indra/llui/llfolderviewmodel.h
@@ -386,27 +386,36 @@ template <typename SORT_TYPE, typename ITEM_TYPE, typename FOLDER_TYPE, typename
class LLFolderViewModel : public LLFolderViewModelCommon
{
public:
- LLFolderViewModel(){}
- virtual ~LLFolderViewModel() {}
-
typedef SORT_TYPE SortType;
typedef ITEM_TYPE ItemType;
typedef FOLDER_TYPE FolderType;
typedef FILTER_TYPE FilterType;
- virtual SortType& getSorter() { return mSorter; }
- virtual const SortType& getSorter() const { return mSorter; }
- virtual void setSorter(const SortType& sorter) { mSorter = sorter; requestSortAll(); }
+ LLFolderViewModel(SortType* sorter, FilterType* filter)
+ : mSorter(sorter),
+ mFilter(filter)
+ {}
- virtual FilterType& getFilter() { return mFilter; }
- virtual const FilterType& getFilter() const { return mFilter; }
- virtual void setFilter(const FilterType& filter) { mFilter = filter; }
+ virtual ~LLFolderViewModel()
+ {
+ delete mSorter;
+ mSorter = NULL;
+ delete mFilter;
+ mFilter = NULL;
+ }
+
+ virtual SortType& getSorter() { return *mSorter; }
+ virtual const SortType& getSorter() const { return *mSorter; }
+ virtual void setSorter(const SortType& sorter) { mSorter = new SortType(sorter); requestSortAll(); }
+
+ virtual FilterType& getFilter() { return *mFilter; }
+ virtual const FilterType& getFilter() const { return *mFilter; }
+ virtual void setFilter(const FilterType& filter) { mFilter = new FilterType(filter); }
// By default, we assume the content is available. If a network fetch mechanism is implemented for the model,
// this method needs to be overloaded and return the relevant fetch status.
virtual bool contentsReady() { return true; }
-
struct ViewModelCompare
{
ViewModelCompare(const SortType& sorter)
@@ -438,8 +447,8 @@ public:
}
protected:
- SortType mSorter;
- FilterType mFilter;
+ SortType* mSorter;
+ FilterType* mFilter;
};
#endif // LLFOLDERVIEWMODEL_H
diff --git a/indra/newview/llconversationmodel.h b/indra/newview/llconversationmodel.h
index d8cdcdfc97..dc74506c53 100644
--- a/indra/newview/llconversationmodel.h
+++ b/indra/newview/llconversationmodel.h
@@ -291,6 +291,9 @@ class LLConversationViewModel
{
public:
typedef LLFolderViewModel<LLConversationSort, LLConversationItem, LLConversationItem, LLConversationFilter> base_t;
+ LLConversationViewModel()
+ : base_t(new LLConversationSort(), new LLConversationFilter())
+ {}
void sort(LLFolderViewFolder* folder);
bool contentsReady() { return true; } // *TODO : we need to check that participants names are available somewhat
diff --git a/indra/newview/llfolderviewmodelinventory.h b/indra/newview/llfolderviewmodelinventory.h
index 9dcfdfa185..8772185ad0 100755
--- a/indra/newview/llfolderviewmodelinventory.h
+++ b/indra/newview/llfolderviewmodelinventory.h
@@ -105,6 +105,10 @@ class LLFolderViewModelInventory
public:
typedef LLFolderViewModel<LLInventorySort, LLFolderViewModelItemInventory, LLFolderViewModelItemInventory, LLInventoryFilter> base_t;
+ LLFolderViewModelInventory(const std::string& name)
+ : base_t(new LLInventorySort(), new LLInventoryFilter(LLInventoryFilter::Params().name(name)))
+ {}
+
void setTaskID(const LLUUID& id) {mTaskID = id;}
void sort(LLFolderViewFolder* folder);
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp
index e5b9e11d48..d27f7d2527 100755
--- a/indra/newview/llinventorypanel.cpp
+++ b/indra/newview/llinventorypanel.cpp
@@ -146,7 +146,8 @@ LLInventoryPanel::LLInventoryPanel(const LLInventoryPanel::Params& p) :
mShowItemLinkOverlays(p.show_item_link_overlays),
mShowEmptyMessage(p.show_empty_message),
mViewsInitialized(false),
- mInvFVBridgeBuilder(NULL)
+ mInvFVBridgeBuilder(NULL),
+ mInventoryViewModel(p.name)
{
mInvFVBridgeBuilder = &INVENTORY_BRIDGE_BUILDER;
diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp
index d7130820ab..bb063f48a5 100755
--- a/indra/newview/llpanelobjectinventory.cpp
+++ b/indra/newview/llpanelobjectinventory.cpp
@@ -1491,7 +1491,8 @@ LLPanelObjectInventory::LLPanelObjectInventory(const LLPanelObjectInventory::Par
mFolders(NULL),
mHaveInventory(FALSE),
mIsInventoryEmpty(TRUE),
- mInventoryNeedsUpdate(FALSE)
+ mInventoryNeedsUpdate(FALSE),
+ mInventoryViewModel(p.name)
{
// Setup context menu callbacks
mCommitCallbackRegistrar.add("Inventory.DoToSelected", boost::bind(&LLPanelObjectInventory::doToSelected, this, _2));