diff options
author | Jacek Antonelli | 2009-01-20 13:33:29 -0600 |
---|---|---|
committer | Jacek Antonelli | 2009-01-22 16:42:59 -0600 |
commit | 9badcd022d8074fa489b788b9ba5162b6e9291c7 (patch) | |
tree | 58dba8867fdb17ef6c84be3531ced1302aa7b795 /linden | |
parent | Missing newline at end of two source files. (diff) | |
download | meta-impy-9badcd022d8074fa489b788b9ba5162b6e9291c7.zip meta-impy-9badcd022d8074fa489b788b9ba5162b6e9291c7.tar.gz meta-impy-9badcd022d8074fa489b788b9ba5162b6e9291c7.tar.bz2 meta-impy-9badcd022d8074fa489b788b9ba5162b6e9291c7.tar.xz |
VWR-508/VWR-2199: Create "Worn Items" tab in Inventory
Patch by Vadim Bigbear.
Diffstat (limited to 'linden')
-rw-r--r-- | linden/indra/newview/llfolderview.cpp | 12 | ||||
-rw-r--r-- | linden/indra/newview/llfolderview.h | 5 | ||||
-rw-r--r-- | linden/indra/newview/llinventoryview.cpp | 24 | ||||
-rw-r--r-- | linden/indra/newview/llinventoryview.h | 3 | ||||
-rw-r--r-- | linden/indra/newview/skins/default/xui/en-us/floater_inventory.xml | 4 |
5 files changed, 48 insertions, 0 deletions
diff --git a/linden/indra/newview/llfolderview.cpp b/linden/indra/newview/llfolderview.cpp index cb9a379..4ef52f0 100644 --- a/linden/indra/newview/llfolderview.cpp +++ b/linden/indra/newview/llfolderview.cpp | |||
@@ -4490,6 +4490,7 @@ LLInventoryFilter::LLInventoryFilter(const std::string& name) : | |||
4490 | 4490 | ||
4491 | mSubStringMatchOffset = 0; | 4491 | mSubStringMatchOffset = 0; |
4492 | mFilterSubString.clear(); | 4492 | mFilterSubString.clear(); |
4493 | mFilterWorn = false; | ||
4493 | mFilterGeneration = 0; | 4494 | mFilterGeneration = 0; |
4494 | mMustPassGeneration = S32_MAX; | 4495 | mMustPassGeneration = S32_MAX; |
4495 | mMinRequiredGeneration = 0; | 4496 | mMinRequiredGeneration = 0; |
@@ -4521,9 +4522,12 @@ BOOL LLInventoryFilter::check(LLFolderViewItem* item) | |||
4521 | earliest = 0; | 4522 | earliest = 0; |
4522 | } | 4523 | } |
4523 | LLFolderViewEventListener* listener = item->getListener(); | 4524 | LLFolderViewEventListener* listener = item->getListener(); |
4525 | const LLUUID& item_id = listener->getUUID(); | ||
4524 | mSubStringMatchOffset = mFilterSubString.size() ? item->getSearchableLabel().find(mFilterSubString) : std::string::npos; | 4526 | mSubStringMatchOffset = mFilterSubString.size() ? item->getSearchableLabel().find(mFilterSubString) : std::string::npos; |
4525 | BOOL passed = (listener->getNInventoryType() & mFilterOps.mFilterTypes || listener->getNInventoryType() == LLInventoryType::NIT_NONE) | 4527 | BOOL passed = (listener->getNInventoryType() & mFilterOps.mFilterTypes || listener->getNInventoryType() == LLInventoryType::NIT_NONE) |
4526 | && (mFilterSubString.size() == 0 || mSubStringMatchOffset != std::string::npos) | 4528 | && (mFilterSubString.size() == 0 || mSubStringMatchOffset != std::string::npos) |
4529 | && (mFilterWorn == false || gAgent.isWearingItem(item_id) || | ||
4530 | gAgent.getAvatarObject() && gAgent.getAvatarObject()->isWearingAttachment(item_id)) | ||
4527 | && ((listener->getPermissionMask() & mFilterOps.mPermissions) == mFilterOps.mPermissions) | 4531 | && ((listener->getPermissionMask() & mFilterOps.mPermissions) == mFilterOps.mPermissions) |
4528 | && (listener->getCreationDate() >= earliest && listener->getCreationDate() <= mFilterOps.mMaxDate); | 4532 | && (listener->getCreationDate() >= earliest && listener->getCreationDate() <= mFilterOps.mMaxDate); |
4529 | return passed; | 4533 | return passed; |
@@ -4544,6 +4548,7 @@ BOOL LLInventoryFilter::isNotDefault() | |||
4544 | { | 4548 | { |
4545 | return mFilterOps.mFilterTypes != mDefaultFilterOps.mFilterTypes | 4549 | return mFilterOps.mFilterTypes != mDefaultFilterOps.mFilterTypes |
4546 | || mFilterSubString.size() | 4550 | || mFilterSubString.size() |
4551 | || mFilterWorn | ||
4547 | || mFilterOps.mPermissions != mDefaultFilterOps.mPermissions | 4552 | || mFilterOps.mPermissions != mDefaultFilterOps.mPermissions |
4548 | || mFilterOps.mMinDate != mDefaultFilterOps.mMinDate | 4553 | || mFilterOps.mMinDate != mDefaultFilterOps.mMinDate |
4549 | || mFilterOps.mMaxDate != mDefaultFilterOps.mMaxDate | 4554 | || mFilterOps.mMaxDate != mDefaultFilterOps.mMaxDate |
@@ -4554,6 +4559,7 @@ BOOL LLInventoryFilter::isActive() | |||
4554 | { | 4559 | { |
4555 | return mFilterOps.mFilterTypes != LLInventoryType::NIT_ALL | 4560 | return mFilterOps.mFilterTypes != LLInventoryType::NIT_ALL |
4556 | || mFilterSubString.size() | 4561 | || mFilterSubString.size() |
4562 | || mFilterWorn | ||
4557 | || mFilterOps.mPermissions != PERM_NONE | 4563 | || mFilterOps.mPermissions != PERM_NONE |
4558 | || mFilterOps.mMinDate != time_min() | 4564 | || mFilterOps.mMinDate != time_min() |
4559 | || mFilterOps.mMaxDate != time_max() | 4565 | || mFilterOps.mMaxDate != time_max() |
@@ -4989,6 +4995,12 @@ std::string LLInventoryFilter::rebuildFilterText() | |||
4989 | { | 4995 | { |
4990 | mFilterText += " - Since Logoff"; | 4996 | mFilterText += " - Since Logoff"; |
4991 | } | 4997 | } |
4998 | |||
4999 | if (getFilterWorn()) | ||
5000 | { | ||
5001 | mFilterText += " - Worn"; | ||
5002 | } | ||
5003 | |||
4992 | return mFilterText; | 5004 | return mFilterText; |
4993 | } | 5005 | } |
4994 | 5006 | ||
diff --git a/linden/indra/newview/llfolderview.h b/linden/indra/newview/llfolderview.h index af3248d..b668015 100644 --- a/linden/indra/newview/llfolderview.h +++ b/linden/indra/newview/llfolderview.h | |||
@@ -194,6 +194,9 @@ public: | |||
194 | 194 | ||
195 | void setFilterSubString(const std::string& string); | 195 | void setFilterSubString(const std::string& string); |
196 | const std::string getFilterSubString(BOOL trim = FALSE); | 196 | const std::string getFilterSubString(BOOL trim = FALSE); |
197 | |||
198 | void setFilterWorn(bool worn) { mFilterWorn = worn; } | ||
199 | bool getFilterWorn() const { return mFilterWorn; } | ||
197 | 200 | ||
198 | void setFilterPermissions(PermissionMask perms); | 201 | void setFilterPermissions(PermissionMask perms); |
199 | PermissionMask getFilterPermissions() const { return mFilterOps.mPermissions; } | 202 | PermissionMask getFilterPermissions() const { return mFilterOps.mPermissions; } |
@@ -257,6 +260,7 @@ protected: | |||
257 | filter_ops mDefaultFilterOps; | 260 | filter_ops mDefaultFilterOps; |
258 | std::string::size_type mSubStringMatchOffset; | 261 | std::string::size_type mSubStringMatchOffset; |
259 | std::string mFilterSubString; | 262 | std::string mFilterSubString; |
263 | bool mFilterWorn; | ||
260 | U32 mOrder; | 264 | U32 mOrder; |
261 | const std::string mName; | 265 | const std::string mName; |
262 | S32 mFilterGeneration; | 266 | S32 mFilterGeneration; |
@@ -745,6 +749,7 @@ public: | |||
745 | 749 | ||
746 | LLInventoryFilter* getFilter() { return &mFilter; } | 750 | LLInventoryFilter* getFilter() { return &mFilter; } |
747 | const std::string getFilterSubString(BOOL trim = FALSE); | 751 | const std::string getFilterSubString(BOOL trim = FALSE); |
752 | bool getFilterWorn() const { return mFilter.getFilterWorn(); } | ||
748 | U32 getFilterTypes() const { return mFilter.getFilterTypes(); } | 753 | U32 getFilterTypes() const { return mFilter.getFilterTypes(); } |
749 | PermissionMask getFilterPermissions() const { return mFilter.getFilterPermissions(); } | 754 | PermissionMask getFilterPermissions() const { return mFilter.getFilterPermissions(); } |
750 | LLInventoryFilter::EFolderShow getShowFolderState() { return mFilter.getShowFolderState(); } | 755 | LLInventoryFilter::EFolderShow getShowFolderState() { return mFilter.getShowFolderState(); } |
diff --git a/linden/indra/newview/llinventoryview.cpp b/linden/indra/newview/llinventoryview.cpp index a265906..1e16b92 100644 --- a/linden/indra/newview/llinventoryview.cpp +++ b/linden/indra/newview/llinventoryview.cpp | |||
@@ -547,6 +547,15 @@ void LLInventoryView::init(LLInventoryModel* inventory) | |||
547 | recent_items_panel->getFilter()->markDefault(); | 547 | recent_items_panel->getFilter()->markDefault(); |
548 | recent_items_panel->setSelectCallback(onSelectionChange, recent_items_panel); | 548 | recent_items_panel->setSelectCallback(onSelectionChange, recent_items_panel); |
549 | } | 549 | } |
550 | LLInventoryPanel* worn_items_panel = getChild<LLInventoryPanel>("Worn Items"); | ||
551 | if (worn_items_panel) | ||
552 | { | ||
553 | worn_items_panel->setSortOrder(gSavedSettings.getU32("InventorySortOrder")); | ||
554 | worn_items_panel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS); | ||
555 | worn_items_panel->getFilter()->markDefault(); | ||
556 | worn_items_panel->setFilterWorn(true); | ||
557 | worn_items_panel->setSelectCallback(onSelectionChange, worn_items_panel); | ||
558 | } | ||
550 | 559 | ||
551 | // Now load the stored settings from disk, if available. | 560 | // Now load the stored settings from disk, if available. |
552 | std::ostringstream filterSaveName; | 561 | std::ostringstream filterSaveName; |
@@ -595,6 +604,7 @@ BOOL LLInventoryView::postBuild() | |||
595 | { | 604 | { |
596 | childSetTabChangeCallback("inventory filter tabs", "All Items", onFilterSelected, this); | 605 | childSetTabChangeCallback("inventory filter tabs", "All Items", onFilterSelected, this); |
597 | childSetTabChangeCallback("inventory filter tabs", "Recent Items", onFilterSelected, this); | 606 | childSetTabChangeCallback("inventory filter tabs", "Recent Items", onFilterSelected, this); |
607 | childSetTabChangeCallback("inventory filter tabs", "Worn Items", onFilterSelected, this); | ||
598 | //panel->getFilter()->markDefault(); | 608 | //panel->getFilter()->markDefault(); |
599 | return TRUE; | 609 | return TRUE; |
600 | } | 610 | } |
@@ -621,6 +631,15 @@ LLInventoryView::~LLInventoryView( void ) | |||
621 | filter->toLLSD(filterState); | 631 | filter->toLLSD(filterState); |
622 | filterRoot[filter->getName()] = filterState; | 632 | filterRoot[filter->getName()] = filterState; |
623 | } | 633 | } |
634 | |||
635 | LLInventoryPanel* worn_items_panel = getChild<LLInventoryPanel>("Worn Items"); | ||
636 | if (worn_items_panel) | ||
637 | { | ||
638 | LLInventoryFilter* filter = worn_items_panel->getFilter(); | ||
639 | LLSD filterState; | ||
640 | filter->toLLSD(filterState); | ||
641 | filterRoot[filter->getName()] = filterState; | ||
642 | } | ||
624 | 643 | ||
625 | std::ostringstream filterSaveName; | 644 | std::ostringstream filterSaveName; |
626 | filterSaveName << gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "filters.xml"); | 645 | filterSaveName << gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "filters.xml"); |
@@ -1653,6 +1672,11 @@ void LLInventoryPanel::setFilterSubString(const std::string& string) | |||
1653 | mFolders->getFilter()->setFilterSubString(string); | 1672 | mFolders->getFilter()->setFilterSubString(string); |
1654 | } | 1673 | } |
1655 | 1674 | ||
1675 | void LLInventoryPanel::setFilterWorn(bool worn) | ||
1676 | { | ||
1677 | mFolders->getFilter()->setFilterWorn(worn); | ||
1678 | } | ||
1679 | |||
1656 | void LLInventoryPanel::setSortOrder(U32 order) | 1680 | void LLInventoryPanel::setSortOrder(U32 order) |
1657 | { | 1681 | { |
1658 | mFolders->getFilter()->setSortOrder(order); | 1682 | mFolders->getFilter()->setSortOrder(order); |
diff --git a/linden/indra/newview/llinventoryview.h b/linden/indra/newview/llinventoryview.h index c5c8532..dd6756a 100644 --- a/linden/indra/newview/llinventoryview.h +++ b/linden/indra/newview/llinventoryview.h | |||
@@ -108,6 +108,9 @@ public: | |||
108 | U32 getFilterPermMask() const { return mFolders->getFilterPermissions(); } | 108 | U32 getFilterPermMask() const { return mFolders->getFilterPermissions(); } |
109 | void setFilterSubString(const std::string& string); | 109 | void setFilterSubString(const std::string& string); |
110 | const std::string getFilterSubString() { return mFolders->getFilterSubString(); } | 110 | const std::string getFilterSubString() { return mFolders->getFilterSubString(); } |
111 | void setFilterWorn(bool worn); | ||
112 | bool getFilterWorn() const { return mFolders->getFilterWorn(); } | ||
113 | |||
111 | void setSortOrder(U32 order); | 114 | void setSortOrder(U32 order); |
112 | U32 getSortOrder() { return mFolders->getSortOrder(); } | 115 | U32 getSortOrder() { return mFolders->getSortOrder(); } |
113 | void setSinceLogoff(BOOL sl); | 116 | void setSinceLogoff(BOOL sl); |
diff --git a/linden/indra/newview/skins/default/xui/en-us/floater_inventory.xml b/linden/indra/newview/skins/default/xui/en-us/floater_inventory.xml index 590555f..3d1c569 100644 --- a/linden/indra/newview/skins/default/xui/en-us/floater_inventory.xml +++ b/linden/indra/newview/skins/default/xui/en-us/floater_inventory.xml | |||
@@ -61,6 +61,10 @@ | |||
61 | follows="left|top|right|bottom" height="431" label="Recent Items" | 61 | follows="left|top|right|bottom" height="431" label="Recent Items" |
62 | left_delta="0" mouse_opaque="true" name="Recent Items" | 62 | left_delta="0" mouse_opaque="true" name="Recent Items" |
63 | sort_order="RecentItemsSortOrder" width="461" /> | 63 | sort_order="RecentItemsSortOrder" width="461" /> |
64 | <inventory_panel allow_multi_select="true" border="true" bottom_delta="0" | ||
65 | follows="left|top|right|bottom" height="431" label="Worn Items" | ||
66 | left_delta="0" mouse_opaque="true" name="Worn Items" | ||
67 | sort_order="RecentItemsSortOrder" width="461" /> | ||
64 | </tab_container> | 68 | </tab_container> |
65 | 69 | ||
66 | <menu_bar bottom="-34" drop_shadow="false" follows="left|top|right" height="18" left="2" | 70 | <menu_bar bottom="-34" drop_shadow="false" follows="left|top|right" height="18" left="2" |