summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelmaininventory.cpp
diff options
context:
space:
mode:
authorMnikolenko Productengine <mnikolenko@productengine.com>2017-08-04 18:44:38 +0300
committerMnikolenko Productengine <mnikolenko@productengine.com>2017-08-04 18:44:38 +0300
commitea152d0d0b795e062142ef824717639468c39af4 (patch)
tree68bcc4b8bf4f06628eb9d5f2060b2c5bda1f3f76 /indra/newview/llpanelmaininventory.cpp
parent8c369771b560dc8e6e5a2a8bc466170e484964c5 (diff)
SL-717 Additional search options for inventory window
Diffstat (limited to 'indra/newview/llpanelmaininventory.cpp')
-rw-r--r--indra/newview/llpanelmaininventory.cpp140
1 files changed, 139 insertions, 1 deletions
diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp
index c34dd64cba..f771a027e0 100644
--- a/indra/newview/llpanelmaininventory.cpp
+++ b/indra/newview/llpanelmaininventory.cpp
@@ -30,6 +30,8 @@
#include "llagent.h"
#include "llagentcamera.h"
#include "llavataractions.h"
+#include "llcheckboxctrl.h"
+#include "llcombobox.h"
#include "lldndbutton.h"
#include "lleconomy.h"
#include "llfilepicker.h"
@@ -84,6 +86,9 @@ public:
BOOL getCheckSinceLogoff();
U32 getDateSearchDirection();
+ void onCreatorSelfFilterCommit();
+ void onCreatorOtherFilterCommit();
+
static void onTimeAgo(LLUICtrl*, void *);
static void onCloseBtn(void* user_data);
static void selectAllTypes(void* user_data);
@@ -92,6 +97,8 @@ private:
LLPanelMainInventory* mPanelMainInventory;
LLSpinCtrl* mSpinSinceDays;
LLSpinCtrl* mSpinSinceHours;
+ LLCheckBoxCtrl* mCreatorSelf;
+ LLCheckBoxCtrl* mCreatorOthers;
LLInventoryFilter* mFilter;
};
@@ -102,6 +109,7 @@ private:
LLPanelMainInventory::LLPanelMainInventory(const LLPanel::Params& p)
: LLPanel(p),
mActivePanel(NULL),
+ mWornItemsPanel(NULL),
mSavedFolderState(NULL),
mFilterText(""),
mMenuGearDefault(NULL),
@@ -158,6 +166,25 @@ BOOL LLPanelMainInventory::postBuild()
recent_items_panel->setSelectCallback(boost::bind(&LLPanelMainInventory::onSelectionChange, this, recent_items_panel, _1, _2));
}
+ mWornItemsPanel = getChild<LLInventoryPanel>("Worn Items");
+ if (mWornItemsPanel)
+ {
+ U32 filter_types = 0x0;
+ filter_types |= 0x1 << LLInventoryType::IT_WEARABLE;
+ filter_types |= 0x1 << LLInventoryType::IT_ATTACHMENT;
+ filter_types |= 0x1 << LLInventoryType::IT_OBJECT;
+ mWornItemsPanel->setFilterTypes(filter_types);
+ mWornItemsPanel->setFilterWorn();
+ mWornItemsPanel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
+ mWornItemsPanel->setFilterLinks(LLInventoryFilter::FILTERLINK_EXCLUDE_LINKS);
+ mWornItemsPanel->getFilter().markDefault();
+ mWornItemsPanel->setSelectCallback(boost::bind(&LLPanelMainInventory::onSelectionChange, this, mWornItemsPanel, _1, _2));
+ }
+ mSearchTypeCombo = getChild<LLComboBox>("search_type");
+ if(mSearchTypeCombo)
+ {
+ mSearchTypeCombo->setCommitCallback(boost::bind(&LLPanelMainInventory::onSelectSearchType, this));
+ }
// Now load the stored settings from disk, if available.
std::string filterSaveName(gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, FILTERS_FILENAME));
LL_INFOS() << "LLPanelMainInventory::init: reading from " << filterSaveName << LL_ENDL;
@@ -262,6 +289,16 @@ LLPanelMainInventory::~LLPanelMainInventory( void )
delete mSavedFolderState;
}
+LLInventoryPanel* LLPanelMainInventory::getAllItemsPanel()
+{
+ return getChild<LLInventoryPanel>("All Items");
+}
+
+void LLPanelMainInventory::selectAllItemsPanel()
+{
+ mFilterTabs->selectFirstTab();
+}
+
void LLPanelMainInventory::startSearch()
{
// this forces focus to line editor portion of search editor
@@ -387,6 +424,48 @@ void LLPanelMainInventory::setSortBy(const LLSD& userdata)
}
}
+void LLPanelMainInventory::onSelectSearchType()
+{
+ std::string new_type = mSearchTypeCombo->getValue();
+ if (new_type == "search_by_name")
+ {
+ getActivePanel()->setSearchType(LLInventoryFilter::SEARCHTYPE_NAME);
+ }
+ if (new_type == "search_by_creator")
+ {
+ getActivePanel()->setSearchType(LLInventoryFilter::SEARCHTYPE_CREATOR);
+ }
+ if (new_type == "search_by_description")
+ {
+ getActivePanel()->setSearchType(LLInventoryFilter::SEARCHTYPE_DESCRIPTION);
+ }
+ if (new_type == "search_by_UUID")
+ {
+ getActivePanel()->setSearchType(LLInventoryFilter::SEARCHTYPE_UUID);
+ }
+}
+
+void LLPanelMainInventory::updateSearchTypeCombo()
+{
+ LLInventoryFilter::ESearchType search_type = getActivePanel()->getSearchType();
+ switch(search_type)
+ {
+ case LLInventoryFilter::SEARCHTYPE_CREATOR:
+ mSearchTypeCombo->setValue("search_by_creator");
+ break;
+ case LLInventoryFilter::SEARCHTYPE_DESCRIPTION:
+ mSearchTypeCombo->setValue("search_by_description");
+ break;
+ case LLInventoryFilter::SEARCHTYPE_UUID:
+ mSearchTypeCombo->setValue("search_by_UUID");
+ break;
+ case LLInventoryFilter::SEARCHTYPE_NAME:
+ default:
+ mSearchTypeCombo->setValue("search_by_name");
+ break;
+ }
+}
+
// static
BOOL LLPanelMainInventory::filtersVisible(void* user_data)
{
@@ -400,7 +479,7 @@ void LLPanelMainInventory::onClearSearch()
{
BOOL initially_active = FALSE;
LLFloater *finder = getFinder();
- if (mActivePanel)
+ if (mActivePanel && (getActivePanel() != mWornItemsPanel))
{
initially_active = mActivePanel->getFilter().isNotDefault();
mActivePanel->setFilterSubString(LLStringUtil::null);
@@ -507,6 +586,11 @@ void LLPanelMainInventory::onFilterSelected()
return;
}
+ if (getActivePanel() == mWornItemsPanel)
+ {
+ mActivePanel->openAllFolders();
+ }
+ updateSearchTypeCombo();
setFilterSubString(mFilterSubString);
LLInventoryFilter& filter = mActivePanel->getFilter();
LLFloaterInventoryFinder *finder = getFinder();
@@ -705,6 +789,11 @@ BOOL LLFloaterInventoryFinder::postBuild()
mSpinSinceDays = getChild<LLSpinCtrl>("spin_days_ago");
childSetCommitCallback("spin_days_ago", onTimeAgo, this);
+ mCreatorSelf = getChild<LLCheckBoxCtrl>("check_created_by_me");
+ mCreatorOthers = getChild<LLCheckBoxCtrl>("check_created_by_others");
+ mCreatorSelf->setCommitCallback(boost::bind(&LLFloaterInventoryFinder::onCreatorSelfFilterCommit, this));
+ mCreatorOthers->setCommitCallback(boost::bind(&LLFloaterInventoryFinder::onCreatorOtherFilterCommit, this));
+
childSetAction("Close", onCloseBtn, this);
updateElementsFromFilter();
@@ -763,6 +852,10 @@ void LLFloaterInventoryFinder::updateElementsFromFilter()
U32 hours = mFilter->getHoursAgo();
U32 date_search_direction = mFilter->getDateSearchDirection();
+ LLInventoryFilter::EFilterCreatorType filter_creator = mFilter->getFilterCreator();
+ bool show_created_by_me = ((filter_creator == LLInventoryFilter::FILTERCREATOR_ALL) || (filter_creator == LLInventoryFilter::FILTERCREATOR_SELF));
+ bool show_created_by_others = ((filter_creator == LLInventoryFilter::FILTERCREATOR_ALL) || (filter_creator == LLInventoryFilter::FILTERCREATOR_OTHERS));
+
// update the ui elements
setTitle(mFilter->getName());
@@ -780,6 +873,10 @@ void LLFloaterInventoryFinder::updateElementsFromFilter()
getChild<LLUICtrl>("check_texture")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_TEXTURE));
getChild<LLUICtrl>("check_snapshot")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_SNAPSHOT));
getChild<LLUICtrl>("check_show_empty")->setValue(show_folders == LLInventoryFilter::SHOW_ALL_FOLDERS);
+
+ getChild<LLUICtrl>("check_created_by_me")->setValue(show_created_by_me);
+ getChild<LLUICtrl>("check_created_by_others")->setValue(show_created_by_others);
+
getChild<LLUICtrl>("check_since_logoff")->setValue(mFilter->isSinceLogoff());
mSpinSinceHours->set((F32)(hours % 24));
mSpinSinceDays->set((F32)(hours / 24));
@@ -877,6 +974,7 @@ void LLFloaterInventoryFinder::draw()
mPanelMainInventory->getPanel()->setShowFolderState(getCheckShowEmpty() ?
LLInventoryFilter::SHOW_ALL_FOLDERS : LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
mPanelMainInventory->getPanel()->setFilterTypes(filter);
+
if (getCheckSinceLogoff())
{
mSpinSinceDays->set(0);
@@ -905,6 +1003,46 @@ void LLFloaterInventoryFinder::draw()
LLPanel::draw();
}
+void LLFloaterInventoryFinder::onCreatorSelfFilterCommit()
+{
+ bool show_creator_self = mCreatorSelf->getValue();
+ bool show_creator_other = mCreatorOthers->getValue();
+
+ if(show_creator_self && show_creator_other)
+ {
+ mFilter->setFilterCreator(LLInventoryFilter::FILTERCREATOR_ALL);
+ }
+ else if(show_creator_self)
+ {
+ mFilter->setFilterCreator(LLInventoryFilter::FILTERCREATOR_SELF);
+ }
+ else if(!show_creator_self || !show_creator_other)
+ {
+ mFilter->setFilterCreator(LLInventoryFilter::FILTERCREATOR_OTHERS);
+ mCreatorOthers->set(TRUE);
+ }
+}
+
+void LLFloaterInventoryFinder::onCreatorOtherFilterCommit()
+{
+ bool show_creator_self = mCreatorSelf->getValue();
+ bool show_creator_other = mCreatorOthers->getValue();
+
+ if(show_creator_self && show_creator_other)
+ {
+ mFilter->setFilterCreator(LLInventoryFilter::FILTERCREATOR_ALL);
+ }
+ else if(show_creator_other)
+ {
+ mFilter->setFilterCreator(LLInventoryFilter::FILTERCREATOR_OTHERS);
+ }
+ else if(!show_creator_other || !show_creator_self)
+ {
+ mFilter->setFilterCreator(LLInventoryFilter::FILTERCREATOR_SELF);
+ mCreatorSelf->set(TRUE);
+ }
+}
+
BOOL LLFloaterInventoryFinder::getCheckShowEmpty()
{
return getChild<LLUICtrl>("check_show_empty")->getValue();