diff options
author | gwigz <gwigz@users.noreply.github.com> | 2024-10-08 18:48:54 +0100 |
---|---|---|
committer | Erik Kundiman <erik@megapahit.org> | 2024-10-09 11:30:41 +0800 |
commit | 0bec080221e1002ef30b01215f7cdafd552c08f2 (patch) | |
tree | 0f0e946ad935fdc4fefe78f272b9ae4a1c1c6d17 /indra/newview | |
parent | 0efe72e7993a9a23a6f8952368548775cb0ea3ef (diff) |
Minimal favorite folder inventory feature
Utilizes the recent-ish "open in new window" functionality from `LLPanelMainInventory::newFolderWindow`
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/app_settings/commands.xml | 8 | ||||
-rw-r--r-- | indra/newview/app_settings/settings_per_account.xml | 11 | ||||
-rw-r--r-- | indra/newview/llinventorybridge.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llinventorygallerymenu.cpp | 25 | ||||
-rw-r--r-- | indra/newview/llinventorygallerymenu.h | 3 | ||||
-rw-r--r-- | indra/newview/llinventorypanel.cpp | 6 | ||||
-rw-r--r-- | indra/newview/llinventorypanel.h | 1 | ||||
-rw-r--r-- | indra/newview/llviewermenu.cpp | 57 | ||||
-rw-r--r-- | indra/newview/skins/default/textures/textures.xml | 1 | ||||
-rw-r--r-- | indra/newview/skins/default/textures/toolbar_icons/favorite_folder.png | bin | 0 -> 572 bytes | |||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_gallery_inventory.xml | 10 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_inventory.xml | 7 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_viewer.xml | 7 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/notifications.xml | 12 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/strings.xml | 2 |
15 files changed, 152 insertions, 0 deletions
diff --git a/indra/newview/app_settings/commands.xml b/indra/newview/app_settings/commands.xml index b47ceff446..f2ab740646 100644 --- a/indra/newview/app_settings/commands.xml +++ b/indra/newview/app_settings/commands.xml @@ -295,4 +295,12 @@ is_running_function="Floater.IsOpen" is_running_parameters="performance" /> + <command name="favoritefolder" + available_in_toybox="true" + icon="Command_FavoriteFolder_Icon" + label_ref="Command_FavoriteFolder_Label" + tooltip_ref="Command_FavoriteFolder_Tooltip" + execute_function="Inventory.OpenFavoriteFolder" + is_running_function="Inventory.IsFavoriteFolderOpen" + /> </commands> diff --git a/indra/newview/app_settings/settings_per_account.xml b/indra/newview/app_settings/settings_per_account.xml index 6b788dd78f..80a4bec57f 100644 --- a/indra/newview/app_settings/settings_per_account.xml +++ b/indra/newview/app_settings/settings_per_account.xml @@ -458,5 +458,16 @@ <key>Value</key> <integer>2</integer> </map> + <key>FavoriteFolder</key> + <map> + <key>Comment</key> + <string>Favorite inventory folder (UUID)</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>String</string> + <key>Value</key> + <string></string> + </map> </map> </llsd> diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index ca84c30b66..5ed79a6493 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -4413,6 +4413,8 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items { mWearables=true; } + + items.push_back(std::string("Set favorite folder")); } else { diff --git a/indra/newview/llinventorygallerymenu.cpp b/indra/newview/llinventorygallerymenu.cpp index dbf4821ca1..0c35a7f695 100644 --- a/indra/newview/llinventorygallerymenu.cpp +++ b/indra/newview/llinventorygallerymenu.cpp @@ -92,6 +92,7 @@ LLContextMenu* LLInventoryGalleryContextMenu::createMenu() registrar.add("Inventory.DoToSelected", boost::bind(&LLInventoryGalleryContextMenu::doToSelected, this, _2)); registrar.add("Inventory.FileUploadLocation", boost::bind(&LLInventoryGalleryContextMenu::fileUploadLocation, this, _2)); + registrar.add("Inventory.SetFavoriteFolder", boost::bind(&LLInventoryGalleryContextMenu::setFavoriteFolder, this)); registrar.add("Inventory.EmptyTrash", boost::bind(&LLInventoryModel::emptyFolderType, &gInventory, "ConfirmEmptyTrash", LLFolderType::FT_TRASH)); registrar.add("Inventory.EmptyLostAndFound", boost::bind(&LLInventoryModel::emptyFolderType, &gInventory, "ConfirmEmptyLostAndFound", LLFolderType::FT_LOST_AND_FOUND)); registrar.add("Inventory.DoCreate", [this](LLUICtrl*, const LLSD& data) @@ -110,6 +111,7 @@ LLContextMenu* LLInventoryGalleryContextMenu::createMenu() registrar.add("Inventory.Share", boost::bind(&LLAvatarActions::shareWithAvatars, uuids, gFloaterView->getParentFloater(mGallery))); enable_registrar.add("Inventory.CanSetUploadLocation", boost::bind(&LLInventoryGalleryContextMenu::canSetUploadLocation, this, _2)); + enable_registrar.add("Inventory.CanSetFavoriteFolder", boost::bind(&LLInventoryGalleryContextMenu::canSetFavoriteFolder, this)); enable_registrar.add("Inventory.EnvironmentEnabled", [](LLUICtrl*, const LLSD&) { @@ -504,6 +506,25 @@ bool LLInventoryGalleryContextMenu::canSetUploadLocation(const LLSD& userdata) return true; } +void LLInventoryGalleryContextMenu::setFavoriteFolder() +{ + gSavedPerAccountSettings.setString("FavoriteFolder", mUUIDs.front().asString()); +} + +bool LLInventoryGalleryContextMenu::canSetFavoriteFolder() +{ + if (mUUIDs.size() != 1) + { + return false; + } + LLInventoryCategory* cat = gInventory.getCategory(mUUIDs.front()); + if (!cat) + { + return false; + } + return true; +} + bool is_inbox_folder(LLUUID item_id) { const LLUUID inbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_INBOX); @@ -769,6 +790,8 @@ void LLInventoryGalleryContextMenu::updateMenuItemsVisibility(LLContextMenu* men items.push_back(std::string("upload_def")); } + items.push_back(std::string("Set favorite folder")); + if(is_outfits && !isRootFolder()) { items.push_back(std::string("New Outfit")); @@ -843,6 +866,8 @@ void LLInventoryGalleryContextMenu::updateMenuItemsVisibility(LLContextMenu* men { disabled_items.push_back(std::string("Copy")); } + + disabled_items.push_back(std::string("Set favorite folder")); } if((obj->getType() == LLAssetType::AT_SETTINGS) || ((obj->getType() <= LLAssetType::AT_GESTURE) diff --git a/indra/newview/llinventorygallerymenu.h b/indra/newview/llinventorygallerymenu.h index 7c3545432b..7f6598e171 100644 --- a/indra/newview/llinventorygallerymenu.h +++ b/indra/newview/llinventorygallerymenu.h @@ -49,6 +49,9 @@ protected: void fileUploadLocation(const LLSD& userdata); bool canSetUploadLocation(const LLSD& userdata); + void setFavoriteFolder(); + bool canSetFavoriteFolder(); + static void onRename(const LLSD& notification, const LLSD& response); private: diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 6d42145f6b..c7bd1d943a 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -185,6 +185,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.SetFavoriteFolder", boost::bind(&LLInventoryPanel::setFavoriteFolder, this)); mCommitCallbackRegistrar.add("Inventory.OpenNewFolderWindow", boost::bind(&LLInventoryPanel::openSingleViewInventory, this, LLUUID())); } @@ -1757,6 +1758,11 @@ void LLInventoryPanel::fileUploadLocation(const LLSD& userdata) } } +void LLInventoryPanel::setFavoriteFolder() +{ + gSavedPerAccountSettings.setString("FavoriteFolder", LLFolderBridge::sSelf.get()->getUUID().asString()); +} + void LLInventoryPanel::openSingleViewInventory(LLUUID folder_id) { LLPanelMainInventory::newFolderWindow(folder_id.isNull() ? LLFolderBridge::sSelf.get()->getUUID() : folder_id); diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h index 56909c8d98..ab17196e5f 100644 --- a/indra/newview/llinventorypanel.h +++ b/indra/newview/llinventorypanel.h @@ -225,6 +225,7 @@ public: void doCreate(const LLSD& userdata); bool beginIMSession(); void fileUploadLocation(const LLSD& userdata); + void setFavoriteFolder(); void openSingleViewInventory(LLUUID folder_id = LLUUID()); void purgeSelectedItems(); bool attachObject(const LLSD& userdata); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 58019d2e87..418c24a25e 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -39,6 +39,7 @@ #include "llfloaterreg.h" #include "llfloatersidepanelcontainer.h" #include "llinventorypanel.h" +#include "llsidepanelinventory.h" #include "llnotifications.h" #include "llnotificationsutil.h" #include "llviewereventrecorder.h" @@ -6913,6 +6914,59 @@ void handle_give_money_dialog() } } +LLFloaterSidePanelContainer* get_favorite_inventory_folder() +{ + LLUUID folder_id = LLUUID(gSavedPerAccountSettings.getString("FavoriteFolder")); + if (!folder_id.isNull()) + { + 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();) + { + LLFloaterSidePanelContainer* inventory_container = dynamic_cast<LLFloaterSidePanelContainer*>(*iter++); + if (inventory_container) + { + LLSidepanelInventory* sidepanel_inventory = dynamic_cast<LLSidepanelInventory*>(inventory_container->findChild<LLPanel>("main_panel", true)); + if (sidepanel_inventory) + { + LLPanelMainInventory* main_inventory = sidepanel_inventory->getMainInventoryPanel(); + if (main_inventory && main_inventory->isSingleFolderMode() + && (main_inventory->getCurrentSFVRoot() == folder_id)) + { + return inventory_container; + } + } + } + } + } + + return NULL; +} + +void toggle_favorite_inventory_folder() +{ + LLUUID folder_id = LLUUID(gSavedPerAccountSettings.getString("FavoriteFolder")); + if ((folder_id.isNull()) || (!gInventory.getCategory(folder_id))) + { + LLNotificationsUtil::add("MissingFavoriteFolder"); + return; + } + + LLFloaterSidePanelContainer* inventory_container = get_favorite_inventory_folder(); + if (inventory_container) + { + inventory_container->closeFloater(); + } + else + { + LLPanelMainInventory::newFolderWindow(folder_id); + } +} + +bool favorite_inventory_folder_visible() +{ + return (get_favorite_inventory_folder() != NULL); +} + bool enable_pay_avatar() { LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); @@ -10243,6 +10297,9 @@ void initialize_menus() commit.add("Inventory.NewWindow", boost::bind(&LLPanelMainInventory::newWindow)); + commit.add("Inventory.OpenFavoriteFolder", boost::bind(&toggle_favorite_inventory_folder)); + enable.add("Inventory.IsFavoriteFolderOpen", boost::bind(&favorite_inventory_folder_visible)); + enable.add("EnablePayObject", boost::bind(&enable_pay_object)); enable.add("EnablePayAvatar", boost::bind(&enable_pay_avatar)); enable.add("EnableEdit", boost::bind(&enable_object_edit)); diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index 11eafcb45d..4763396d50 100644 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -162,6 +162,7 @@ with the same filename but different name <texture name="Command_Speak_Icon" file_name="toolbar_icons/speak.png" preload="true" /> <texture name="Command_View_Icon" file_name="toolbar_icons/view.png" preload="true" /> <texture name="Command_Voice_Icon" file_name="toolbar_icons/nearbyvoice.png" preload="true" /> + <texture name="Command_FavoriteFolder_Icon" file_name="toolbar_icons/favorite_folder.png" preload="true" /> <texture name="Caret_Bottom_Icon" file_name="toolbar_icons/caret_bottom.png" preload="true" scale.left="1" scale.top="23" scale.right="15" scale.bottom="1" /> <texture name="Caret_Right_Icon" file_name="toolbar_icons/caret_right.png" preload="true" scale.left="5" scale.top="15" scale.right="28" scale.bottom="1" /> <texture name="Caret_Left_Icon" file_name="toolbar_icons/caret_left.png" preload="true" scale.left="1" scale.top="15" scale.right="23" scale.bottom="1" /> diff --git a/indra/newview/skins/default/textures/toolbar_icons/favorite_folder.png b/indra/newview/skins/default/textures/toolbar_icons/favorite_folder.png Binary files differnew file mode 100644 index 0000000000..811efffc0b --- /dev/null +++ b/indra/newview/skins/default/textures/toolbar_icons/favorite_folder.png diff --git a/indra/newview/skins/default/xui/en/menu_gallery_inventory.xml b/indra/newview/skins/default/xui/en/menu_gallery_inventory.xml index 16907d3577..99f84fe808 100644 --- a/indra/newview/skins/default/xui/en/menu_gallery_inventory.xml +++ b/indra/newview/skins/default/xui/en/menu_gallery_inventory.xml @@ -715,6 +715,16 @@ function="Inventory.CanSetUploadLocation" /> </menu_item_call> </menu> + <menu_item_call + label="Use as favorite folder" + layout="topleft" + name="Set favorite folder"> + <menu_item_call.on_click + function="Inventory.SetFavoriteFolder" + parameter="favorite" /> + <menu_item_call.on_visible + function="Inventory.CanSetFavoriteFolder" /> + </menu_item_call> <menu_item_separator layout="topleft" name="Marketplace Separator" /> diff --git a/indra/newview/skins/default/xui/en/menu_inventory.xml b/indra/newview/skins/default/xui/en/menu_inventory.xml index d8aac71dd5..a72f610abb 100644 --- a/indra/newview/skins/default/xui/en/menu_inventory.xml +++ b/indra/newview/skins/default/xui/en/menu_inventory.xml @@ -996,6 +996,13 @@ parameter="pbr_material" /> </menu_item_call> </menu> + <menu_item_call + label="Use as favorite folder" + layout="topleft" + name="Set favorite folder"> + <menu_item_call.on_click + function="Inventory.SetFavoriteFolder" /> + </menu_item_call> <menu_item_separator layout="topleft" name="Marketplace Separator" /> diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 911f61f346..5789b113c1 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -37,6 +37,13 @@ parameter="" /> </menu_item_call> <menu_item_call + label="Favorite Inventory Folder" + layout="topleft" + name="Favorite Folder"> + <menu_item_call.on_click + function="Inventory.OpenFavoriteFolder" /> + </menu_item_call> + <menu_item_call label="Places..." name="Places" shortcut="control|L"> diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 5ce73b2cfa..951903fe34 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -12583,4 +12583,16 @@ are wearing now. yestext="OK"/> </notification> + <notification + icon="alertmodal.tga" + name="MissingFavoriteFolder" + type="alertmodal"> +Favorite folder is missing. + +Select the "use as favorite folder" from a folder's menu to set it as the favorite folder. + <tag>fail</tag> + <usetemplate + name="okbutton" + yestext="OK"/> + </notification> </notifications> diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 232586636b..25779ca2c6 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -4212,6 +4212,7 @@ name="Command_360_Capture_Label">360 snapshot</string> <string name="Command_Speak_Label">Speak</string> <string name="Command_View_Label">Camera controls</string> <string name="Command_Voice_Label">Voice settings</string> + <string name="Command_FavoriteFolder_Label">Favorite folder</string> <string name="Command_360_Capture_Tooltip">Capture a 360 equirectangular image</string> @@ -4245,6 +4246,7 @@ name="Command_360_Capture_Tooltip">Capture a 360 equirectangular image</string> <string name="Command_Speak_Tooltip">Speak with people nearby using your microphone</string> <string name="Command_View_Tooltip">Changing camera angle</string> <string name="Command_Voice_Tooltip">Volume controls for calls and people near you in world</string> + <string name="Command_FavoriteFolder_Tooltip">Open your favorite inventory folder</string> <string name="Toolbar_Bottom_Tooltip">currently in your bottom toolbar</string> <string name="Toolbar_Left_Tooltip" >currently in your left toolbar</string> |