diff options
author | Rider Linden <rider@lindenlab.com> | 2019-04-18 16:28:03 +0000 |
---|---|---|
committer | Rider Linden <rider@lindenlab.com> | 2019-04-18 16:28:03 +0000 |
commit | d923a1500af7f6512f60a96134baad87b9b8d1d0 (patch) | |
tree | 7879b174861f118f672d2de513b4e8d79dd31b7d | |
parent | 2684b301687f1f226834eaae0c25482e65cbf9ca (diff) | |
parent | 32598518816be6c312acc9b027d3a28ed807429a (diff) |
Merged in maxim_productengine/viewer-eep (pull request #355)
SL-10983 [EEP] Add a search box to the "My Environments" floater
-rw-r--r-- | indra/newview/llfloatermyenvironment.cpp | 121 | ||||
-rw-r--r-- | indra/newview/llfloatermyenvironment.h | 66 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_my_environments.xml | 13 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/notifications.xml | 4 |
4 files changed, 56 insertions, 148 deletions
diff --git a/indra/newview/llfloatermyenvironment.cpp b/indra/newview/llfloatermyenvironment.cpp index 3a83042d4f..8c2772a87d 100644 --- a/indra/newview/llfloatermyenvironment.cpp +++ b/indra/newview/llfloatermyenvironment.cpp @@ -1,10 +1,10 @@ /** * @file llfloatergesture.cpp - * @brief Read-only list of gestures from your inventory. + * @brief LLFloaterMyEnvironment class implementation * * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. + * Copyright (C) 2019, Linden Research, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -32,21 +32,11 @@ #include "llinventorybridge.h" #include "llinventoryfunctions.h" #include "llinventorymodel.h" -#include "llclipboard.h" #include "llagent.h" #include "llclipboard.h" -#include "llkeyboard.h" -#include "llmenugl.h" -#include "llmultigesture.h" -#include "llscrolllistctrl.h" #include "llcheckboxctrl.h" -#include "lltrans.h" -#include "llviewergesture.h" -#include "llviewermenu.h" #include "llviewerinventory.h" -#include "llviewercontrol.h" -#include "llfloaterperms.h" #include "llenvironment.h" #include "llparcel.h" #include "llviewerparcelmgr.h" @@ -57,6 +47,7 @@ namespace const std::string CHECK_DAYS("chk_days"); const std::string CHECK_SKIES("chk_skies"); const std::string CHECK_WATER("chk_water"); + const std::string FLT_SEARCH("flt_search"); const std::string PANEL_SETTINGS("pnl_settings"); const std::string BUTTON_NEWSETTINGS("btn_gear"); const std::string BUTTON_GEAR("btn_newsettings"); @@ -82,72 +73,6 @@ namespace } //========================================================================= -#if 0 -BOOL item_name_precedes( LLInventoryItem* a, LLInventoryItem* b ) -{ - return LLStringUtil::precedesDict( a->getName(), b->getName() ); -} - -class LLFloaterGestureObserver : public LLGestureManagerObserver -{ -public: - LLFloaterGestureObserver(LLFloaterGesture* floater) : mFloater(floater) {} - virtual ~LLFloaterGestureObserver() {} - virtual void changed() { mFloater->refreshAll(); } - -private: - LLFloaterGesture* mFloater; -}; -//----------------------------- -// GestureCallback -//----------------------------- - -class GestureShowCallback : public LLInventoryCallback -{ -public: - void fire(const LLUUID &inv_item) - { - LLPreviewGesture::show(inv_item, LLUUID::null); - - LLInventoryItem* item = gInventory.getItem(inv_item); - if (item) - { - LLPermissions perm = item->getPermissions(); - perm.setMaskNext(LLFloaterPerms::getNextOwnerPerms("Gestures")); - perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Gestures")); - perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Gestures")); - item->setPermissions(perm); - item->updateServer(FALSE); - } - } -}; - -class GestureCopiedCallback : public LLInventoryCallback -{ -private: - LLFloaterGesture* mFloater; - -public: - GestureCopiedCallback(LLFloaterGesture* floater): mFloater(floater) - {} - void fire(const LLUUID &inv_item) - { - if(mFloater) - { - mFloater->addGesture(inv_item,NULL,mFloater->getChild<LLScrollListCtrl>("gesture_list")); - - // EXP-1909 (Pasted gesture displayed twice) - // The problem is that addGesture is called here for the second time for the same item (which is copied) - // First time addGesture is called from LLFloaterGestureObserver::changed(), which is a callback for inventory - // change. So we need to refresh the gesture list to avoid duplicates. - mFloater->refreshAll(); - } - } -}; - -#endif - -//========================================================================= LLFloaterMyEnvironment::LLFloaterMyEnvironment(const LLSD& key) : LLFloater(key), mInventoryList(nullptr), @@ -167,10 +92,6 @@ LLFloaterMyEnvironment::LLFloaterMyEnvironment(const LLSD& key) : LLFloaterMyEnvironment::~LLFloaterMyEnvironment() { - // LLGestureMgr::instance().removeObserver(mObserver); - // delete mObserver; - // mObserver = NULL; - // gInventory.removeObserver(this); } @@ -193,8 +114,11 @@ BOOL LLFloaterMyEnvironment::postBuild() childSetCommitCallback(CHECK_SKIES, [this](LLUICtrl*, void*) { onFilterCheckChange(); }, nullptr); childSetCommitCallback(CHECK_WATER, [this](LLUICtrl*, void*) { onFilterCheckChange(); }, nullptr); - childSetCommitCallback(BUTTON_DELETE, [this](LLUICtrl *, void*) { onDeleteSelected(); }, nullptr); + mFilterEdit = getChild<LLFilterEditor>(FLT_SEARCH); + mFilterEdit->setCommitCallback([this](LLUICtrl*, const LLSD& param){ onFilterEdit(param.asString()); }); + childSetCommitCallback(BUTTON_DELETE, [this](LLUICtrl *, void*) { onDeleteSelected(); }, nullptr); + mSavedFolderState.setApply(FALSE); return TRUE; } @@ -252,6 +176,37 @@ void LLFloaterMyEnvironment::onSelectionChange() refreshButtonStates(); } +void LLFloaterMyEnvironment::onFilterEdit(const std::string& search_string) +{ + std::string upper_case_search_string = search_string; + LLStringUtil::toUpper(upper_case_search_string); + + if (upper_case_search_string.empty()) + { + if (mInventoryList->getFilterSubString().empty()) + { + // current filter and new filter empty, do nothing + return; + } + + mSavedFolderState.setApply(TRUE); + mInventoryList->getRootFolder()->applyFunctorRecursively(mSavedFolderState); + // add folder with current item to list of previously opened folders + LLOpenFoldersWithSelection opener; + mInventoryList->getRootFolder()->applyFunctorRecursively(opener); + mInventoryList->getRootFolder()->scrollToShowSelection(); + + } + else if (mInventoryList->getFilterSubString().empty()) + { + // first letter in search term, save existing folder open state + mSavedFolderState.setApply(FALSE); + mInventoryList->getRootFolder()->applyFunctorRecursively(mSavedFolderState); + } + + mInventoryList->setFilterSubString(search_string); +} + void LLFloaterMyEnvironment::onDeleteSelected() { uuid_vec_t selected; diff --git a/indra/newview/llfloatermyenvironment.h b/indra/newview/llfloatermyenvironment.h index 9472fb63e2..67e35343da 100644 --- a/indra/newview/llfloatermyenvironment.h +++ b/indra/newview/llfloatermyenvironment.h @@ -1,10 +1,10 @@ /** * @file llfloatermyenvironment.h - * @brief Read-only list of gestures from your inventory. + * @brief LLFloaterMyEnvironment class header file * * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. + * Copyright (C) 2019, Linden Research, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -24,10 +24,6 @@ * $/LicenseInfo$ */ -/** - * (Also has legacy gesture editor for testing.) - */ - #ifndef LL_LLFLOATERMYENVIRONMENT_H #define LL_LLFLOATERMYENVIRONMENT_H #include <vector> @@ -35,14 +31,8 @@ #include "llfloater.h" #include "llinventoryobserver.h" #include "llinventoryfilter.h" +#include "llfiltereditor.h" -class LLView; -class LLButton; -class LLLineEditor; -class LLComboBox; -class LLViewerGesture; -class LLGestureOptions; -class LLMenuGL; class LLInventoryPanel; class LLFloaterMyEnvironment @@ -60,10 +50,13 @@ public: private: LLInventoryPanel * mInventoryList; + LLFilterEditor * mFilterEdit; U64 mTypeFilter; LLUUID mSelectedAsset; + LLSaveFolderState mSavedFolderState; void onFilterCheckChange(); + void onFilterEdit(const std::string& search_string); void onSelectionChange(); void onDeleteSelected(); void onDoCreate(const LLSD &data); @@ -77,53 +70,6 @@ private: bool isSettingSelected(LLUUID item_id); static LLUUID findItemByAssetId(LLUUID asset_id, bool copyable_only, bool ignore_library); - -#if 0 - virtual void done (); - void refreshAll(); - /** - * @brief Add new scrolllistitem into gesture_list. - * @param item_id inventory id of gesture - * @param gesture can be NULL , if item was not loaded yet - */ - void addGesture(const LLUUID& item_id, LLMultiGesture* gesture, LLCtrlListInterface * list); - -protected: - // Reads from the gesture manager's list of active gestures - // and puts them in this list. - void buildGestureList(); - void playGesture(LLUUID item_id); -private: - void addToCurrentOutFit(); - /** - * @brief This method is using to collect selected items. - * In some places gesture_list can be rebuilt by gestureObservers during iterating data from LLScrollListCtrl::getAllSelected(). - * Therefore we have to copy these items to avoid viewer crash. - * @see LLFloaterGesture::onActivateBtnClick - */ - void getSelectedIds(uuid_vec_t& ids); - bool isActionEnabled(const LLSD& command); - /** - * @brief Activation rules: - * According to Gesture Spec: - * 1. If all selected gestures are active: set to inactive - * 2. If all selected gestures are inactive: set to active - * 3. If selected gestures are in a mixed state: set all to active - */ - void onActivateBtnClick(); - void onClickEdit(); - void onClickPlay(); - void onClickNew(); - void onCommitList(); - void onCopyPasteAction(const LLSD& command); - void onDeleteSelected(); - - LLUUID mSelectedID; - LLUUID mGestureFolderID; - LLScrollListCtrl* mGestureList; - - LLFloaterGestureObserver* mObserver; -#endif }; diff --git a/indra/newview/skins/default/xui/en/floater_my_environments.xml b/indra/newview/skins/default/xui/en/floater_my_environments.xml index 854ac8b758..7e65e5d69c 100644 --- a/indra/newview/skins/default/xui/en/floater_my_environments.xml +++ b/indra/newview/skins/default/xui/en/floater_my_environments.xml @@ -28,9 +28,8 @@ border="true" bevel_style="in" auto_resize="false" - user_resize="true" tab_group="1" - height="24" + height="54" name="filter_panel" label="Filters" font="SansSerifBold"> @@ -82,6 +81,15 @@ name="chk_water" top_delta="0" width="60" /> + <filter_editor + follows="left|top|right" + height="23" + label="Filter Environments" + layout="topleft" + left="4" + name="flt_search" + top_pad="6" + right="-4" /> </layout_panel> <layout_panel auto_resize="true" @@ -116,7 +124,6 @@ </layout_panel> <layout_panel auto_resize="false" - user_resize="true" tab_group="1" height="31" name="pnl_control" diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index fa5b6062df..fc3556ddc0 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -11410,8 +11410,8 @@ Are you sure you want to continue? icon="alertmodal.tga" name="PersonalSettingsConfirmReset" type="alertmodal"> - You are about to remove all applied Personal lighting settings. - Are you sure you want to continue? +You are about to remove all applied Personal lighting settings. +Are you sure you want to continue? <tag>confirm</tag> <usetemplate name="okcancelbuttons" |