Redo start_folder to be like upstream has it now

start_folder in xmls must now be start_folder.name

This reverts commit 1405a7c103.
This commit is contained in:
Lirusaito
2019-03-04 13:16:48 -05:00
parent a62b7d5ce7
commit 4008cf519c
9 changed files with 45 additions and 38 deletions

View File

@@ -32,7 +32,7 @@ LFFloaterInvPanel::LFFloaterInvPanel(const LLUUID& cat_id, LLInventoryModel* mod
mCommitCallbackRegistrar.add("InvPanel.Search", boost::bind(&LLInventoryPanel::setFilterSubString, boost::ref(mPanel), _2));
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_inv_panel.xml");
LLPanel* panel = getChild<LLPanel>("placeholder_panel");
mPanel = new LLInventoryPanel("inv_panel", LLInventoryPanel::DEFAULT_SORT_ORDER, cat_id.asString(), panel->getRect(), model, true);
mPanel = new LLInventoryPanel("inv_panel", LLInventoryPanel::DEFAULT_SORT_ORDER, LLSD().with("id", cat_id), panel->getRect(), model, true);
mPanel->postBuild();
mPanel->setFollows(FOLLOWS_ALL);
mPanel->setEnabled(true);

View File

@@ -131,7 +131,7 @@ void LLInvPanelComplObserver::done()
LLInventoryPanel::LLInventoryPanel(const std::string& name,
const std::string& sort_order_setting,
const std::string& start_folder,
const LLSD& start_folder,
const LLRect& rect,
LLInventoryModel* inventory,
BOOL allow_multi_select,
@@ -159,32 +159,12 @@ LLInventoryPanel::LLInventoryPanel(const std::string& name,
setBackgroundOpaque(TRUE);
}
LLUUID getStartFolder(const std::string& start_folder)
{
if ("LIBRARY" == start_folder)
return gInventory.getLibraryRootFolderID();
const LLFolderType::EType preferred_type = LLViewerFolderType::lookupTypeFromNewCategoryName(start_folder);
return (preferred_type != LLFolderType::FT_NONE)
? gInventory.findCategoryUUIDForType(preferred_type, false)
: gInventory.getCategory(static_cast<LLUUID>(start_folder)) ? static_cast<LLUUID>(start_folder) // Singu Note: if start folder is an id of a folder, use it
: LLUUID::null;
}
void LLInventoryPanel::buildFolderView()
{
// Determine the root folder in case specified, and
// build the views starting with that folder.
//std::string start_folder_name(params.start_folder());
LLUUID root_id = getStartFolder(mStartFolder);
if ((root_id == LLUUID::null) && !mStartFolder.empty())
{
LL_WARNS() << "No category found that matches start_folder: " << mStartFolder << LL_ENDL;
root_id = LLUUID::generateNewID();
}
LLUUID root_id = getRootFolderID();
mStartFolder["id"] = root_id; // Cache this, so we don't waste time on future getRootFolderID calls
LLInvFVBridge* new_listener = mInvFVBridgeBuilder->createBridge(LLAssetType::AT_CATEGORY,
(mUseMarketplaceFolders/*mParams.use_marketplace_folders*/ ? LLAssetType::AT_MARKETPLACE_FOLDER : LLAssetType::AT_CATEGORY),
@@ -343,8 +323,14 @@ LLView* LLInventoryPanel::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFac
std::string sort_order(INHERIT_SORT_ORDER);
node->getAttributeString("sort_order", sort_order);
std::string start_folder;
node->getAttributeString("start_folder", start_folder);
LLSD start_folder;
std::string start;
if (node->getAttributeString("start_folder.name", start))
start_folder["name"] = start;
if (node->getAttributeString("start_folder.id", start))
start_folder["id"] = LLUUID(start);
if (node->getAttributeString("start_folder.type", start))
start_folder["type"] = start;
if(name == "Recent Items")
panel = new LLInventoryRecentItemsPanel(name, sort_order, start_folder,
@@ -707,11 +693,32 @@ const LLUUID LLInventoryPanel::getRootFolderID() const
}
else
{
root_id = getStartFolder(mStartFolder);
if (root_id.isNull())
if (mStartFolder.has("id"))
{
LL_WARNS() << "Could not find folder of type " << mStartFolder << LL_ENDL;
root_id.generateNewID();
root_id = mStartFolder["id"];
}
else
{
LLStringExplicit label(mStartFolder["name"]);
const LLFolderType::EType preferred_type = mStartFolder.has("type")
? LLFolderType::lookup(mStartFolder["type"])
: LLViewerFolderType::lookupTypeFromNewCategoryName(label);
if ("LIBRARY" == label)
{
root_id = gInventory.getLibraryRootFolderID();
}
else if (preferred_type != LLFolderType::FT_NONE)
{
//setLabel(label);
root_id = gInventory.findCategoryUUIDForType(preferred_type, false);
if (root_id.isNull())
{
LL_WARNS() << "Could not find folder for " << mStartFolder << LL_ENDL;
root_id.generateNewID();
}
}
}
}
return root_id;

View File

@@ -95,7 +95,7 @@ protected:
friend class LFFloaterInvPanel;
LLInventoryPanel(const std::string& name,
const std::string& sort_order_setting,
const std::string& start_folder,
const LLSD& start_folder,
const LLRect& rect,
LLInventoryModel* inventory,
BOOL allow_multi_select,
@@ -236,7 +236,7 @@ public:
void requestSort();
private:
const std::string mStartFolder;
LLSD mStartFolder;
bool mShowRootFolder;
bool mAllowDropOnRoot;
bool mAllowWear;

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<floater name="floater_inventory_favs.xml" title="Favorites" width="250" height="400" min_width="100" min_height="100" rect_control="FloaterFavoritesRect" can_close="true" can_minimize="true" can_resize="true">
<inventory_panel name="inventory_favs" start_folder="Favorites" follows="all" left="5" right="-5" top="-20" bottom="5" show_item_link_overlays="true"/>
<inventory_panel name="inventory_favs" start_folder.name="Favorites" follows="all" left="5" right="-5" top="-20" bottom="5" show_item_link_overlays="true"/>
</floater>

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<floater name="floater_my_outfits.xml" title="My Outfits" width="250" height="400" min_width="100" min_height="100" rect_control="FloaterMyOutfitsRect" can_close="true" can_minimize="true" can_resize="true">
<inventory_panel name="my_outfits" start_folder="My Outfits" follows="all" left="5" right="-5" top="-20" bottom="5" show_item_link_overlays="true"/>
<inventory_panel name="my_outfits" start_folder.name="My Outfits" follows="all" left="5" right="-5" top="-20" bottom="5" show_item_link_overlays="true"/>
</floater>

View File

@@ -9,7 +9,7 @@
height="370"
top="16"
left="0"
start_folder="Marketplace listings"
start_folder.name="Marketplace listings"
show_empty_message="true"
show_root_folder="false"
use_marketplace_folders="true"

View File

@@ -8,7 +8,7 @@
width="308"
height="370"
left_delta="0"
start_folder="Marketplace listings"
start_folder.name="Marketplace listings"
show_empty_message="true"
show_root_folder="false"
use_marketplace_folders="true"

View File

@@ -8,7 +8,7 @@
width="308"
height="370"
left_delta="0"
start_folder="Marketplace listings"
start_folder.name="Marketplace listings"
show_empty_message="true"
show_root_folder="false"
use_marketplace_folders="true"

View File

@@ -8,7 +8,7 @@
width="308"
height="370"
left_delta="0"
start_folder="Marketplace listings"
start_folder.name="Marketplace listings"
show_empty_message="true"
show_root_folder="false"
use_marketplace_folders="true"