From 49da5288bd0425241823186bfd56a159fe2f9a60 Mon Sep 17 00:00:00 2001 From: Maxim Nikolenko Date: Fri, 24 Feb 2023 03:05:30 +0200 Subject: SL-19234 add Inventory settings floater --- indra/newview/CMakeLists.txt | 2 + indra/newview/app_settings/settings.xml | 33 ++++ indra/newview/llconversationmodel.h | 2 +- indra/newview/llfloaterinventorysettings.cpp | 44 ++++++ indra/newview/llfloaterinventorysettings.h | 45 ++++++ indra/newview/llinventorybridge.cpp | 31 ++-- indra/newview/llinventorybridge.h | 2 +- indra/newview/llinventoryfunctions.cpp | 22 ++- indra/newview/llinventorypanel.cpp | 6 +- indra/newview/llinventorypanel.h | 2 +- indra/newview/llpanelmaininventory.cpp | 8 +- indra/newview/llpanelmaininventory.h | 2 +- indra/newview/llpanelobjectinventory.cpp | 2 +- indra/newview/llviewerfloaterreg.cpp | 2 + indra/newview/llviewermenu.cpp | 2 +- .../default/xui/en/floater_inventory_settings.xml | 169 +++++++++++++++++++++ .../default/xui/en/menu_inventory_view_default.xml | 14 +- 17 files changed, 358 insertions(+), 30 deletions(-) create mode 100644 indra/newview/llfloaterinventorysettings.cpp create mode 100644 indra/newview/llfloaterinventorysettings.h create mode 100644 indra/newview/skins/default/xui/en/floater_inventory_settings.xml (limited to 'indra/newview') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 08cce23852..7c30d8eba8 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -270,6 +270,7 @@ set(viewer_SOURCE_FILES llfloaterimsession.cpp llfloaterimcontainer.cpp llfloaterinspect.cpp + llfloaterinventorysettings.cpp llfloaterjoystick.cpp llfloaterlagmeter.cpp llfloaterland.cpp @@ -914,6 +915,7 @@ set(viewer_HEADER_FILES llfloaterimsession.h llfloaterimcontainer.h llfloaterinspect.h + llfloaterinventorysettings.h llfloaterjoystick.h llfloaterlagmeter.h llfloaterland.h diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 411f77e6a7..3a896b4f5f 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -16898,5 +16898,38 @@ Value 0 + FindOriginalOpenWindow + + Comment + Sets the action for 'Find original' and 'Show in Inventory' (0 - shows item in main Inventory, 1 - opens a new single-folder window) + Persist + 1 + Type + Boolean + Value + 0 + +MultiModeDoubleClickOpenWindow + + Comment + Sets the action for Double-click on folder in multi-folder view (0 - expands and collapses folder, 1 - opens a new window) + Persist + 1 + Type + Boolean + Value + 0 + +SingleModeDoubleClickOpenWindow + + Comment + Sets the action for Double-click on folder in single-folder view (0 - stays in current window, 1 - opens a new window) + Persist + 1 + Type + Boolean + Value + 0 + diff --git a/indra/newview/llconversationmodel.h b/indra/newview/llconversationmodel.h index 5999ab3925..c7da060f33 100644 --- a/indra/newview/llconversationmodel.h +++ b/indra/newview/llconversationmodel.h @@ -111,7 +111,7 @@ public: virtual void previewItem( void ); virtual void selectItem(void) { } virtual void showProperties(void); - virtual void navigateToFolder() {} + virtual void navigateToFolder(bool new_window = false) {} // Methods used in sorting (see LLConversationSort::operator()) EConversationType const getType() const { return mConvType; } diff --git a/indra/newview/llfloaterinventorysettings.cpp b/indra/newview/llfloaterinventorysettings.cpp new file mode 100644 index 0000000000..29d6e90a33 --- /dev/null +++ b/indra/newview/llfloaterinventorysettings.cpp @@ -0,0 +1,44 @@ +/** + * @file llfloaterinventorysettings.cpp + * @brief LLFloaterInventorySettings class implementation + * + * $LicenseInfo:firstyear=2023&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2023, 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 + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llfloaterinventorysettings.h" + +LLFloaterInventorySettings::LLFloaterInventorySettings(const LLSD& key) + : LLFloater(key) +{ +} + +LLFloaterInventorySettings::~LLFloaterInventorySettings() +{} + +BOOL LLFloaterInventorySettings::postBuild() +{ + getChild("ok_btn")->setCommitCallback(boost::bind(&LLFloater::closeFloater, this, false)); + return TRUE; +} + diff --git a/indra/newview/llfloaterinventorysettings.h b/indra/newview/llfloaterinventorysettings.h new file mode 100644 index 0000000000..50304276c7 --- /dev/null +++ b/indra/newview/llfloaterinventorysettings.h @@ -0,0 +1,45 @@ +/** + * @file llfloaterinventorysettings.h + * @brief LLFloaterInventorySettings class definition + * + * $LicenseInfo:firstyear=2023&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2023, 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 + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLFLOATERINVENTORYSETTINGS_H +#define LL_LLFLOATERINVENTORYSETTINGS_H + +#include "llfloater.h" + +class LLFloaterInventorySettings + : public LLFloater +{ + friend class LLFloaterReg; + +public: + virtual BOOL postBuild(); + +private: + LLFloaterInventorySettings(const LLSD& key); + ~LLFloaterInventorySettings(); +}; + +#endif diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index db88ca0b9b..f7b7a6635e 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -413,23 +413,30 @@ void LLInvFVBridge::showProperties() } } -void LLInvFVBridge::navigateToFolder() +void LLInvFVBridge::navigateToFolder(bool new_window) { - LLInventorySingleFolderPanel* panel = dynamic_cast(mInventoryPanel.get()); - if (!panel) - { - return; - } - LLInventoryModel* model = getInventoryModel(); - if (!model) + if(new_window) { - return; + mInventoryPanel.get()->openSingleViewInventory(mUUID); } - if (mUUID.isNull()) + else { - return; + LLInventorySingleFolderPanel* panel = dynamic_cast(mInventoryPanel.get()); + if (!panel) + { + return; + } + LLInventoryModel* model = getInventoryModel(); + if (!model) + { + return; + } + if (mUUID.isNull()) + { + return; + } + panel->changeFolderRoot(mUUID); } - panel->changeFolderRoot(mUUID); } void LLInvFVBridge::removeBatch(std::vector& batch) diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index 39dd268115..b2cc33aadd 100644 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -107,7 +107,7 @@ public: virtual std::string getLabelSuffix() const { return LLStringUtil::null; } virtual void openItem() {} virtual void closeItem() {} - virtual void navigateToFolder(); + virtual void navigateToFolder(bool new_window = false); virtual void showProperties(); virtual BOOL isItemRenameable() const { return TRUE; } virtual BOOL isMultiPreviewAllowed() { return TRUE; } diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 5e5be39c0c..15916ffaba 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -781,7 +781,22 @@ void show_item_profile(const LLUUID& item_uuid) void show_item_original(const LLUUID& item_uuid) { - LLFloater* floater_inventory = LLFloaterReg::getInstance("inventory"); + static LLUICachedControl find_original_new_floater("FindOriginalOpenWindow", false); + + //show in a new single-folder window + if(find_original_new_floater) + { + const LLUUID& linked_item_uuid = gInventory.getLinkedItemID(item_uuid); + const LLInventoryObject *obj = gInventory.getObject(linked_item_uuid); + if (obj && obj->getParentUUID().notNull()) + { + LLPanelMainInventory::newFolderWindow(obj->getParentUUID(), linked_item_uuid); + } + } + //show in main Inventory + else + { + LLFloater* floater_inventory = LLFloaterReg::getInstance("inventory"); if (!floater_inventory) { LL_WARNS() << "Could not find My Inventory floater" << LL_ENDL; @@ -793,6 +808,10 @@ void show_item_original(const LLUUID& item_uuid) LLPanelMainInventory* main_inventory = sidepanel_inventory->getMainInventoryPanel(); if (main_inventory) { + if(main_inventory->isSingleFolderMode()) + { + main_inventory->onViewModeClick(); + } main_inventory->resetFilters(); } reset_inventory_filter(); @@ -820,6 +839,7 @@ void show_item_original(const LLUUID& item_uuid) } } } + } } diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 91fa856d5e..80d9b69937 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -183,7 +183,7 @@ LLInventoryPanel::LLInventoryPanel(const LLInventoryPanel::Params& p) : mCommitCallbackRegistrar.add("Inventory.BeginIMSession", boost::bind(&LLInventoryPanel::beginIMSession, this)); mCommitCallbackRegistrar.add("Inventory.Share", boost::bind(&LLAvatarActions::shareWithAvatars, this)); mCommitCallbackRegistrar.add("Inventory.FileUploadLocation", boost::bind(&LLInventoryPanel::fileUploadLocation, this, _2)); - mCommitCallbackRegistrar.add("Inventory.OpenNewFolderWindow", boost::bind(&LLInventoryPanel::openSingleViewInventory, this, _2)); + mCommitCallbackRegistrar.add("Inventory.OpenNewFolderWindow", boost::bind(&LLInventoryPanel::openSingleViewInventory, this, LLUUID())); } LLFolderView * LLInventoryPanel::createFolderRoot(LLUUID root_id ) @@ -1644,9 +1644,9 @@ void LLInventoryPanel::fileUploadLocation(const LLSD& userdata) } } -void LLInventoryPanel::openSingleViewInventory(const LLSD& userdata) +void LLInventoryPanel::openSingleViewInventory(LLUUID folder_id) { - LLPanelMainInventory::newFolderWindow(LLFolderBridge::sSelf.get()->getUUID()); + LLPanelMainInventory::newFolderWindow(folder_id.isNull() ? LLFolderBridge::sSelf.get()->getUUID() : folder_id); } void LLInventoryPanel::purgeSelectedItems() diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h index 981bef62a8..baaefe5dd7 100644 --- a/indra/newview/llinventorypanel.h +++ b/indra/newview/llinventorypanel.h @@ -222,7 +222,7 @@ public: void doCreate(const LLSD& userdata); bool beginIMSession(); void fileUploadLocation(const LLSD& userdata); - void openSingleViewInventory(const LLSD& userdata); + void openSingleViewInventory(LLUUID folder_id = LLUUID()); void purgeSelectedItems(); bool attachObject(const LLSD& userdata); static void idle(void* user_data); diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index fa40f13d00..0fd4eb0c15 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -411,7 +411,7 @@ void LLPanelMainInventory::newWindow() } } -void LLPanelMainInventory::newFolderWindow(const LLUUID& folder_id) +void LLPanelMainInventory::newFolderWindow(LLUUID folder_id, LLUUID item_to_select) { S32 instance_num = get_instance_num(); @@ -428,6 +428,10 @@ void LLPanelMainInventory::newFolderWindow(const LLUUID& folder_id) if(folder_id.notNull()) { main_inventory->setSingleFolderViewRoot(folder_id); + if(item_to_select.notNull()) + { + sidepanel_inventory->getActivePanel()->setSelection(item_to_select, TAKE_FOCUS_YES); + } } } } @@ -1368,7 +1372,7 @@ void LLPanelMainInventory::onCustomAction(const LLSD& userdata) const std::string command_name = userdata.asString(); if (command_name == "new_single_folder_window") { - newFolderWindow(LLUUID()); + newFolderWindow(); } if ((command_name == "open_in_current_window") || (command_name == "open_in_new_window")) { diff --git a/indra/newview/llpanelmaininventory.h b/indra/newview/llpanelmaininventory.h index e5262540cf..85373d7de3 100644 --- a/indra/newview/llpanelmaininventory.h +++ b/indra/newview/llpanelmaininventory.h @@ -94,7 +94,7 @@ public: void setFocusFilterEditor(); static void newWindow(); - static void newFolderWindow(const LLUUID& folder_id); + static void newFolderWindow(LLUUID folder_id = LLUUID(), LLUUID item_to_select = LLUUID()); void toggleFindOptions(); diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp index c9169fdc8f..c22915c3ab 100644 --- a/indra/newview/llpanelobjectinventory.cpp +++ b/indra/newview/llpanelobjectinventory.cpp @@ -125,7 +125,7 @@ public: virtual BOOL canOpenItem() const { return FALSE; } virtual void closeItem() {} virtual void selectItem() {} - virtual void navigateToFolder() {} + virtual void navigateToFolder(bool new_window = false) {} virtual BOOL isItemRenameable() const; virtual BOOL renameItem(const std::string& new_name); virtual BOOL isItemMovable() const; diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 4d51d56569..581c6779ab 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -85,6 +85,7 @@ #include "llfloaterimagepreview.h" #include "llfloaterimsession.h" #include "llfloaterinspect.h" +#include "llfloaterinventorysettings.h" #include "llfloaterjoystick.h" #include "llfloaterlagmeter.h" #include "llfloaterland.h" @@ -373,6 +374,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("inspect", "floater_inspect.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("item_properties", "floater_item_properties.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("task_properties", "floater_task_properties.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("inventory_settings", "floater_inventory_settings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLInspectAvatarUtil::registerFloater(); LLInspectGroupUtil::registerFloater(); LLInspectObjectUtil::registerFloater(); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 09fd4b04cb..19930e0e03 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -9703,7 +9703,7 @@ void initialize_menus() commit.add("PayObject", boost::bind(&handle_give_money_dialog)); commit.add("Inventory.NewWindow", boost::bind(&LLPanelMainInventory::newWindow)); - commit.add("Inventory.NewFolderWindow", boost::bind(&LLPanelMainInventory::newFolderWindow, LLUUID())); + commit.add("Inventory.NewFolderWindow", boost::bind(&LLPanelMainInventory::newFolderWindow, LLUUID(), LLUUID())); enable.add("EnablePayObject", boost::bind(&enable_pay_object)); enable.add("EnablePayAvatar", boost::bind(&enable_pay_avatar)); diff --git a/indra/newview/skins/default/xui/en/floater_inventory_settings.xml b/indra/newview/skins/default/xui/en/floater_inventory_settings.xml new file mode 100644 index 0000000000..c3e81a5523 --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_inventory_settings.xml @@ -0,0 +1,169 @@ + + + + + Double-click on folder in multi-folder view: + + + + + + + + Double-click on folder in single-folder view: + + + + + + + Clicking on "Show in inventory" or "Find original" + + + + + +