From 7420e9f3599b8974cc86758af88eebc966e57214 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Sat, 22 Nov 2008 01:21:22 -0600 Subject: Quick Filter combo box refreshes properly. --- linden/indra/newview/llinventoryview.cpp | 128 +++++++++++++++++++++++++++++++ linden/indra/newview/llinventoryview.h | 1 + 2 files changed, 129 insertions(+) (limited to 'linden/indra/newview') diff --git a/linden/indra/newview/llinventoryview.cpp b/linden/indra/newview/llinventoryview.cpp index 07b5115..97f4644 100644 --- a/linden/indra/newview/llinventoryview.cpp +++ b/linden/indra/newview/llinventoryview.cpp @@ -624,6 +624,11 @@ void LLInventoryView::draw() { mSearchEditor->setText(mActivePanel->getFilterSubString()); } + if (mActivePanel && mQuickFilterCombo) + { + refreshQuickFilter( mQuickFilterCombo ); + } + LLFloater::draw(); } @@ -1091,6 +1096,129 @@ void LLInventoryView::onQuickFilterCommit(LLUICtrl* ctrl, void* user_data) } + +//static +void LLInventoryView::refreshQuickFilter(LLUICtrl* ctrl) +{ + + LLInventoryView* view = (LLInventoryView*)(ctrl->getParent()); + if (!view->mActivePanel) + { + return; + } + + LLComboBox* quickfilter = view->getChild("Quick Filter"); + if (!quickfilter) + { + return; + } + + + U32 filter_type = view->mActivePanel->getFilterTypes(); + + + // Mask to extract only the bit fields we care about. + // *TODO: There's probably a cleaner way to construct this mask. + U32 filter_mask = 0; + filter_mask |= (0x1 << LLInventoryType::IT_ANIMATION); + filter_mask |= (0x1 << LLInventoryType::IT_CALLINGCARD); + filter_mask |= (0x1 << LLInventoryType::IT_WEARABLE); + filter_mask |= (0x1 << LLInventoryType::IT_GESTURE); + filter_mask |= (0x1 << LLInventoryType::IT_LANDMARK); + filter_mask |= (0x1 << LLInventoryType::IT_NOTECARD); + filter_mask |= (0x1 << LLInventoryType::IT_OBJECT); + filter_mask |= (0x1 << LLInventoryType::IT_LSL); + filter_mask |= (0x1 << LLInventoryType::IT_SOUND); + filter_mask |= (0x1 << LLInventoryType::IT_TEXTURE); + filter_mask |= (0x1 << LLInventoryType::IT_SNAPSHOT); + + + filter_type &= filter_mask; + + + //llinfos << "filter_type: " << filter_type << llendl; + + std::string selection; + + + if (filter_type == filter_mask) + { + selection = "Show All Items"; + } + + else if (filter_type == (0x1 << LLInventoryType::IT_ANIMATION)) + { + selection = "Animations"; + } + + else if (filter_type == (0x1 << LLInventoryType::IT_CALLINGCARD)) + { + selection = "Calling Cards"; + } + + else if (filter_type == (0x1 << LLInventoryType::IT_WEARABLE)) + { + selection = "Clothing"; + } + + else if (filter_type == (0x1 << LLInventoryType::IT_GESTURE)) + { + selection = "Gestures"; + } + + else if (filter_type == (0x1 << LLInventoryType::IT_LANDMARK)) + { + selection = "Landmarks"; + } + + else if (filter_type == (0x1 << LLInventoryType::IT_NOTECARD)) + { + selection = "Notecards"; + } + + else if (filter_type == (0x1 << LLInventoryType::IT_OBJECT)) + { + selection = "Objects"; + } + + else if (filter_type == (0x1 << LLInventoryType::IT_LSL)) + { + selection = "Scripts"; + } + + else if (filter_type == (0x1 << LLInventoryType::IT_SOUND)) + { + selection = "Sounds"; + } + + else if (filter_type == (0x1 << LLInventoryType::IT_TEXTURE)) + { + selection = "Textures"; + } + + else if (filter_type == (0x1 << LLInventoryType::IT_SNAPSHOT)) + { + selection = "Snapshots"; + } + + else + { + selection = "Custom..."; + } + + + // Select the chosen item by label text + BOOL result = quickfilter->setSimple( (selection) ); + + if( !result ) + { + llinfos << "The item didn't exist: " << selection << llendl; + } + +} + + + // static // BOOL LLInventoryView::incrementalFind(LLFolderViewItem* first_item, const char *find_text, BOOL backward) // { diff --git a/linden/indra/newview/llinventoryview.h b/linden/indra/newview/llinventoryview.h index ec621ec..cce30aa 100644 --- a/linden/indra/newview/llinventoryview.h +++ b/linden/indra/newview/llinventoryview.h @@ -241,6 +241,7 @@ public: static BOOL checkFoldersByName(void *user_data); static void onSearchEdit(const std::string& search_string, void* user_data ); static void onQuickFilterCommit(LLUICtrl* ctrl, void* user_data); + static void refreshQuickFilter(LLUICtrl* ctrl); static void onFilterSelected(void* userdata, bool from_click); static void onSelectionChange(const std::deque &items, BOOL user_action, void* data); -- cgit v1.1