summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelmaininventory.cpp
diff options
context:
space:
mode:
authorMaxim Nikolenko <maximnproductengine@lindenlab.com>2023-03-21 17:47:26 +0200
committerMaxim Nikolenko <maximnproductengine@lindenlab.com>2023-03-21 17:47:26 +0200
commit1eab3247111e66a3b81153173d1624a5c1c9fb72 (patch)
tree3d5cfd8a5ee3bca5194fad8a9f27d519884e844e /indra/newview/llpanelmaininventory.cpp
parentb68a67491026a055f0de9df349508b9e60a200ed (diff)
SL-19379 WIP Gallery view Inventory: first pass
Diffstat (limited to 'indra/newview/llpanelmaininventory.cpp')
-rw-r--r--indra/newview/llpanelmaininventory.cpp157
1 files changed, 133 insertions, 24 deletions
diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp
index 9fab6e4d2e..a867077ab0 100644
--- a/indra/newview/llpanelmaininventory.cpp
+++ b/indra/newview/llpanelmaininventory.cpp
@@ -37,6 +37,7 @@
#include "llfilepicker.h"
#include "llinventorybridge.h"
#include "llinventoryfunctions.h"
+#include "llinventorygallery.h"
#include "llinventorymodelbackgroundfetch.h"
#include "llfiltereditor.h"
#include "llfloatersidepanelcontainer.h"
@@ -115,7 +116,9 @@ LLPanelMainInventory::LLPanelMainInventory(const LLPanel::Params& p)
mNeedUploadCost(true),
mMenuViewDefault(NULL),
mSingleFolderMode(false),
- mFolderRootChangedConnection()
+ mViewMode(VIEW_LIST),
+ mListViewRootUpdatedConnection(),
+ mGalleryRootUpdatedConnection()
{
// Menu Callbacks (non contex menus)
mCommitCallbackRegistrar.add("Inventory.DoToSelected", boost::bind(&LLPanelMainInventory::doToSelected, this, _2));
@@ -242,9 +245,12 @@ BOOL LLPanelMainInventory::postBuild()
mViewMenuButton = getChild<LLMenuButton>("view_btn");
mSingleFolderPanelInventory = getChild<LLInventorySingleFolderPanel>("single_folder_inv");
- mFolderRootChangedConnection = mSingleFolderPanelInventory->setRootChangedCallback(boost::bind(&LLPanelMainInventory::updateTitle, this));
+ 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();
const std::string texture_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getTextureUploadCost());
@@ -322,9 +328,13 @@ LLPanelMainInventory::~LLPanelMainInventory( void )
mMenuAddHandle.markDead();
}
- if (mFolderRootChangedConnection.connected())
+ if (mListViewRootUpdatedConnection.connected())
+ {
+ mListViewRootUpdatedConnection.disconnect();
+ }
+ if (mGalleryRootUpdatedConnection.connected())
{
- mFolderRootChangedConnection.disconnect();
+ mGalleryRootUpdatedConnection.disconnect();
}
}
@@ -635,10 +645,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;
@@ -863,8 +881,9 @@ void LLPanelMainInventory::updateItemcountText()
{
LLInventoryModel::cat_array_t *cats;
LLInventoryModel::item_array_t *items;
- gInventory.getDirectDescendentsOf(mSingleFolderPanelInventory->getSingleFolderRoot(), cats, 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);
@@ -1334,7 +1353,8 @@ void LLPanelMainInventory::toggleViewMode()
mSingleFolderMode = !mSingleFolderMode;
getChild<LLPanel>("default_inventory_panel")->setVisible(!mSingleFolderMode);
- getChild<LLPanel>("single_folder_inventory")->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"));
@@ -1362,7 +1382,10 @@ void LLPanelMainInventory::onViewModeClick()
LLUUID new_root_folder;
if(mSingleFolderMode)
{
- selected_folder = mSingleFolderPanelInventory->getSingleFolderRoot();
+ if(isListViewMode())
+ {
+ selected_folder = mSingleFolderPanelInventory->getSingleFolderRoot();
+ }
}
else
{
@@ -1413,33 +1436,57 @@ void LLPanelMainInventory::onViewModeClick()
void LLPanelMainInventory::onUpFolderClicked()
{
- const LLViewerInventoryCategory* cat = gInventory.getCategory(mSingleFolderPanelInventory->getSingleFolderRoot());
+ const LLViewerInventoryCategory* cat = gInventory.getCategory(getCurrentSFVRoot());
if (cat)
{
if (cat->getParentUUID().notNull())
{
- mSingleFolderPanelInventory->changeFolderRoot(cat->getParentUUID());
+ if(isListViewMode())
+ {
+ mSingleFolderPanelInventory->changeFolderRoot(cat->getParentUUID());
+ }
+ if(isGalleryViewMode())
+ {
+ mInventoryGalleryPanel->setRootFolder(cat->getParentUUID());
+ }
}
}
}
void LLPanelMainInventory::onBackFolderClicked()
{
- mSingleFolderPanelInventory->onBackwardFolder();
+ if(isListViewMode())
+ {
+ mSingleFolderPanelInventory->onBackwardFolder();
+ }
+ if(isGalleryViewMode())
+ {
+ mInventoryGalleryPanel->onBackwardFolder();
+ }
}
void LLPanelMainInventory::onForwardFolderClicked()
{
- mSingleFolderPanelInventory->onForwardFolder();
+ if(isListViewMode())
+ {
+ mSingleFolderPanelInventory->onForwardFolder();
+ }
+ if(isGalleryViewMode())
+ {
+ mInventoryGalleryPanel->onForwardFolder();
+ }
}
void LLPanelMainInventory::setSingleFolderViewRoot(const LLUUID& folder_id, bool clear_nav_history)
{
- mSingleFolderPanelInventory->changeFolderRoot(folder_id);
- if(clear_nav_history)
+ if(isListViewMode())
{
- mSingleFolderPanelInventory->clearNavigationHistory();
- updateNavButtons();
+ mSingleFolderPanelInventory->changeFolderRoot(folder_id);
+ if(clear_nav_history)
+ {
+ mSingleFolderPanelInventory->clearNavigationHistory();
+ updateNavButtons();
+ }
}
}
@@ -1638,7 +1685,16 @@ void LLPanelMainInventory::onCustomAction(const LLSD& userdata)
if (command_name == "include_links")
{
mActivePanel->getFilter().toggleSearchVisibilityLinks();
- }
+ }
+
+ if (command_name == "list_view")
+ {
+ setViewMode(VIEW_LIST);
+ }
+ if (command_name == "gallery_view")
+ {
+ setViewMode(VIEW_GALLERY);
+ }
}
void LLPanelMainInventory::onVisibilityChange( BOOL new_visibility )
@@ -1821,11 +1877,11 @@ BOOL LLPanelMainInventory::isActionChecked(const LLSD& userdata)
if (command_name == "list_view")
{
- return true;
+ return isListViewMode();
}
if (command_name == "gallery_view")
{
- return false;
+ return isGalleryViewMode();
}
if (command_name == "combination_view")
{
@@ -1862,7 +1918,7 @@ void LLPanelMainInventory::updateTitle()
{
if(mSingleFolderMode)
{
- const LLViewerInventoryCategory* cat = gInventory.getCategory(mSingleFolderPanelInventory->getSingleFolderRoot());
+ const LLViewerInventoryCategory* cat = gInventory.getCategory(getCurrentSFVRoot());
if (cat)
{
inventory_floater->setTitle(cat->getName());
@@ -1883,10 +1939,18 @@ void LLPanelMainInventory::updateTitle()
void LLPanelMainInventory::updateNavButtons()
{
- getChild<LLButton>("back_btn")->setEnabled(mSingleFolderPanelInventory->isBackwardAvailable());
- getChild<LLButton>("forward_btn")->setEnabled(mSingleFolderPanelInventory->isForwardAvailable());
-
- const LLViewerInventoryCategory* cat = gInventory.getCategory(mSingleFolderPanelInventory->getSingleFolderRoot());
+ 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);
}
@@ -1900,5 +1964,50 @@ LLSidepanelInventory* LLPanelMainInventory::getParentSidepanelInventory()
}
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);
+ }
+ }
+}
+
+LLUUID LLPanelMainInventory::getCurrentSFVRoot()
+{
+ if(isListViewMode())
+ {
+ return mSingleFolderPanelInventory->getSingleFolderRoot();
+ }
+ if(isGalleryViewMode())
+ {
+ return mInventoryGalleryPanel->getRootFolder();
+ }
+ return LLUUID::null;
+}
// List Commands //
////////////////////////////////////////////////////////////////////////////////