From f377e27f0b8ddabf755c6efe71d6bc0e53e751c1 Mon Sep 17 00:00:00 2001 From: Maxim Nikolenko Date: Mon, 27 Feb 2023 20:27:11 +0200 Subject: SL-19274 Add new double-click option to Inventory settings --- indra/llui/llfolderviewitem.cpp | 9 +++++-- indra/llui/llfolderviewmodel.h | 2 +- indra/newview/app_settings/settings.xml | 6 ++--- indra/newview/llconversationmodel.h | 2 +- indra/newview/llinventorybridge.cpp | 24 +++++++++---------- indra/newview/llinventorybridge.h | 2 +- indra/newview/llinventorypanel.cpp | 18 ++++++++++++++ indra/newview/llinventorypanel.h | 2 +- indra/newview/llpanelmaininventory.cpp | 7 ++++-- indra/newview/llpanelmaininventory.h | 2 +- indra/newview/llpanelobjectinventory.cpp | 2 +- .../default/xui/en/floater_inventory_settings.xml | 28 +++++++++++++++------- 12 files changed, 70 insertions(+), 34 deletions(-) (limited to 'indra') diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index 4a9ac56d9f..6ddbf26639 100644 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -2077,11 +2077,16 @@ BOOL LLFolderViewFolder::handleDoubleClick( S32 x, S32 y, MASK mask ) } if( !handled ) { - static LLUICachedControl double_click_new_window("MultiModeDoubleClickOpenWindow", false); - if (double_click_new_window) + static LLUICachedControl double_click_action("MultiModeDoubleClickFolder", false); + if (double_click_action == 1) { getViewModelItem()->navigateToFolder(true); return TRUE; + } + if (double_click_action == 2) + { + getViewModelItem()->navigateToFolder(false, true); + return TRUE; } if(mIndentation < x && x < mIndentation + (isCollapsed() ? 0 : mArrowSize) + mTextPad) { diff --git a/indra/llui/llfolderviewmodel.h b/indra/llui/llfolderviewmodel.h index b1db9489fd..b5a765fab3 100644 --- a/indra/llui/llfolderviewmodel.h +++ b/indra/llui/llfolderviewmodel.h @@ -160,7 +160,7 @@ public: virtual void closeItem( void ) = 0; virtual void selectItem(void) = 0; - virtual void navigateToFolder(bool new_window = false) = 0; + virtual void navigateToFolder(bool new_window = false, bool change_mode = false) = 0; virtual BOOL isItemWearable() const { return FALSE; } diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 3a896b4f5f..23521351ca 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -16909,14 +16909,14 @@ Value 0 -MultiModeDoubleClickOpenWindow +MultiModeDoubleClickFolder Comment - Sets the action for Double-click on folder in multi-folder view (0 - expands and collapses folder, 1 - opens a new window) + Sets the action for Double-click on folder in multi-folder view (0 - expands and collapses folder, 1 - opens a new window, 2 – stays in current floater but switches to SFV) Persist 1 Type - Boolean + U32 Value 0 diff --git a/indra/newview/llconversationmodel.h b/indra/newview/llconversationmodel.h index c7da060f33..22d2d60905 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(bool new_window = false) {} + virtual void navigateToFolder(bool new_window = false, bool change_mode = false) {} // Methods used in sorting (see LLConversationSort::operator()) EConversationType const getType() const { return mConvType; } diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index f7b7a6635e..5f1db0895c 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -413,7 +413,7 @@ void LLInvFVBridge::showProperties() } } -void LLInvFVBridge::navigateToFolder(bool new_window) +void LLInvFVBridge::navigateToFolder(bool new_window, bool change_mode) { if(new_window) { @@ -421,21 +421,21 @@ void LLInvFVBridge::navigateToFolder(bool new_window) } else { - LLInventorySingleFolderPanel* panel = dynamic_cast(mInventoryPanel.get()); - if (!panel) + if(change_mode) { - return; - } - LLInventoryModel* model = getInventoryModel(); - if (!model) - { - return; + LLInventoryPanel::setSFViewAndOpenFolder(mInventoryPanel.get(), mUUID); } - if (mUUID.isNull()) + else { - return; + LLInventorySingleFolderPanel* panel = dynamic_cast(mInventoryPanel.get()); + if (!panel || !getInventoryModel() || mUUID.isNull()) + { + return; + } + + panel->changeFolderRoot(mUUID); } - panel->changeFolderRoot(mUUID); + } } diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index b2cc33aadd..958d284854 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(bool new_window = false); + virtual void navigateToFolder(bool new_window = false, bool change_mode = false); virtual void showProperties(); virtual BOOL isItemRenameable() const { return TRUE; } virtual BOOL isMultiPreviewAllowed() { return TRUE; } diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 77588c8716..82f791a171 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -1831,6 +1831,24 @@ void LLInventoryPanel::openInventoryPanelAndSetSelection(BOOL auto_open, const L } } +void LLInventoryPanel::setSFViewAndOpenFolder(const LLInventoryPanel* panel, const LLUUID& folder_id) +{ + + LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("inventory"); + for (LLFloaterReg::const_instance_list_t::const_iterator iter = inst_list.begin(); iter != inst_list.end(); ++iter) + { + LLFloaterSidePanelContainer* inventory_floater = dynamic_cast(*iter); + LLSidepanelInventory* sidepanel_inventory = inventory_floater->findChild("main_panel"); + + LLPanelMainInventory* main_inventory = sidepanel_inventory->getMainInventoryPanel(); + if (main_inventory && panel->hasAncestor(main_inventory) && !main_inventory->isSingleFolderMode()) + { + main_inventory->onViewModeClick(); + main_inventory->setSingleFolderViewRoot(folder_id, false); + } + } +} + void LLInventoryPanel::addHideFolderType(LLFolderType::EType folder_type) { getFilter().setFilterCategoryTypes(getFilter().getFilterCategoryTypes() & ~(1ULL << folder_type)); diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h index baaefe5dd7..e9eaaa232d 100644 --- a/indra/newview/llinventorypanel.h +++ b/indra/newview/llinventorypanel.h @@ -246,7 +246,7 @@ public: BOOL main_panel = FALSE, BOOL take_keyboard_focus = TAKE_FOCUS_YES, BOOL reset_filter = FALSE); - + static void setSFViewAndOpenFolder(const LLInventoryPanel* panel, const LLUUID& folder_id); void addItemID(const LLUUID& id, LLFolderViewItem* itemp); void removeItemID(const LLUUID& id); LLFolderViewItem* getItemByID(const LLUUID& id); diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index 0fd4eb0c15..5da53cc928 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -1321,10 +1321,13 @@ void LLPanelMainInventory::onForwardFolderClicked() mSingleFolderPanelInventory->onForwardFolder(); } -void LLPanelMainInventory::setSingleFolderViewRoot(const LLUUID& folder_id) +void LLPanelMainInventory::setSingleFolderViewRoot(const LLUUID& folder_id, bool clear_nav_history) { mSingleFolderPanelInventory->changeFolderRoot(folder_id); - mSingleFolderPanelInventory->clearNavigationHistory(); + if(clear_nav_history) + { + mSingleFolderPanelInventory->clearNavigationHistory(); + } } void LLPanelMainInventory::showActionMenu(LLMenuGL* menu, std::string spawning_view_name) diff --git a/indra/newview/llpanelmaininventory.h b/indra/newview/llpanelmaininventory.h index 85373d7de3..6382f44bc9 100644 --- a/indra/newview/llpanelmaininventory.h +++ b/indra/newview/llpanelmaininventory.h @@ -103,7 +103,7 @@ public: void onUpFolderClicked(); void onBackFolderClicked(); void onForwardFolderClicked(); - void setSingleFolderViewRoot(const LLUUID& folder_id); + void setSingleFolderViewRoot(const LLUUID& folder_id, bool clear_nav_history = true); bool isSingleFolderMode() { return mSingleFolderMode; } protected: diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp index c22915c3ab..1348996136 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(bool new_window = false) {} + virtual void navigateToFolder(bool new_window = false, bool change_mode = false) {} virtual BOOL isItemRenameable() const; virtual BOOL renameItem(const std::string& new_name); virtual BOOL isItemMovable() const; diff --git a/indra/newview/skins/default/xui/en/floater_inventory_settings.xml b/indra/newview/skins/default/xui/en/floater_inventory_settings.xml index c3e81a5523..bfac79ac46 100644 --- a/indra/newview/skins/default/xui/en/floater_inventory_settings.xml +++ b/indra/newview/skins/default/xui/en/floater_inventory_settings.xml @@ -4,10 +4,10 @@ can_minimize="true" can_resize="false" save_rect="true" - height="350" + height="370" width="370" name="inventory_settings" - title="Inventory settings"> + title="INVENTORY SETTINGS"> + @@ -92,7 +102,7 @@ layout="topleft" font="SansSerifMedium" left="60" - width="325" + width="300" height="45" name="single_double_click_setting">