summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelmaininventory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llpanelmaininventory.cpp')
-rw-r--r--indra/newview/llpanelmaininventory.cpp555
1 files changed, 500 insertions, 55 deletions
diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp
index 744d49ff57..c40c5930c4 100644
--- a/indra/newview/llpanelmaininventory.cpp
+++ b/indra/newview/llpanelmaininventory.cpp
@@ -37,8 +37,8 @@
#include "llfilepicker.h"
#include "llinventorybridge.h"
#include "llinventoryfunctions.h"
+#include "llinventorygallery.h"
#include "llinventorymodelbackgroundfetch.h"
-#include "llinventorypanel.h"
#include "llfiltereditor.h"
#include "llfloatersidepanelcontainer.h"
#include "llfloaterreg.h"
@@ -53,6 +53,7 @@
#include "llspinctrl.h"
#include "lltoggleablemenu.h"
#include "lltooldraganddrop.h"
+#include "lltrans.h"
#include "llviewermenu.h"
#include "llviewertexturelist.h"
#include "llsidepanelinventory.h"
@@ -113,7 +114,12 @@ LLPanelMainInventory::LLPanelMainInventory(const LLPanel::Params& p)
mMenuGearDefault(NULL),
mMenuVisibility(NULL),
mMenuAddHandle(),
- mNeedUploadCost(true)
+ mNeedUploadCost(true),
+ mMenuViewDefault(NULL),
+ mSingleFolderMode(false),
+ mViewMode(MODE_LIST),
+ mListViewRootUpdatedConnection(),
+ mGalleryRootUpdatedConnection()
{
// Menu Callbacks (non contex menus)
mCommitCallbackRegistrar.add("Inventory.DoToSelected", boost::bind(&LLPanelMainInventory::doToSelected, this, _2));
@@ -237,6 +243,14 @@ BOOL LLPanelMainInventory::postBuild()
mGearMenuButton = getChild<LLMenuButton>("options_gear_btn");
mVisibilityMenuButton = getChild<LLMenuButton>("options_visibility_btn");
+ mViewMenuButton = getChild<LLMenuButton>("view_btn");
+
+ mSingleFolderPanelInventory = getChild<LLInventorySingleFolderPanel>("single_folder_inv");
+ mListViewRootUpdatedConnection = mSingleFolderPanelInventory->setRootChangedCallback(boost::bind(&LLPanelMainInventory::updateTitle, this));
+ mSingleFolderPanelInventory->setSelectCallback(boost::bind(&LLPanelMainInventory::onSelectionChange, this, mSingleFolderPanelInventory, _1, _2));
+
+ mInventoryGalleryPanel = getChild<LLInventoryGallery>("gallery_view_inv");
+ mGalleryRootUpdatedConnection = mInventoryGalleryPanel->setRootChangedCallback(boost::bind(&LLPanelMainInventory::updateTitle, this));
initListCommandsHandlers();
@@ -308,12 +322,21 @@ LLPanelMainInventory::~LLPanelMainInventory( void )
gInventory.removeObserver(this);
delete mSavedFolderState;
- auto menu = mMenuAddHandle.get();
- if(menu)
- {
- menu->die();
- mMenuAddHandle.markDead();
- }
+ auto menu = mMenuAddHandle.get();
+ if(menu)
+ {
+ menu->die();
+ mMenuAddHandle.markDead();
+ }
+
+ if (mListViewRootUpdatedConnection.connected())
+ {
+ mListViewRootUpdatedConnection.disconnect();
+ }
+ if (mGalleryRootUpdatedConnection.connected())
+ {
+ mGalleryRootUpdatedConnection.disconnect();
+ }
}
LLInventoryPanel* LLPanelMainInventory::getAllItemsPanel()
@@ -362,6 +385,10 @@ BOOL LLPanelMainInventory::handleKeyHere(KEY key, MASK mask)
{
startSearch();
}
+ if(mSingleFolderMode && key == KEY_LEFT)
+ {
+ onBackFolderClicked();
+ }
}
return LLPanel::handleKeyHere(key, mask);
@@ -381,10 +408,17 @@ void LLPanelMainInventory::closeAllFolders()
getPanel()->getRootFolder()->closeAllFolders();
}
+S32 get_instance_num()
+{
+ static S32 instance_num = 0;
+ instance_num = (instance_num + 1) % S32_MAX;
+
+ return instance_num;
+}
+
void LLPanelMainInventory::newWindow()
{
- static S32 instance_num = 0;
- instance_num = (instance_num + 1) % S32_MAX;
+ S32 instance_num = get_instance_num();
if (!gAgentCamera.cameraMouselook())
{
@@ -392,10 +426,81 @@ void LLPanelMainInventory::newWindow()
}
}
+//static
+void LLPanelMainInventory::newFolderWindow(LLUUID folder_id, LLUUID item_to_select)
+{
+ 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->getSingleFolderViewRoot() == folder_id))
+ {
+ main_inventory->setFocus(true);
+ if(item_to_select.notNull())
+ {
+ sidepanel_inventory->getActivePanel()->setSelection(item_to_select, TAKE_FOCUS_YES);
+ }
+ return;
+ }
+ }
+ }
+ }
+
+ S32 instance_num = get_instance_num();
+
+ LLFloaterSidePanelContainer* inventory_container = LLFloaterReg::showTypedInstance<LLFloaterSidePanelContainer>("inventory", LLSD(instance_num));
+ 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->toggleViewMode();
+ if(folder_id.notNull())
+ {
+ main_inventory->setSingleFolderViewRoot(folder_id);
+ if(item_to_select.notNull())
+ {
+ sidepanel_inventory->getActivePanel()->setSelection(item_to_select, TAKE_FOCUS_YES);
+ }
+ }
+ }
+ }
+ }
+}
+
void LLPanelMainInventory::doCreate(const LLSD& userdata)
{
reset_inventory_filter();
- menu_create_inventory_item(getPanel(), NULL, userdata);
+ if(mSingleFolderMode)
+ {
+ if(isListViewMode())
+ {
+ LLFolderViewItem* current_folder = getActivePanel()->getRootFolder();
+ if (current_folder)
+ {
+ LLFolderBridge* bridge = (LLFolderBridge*)current_folder->getViewModelItem();
+ menu_create_inventory_item(getPanel(), bridge, userdata);
+ }
+ }
+ else if(isGalleryViewMode())
+ {
+ menu_create_inventory_item(NULL, mInventoryGalleryPanel->getRootFolder(), userdata);
+ }
+ }
+ else
+ {
+ menu_create_inventory_item(getPanel(), NULL, userdata);
+ }
}
void LLPanelMainInventory::resetFilters()
@@ -473,25 +578,47 @@ void LLPanelMainInventory::onSelectSearchType()
std::string new_type = mSearchTypeCombo->getValue();
if (new_type == "search_by_name")
{
- getActivePanel()->setSearchType(LLInventoryFilter::SEARCHTYPE_NAME);
+ setSearchType(LLInventoryFilter::SEARCHTYPE_NAME);
}
if (new_type == "search_by_creator")
{
- getActivePanel()->setSearchType(LLInventoryFilter::SEARCHTYPE_CREATOR);
+ setSearchType(LLInventoryFilter::SEARCHTYPE_CREATOR);
}
if (new_type == "search_by_description")
{
- getActivePanel()->setSearchType(LLInventoryFilter::SEARCHTYPE_DESCRIPTION);
+ setSearchType(LLInventoryFilter::SEARCHTYPE_DESCRIPTION);
}
if (new_type == "search_by_UUID")
{
- getActivePanel()->setSearchType(LLInventoryFilter::SEARCHTYPE_UUID);
+ setSearchType(LLInventoryFilter::SEARCHTYPE_UUID);
}
}
+void LLPanelMainInventory::setSearchType(LLInventoryFilter::ESearchType type)
+{
+ if(mSingleFolderMode && isGalleryViewMode())
+ {
+ mInventoryGalleryPanel->setSearchType(type);
+ }
+ else
+ {
+ getActivePanel()->setSearchType(type);
+ }
+}
+
void LLPanelMainInventory::updateSearchTypeCombo()
{
- LLInventoryFilter::ESearchType search_type = getActivePanel()->getSearchType();
+ LLInventoryFilter::ESearchType search_type(LLInventoryFilter::SEARCHTYPE_NAME);
+
+ if(mSingleFolderMode && isGalleryViewMode())
+ {
+ search_type = mInventoryGalleryPanel->getSearchType();
+ }
+ else
+ {
+ search_type = getActivePanel()->getSearchType();
+ }
+
switch(search_type)
{
case LLInventoryFilter::SEARCHTYPE_CREATOR:
@@ -537,7 +664,7 @@ void LLPanelMainInventory::onClearSearch()
}
// re-open folders that were initially open in case filter was active
- if (mActivePanel && (mFilterSubString.size() || initially_active))
+ if (mActivePanel && (mFilterSubString.size() || initially_active) && !mSingleFolderMode)
{
mSavedFolderState->setApply(TRUE);
mActivePanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState);
@@ -547,7 +674,7 @@ void LLPanelMainInventory::onClearSearch()
}
mFilterSubString = "";
- LLSidepanelInventory * sidepanel_inventory = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory");
+ LLSidepanelInventory * sidepanel_inventory = getParentSidepanelInventory();
if (sidepanel_inventory)
{
LLPanelMarketplaceInbox* inbox_panel = sidepanel_inventory->getChild<LLPanelMarketplaceInbox>("marketplace_inbox");
@@ -560,10 +687,18 @@ void LLPanelMainInventory::onClearSearch()
void LLPanelMainInventory::onFilterEdit(const std::string& search_string )
{
+ if(mSingleFolderMode && isGalleryViewMode())
+ {
+ mFilterSubString = search_string;
+ mInventoryGalleryPanel->setFilterSubString(mFilterSubString);
+ return;
+ }
+
if (search_string == "")
{
onClearSearch();
}
+
if (!mActivePanel)
{
return;
@@ -588,7 +723,7 @@ void LLPanelMainInventory::onFilterEdit(const std::string& search_string )
// set new filter string
setFilterSubString(mFilterSubString);
- LLSidepanelInventory * sidepanel_inventory = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory");
+ LLSidepanelInventory * sidepanel_inventory = getParentSidepanelInventory();
if (sidepanel_inventory)
{
LLPanelMarketplaceInbox* inbox_panel = sidepanel_inventory->getChild<LLPanelMarketplaceInbox>("marketplace_inbox");
@@ -643,7 +778,7 @@ void LLPanelMainInventory::onFilterEdit(const std::string& search_string )
void LLPanelMainInventory::onFilterSelected()
{
// Find my index
- mActivePanel = (LLInventoryPanel*)getChild<LLTabContainer>("inventory filter tabs")->getCurrentPanel();
+ mActivePanel = mSingleFolderMode ? getChild<LLInventoryPanel>("single_folder_inv") : (LLInventoryPanel*)getChild<LLTabContainer>("inventory filter tabs")->getCurrentPanel();
if (!mActivePanel)
{
@@ -661,6 +796,10 @@ void LLPanelMainInventory::onFilterSelected()
if (finder)
{
finder->changeFilter(&filter);
+ if (mSingleFolderMode)
+ {
+ finder->setTitle(getLocalizedRootName());
+ }
}
if (filter.isActive())
{
@@ -775,6 +914,18 @@ void LLPanelMainInventory::updateItemcountText()
{
text = getString("ItemcountUnknown", string_args);
}
+
+ if (mSingleFolderMode)
+ {
+ LLInventoryModel::cat_array_t *cats;
+ LLInventoryModel::item_array_t *items;
+
+ gInventory.getDirectDescendentsOf(getCurrentSFVRoot(), cats, items);
+
+ string_args["[ITEM_COUNT]"] = llformat("%d", items->size());
+ string_args["[CATEGORY_COUNT]"] = llformat("%d", cats->size());
+ text = getString("ItemcountCompleted", string_args);
+ }
mCounterCtrl->setValue(text);
mCounterCtrl->setToolTip(text);
@@ -811,6 +962,11 @@ void LLPanelMainInventory::toggleFindOptions()
parent_floater->addDependentFloater(mFinderHandle);
// start background fetch of folders
LLInventoryModelBackgroundFetch::instance().start();
+
+ if (mSingleFolderMode)
+ {
+ finder->setTitle(getLocalizedRootName());
+ }
}
else
{
@@ -1182,26 +1338,25 @@ void LLFloaterInventoryFinder::selectNoTypes(void* user_data)
void LLPanelMainInventory::initListCommandsHandlers()
{
- childSetAction("trash_btn", boost::bind(&LLPanelMainInventory::onTrashButtonClick, this));
childSetAction("add_btn", boost::bind(&LLPanelMainInventory::onAddButtonClick, this));
-
- mTrashButton = getChild<LLDragAndDropButton>("trash_btn");
- mTrashButton->setDragAndDropHandler(boost::bind(&LLPanelMainInventory::handleDragAndDropToTrash, this
- , _4 // BOOL drop
- , _5 // EDragAndDropType cargo_type
- , _7 // EAcceptance* accept
- ));
+ childSetAction("view_mode_btn", boost::bind(&LLPanelMainInventory::onViewModeClick, this));
+ childSetAction("up_btn", boost::bind(&LLPanelMainInventory::onUpFolderClicked, this));
+ childSetAction("back_btn", boost::bind(&LLPanelMainInventory::onBackFolderClicked, this));
+ childSetAction("forward_btn", boost::bind(&LLPanelMainInventory::onForwardFolderClicked, this));
mCommitCallbackRegistrar.add("Inventory.GearDefault.Custom.Action", boost::bind(&LLPanelMainInventory::onCustomAction, this, _2));
mEnableCallbackRegistrar.add("Inventory.GearDefault.Check", boost::bind(&LLPanelMainInventory::isActionChecked, this, _2));
mEnableCallbackRegistrar.add("Inventory.GearDefault.Enable", boost::bind(&LLPanelMainInventory::isActionEnabled, this, _2));
+ mEnableCallbackRegistrar.add("Inventory.GearDefault.Visible", boost::bind(&LLPanelMainInventory::isActionVisible, this, _2));
mMenuGearDefault = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_inventory_gear_default.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
- mGearMenuButton->setMenu(mMenuGearDefault, LLMenuButton::MP_TOP_LEFT, true);
+ mGearMenuButton->setMenu(mMenuGearDefault, LLMenuButton::MP_BOTTOM_LEFT, true);
+ mMenuViewDefault = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_inventory_view_default.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
+ mViewMenuButton->setMenu(mMenuViewDefault, LLMenuButton::MP_BOTTOM_LEFT, true);
LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_inventory_add.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
mMenuAddHandle = menu->getHandle();
mMenuVisibility = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_inventory_search_visibility.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
- mVisibilityMenuButton->setMenu(mMenuVisibility, LLMenuButton::MP_BOTTOM_LEFT, true);
+ mVisibilityMenuButton->setMenu(mMenuVisibility, LLMenuButton::MP_BOTTOM_LEFT, true);
// Update the trash button when selected item(s) get worn or taken off.
LLOutfitObserver::instance().addCOFChangedCallback(boost::bind(&LLPanelMainInventory::updateListCommands, this));
@@ -1209,9 +1364,6 @@ void LLPanelMainInventory::initListCommandsHandlers()
void LLPanelMainInventory::updateListCommands()
{
- bool trash_enabled = isActionEnabled("delete");
-
- mTrashButton->setEnabled(trash_enabled);
}
void LLPanelMainInventory::onAddButtonClick()
@@ -1230,6 +1382,158 @@ void LLPanelMainInventory::onAddButtonClick()
}
}
+void LLPanelMainInventory::toggleViewMode()
+{
+ mSingleFolderMode = !mSingleFolderMode;
+
+ getChild<LLPanel>("default_inventory_panel")->setVisible(!mSingleFolderMode);
+ getChild<LLPanel>("single_folder_inventory")->setVisible(mSingleFolderMode && isListViewMode());
+ getChild<LLPanel>("gallery_view_inventory")->setVisible(mSingleFolderMode && isGalleryViewMode());
+ getChild<LLLayoutPanel>("nav_buttons")->setVisible(mSingleFolderMode);
+ getChild<LLButton>("view_mode_btn")->setImageOverlay(mSingleFolderMode ? getString("default_mode_btn") : getString("single_folder_mode_btn"));
+
+ mActivePanel = mSingleFolderMode ? getChild<LLInventoryPanel>("single_folder_inv") : (LLInventoryPanel*)getChild<LLTabContainer>("inventory filter tabs")->getCurrentPanel();
+ updateTitle();
+ onFilterSelected();
+
+ LLSidepanelInventory* sidepanel_inventory = getParentSidepanelInventory();
+ if (sidepanel_inventory)
+ {
+ if(mSingleFolderMode)
+ {
+ sidepanel_inventory->hideInbox();
+ }
+ else
+ {
+ sidepanel_inventory->toggleInbox();
+ }
+ }
+}
+
+void LLPanelMainInventory::onViewModeClick()
+{
+ LLUUID selected_folder;
+ LLUUID new_root_folder;
+ if(mSingleFolderMode)
+ {
+ selected_folder = getCurrentSFVRoot();
+ }
+ else
+ {
+ LLFolderView* root = getActivePanel()->getRootFolder();
+ std::set<LLFolderViewItem*> selection_set = root->getSelectionList();
+ if (selection_set.size() == 1)
+ {
+ LLFolderViewItem* current_item = *selection_set.begin();
+ if (current_item)
+ {
+ const LLUUID& id = static_cast<LLFolderViewModelItemInventory*>(current_item->getViewModelItem())->getUUID();
+ if(gInventory.getCategory(id) != NULL)
+ {
+ new_root_folder = id;
+ }
+ else
+ {
+ const LLViewerInventoryItem* selected_item = gInventory.getItem(id);
+ if (selected_item && selected_item->getParentUUID().notNull())
+ {
+ new_root_folder = selected_item->getParentUUID();
+ selected_folder = id;
+ }
+ }
+ }
+ }
+ }
+
+ toggleViewMode();
+
+ if (mSingleFolderMode && new_root_folder.notNull())
+ {
+ setSingleFolderViewRoot(new_root_folder, true);
+ if(selected_folder.notNull() && isListViewMode())
+ {
+ getActivePanel()->setSelection(selected_folder, TAKE_FOCUS_YES);
+ }
+ }
+ else
+ {
+ if(selected_folder.notNull())
+ {
+ selectAllItemsPanel();
+ getActivePanel()->setSelection(selected_folder, TAKE_FOCUS_YES);
+ }
+ }
+}
+
+void LLPanelMainInventory::onUpFolderClicked()
+{
+ const LLViewerInventoryCategory* cat = gInventory.getCategory(getCurrentSFVRoot());
+ if (cat)
+ {
+ if (cat->getParentUUID().notNull())
+ {
+ if(isListViewMode())
+ {
+ mSingleFolderPanelInventory->changeFolderRoot(cat->getParentUUID());
+ }
+ if(isGalleryViewMode())
+ {
+ mInventoryGalleryPanel->setRootFolder(cat->getParentUUID());
+ }
+ }
+ }
+}
+
+void LLPanelMainInventory::onBackFolderClicked()
+{
+ if(isListViewMode())
+ {
+ mSingleFolderPanelInventory->onBackwardFolder();
+ }
+ if(isGalleryViewMode())
+ {
+ mInventoryGalleryPanel->onBackwardFolder();
+ }
+}
+
+void LLPanelMainInventory::onForwardFolderClicked()
+{
+ if(isListViewMode())
+ {
+ mSingleFolderPanelInventory->onForwardFolder();
+ }
+ if(isGalleryViewMode())
+ {
+ mInventoryGalleryPanel->onForwardFolder();
+ }
+}
+
+void LLPanelMainInventory::setSingleFolderViewRoot(const LLUUID& folder_id, bool clear_nav_history)
+{
+ if(isListViewMode())
+ {
+ mSingleFolderPanelInventory->changeFolderRoot(folder_id);
+ if(clear_nav_history)
+ {
+ mSingleFolderPanelInventory->clearNavigationHistory();
+ }
+ }
+ else if(isGalleryViewMode())
+ {
+ mInventoryGalleryPanel->setRootFolder(folder_id);
+ if(clear_nav_history)
+ {
+ mInventoryGalleryPanel->clearNavigationHistory();
+ }
+ }
+ updateNavButtons();
+}
+
+LLUUID LLPanelMainInventory::getSingleFolderViewRoot()
+{
+ return mSingleFolderPanelInventory->getSingleFolderRoot();
+}
+
void LLPanelMainInventory::showActionMenu(LLMenuGL* menu, std::string spawning_view_name)
{
if (menu)
@@ -1239,17 +1543,11 @@ void LLPanelMainInventory::showActionMenu(LLMenuGL* menu, std::string spawning_v
LLView* spawning_view = getChild<LLView> (spawning_view_name);
S32 menu_x, menu_y;
//show menu in co-ordinates of panel
- spawning_view->localPointToOtherView(0, spawning_view->getRect().getHeight(), &menu_x, &menu_y, this);
- menu_y += menu->getRect().getHeight();
+ spawning_view->localPointToOtherView(0, 0, &menu_x, &menu_y, this);
LLMenuGL::showPopup(this, menu, menu_x, menu_y);
}
}
-void LLPanelMainInventory::onTrashButtonClick()
-{
- onClipboardAction("delete");
-}
-
void LLPanelMainInventory::onClipboardAction(const LLSD& userdata)
{
std::string command_name = userdata.asString();
@@ -1278,6 +1576,7 @@ void LLPanelMainInventory::onCustomAction(const LLSD& userdata)
return;
const std::string command_name = userdata.asString();
+
if (command_name == "new_window")
{
newWindow();
@@ -1393,6 +1692,25 @@ void LLPanelMainInventory::onCustomAction(const LLSD& userdata)
LLFloaterReg::showInstance("linkreplace", params);
}
+ if (command_name == "close_inv_windows")
+ {
+ 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* iv = dynamic_cast<LLFloaterSidePanelContainer*>(*iter++);
+ if (iv)
+ {
+ iv->closeFloater();
+ }
+ }
+ LLFloaterReg::hideInstance("inventory_settings");
+ }
+
+ if (command_name == "toggle_search_outfits")
+ {
+ mActivePanel->getFilter().toggleSearchVisibilityOutfits();
+ }
+
if (command_name == "toggle_search_trash")
{
mActivePanel->getFilter().toggleSearchVisibilityTrash();
@@ -1406,7 +1724,16 @@ void LLPanelMainInventory::onCustomAction(const LLSD& userdata)
if (command_name == "include_links")
{
mActivePanel->getFilter().toggleSearchVisibilityLinks();
- }
+ }
+
+ if (command_name == "list_view")
+ {
+ setViewMode(MODE_LIST);
+ }
+ if (command_name == "gallery_view")
+ {
+ setViewMode(MODE_GALLERY);
+ }
}
void LLPanelMainInventory::onVisibilityChange( BOOL new_visibility )
@@ -1528,6 +1855,21 @@ BOOL LLPanelMainInventory::isActionEnabled(const LLSD& userdata)
return TRUE;
}
+bool LLPanelMainInventory::isActionVisible(const LLSD& userdata)
+{
+ const std::string param_str = userdata.asString();
+ if (param_str == "single_folder_view")
+ {
+ return mSingleFolderMode;
+ }
+ if (param_str == "multi_folder_view")
+ {
+ return !mSingleFolderMode;
+ }
+
+ return true;
+}
+
BOOL LLPanelMainInventory::isActionChecked(const LLSD& userdata)
{
U32 sort_order_mask = getActivePanel()->getSortOrder();
@@ -1552,6 +1894,11 @@ BOOL LLPanelMainInventory::isActionChecked(const LLSD& userdata)
return sort_order_mask & LLInventoryFilter::SO_SYSTEM_FOLDERS_TO_TOP;
}
+ if (command_name == "toggle_search_outfits")
+ {
+ return (mActivePanel->getFilter().getSearchVisibilityTypes() & LLInventoryFilter::VISIBILITY_OUTFITS) != 0;
+ }
+
if (command_name == "toggle_search_trash")
{
return (mActivePanel->getFilter().getSearchVisibilityTypes() & LLInventoryFilter::VISIBILITY_TRASH) != 0;
@@ -1567,21 +1914,20 @@ BOOL LLPanelMainInventory::isActionChecked(const LLSD& userdata)
return (mActivePanel->getFilter().getSearchVisibilityTypes() & LLInventoryFilter::VISIBILITY_LINKS) != 0;
}
- return FALSE;
-}
-
-bool LLPanelMainInventory::handleDragAndDropToTrash(BOOL drop, EDragAndDropType cargo_type, EAcceptance* accept)
-{
- *accept = ACCEPT_NO;
-
- const bool is_enabled = isActionEnabled("delete");
- if (is_enabled) *accept = ACCEPT_YES_MULTI;
+ if (command_name == "list_view")
+ {
+ return isListViewMode();
+ }
+ if (command_name == "gallery_view")
+ {
+ return isGalleryViewMode();
+ }
+ if (command_name == "combination_view")
+ {
+ return false;
+ }
- if (is_enabled && drop)
- {
- onClipboardAction("delete");
- }
- return true;
+ return FALSE;
}
void LLPanelMainInventory::setUploadCostIfNeeded()
@@ -1604,5 +1950,104 @@ bool LLPanelMainInventory::hasSettingsInventory()
return LLEnvironment::instance().isInventoryEnabled();
}
+void LLPanelMainInventory::updateTitle()
+{
+ LLFloater* inventory_floater = gFloaterView->getParentFloater(this);
+ if(inventory_floater)
+ {
+ if(mSingleFolderMode)
+ {
+ inventory_floater->setTitle(getLocalizedRootName());
+ LLFloaterInventoryFinder *finder = getFinder();
+ if (finder)
+ {
+ finder->setTitle(getLocalizedRootName());
+ }
+ }
+ else
+ {
+ inventory_floater->setTitle(getString("inventory_title"));
+ }
+ }
+ updateNavButtons();
+}
+
+void LLPanelMainInventory::updateNavButtons()
+{
+ if(isListViewMode())
+ {
+ getChild<LLButton>("back_btn")->setEnabled(mSingleFolderPanelInventory->isBackwardAvailable());
+ getChild<LLButton>("forward_btn")->setEnabled(mSingleFolderPanelInventory->isForwardAvailable());
+ }
+ if(isGalleryViewMode())
+ {
+ getChild<LLButton>("back_btn")->setEnabled(mInventoryGalleryPanel->isBackwardAvailable());
+ getChild<LLButton>("forward_btn")->setEnabled(mInventoryGalleryPanel->isForwardAvailable());
+ }
+
+ const LLViewerInventoryCategory* cat = gInventory.getCategory(getCurrentSFVRoot());
+ bool up_enabled = (cat && cat->getParentUUID().notNull());
+ getChild<LLButton>("up_btn")->setEnabled(up_enabled);
+}
+
+LLSidepanelInventory* LLPanelMainInventory::getParentSidepanelInventory()
+{
+ LLFloaterSidePanelContainer* inventory_container = dynamic_cast<LLFloaterSidePanelContainer*>(gFloaterView->getParentFloater(this));
+ if(inventory_container)
+ {
+ return dynamic_cast<LLSidepanelInventory*>(inventory_container->findChild<LLPanel>("main_panel", true));
+ }
+ return NULL;
+}
+
+void LLPanelMainInventory::setViewMode(EViewModeType mode)
+{
+ if(mode != mViewMode)
+ {
+ LLUUID cur_root = getCurrentSFVRoot();
+ mViewMode = mode;
+
+ getChild<LLPanel>("single_folder_inventory")->setVisible(mSingleFolderMode && isListViewMode());
+ getChild<LLPanel>("gallery_view_inventory")->setVisible(mSingleFolderMode && isGalleryViewMode());
+
+ if(isListViewMode())
+ {
+ mSingleFolderPanelInventory->changeFolderRoot(cur_root);
+ mSingleFolderPanelInventory->setNavForwardList(mInventoryGalleryPanel->getNavForwardList());
+ mSingleFolderPanelInventory->setNavBackwardList(mInventoryGalleryPanel->getNavBackwardList());
+ }
+ if(isGalleryViewMode())
+ {
+ mInventoryGalleryPanel->setRootFolder(cur_root);
+ mInventoryGalleryPanel->setNavForwardList(mSingleFolderPanelInventory->getNavForwardList());
+ mInventoryGalleryPanel->setNavBackwardList(mSingleFolderPanelInventory->getNavBackwardList());
+ }
+ updateNavButtons();
+
+ if((isListViewMode() && (mActivePanel->getFilterSubString() != mFilterSubString)) ||
+ (isGalleryViewMode() && (mInventoryGalleryPanel->getFilterSubString() != mFilterSubString)))
+ {
+ onFilterEdit(mFilterSubString);
+ }
+ }
+}
+
+std::string LLPanelMainInventory::getLocalizedRootName()
+{
+ return mSingleFolderMode ? get_localized_folder_name(getCurrentSFVRoot()) : "";
+}
+
+LLUUID LLPanelMainInventory::getCurrentSFVRoot()
+{
+ if(isListViewMode())
+ {
+ return mSingleFolderPanelInventory->getSingleFolderRoot();
+ }
+ if(isGalleryViewMode())
+ {
+ return mInventoryGalleryPanel->getRootFolder();
+ }
+ return LLUUID::null;
+}
// List Commands //
////////////////////////////////////////////////////////////////////////////////