SL-19274 Add new double-click option to Inventory settings

master
Maxim Nikolenko 2023-02-27 20:27:11 +02:00
parent cb7debd70d
commit f377e27f0b
12 changed files with 70 additions and 34 deletions

View File

@ -2077,11 +2077,16 @@ BOOL LLFolderViewFolder::handleDoubleClick( S32 x, S32 y, MASK mask )
}
if( !handled )
{
static LLUICachedControl<bool> double_click_new_window("MultiModeDoubleClickOpenWindow", false);
if (double_click_new_window)
static LLUICachedControl<U32> 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)
{

View File

@ -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; }

View File

@ -16909,14 +16909,14 @@
<key>Value</key>
<integer>0</integer>
</map>
<key>MultiModeDoubleClickOpenWindow</key>
<key>MultiModeDoubleClickFolder</key>
<map>
<key>Comment</key>
<string>Sets the action for Double-click on folder in multi-folder view (0 - expands and collapses folder, 1 - opens a new window)</string>
<string>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)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<string>U32</string>
<key>Value</key>
<integer>0</integer>
</map>

View File

@ -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; }

View File

@ -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<LLInventorySingleFolderPanel*>(mInventoryPanel.get());
if (!panel)
if(change_mode)
{
return;
LLInventoryPanel::setSFViewAndOpenFolder(mInventoryPanel.get(), mUUID);
}
LLInventoryModel* model = getInventoryModel();
if (!model)
else
{
return;
LLInventorySingleFolderPanel* panel = dynamic_cast<LLInventorySingleFolderPanel*>(mInventoryPanel.get());
if (!panel || !getInventoryModel() || mUUID.isNull())
{
return;
}
panel->changeFolderRoot(mUUID);
}
if (mUUID.isNull())
{
return;
}
panel->changeFolderRoot(mUUID);
}
}

View File

@ -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; }

View File

@ -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<LLFloaterSidePanelContainer*>(*iter);
LLSidepanelInventory* sidepanel_inventory = inventory_floater->findChild<LLSidepanelInventory>("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));

View File

@ -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);

View File

@ -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)

View File

@ -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:

View File

@ -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;

View File

@ -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">
<icon
follows="top|left"
height="18"
@ -33,14 +33,14 @@
Double-click on folder in multi-folder view:
</text>
<radio_group
control_name="MultiModeDoubleClickOpenWindow"
control_name="MultiModeDoubleClickFolder"
follows="left|top"
top_pad="8"
layout="topleft"
font="SansSerifMedium"
left="60"
width="325"
height="45"
width="300"
height="70"
name="multi_double_click_setting">
<radio_item
height="20"
@ -48,7 +48,7 @@
label_text.text_color="White"
follows="left|top"
layout="topleft"
name="false"
name="0"
width="200"/>
<radio_item
height="20"
@ -57,7 +57,17 @@
label_text.text_color="White"
layout="topleft"
left_delta="0"
name="true"
name="1"
top_pad ="5"
width="200" />
<radio_item
height="20"
follows="left|top"
label="Switch view"
label_text.text_color="White"
layout="topleft"
left_delta="0"
name="2"
top_pad ="5"
width="200" />
</radio_group>
@ -92,7 +102,7 @@
layout="topleft"
font="SansSerifMedium"
left="60"
width="325"
width="300"
height="45"
name="single_double_click_setting">
<radio_item
@ -135,7 +145,7 @@
layout="topleft"
font="SansSerifMedium"
left="60"
width="325"
width="300"
height="45"
name="find_original_settings">
<radio_item