Viewer#1301 Implement Inventory Favorites Tab WIP#2
parent
645811c6ef
commit
fc5e5327bc
|
|
@ -874,12 +874,20 @@ BOOL LLInventoryItem::exportLegacyStream(std::ostream& output_stream, BOOL inclu
|
|||
output_stream << "\t\tparent_id\t" << uuid_str << "\n";
|
||||
mPermissions.exportLegacyStream(output_stream);
|
||||
|
||||
if (mThumbnailUUID.notNull())
|
||||
bool needs_metadata = mThumbnailUUID.notNull() || mFavorite;
|
||||
if (needs_metadata)
|
||||
{
|
||||
// Max length is 255 chars, will have to export differently if it gets more data
|
||||
// Ex: use newline and toNotation (uses {}) for unlimited size
|
||||
LLSD metadata;
|
||||
metadata["thumbnail"] = LLSD().with("asset_id", mThumbnailUUID);
|
||||
if (mThumbnailUUID.notNull())
|
||||
{
|
||||
metadata["thumbnail"] = LLSD().with("asset_id", mThumbnailUUID);
|
||||
}
|
||||
if (mFavorite)
|
||||
{
|
||||
metadata["favorite"] = LLSD().with("toggled", mFavorite);
|
||||
}
|
||||
|
||||
output_stream << "\t\tmetadata\t";
|
||||
LLSDSerialize::toXML(metadata, output_stream);
|
||||
|
|
@ -1488,11 +1496,21 @@ BOOL LLInventoryCategory::exportLegacyStream(std::ostream& output_stream, BOOL)
|
|||
output_stream << "\t\ttype\t" << LLAssetType::lookup(mType) << "\n";
|
||||
output_stream << "\t\tpref_type\t" << LLFolderType::lookup(mPreferredType) << "\n";
|
||||
output_stream << "\t\tname\t" << mName.c_str() << "|\n";
|
||||
if (mThumbnailUUID.notNull())
|
||||
|
||||
bool needs_metadata = mThumbnailUUID.notNull() || mFavorite;
|
||||
if (needs_metadata)
|
||||
{
|
||||
// Only up to 255 chars
|
||||
LLSD metadata;
|
||||
metadata["thumbnail"] = LLSD().with("asset_id", mThumbnailUUID);
|
||||
if (mThumbnailUUID.notNull())
|
||||
{
|
||||
metadata["thumbnail"] = LLSD().with("asset_id", mThumbnailUUID);
|
||||
}
|
||||
if (mFavorite)
|
||||
{
|
||||
metadata["favorite"] = LLSD().with("toggled", mFavorite);
|
||||
}
|
||||
|
||||
output_stream << "\t\tmetadata\t";
|
||||
LLSDSerialize::toXML(metadata, output_stream);
|
||||
output_stream << "|\n";
|
||||
|
|
|
|||
|
|
@ -947,18 +947,7 @@ void LLInventoryPanel::initializeViews(F64 max_time)
|
|||
mBuildViewsEndTime = curent_time + max_time;
|
||||
|
||||
// init everything
|
||||
LLUUID root_id = getRootFolderID();
|
||||
if (root_id.notNull())
|
||||
{
|
||||
buildNewViews(getRootFolderID());
|
||||
}
|
||||
else
|
||||
{
|
||||
// Default case: always add "My Inventory" root first, "Library" root second
|
||||
// If we run out of time, this still should create root folders
|
||||
buildNewViews(gInventory.getRootFolderID()); // My Inventory
|
||||
buildNewViews(gInventory.getLibraryRootFolderID()); // Library
|
||||
}
|
||||
initRootContent();
|
||||
|
||||
if (mBuildViewsQueue.empty())
|
||||
{
|
||||
|
|
@ -991,6 +980,22 @@ void LLInventoryPanel::initializeViews(F64 max_time)
|
|||
}
|
||||
}
|
||||
|
||||
void LLInventoryPanel::initRootContent()
|
||||
{
|
||||
LLUUID root_id = getRootFolderID();
|
||||
if (root_id.notNull())
|
||||
{
|
||||
buildNewViews(getRootFolderID());
|
||||
}
|
||||
else
|
||||
{
|
||||
// Default case: always add "My Inventory" root first, "Library" root second
|
||||
// If we run out of time, this still should create root folders
|
||||
buildNewViews(gInventory.getRootFolderID()); // My Inventory
|
||||
buildNewViews(gInventory.getLibraryRootFolderID()); // Library
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LLFolderViewFolder * LLInventoryPanel::createFolderViewFolder(LLInvFVBridge * bridge, bool allow_drop)
|
||||
{
|
||||
|
|
@ -1248,6 +1253,7 @@ LLFolderViewItem* LLInventoryPanel::buildViewsTree(const LLUUID& id,
|
|||
{
|
||||
LLViewerInventoryCategory::cat_array_t* categories;
|
||||
LLViewerInventoryItem::item_array_t* items;
|
||||
//collectInventoryDescendants(id, categories, items);
|
||||
mInventory->lockDirectDescendentArrays(id, categories, items);
|
||||
|
||||
// Make sure panel won't lock in a loop over existing items if
|
||||
|
|
@ -1348,6 +1354,14 @@ LLFolderViewItem* LLInventoryPanel::buildViewsTree(const LLUUID& id,
|
|||
return folder_view_item;
|
||||
}
|
||||
|
||||
|
||||
/*void LLInventoryPanel::collectInventoryDescendants(const LLUUID& id,
|
||||
LLViewerInventoryCategory::cat_array_t*& categories,
|
||||
LLViewerInventoryItem::item_array_t*& items);
|
||||
{
|
||||
mInventory->lockDirectDescendentArrays(id, categories, items);
|
||||
}*/
|
||||
|
||||
// bit of a hack to make sure the inventory is open.
|
||||
void LLInventoryPanel::openStartFolderOrMyInventory()
|
||||
{
|
||||
|
|
@ -2250,6 +2264,9 @@ public:
|
|||
protected:
|
||||
LLInventoryFavoritesItemsPanel(const Params&);
|
||||
friend class LLUICtrlFactory;
|
||||
|
||||
void initRootContent(const LLUUID& id);
|
||||
void initRootContent() override;
|
||||
};
|
||||
|
||||
LLInventoryFavoritesItemsPanel::LLInventoryFavoritesItemsPanel(const Params& params)
|
||||
|
|
@ -2259,6 +2276,58 @@ LLInventoryFavoritesItemsPanel::LLInventoryFavoritesItemsPanel(const Params& par
|
|||
mInvFVBridgeBuilder = &FAVORITES_BUILDER;
|
||||
}
|
||||
|
||||
void LLInventoryFavoritesItemsPanel::initRootContent(const LLUUID& id)
|
||||
{
|
||||
LLViewerInventoryCategory::cat_array_t* categories;
|
||||
LLViewerInventoryItem::item_array_t* items;
|
||||
mInventory->lockDirectDescendentArrays(id, categories, items);
|
||||
|
||||
if (categories)
|
||||
{
|
||||
S32 count = categories->size();
|
||||
for (S32 i = 0; i < count; ++i)
|
||||
{
|
||||
LLViewerInventoryCategory* cat = categories->at(i);
|
||||
if (cat->getPreferredType() == LLFolderType::FT_TRASH)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (cat->getIsFavorite())
|
||||
{
|
||||
const LLUUID& parent_id = cat->getParentUUID();
|
||||
LLFolderViewItem* folder_view_item = getItemByID(cat->getUUID()); // Should be NULL
|
||||
|
||||
buildViewsTree(cat->getUUID(), parent_id, cat, folder_view_item, mFolderRoot.get(), BUILD_TIMELIMIT);
|
||||
}
|
||||
else // Todo: timelimits
|
||||
{
|
||||
initRootContent(cat->getUUID());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (items)
|
||||
{
|
||||
S32 count = items->size();
|
||||
for (S32 i = 0; i < count; ++i)
|
||||
{
|
||||
LLViewerInventoryItem* item = items->at(i);
|
||||
if (item->getIsFavorite() && typedViewsFilter(id, item))
|
||||
{
|
||||
const LLUUID& parent_id = item->getParentUUID();
|
||||
LLFolderViewItem* folder_view_item = getItemByID(id); // Should be NULL
|
||||
|
||||
buildViewsTree(item->getUUID(), parent_id, item, folder_view_item, mFolderRoot.get(), BUILD_TIMELIMIT);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LLInventoryFavoritesItemsPanel::initRootContent()
|
||||
{
|
||||
initRootContent(gInventory.getRootFolderID()); // My Inventory
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* LLInventorySingleFolderPanel */
|
||||
/************************************************************************/
|
||||
|
|
|
|||
|
|
@ -334,6 +334,7 @@ public:
|
|||
protected:
|
||||
// Builds the UI. Call this once the inventory is usable.
|
||||
void initializeViews(F64 max_time);
|
||||
virtual void initRootContent();
|
||||
|
||||
// Specific inventory colors
|
||||
static bool sColorSetInitialized;
|
||||
|
|
@ -371,7 +372,7 @@ protected:
|
|||
virtual LLFolderViewItem* createFolderViewItem(LLInvFVBridge * bridge);
|
||||
|
||||
boost::function<void(const std::deque<LLFolderViewItem*>& items, BOOL user_action)> mSelectionCallback;
|
||||
private:
|
||||
protected:
|
||||
// buildViewsTree does not include some checks and is meant
|
||||
// for recursive use, use buildNewViews() for first call
|
||||
LLFolderViewItem* buildViewsTree(const LLUUID& id,
|
||||
|
|
@ -394,6 +395,7 @@ private:
|
|||
EViewsInitializationState mViewsInitialized; // Whether views have been generated
|
||||
F64 mBuildViewsEndTime; // Stop building views past this timestamp
|
||||
std::deque<LLUUID> mBuildViewsQueue;
|
||||
std::deque<LLUUID> mBuildRootContent;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -199,9 +199,7 @@ BOOL LLPanelMainInventory::postBuild()
|
|||
if (favorites_panel)
|
||||
{
|
||||
favorites_panel->setSortOrder(gSavedSettings.getU32(LLInventoryPanel::DEFAULT_SORT_ORDER));
|
||||
favorites_panel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
|
||||
LLInventoryFilter& favorites_filter = favorites_panel->getFilter();
|
||||
favorites_filter.setFilterFavorites(LLInventoryFilter::FILTER_ONLY_FAVORITES);
|
||||
favorites_filter.setEmptyLookupMessage("InventoryNoMatchingFavorites");
|
||||
favorites_filter.markDefault();
|
||||
favorites_panel->setSelectCallback(boost::bind(&LLPanelMainInventory::onSelectionChange, this, favorites_panel, _1, _2));
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 474 B |
Binary file not shown.
|
After Width: | Height: | Size: 582 B |
|
|
@ -304,6 +304,8 @@ with the same filename but different name
|
|||
<texture name="Inv_CallingCard" file_name="icons/Inv_CallingCard.png" preload="false" />
|
||||
<texture name="Inv_Clothing" file_name="icons/Inv_Clothing.png" preload="false" />
|
||||
<texture name="Inv_Eye" file_name="icons/Inv_Eye.png" preload="false" />
|
||||
<texture name="Inv_Favorite_Star_Content" file_name="icons/Inv_Favorite_Star_Content.png" preload="false" />
|
||||
<texture name="Inv_Favorite_Star_Full" file_name="icons/Inv_Favorite_Star_Full.png" preload="false" />
|
||||
<texture name="Inv_FolderClosed" file_name="icons/Inv_FolderClosed.png" preload="false" />
|
||||
<texture name="Inv_FolderOpen" file_name="icons/Inv_FolderOpen.png" preload="false" />
|
||||
<texture name="Inv_Gesture" file_name="icons/Inv_Gesture.png" preload="false" />
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@
|
|||
bevel_style="none"
|
||||
scroll.reserve_scroll_corner="false">
|
||||
<folder folder_arrow_image="Folder_Arrow"
|
||||
favorite_image="Favorite_Star_Active"
|
||||
favorite_content_image="Favorite_Star_Off"
|
||||
favorite_image="Inv_Favorite_Star_Full"
|
||||
favorite_content_image="Inv_Favorite_Star_Content"
|
||||
folder_indentation="8"
|
||||
item_height="20"
|
||||
item_top_pad="4"
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<folder_view_item
|
||||
folder_arrow_image="Folder_Arrow"
|
||||
favorite_image="Favorite_Star_Active"
|
||||
favorite_content_image="Favorite_Star_Off"
|
||||
favorite_image="Inv_Favorite_Star_Full"
|
||||
favorite_content_image="Inv_Favorite_Star_Content"
|
||||
folder_indentation="8"
|
||||
item_height="20"
|
||||
item_top_pad="4"
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<inbox_folder_view_folder
|
||||
folder_arrow_image="Folder_Arrow"
|
||||
favorite_image="Favorite_Star_Active"
|
||||
favorite_content_image="Favorite_Star_Off"
|
||||
favorite_image="Inv_Favorite_Star_Full"
|
||||
favorite_content_image="Inv_Favorite_Star_Content"
|
||||
folder_indentation="8"
|
||||
item_height="20"
|
||||
item_top_pad="4"
|
||||
|
|
|
|||
Loading…
Reference in New Issue