MAINT-5194 Visual Outfit Browser
1) Made code clean-up 2) Removed constants in code via #define and introduced parametres which can ne set in XML instead 3) Made refactoring of some methods 4) Removed non-functional item "Load assets" from outfit gear-menumaster
parent
51945162d2
commit
7ca8e984be
|
|
@ -45,21 +45,48 @@
|
|||
#include "llviewermenufile.h"
|
||||
#include "llwearableitemslist.h"
|
||||
|
||||
|
||||
static LLPanelInjector<LLOutfitGallery> t_outfit_gallery("outfit_gallery");
|
||||
static LLOutfitGallery* gOutfitGallery = NULL;
|
||||
|
||||
LLOutfitGallery::LLOutfitGallery()
|
||||
LLOutfitGallery::LLOutfitGallery(const LLOutfitGallery::Params& p)
|
||||
: LLOutfitListBase(),
|
||||
mTexturesObserver(NULL),
|
||||
mOutfitsObserver(NULL),
|
||||
mScrollPanel(NULL),
|
||||
mGalleryPanel(NULL),
|
||||
galleryCreated(false),
|
||||
mGalleryCreated(false),
|
||||
mRowCount(0),
|
||||
mItemsAddedCount(0),
|
||||
mOutfitLinkPending(NULL)
|
||||
mOutfitLinkPending(NULL),
|
||||
mRowPanelHeight(p.row_panel_height),
|
||||
mVerticalGap(p.vertical_gap),
|
||||
mHorizontalGap(p.horizontal_gap),
|
||||
mItemWidth(p.item_width),
|
||||
mItemHeight(p.item_height),
|
||||
mItemHorizontalGap(p.item_horizontal_gap),
|
||||
mItemsInRow(p.items_in_row)
|
||||
{
|
||||
mRowPanelWidth = p.row_panel_width_factor * mItemsInRow;
|
||||
mGalleryWidth = p.gallery_width_factor * mItemsInRow;
|
||||
}
|
||||
|
||||
LLOutfitGallery::Params::Params()
|
||||
: row_panel_height("row_panel_height", 180),
|
||||
vertical_gap("vertical_gap", 10),
|
||||
horizontal_gap("horizontal_gap", 10),
|
||||
item_width("item_width", 150),
|
||||
item_height("item_height", 175),
|
||||
item_horizontal_gap("item_horizontal_gap", 16),
|
||||
items_in_row("items_in_row", 3),
|
||||
row_panel_width_factor("row_panel_width_factor", 166),
|
||||
gallery_width_factor("gallery_width_factor", 163)
|
||||
{
|
||||
addSynonym(row_panel_height, "row_height");
|
||||
}
|
||||
|
||||
const LLOutfitGallery::Params& LLOutfitGallery::getDefaultParams()
|
||||
{
|
||||
return LLUICtrlFactory::getDefaultParams<LLOutfitGallery>();
|
||||
}
|
||||
|
||||
BOOL LLOutfitGallery::postBuild()
|
||||
|
|
@ -73,7 +100,7 @@ BOOL LLOutfitGallery::postBuild()
|
|||
void LLOutfitGallery::onOpen(const LLSD& info)
|
||||
{
|
||||
LLOutfitListBase::onOpen(info);
|
||||
if (!galleryCreated)
|
||||
if (!mGalleryCreated)
|
||||
{
|
||||
loadPhotos();
|
||||
uuid_vec_t cats;
|
||||
|
|
@ -85,26 +112,16 @@ void LLOutfitGallery::onOpen(const LLSD& info)
|
|||
{
|
||||
addToGallery(mOutfitMap[cats[i]]);
|
||||
}
|
||||
galleryCreated = true;
|
||||
mGalleryCreated = true;
|
||||
}
|
||||
}
|
||||
|
||||
#define LAYOUT_STACK_HEIGHT 180
|
||||
#define GALLERY_VERTICAL_GAP 10
|
||||
#define GALLERY_HORIZONTAL_GAP 10
|
||||
#define GALLERY_ITEM_WIDTH 150
|
||||
#define GALLERY_ITEM_HEIGHT 175
|
||||
#define GALLERY_ITEM_HGAP 16
|
||||
#define ITEMS_IN_ROW 3
|
||||
#define LAYOUT_STACK_WIDTH 166 * ITEMS_IN_ROW//498
|
||||
#define GALLERY_WIDTH 163 * ITEMS_IN_ROW//485//290
|
||||
|
||||
LLPanel* LLOutfitGallery::addLastRow()
|
||||
{
|
||||
mRowCount++;
|
||||
int row = 0;
|
||||
int vgap = GALLERY_VERTICAL_GAP * row;
|
||||
LLPanel* result = buildLayoutStak(0, row * LAYOUT_STACK_HEIGHT + vgap);
|
||||
int vgap = mVerticalGap * row;
|
||||
LLPanel* result = buildRowPanel(0, row * mRowPanelHeight + vgap);
|
||||
mGalleryPanel->addChild(result);
|
||||
return result;
|
||||
}
|
||||
|
|
@ -121,24 +138,24 @@ void LLOutfitGallery::moveRowDown(int row)
|
|||
|
||||
void LLOutfitGallery::moveRow(int row, int pos)
|
||||
{
|
||||
int vgap = GALLERY_VERTICAL_GAP * pos;
|
||||
moveLayoutStak(mStacks[row], 0, pos * LAYOUT_STACK_HEIGHT + vgap);
|
||||
int vgap = mVerticalGap * pos;
|
||||
moveRowPanel(mRowPanels[row], 0, pos * mRowPanelHeight + vgap);
|
||||
}
|
||||
|
||||
void LLOutfitGallery::removeLastRow()
|
||||
{
|
||||
mRowCount--;
|
||||
mGalleryPanel->removeChild(mLastRowStack);
|
||||
mStacks.pop_back();
|
||||
mLastRowStack = mStacks.back();
|
||||
mGalleryPanel->removeChild(mLastRowPanel);
|
||||
mRowPanels.pop_back();
|
||||
mLastRowPanel = mRowPanels.back();
|
||||
}
|
||||
|
||||
LLPanel* LLOutfitGallery::addToRow(LLPanel* row_stack, LLOutfitGalleryItem* item, int pos, int hgap)
|
||||
{
|
||||
LLPanel* lpanel = buildLayoutPanel(pos * GALLERY_ITEM_WIDTH + hgap);
|
||||
LLPanel* lpanel = buildItemPanel(pos * mItemWidth + hgap);
|
||||
lpanel->addChild(item);
|
||||
row_stack->addChild(lpanel);
|
||||
mPanels.push_back(lpanel);
|
||||
mItemPanels.push_back(lpanel);
|
||||
return lpanel;
|
||||
}
|
||||
|
||||
|
|
@ -147,9 +164,9 @@ void LLOutfitGallery::addToGallery(LLOutfitGalleryItem* item)
|
|||
mItemsAddedCount++;
|
||||
mItemIndexMap[item] = mItemsAddedCount - 1;
|
||||
int n = mItemsAddedCount;
|
||||
int row_count = (n % ITEMS_IN_ROW) == 0 ? n / ITEMS_IN_ROW : n / ITEMS_IN_ROW + 1;
|
||||
int row_count = (n % mItemsInRow) == 0 ? n / mItemsInRow : n / mItemsInRow + 1;
|
||||
int n_prev = n - 1;
|
||||
int row_count_prev = (n_prev % ITEMS_IN_ROW) == 0 ? n_prev / ITEMS_IN_ROW : n_prev / ITEMS_IN_ROW + 1;
|
||||
int row_count_prev = (n_prev % mItemsInRow) == 0 ? n_prev / mItemsInRow : n_prev / mItemsInRow + 1;
|
||||
|
||||
bool add_row = row_count != row_count_prev;
|
||||
int pos = 0;
|
||||
|
|
@ -159,12 +176,12 @@ void LLOutfitGallery::addToGallery(LLOutfitGalleryItem* item)
|
|||
{
|
||||
moveRowUp(i);
|
||||
}
|
||||
mLastRowStack = addLastRow();
|
||||
mStacks.push_back(mLastRowStack);
|
||||
mLastRowPanel = addLastRow();
|
||||
mRowPanels.push_back(mLastRowPanel);
|
||||
}
|
||||
pos = (n - 1) % ITEMS_IN_ROW;
|
||||
pos = (n - 1) % mItemsInRow;
|
||||
mItems.push_back(item);
|
||||
addToRow(mLastRowStack, item, pos, GALLERY_HORIZONTAL_GAP * pos);
|
||||
addToRow(mLastRowPanel, item, pos, mHorizontalGap * pos);
|
||||
reshapeGalleryPanel(row_count);
|
||||
}
|
||||
|
||||
|
|
@ -173,12 +190,11 @@ void LLOutfitGallery::removeFromGalleryLast(LLOutfitGalleryItem* item)
|
|||
{
|
||||
int n_prev = mItemsAddedCount;
|
||||
int n = mItemsAddedCount - 1;
|
||||
int row_count = (n % ITEMS_IN_ROW) == 0 ? n / ITEMS_IN_ROW : n / ITEMS_IN_ROW + 1;
|
||||
int row_count_prev = (n_prev % ITEMS_IN_ROW) == 0 ? n_prev / ITEMS_IN_ROW : n_prev / ITEMS_IN_ROW + 1;
|
||||
int row_count = (n % mItemsInRow) == 0 ? n / mItemsInRow : n / mItemsInRow + 1;
|
||||
int row_count_prev = (n_prev % mItemsInRow) == 0 ? n_prev / mItemsInRow : n_prev / mItemsInRow + 1;
|
||||
mItemsAddedCount--;
|
||||
|
||||
bool remove_row = row_count != row_count_prev;
|
||||
//int pos = (n_prev - 1) % ITEMS_IN_ROW;
|
||||
removeFromLastRow(mItems[mItemsAddedCount]);
|
||||
mItems.pop_back();
|
||||
if (remove_row)
|
||||
|
|
@ -214,16 +230,16 @@ void LLOutfitGallery::removeFromGalleryMiddle(LLOutfitGalleryItem* item)
|
|||
|
||||
void LLOutfitGallery::removeFromLastRow(LLOutfitGalleryItem* item)
|
||||
{
|
||||
mPanels.back()->removeChild(item);
|
||||
mLastRowStack->removeChild(mPanels.back());
|
||||
mPanels.pop_back();
|
||||
mItemPanels.back()->removeChild(item);
|
||||
mLastRowPanel->removeChild(mItemPanels.back());
|
||||
mItemPanels.pop_back();
|
||||
}
|
||||
|
||||
LLOutfitGalleryItem* LLOutfitGallery::buildGalleryItem(std::string name)
|
||||
{
|
||||
LLOutfitGalleryItem::Params giparams;
|
||||
LLOutfitGalleryItem* gitem = LLUICtrlFactory::create<LLOutfitGalleryItem>(giparams);
|
||||
gitem->reshape(GALLERY_ITEM_WIDTH, GALLERY_ITEM_HEIGHT);
|
||||
gitem->reshape(mItemWidth, mItemHeight);
|
||||
gitem->setVisible(true);
|
||||
gitem->setFollowsLeft();
|
||||
gitem->setFollowsTop();
|
||||
|
|
@ -242,42 +258,42 @@ void LLOutfitGallery::reshapeGalleryPanel(int row_count)
|
|||
{
|
||||
int bottom = 0;
|
||||
int left = 0;
|
||||
int height = row_count * (LAYOUT_STACK_HEIGHT + GALLERY_VERTICAL_GAP);
|
||||
LLRect rect = LLRect(left, bottom + height, left + GALLERY_WIDTH, bottom);
|
||||
int height = row_count * (mRowPanelHeight + mVerticalGap);
|
||||
LLRect rect = LLRect(left, bottom + height, left + mGalleryWidth, bottom);
|
||||
mGalleryPanel->setRect(rect);
|
||||
mGalleryPanel->reshape(GALLERY_WIDTH, height);
|
||||
mGalleryPanel->reshape(mGalleryWidth, height);
|
||||
mGalleryPanel->setVisible(true);
|
||||
mGalleryPanel->setFollowsLeft();
|
||||
mGalleryPanel->setFollowsTop();
|
||||
}
|
||||
|
||||
LLPanel* LLOutfitGallery::buildLayoutPanel(int left)
|
||||
LLPanel* LLOutfitGallery::buildItemPanel(int left)
|
||||
{
|
||||
LLPanel::Params lpparams;
|
||||
int top = 0;
|
||||
LLPanel* lpanel = LLUICtrlFactory::create<LLPanel>(lpparams);
|
||||
LLRect rect = LLRect(left, top + GALLERY_ITEM_HEIGHT, left + GALLERY_ITEM_WIDTH + GALLERY_ITEM_HGAP, top);
|
||||
LLRect rect = LLRect(left, top + mItemHeight, left + mItemWidth + mItemHorizontalGap, top);
|
||||
lpanel->setRect(rect);
|
||||
lpanel->reshape(GALLERY_ITEM_WIDTH + GALLERY_ITEM_HGAP, GALLERY_ITEM_HEIGHT);
|
||||
lpanel->reshape(mItemWidth + mItemHorizontalGap, mItemHeight);
|
||||
lpanel->setVisible(true);
|
||||
lpanel->setFollowsLeft();
|
||||
lpanel->setFollowsTop();
|
||||
return lpanel;
|
||||
}
|
||||
|
||||
LLPanel* LLOutfitGallery::buildLayoutStak(int left, int bottom)
|
||||
LLPanel* LLOutfitGallery::buildRowPanel(int left, int bottom)
|
||||
{
|
||||
LLPanel::Params sparams;
|
||||
LLPanel* stack = LLUICtrlFactory::create<LLPanel>(sparams);
|
||||
moveLayoutStak(stack, left, bottom);
|
||||
moveRowPanel(stack, left, bottom);
|
||||
return stack;
|
||||
}
|
||||
|
||||
void LLOutfitGallery::moveLayoutStak(LLPanel* stack, int left, int bottom)
|
||||
void LLOutfitGallery::moveRowPanel(LLPanel* stack, int left, int bottom)
|
||||
{
|
||||
LLRect rect = LLRect(left, bottom + LAYOUT_STACK_HEIGHT, left + LAYOUT_STACK_WIDTH, bottom);
|
||||
LLRect rect = LLRect(left, bottom + mRowPanelHeight, left + mRowPanelWidth, bottom);
|
||||
stack->setRect(rect);
|
||||
stack->reshape(LAYOUT_STACK_WIDTH, LAYOUT_STACK_HEIGHT);
|
||||
stack->reshape(mRowPanelWidth, mRowPanelHeight);
|
||||
stack->setVisible(true);
|
||||
stack->setFollowsLeft();
|
||||
stack->setFollowsTop();
|
||||
|
|
@ -290,6 +306,12 @@ LLOutfitGallery::~LLOutfitGallery()
|
|||
gInventory.removeObserver(mTexturesObserver);
|
||||
}
|
||||
delete mTexturesObserver;
|
||||
|
||||
if (gInventory.containsObserver(mOutfitsObserver))
|
||||
{
|
||||
gInventory.removeObserver(mOutfitsObserver);
|
||||
}
|
||||
delete mOutfitsObserver;
|
||||
}
|
||||
|
||||
void LLOutfitGallery::setFilterSubString(const std::string& string)
|
||||
|
|
@ -340,7 +362,7 @@ void LLOutfitGallery::updateAddedCategory(LLUUID cat_id)
|
|||
_1, _2, _3, cat_id));
|
||||
LLWearableItemsList* list = NULL;
|
||||
item->setFocusReceivedCallback(boost::bind(&LLOutfitListBase::ChangeOutfitSelection, this, list, cat_id));
|
||||
if (galleryCreated)
|
||||
if (mGalleryCreated)
|
||||
{
|
||||
addToGallery(item);
|
||||
}
|
||||
|
|
@ -355,7 +377,7 @@ void LLOutfitGallery::updateAddedCategory(LLUUID cat_id)
|
|||
gInventory.addObserver(mOutfitsObserver);
|
||||
}
|
||||
|
||||
// Start observing changes in "My Outits" category.
|
||||
// Start observing changes in "My Outfits" category.
|
||||
mOutfitsObserver->addCategory(cat_id,
|
||||
boost::bind(&LLOutfitGallery::refreshOutfit, this, cat_id));
|
||||
|
||||
|
|
@ -376,7 +398,7 @@ void LLOutfitGallery::updateRemovedCategory(LLUUID cat_id)
|
|||
|
||||
// An outfit is removed from the list. Do the following:
|
||||
// 2. Remove the outfit from selection.
|
||||
//deselectOutfit(outfit_id);
|
||||
deselectOutfit(cat_id);
|
||||
|
||||
// 3. Remove category UUID to accordion tab mapping.
|
||||
mOutfitMap.erase(outfits_iter);
|
||||
|
|
@ -384,8 +406,6 @@ void LLOutfitGallery::updateRemovedCategory(LLUUID cat_id)
|
|||
// 4. Remove outfit from gallery.
|
||||
removeFromGalleryMiddle(item);
|
||||
|
||||
|
||||
|
||||
// kill removed item
|
||||
if (item != NULL)
|
||||
{
|
||||
|
|
@ -479,7 +499,6 @@ BOOL LLOutfitGalleryItem::postBuild()
|
|||
void LLOutfitGalleryItem::draw()
|
||||
{
|
||||
LLPanel::draw();
|
||||
|
||||
|
||||
// Draw border
|
||||
LLUIColor border_color = LLUIColorTable::instance().getColor(mSelected ? "OutfitGalleryItemSelected" : "OutfitGalleryItemUnselected", LLColor4::white);
|
||||
|
|
@ -491,12 +510,6 @@ void LLOutfitGalleryItem::draw()
|
|||
const F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency();
|
||||
if (mTexturep)
|
||||
{
|
||||
//if (mTexturep->getComponents() == 4)
|
||||
//{
|
||||
// gl_rect_2d_checkerboard(interior, alpha);
|
||||
//}
|
||||
|
||||
// Interior
|
||||
LLRect interior = border;
|
||||
interior.stretch(-1);
|
||||
|
||||
|
|
@ -516,8 +529,6 @@ void LLOutfitGalleryItem::setOutfitName(std::string name)
|
|||
void LLOutfitGalleryItem::setOutfitWorn(bool value)
|
||||
{
|
||||
mWorn = value;
|
||||
//LLStringUtil::format_map_t string_args;
|
||||
//std::string worn_text = getString("worn_text", string_args);
|
||||
LLStringUtil::format_map_t worn_string_args;
|
||||
std::string worn_string = getString("worn_string", worn_string_args);
|
||||
LLUIColor text_color = LLUIColorTable::instance().getColor(mSelected ? "White" : (mWorn ? "OutfitGalleryItemWorn" : "White"), LLColor4::white);
|
||||
|
|
@ -547,11 +558,6 @@ void LLOutfitGalleryItem::setImageAssetId(LLUUID image_asset_id)
|
|||
|
||||
void LLOutfitGalleryItem::setDefaultImage()
|
||||
{
|
||||
/*
|
||||
LLUUID imageAssetID("e417f443-a199-bac1-86b0-0530e177fb54");
|
||||
mTexturep = LLViewerTextureManager::getFetchedTexture(imageAssetID);
|
||||
mTexturep->setBoostLevel(LLGLTexture::BOOST_PREVIEW);
|
||||
*/
|
||||
mTexturep = NULL;
|
||||
}
|
||||
|
||||
|
|
@ -580,15 +586,6 @@ void LLOutfitGalleryGearMenu::onUploadFoto()
|
|||
}
|
||||
}
|
||||
|
||||
void LLOutfitGalleryGearMenu::onLoadAssets()
|
||||
{
|
||||
LLOutfitGallery* gallery = dynamic_cast<LLOutfitGallery*>(mOutfitList);
|
||||
if (gallery != NULL)
|
||||
{
|
||||
gallery->loadPhotos();
|
||||
}
|
||||
}
|
||||
|
||||
void LLOutfitGallery::loadPhotos()
|
||||
{
|
||||
//Iterate over inventory
|
||||
|
|
@ -692,26 +689,6 @@ void LLOutfitGallery::refreshTextures(const LLUUID& category_id)
|
|||
}
|
||||
}
|
||||
|
||||
void LLOutfitGallery::onLoadComplete(LLVFS *vfs, const LLUUID& asset_uuid, LLAssetType::EType type, void* user_data, S32 status, LLExtStat ext_status)
|
||||
{
|
||||
LL_WARNS() << "asset_uuid: " << asset_uuid.asString() << LL_ENDL;
|
||||
|
||||
LLUUID* outfit_id = (LLUUID*)user_data;
|
||||
if (!user_data)
|
||||
return;
|
||||
LL_WARNS() << "outfit_id: " << outfit_id->asString() << LL_ENDL;
|
||||
|
||||
outfit_map_t::iterator it = gOutfitGallery->mOutfitMap.find(*outfit_id);
|
||||
if (it != gOutfitGallery->mOutfitMap.end() && !it->first.isNull())
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
void LLGalleryPhotoStoreCallback(const LLUUID &asset_id, void *user_data, S32 status, LLExtStat ext_status)
|
||||
{
|
||||
LL_WARNS() << "Photo stored as asset. UUID:" << asset_id.asString() << LL_ENDL;
|
||||
}
|
||||
|
||||
void LLOutfitGallery::uploadPhoto(LLUUID outfit_id)
|
||||
{
|
||||
outfit_map_t::iterator outfit_it = mOutfitMap.find(outfit_id);
|
||||
|
|
@ -736,6 +713,7 @@ void LLOutfitGallery::uploadPhoto(LLUUID outfit_id)
|
|||
|
||||
checkRemovePhoto(outfit_id);
|
||||
std::string upload_pending_name = outfit_id.asString();
|
||||
LLAssetStorage::LLStoreAssetCallback callback = NULL;
|
||||
LLUUID photo_id = upload_new_resource(filename, // file
|
||||
upload_pending_name,
|
||||
outfit_id.asString(),
|
||||
|
|
@ -743,7 +721,7 @@ void LLOutfitGallery::uploadPhoto(LLUUID outfit_id)
|
|||
LLFloaterPerms::getNextOwnerPerms("Uploads"),
|
||||
LLFloaterPerms::getGroupPerms("Uploads"),
|
||||
LLFloaterPerms::getEveryonePerms("Uploads"),
|
||||
upload_pending_name, &LLGalleryPhotoStoreCallback, expected_upload_cost, nruserdata);
|
||||
upload_pending_name, callback, expected_upload_cost, nruserdata);
|
||||
mOutfitLinkPending = outfit_id;
|
||||
}
|
||||
}
|
||||
|
|
@ -766,11 +744,6 @@ bool LLOutfitGallery::checkRemovePhoto(LLUUID outfit_id)
|
|||
return false;
|
||||
}
|
||||
|
||||
void LLOutfitGallery::setUploadedPhoto(LLUUID outfit_id, LLUUID asset_id)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void LLOutfitGallery::computeDifferenceOfTextures(
|
||||
const LLInventoryModel::item_array_t& vtextures,
|
||||
uuid_vec_t& vadded,
|
||||
|
|
@ -793,8 +766,6 @@ void LLOutfitGallery::computeDifferenceOfTextures(
|
|||
{
|
||||
vcur.push_back((*iter).second->getUUID());
|
||||
}
|
||||
// getCurrentCategories(vcur);
|
||||
|
||||
LLCommonUtils::computeDifference(vnew, vcur, vadded, vremoved);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,7 +56,28 @@ class LLOutfitGallery : public LLOutfitListBase
|
|||
{
|
||||
public:
|
||||
friend class LLOutfitGalleryGearMenu;
|
||||
LLOutfitGallery();
|
||||
|
||||
struct Params
|
||||
: public LLInitParam::Block<Params, LLPanel::Params>
|
||||
{
|
||||
Optional<S32> row_panel_height;
|
||||
Optional<S32> row_panel_width_factor;
|
||||
Optional<S32> gallery_width_factor;
|
||||
Optional<S32> vertical_gap;
|
||||
Optional<S32> horizontal_gap;
|
||||
Optional<S32> item_width;
|
||||
Optional<S32> item_height;
|
||||
Optional<S32> item_horizontal_gap;
|
||||
Optional<S32> items_in_row;
|
||||
|
||||
Params();
|
||||
};
|
||||
|
||||
static const LLOutfitGallery::Params& getDefaultParams();
|
||||
|
||||
LLOutfitGallery(const LLOutfitGallery::Params& params = getDefaultParams());
|
||||
|
||||
// LLOutfitGallery();
|
||||
virtual ~LLOutfitGallery();
|
||||
|
||||
/*virtual*/ BOOL postBuild();
|
||||
|
|
@ -93,7 +114,6 @@ private:
|
|||
void uploadPhoto(LLUUID outfit_id);
|
||||
void linkPhotoToOutfit(LLUUID outfit_id, LLUUID photo_id);
|
||||
bool checkRemovePhoto(LLUUID outfit_id);
|
||||
void setUploadedPhoto(LLUUID outfit_id, LLUUID asset_id);
|
||||
void addToGallery(LLOutfitGalleryItem* item);
|
||||
void removeFromGalleryLast(LLOutfitGalleryItem* item);
|
||||
void removeFromGalleryMiddle(LLOutfitGalleryItem* item);
|
||||
|
|
@ -105,27 +125,44 @@ private:
|
|||
LLPanel* addToRow(LLPanel* row_stack, LLOutfitGalleryItem* item, int pos, int hgap);
|
||||
void removeFromLastRow(LLOutfitGalleryItem* item);
|
||||
|
||||
static void onLoadComplete(LLVFS *vfs,
|
||||
const LLUUID& asset_uuid,
|
||||
LLAssetType::EType type,
|
||||
void* user_data, S32 status, LLExtStat ext_status);
|
||||
|
||||
LLOutfitGalleryItem* buildGalleryItem(std::string name);
|
||||
void buildGalleryPanel(int row_count);
|
||||
void reshapeGalleryPanel(int row_count);
|
||||
LLPanel* buildLayoutPanel(int left);
|
||||
LLPanel* buildLayoutStak(int left, int bottom);
|
||||
void moveLayoutStak(LLPanel* stack, int left, int bottom);
|
||||
std::vector<LLPanel*> mStacks;
|
||||
std::vector<LLPanel*> mPanels;
|
||||
LLPanel* buildItemPanel(int left);
|
||||
LLPanel* buildRowPanel(int left, int bottom);
|
||||
void moveRowPanel(LLPanel* stack, int left, int bottom);
|
||||
std::vector<LLPanel*> mRowPanels;
|
||||
std::vector<LLPanel*> mItemPanels;
|
||||
std::vector<LLOutfitGalleryItem*> mItems;
|
||||
LLScrollContainer* mScrollPanel;
|
||||
LLPanel* mGalleryPanel;
|
||||
LLPanel* mLastRowStack;
|
||||
LLPanel* mLastRowPanel;
|
||||
LLUUID mOutfitLinkPending;
|
||||
bool galleryCreated;
|
||||
bool mGalleryCreated;
|
||||
int mRowCount;
|
||||
int mItemsAddedCount;
|
||||
/* Params */
|
||||
int mRowPanelHeight;
|
||||
int mVerticalGap;
|
||||
int mHorizontalGap;
|
||||
int mItemWidth;
|
||||
int mItemHeight;
|
||||
int mItemHorizontalGap;
|
||||
int mItemsInRow;
|
||||
int mRowPanelWidth;
|
||||
int mGalleryWidth;
|
||||
|
||||
/*
|
||||
#define LAYOUT_STACK_WIDTH_FACTOR 166
|
||||
#define LAYOUT_STACK_WIDTH LAYOUT_STACK_WIDTH_FACTOR * ITEMS_IN_ROW//498
|
||||
#define GALLERY_WIDTH_FACTOR 163
|
||||
#define GALLERY_WIDTH GALLERY_WIDTH_FACTOR * ITEMS_IN_ROW//485//290
|
||||
*/
|
||||
|
||||
/*
|
||||
#define GALLERY_ITEM_HGAP 16
|
||||
#define ITEMS_IN_ROW 3
|
||||
*/
|
||||
|
||||
typedef std::map<LLUUID, LLOutfitGalleryItem*> outfit_map_t;
|
||||
typedef outfit_map_t::value_type outfit_map_value_t;
|
||||
|
|
@ -155,7 +192,6 @@ protected:
|
|||
|
||||
private:
|
||||
/*virtual*/ void onUploadFoto();
|
||||
/*virtual*/ void onLoadAssets();
|
||||
};
|
||||
|
||||
class LLOutfitGalleryItem : public LLPanel
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@
|
|||
#include "llfloatersidepanelcontainer.h"
|
||||
#include "llinventoryfunctions.h"
|
||||
#include "llinventorymodel.h"
|
||||
//#include "lllistcontextmenu.h"
|
||||
#include "llmenubutton.h"
|
||||
#include "llnotificationsutil.h"
|
||||
#include "lloutfitobserver.h"
|
||||
|
|
@ -106,14 +105,10 @@ LLOutfitsList::LLOutfitsList()
|
|||
, mListCommands(NULL)
|
||||
, mItemSelected(false)
|
||||
{
|
||||
// mCategoriesObserver = new LLInventoryCategoriesObserver();
|
||||
|
||||
// mGearMenu = new LLOutfitListGearMenu(this);
|
||||
}
|
||||
|
||||
LLOutfitsList::~LLOutfitsList()
|
||||
{
|
||||
// delete mGearMenu;
|
||||
}
|
||||
|
||||
BOOL LLOutfitsList::postBuild()
|
||||
|
|
@ -121,11 +116,6 @@ BOOL LLOutfitsList::postBuild()
|
|||
mAccordion = getChild<LLAccordionCtrl>("outfits_accordion");
|
||||
mAccordion->setComparator(&OUTFIT_TAB_NAME_COMPARATOR);
|
||||
|
||||
//LLMenuButton* menu_gear_btn = getChild<LLMenuButton>("options_gear_btn");
|
||||
|
||||
//menu_gear_btn->setMouseDownCallback(boost::bind(&LLOutfitListGearMenu::updateItemsVisibility, mGearMenu));
|
||||
//menu_gear_btn->setMenu(mGearMenu->getMenu());
|
||||
|
||||
return LLOutfitListBase::postBuild();
|
||||
}
|
||||
|
||||
|
|
@ -141,44 +131,6 @@ void LLOutfitsList::onOpen(const LLSD& info)
|
|||
|
||||
LLOutfitListBase::onOpen(info);
|
||||
|
||||
// if (!mIsInitialized)
|
||||
//{
|
||||
// // *TODO: I'm not sure is this check necessary but it never match while developing.
|
||||
// if (!gInventory.isInventoryUsable())
|
||||
// return;
|
||||
|
||||
// const LLUUID outfits = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS);
|
||||
|
||||
// // *TODO: I'm not sure is this check necessary but it never match while developing.
|
||||
// LLViewerInventoryCategory* category = gInventory.getCategory(outfits);
|
||||
// if (!category)
|
||||
// return;
|
||||
|
||||
// gInventory.addObserver(mCategoriesObserver);
|
||||
|
||||
// // Start observing changes in "My Outfits" category.
|
||||
// mCategoriesObserver->addCategory(outfits,
|
||||
// boost::bind(&LLOutfitsList::refreshList, this, outfits));
|
||||
|
||||
// const LLUUID cof = gInventory.findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT);
|
||||
|
||||
// // Start observing changes in Current Outfit category.
|
||||
// mCategoriesObserver->addCategory(cof, boost::bind(&LLOutfitsList::onCOFChanged, this));
|
||||
|
||||
// LLOutfitObserver::instance().addBOFChangedCallback(boost::bind(&LLOutfitsList::highlightBaseOutfit, this));
|
||||
// LLOutfitObserver::instance().addBOFReplacedCallback(boost::bind(&LLOutfitsList::highlightBaseOutfit, this));
|
||||
|
||||
// // Fetch "My Outfits" contents and refresh the list to display
|
||||
// // initially fetched items. If not all items are fetched now
|
||||
// // the observer will refresh the list as soon as the new items
|
||||
// // arrive.
|
||||
// category->fetch();
|
||||
// refreshList(outfits);
|
||||
// highlightBaseOutfit();
|
||||
|
||||
// mIsInitialized = true;
|
||||
//}
|
||||
|
||||
LLAccordionCtrlTab* selected_tab = mAccordion->getSelectedTab();
|
||||
if (!selected_tab) return;
|
||||
|
||||
|
|
@ -295,157 +247,6 @@ void LLOutfitsList::updateRemovedCategory(LLUUID cat_id)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
void LLOutfitsList::refreshList(const LLUUID& category_id)
|
||||
{
|
||||
LLInventoryModel::cat_array_t cat_array;
|
||||
LLInventoryModel::item_array_t item_array;
|
||||
|
||||
// Collect all sub-categories of a given category.
|
||||
LLIsType is_category(LLAssetType::AT_CATEGORY);
|
||||
gInventory.collectDescendentsIf(
|
||||
category_id,
|
||||
cat_array,
|
||||
item_array,
|
||||
LLInventoryModel::EXCLUDE_TRASH,
|
||||
is_category);
|
||||
|
||||
uuid_vec_t vadded;
|
||||
uuid_vec_t vremoved;
|
||||
|
||||
// Create added and removed items vectors.
|
||||
computeDifference(cat_array, vadded, vremoved);
|
||||
|
||||
// Handle added tabs.
|
||||
for (uuid_vec_t::const_iterator iter = vadded.begin();
|
||||
iter != vadded.end();
|
||||
++iter)
|
||||
{
|
||||
const LLUUID cat_id = (*iter);
|
||||
updateAddedCategory(cat_id);
|
||||
//LLViewerInventoryCategory *cat = gInventory.getCategory(cat_id);
|
||||
//if (!cat) continue;
|
||||
|
||||
//std::string name = cat->getName();
|
||||
|
||||
//outfit_accordion_tab_params tab_params(get_accordion_tab_params());
|
||||
//LLAccordionCtrlTab* tab = LLUICtrlFactory::create<LLAccordionCtrlTab>(tab_params);
|
||||
//if (!tab) continue;
|
||||
//LLWearableItemsList* wearable_list = LLUICtrlFactory::create<LLWearableItemsList>(tab_params.wearable_list);
|
||||
//wearable_list->setShape(tab->getLocalRect());
|
||||
//tab->addChild(wearable_list);
|
||||
|
||||
//tab->setName(name);
|
||||
//tab->setTitle(name);
|
||||
|
||||
//// *TODO: LLUICtrlFactory::defaultBuilder does not use "display_children" from xml. Should be investigated.
|
||||
//tab->setDisplayChildren(false);
|
||||
//mAccordion->addCollapsibleCtrl(tab);
|
||||
|
||||
//// Start observing the new outfit category.
|
||||
//LLWearableItemsList* list = tab->getChild<LLWearableItemsList>("wearable_items_list");
|
||||
//if (!mCategoriesObserver->addCategory(cat_id, boost::bind(&LLWearableItemsList::updateList, list, cat_id)))
|
||||
//{
|
||||
// // Remove accordion tab if category could not be added to observer.
|
||||
// mAccordion->removeCollapsibleCtrl(tab);
|
||||
|
||||
// // kill removed tab
|
||||
// tab->die();
|
||||
// continue;
|
||||
//}
|
||||
|
||||
//// Map the new tab with outfit category UUID.
|
||||
//mOutfitsMap.insert(LLOutfitsList::outfits_map_value_t(cat_id, tab));
|
||||
|
||||
//tab->setRightMouseDownCallback(boost::bind(&LLOutfitsList::onAccordionTabRightClick, this,
|
||||
// _1, _2, _3, cat_id));
|
||||
|
||||
//// Setting tab focus callback to monitor currently selected outfit.
|
||||
//tab->setFocusReceivedCallback(boost::bind(&LLOutfitsList::changeOutfitSelection, this, list, cat_id));
|
||||
|
||||
//// Setting callback to reset items selection inside outfit on accordion collapsing and expanding (EXT-7875)
|
||||
//tab->setDropDownStateChangedCallback(boost::bind(&LLOutfitsList::resetItemSelection, this, list, cat_id));
|
||||
|
||||
//// force showing list items that don't match current filter(EXT-7158)
|
||||
//list->setForceShowingUnmatchedItems(true);
|
||||
|
||||
//// Setting list commit callback to monitor currently selected wearable item.
|
||||
//list->setCommitCallback(boost::bind(&LLOutfitsList::onSelectionChange, this, _1));
|
||||
|
||||
//// Setting list refresh callback to apply filter on list change.
|
||||
//list->setRefreshCompleteCallback(boost::bind(&LLOutfitsList::onFilteredWearableItemsListRefresh, this, _1));
|
||||
|
||||
//list->setRightMouseDownCallback(boost::bind(&LLOutfitsList::onWearableItemsListRightClick, this, _1, _2, _3));
|
||||
|
||||
//// Fetch the new outfit contents.
|
||||
//cat->fetch();
|
||||
|
||||
//// Refresh the list of outfit items after fetch().
|
||||
//// Further list updates will be triggered by the category observer.
|
||||
//list->updateList(cat_id);
|
||||
|
||||
//// If filter is currently applied we store the initial tab state and
|
||||
//// open it to show matched items if any.
|
||||
//if (!sFilterSubString.empty())
|
||||
//{
|
||||
// tab->notifyChildren(LLSD().with("action","store_state"));
|
||||
// tab->setDisplayChildren(true);
|
||||
|
||||
// // Setting mForceRefresh flag will make the list refresh its contents
|
||||
// // even if it is not currently visible. This is required to apply the
|
||||
// // filter to the newly added list.
|
||||
// list->setForceRefresh(true);
|
||||
|
||||
// list->setFilterSubString(sFilterSubString);
|
||||
//}
|
||||
}
|
||||
|
||||
// Handle removed tabs.
|
||||
for (uuid_vec_t::const_iterator iter=vremoved.begin(); iter != vremoved.end(); ++iter)
|
||||
{
|
||||
const LLUUID cat_id = (*iter);
|
||||
updateRemovedCategory(cat_id);
|
||||
//outfits_map_t::iterator outfits_iter = mOutfitsMap.find(cat_id);
|
||||
//if (outfits_iter != mOutfitsMap.end())
|
||||
//{
|
||||
// const LLUUID& outfit_id = outfits_iter->first;
|
||||
// LLAccordionCtrlTab* tab = outfits_iter->second;
|
||||
|
||||
// // An outfit is removed from the list. Do the following:
|
||||
// // 1. Remove outfit category from observer to stop monitoring its changes.
|
||||
// mCategoriesObserver->removeCategory(outfit_id);
|
||||
|
||||
// // 2. Remove the outfit from selection.
|
||||
// deselectOutfit(outfit_id);
|
||||
|
||||
// // 3. Remove category UUID to accordion tab mapping.
|
||||
// mOutfitsMap.erase(outfits_iter);
|
||||
|
||||
// // 4. Remove outfit tab from accordion.
|
||||
// mAccordion->removeCollapsibleCtrl(tab);
|
||||
|
||||
// // kill removed tab
|
||||
// if (tab != NULL)
|
||||
// {
|
||||
// tab->die();
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
// Get changed items from inventory model and update outfit tabs
|
||||
// which might have been renamed.
|
||||
const LLInventoryModel::changed_items_t& changed_items = gInventory.getChangedIDs();
|
||||
for (LLInventoryModel::changed_items_t::const_iterator items_iter = changed_items.begin();
|
||||
items_iter != changed_items.end();
|
||||
++items_iter)
|
||||
{
|
||||
updateChangedCategoryName(*items_iter);
|
||||
}
|
||||
|
||||
mAccordion->sort();
|
||||
}
|
||||
*/
|
||||
|
||||
//virtual
|
||||
void LLOutfitsList::onHighlightBaseOutfit(LLUUID base_id, LLUUID prev_id)
|
||||
{
|
||||
|
|
@ -628,33 +429,6 @@ bool LLOutfitsList::hasItemSelected()
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
// Private methods
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
void LLOutfitsList::computeDifference(
|
||||
const LLInventoryModel::cat_array_t& vcats,
|
||||
uuid_vec_t& vadded,
|
||||
uuid_vec_t& vremoved)
|
||||
{
|
||||
uuid_vec_t vnew;
|
||||
// Creating a vector of newly collected sub-categories UUIDs.
|
||||
for (LLInventoryModel::cat_array_t::const_iterator iter = vcats.begin();
|
||||
iter != vcats.end();
|
||||
iter++)
|
||||
{
|
||||
vnew.push_back((*iter)->getUUID());
|
||||
}
|
||||
|
||||
uuid_vec_t vcur;
|
||||
// Creating a vector of currently displayed sub-categories UUIDs.
|
||||
for (outfits_map_t::const_iterator iter = mOutfitsMap.begin();
|
||||
iter != mOutfitsMap.end();
|
||||
iter++)
|
||||
{
|
||||
vcur.push_back((*iter).first);
|
||||
}
|
||||
|
||||
LLCommonUtils::computeDifference(vnew, vcur, vadded, vremoved);
|
||||
}
|
||||
*/
|
||||
|
||||
void LLOutfitsList::updateChangedCategoryName(LLViewerInventoryCategory *cat, std::string name)
|
||||
{
|
||||
|
|
@ -710,12 +484,8 @@ void LLOutfitsList::deselectOutfit(const LLUUID& category_id)
|
|||
{
|
||||
// Remove selected lists map entry.
|
||||
mSelectedListsMap.erase(category_id);
|
||||
|
||||
// Reset selection if the outfit is selected.
|
||||
if (category_id == mSelectedOutfitUUID)
|
||||
{
|
||||
signalSelectionOutfitUUID(LLUUID::null);
|
||||
}
|
||||
|
||||
LLOutfitListBase::deselectOutfit(category_id);
|
||||
}
|
||||
|
||||
void LLOutfitsList::restoreOutfitSelection(LLAccordionCtrlTab* tab, const LLUUID& category_id)
|
||||
|
|
@ -1056,12 +826,6 @@ void LLOutfitListBase::onOpen(const LLSD& info)
|
|||
|
||||
mIsInitialized = true;
|
||||
}
|
||||
|
||||
//LLAccordionCtrlTab* selected_tab = mAccordion->getSelectedTab();
|
||||
//if (!selected_tab) return;
|
||||
|
||||
//// Pass focus to the selected outfit tab.
|
||||
//selected_tab->showAndFocusHeader();
|
||||
}
|
||||
|
||||
void LLOutfitListBase::refreshList(const LLUUID& category_id)
|
||||
|
|
@ -1133,13 +897,6 @@ void LLOutfitListBase::computeDifference(
|
|||
}
|
||||
|
||||
uuid_vec_t vcur;
|
||||
//// Creating a vector of currently displayed sub-categories UUIDs.
|
||||
//for (outfits_map_t::const_iterator iter = mOutfitsMap.begin();
|
||||
// iter != mOutfitsMap.end();
|
||||
// iter++)
|
||||
//{
|
||||
// vcur.push_back((*iter).first);
|
||||
//}
|
||||
getCurrentCategories(vcur);
|
||||
|
||||
LLCommonUtils::computeDifference(vnew, vcur, vadded, vremoved);
|
||||
|
|
@ -1226,6 +983,15 @@ void LLOutfitListBase::expandAllFolders()
|
|||
onExpandAllFolders();
|
||||
}
|
||||
|
||||
void LLOutfitListBase::deselectOutfit(const LLUUID& category_id)
|
||||
{
|
||||
// Reset selection if the outfit is selected.
|
||||
if (category_id == mSelectedOutfitUUID)
|
||||
{
|
||||
signalSelectionOutfitUUID(LLUUID::null);
|
||||
}
|
||||
}
|
||||
|
||||
LLContextMenu* LLOutfitContextMenu::createMenu()
|
||||
{
|
||||
LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
|
||||
|
|
@ -1325,7 +1091,6 @@ LLOutfitListGearMenuBase::LLOutfitListGearMenuBase(LLOutfitListBase* olist)
|
|||
registrar.add("Gear.WearAdd", boost::bind(&LLOutfitListGearMenuBase::onAdd, this));
|
||||
|
||||
registrar.add("Gear.UploadPhoto", boost::bind(&LLOutfitListGearMenuBase::onUploadFoto, this));
|
||||
registrar.add("Gear.LoadAssets", boost::bind(&LLOutfitListGearMenuBase::onLoadAssets, this));
|
||||
|
||||
enable_registrar.add("Gear.OnEnable", boost::bind(&LLOutfitListGearMenuBase::onEnable, this, _2));
|
||||
enable_registrar.add("Gear.OnVisible", boost::bind(&LLOutfitListGearMenuBase::onVisible, this, _2));
|
||||
|
|
@ -1350,8 +1115,6 @@ void LLOutfitListGearMenuBase::onUpdateItemsVisibility()
|
|||
bool have_selection = getSelectedOutfitID().notNull();
|
||||
mMenu->setItemVisible("sepatator1", have_selection);
|
||||
mMenu->setItemVisible("sepatator2", have_selection);
|
||||
//mMenu->setItemVisible("expand", mOutfitList->getHasExpandableFolders());
|
||||
//mMenu->setItemVisible("collapse", mOutfitList->getHasExpandableFolders());
|
||||
mMenu->arrangeAndClear(); // update menu height
|
||||
}
|
||||
|
||||
|
|
@ -1466,11 +1229,6 @@ void LLOutfitListGearMenuBase::onUploadFoto()
|
|||
|
||||
}
|
||||
|
||||
void LLOutfitListGearMenuBase::onLoadAssets()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
LLOutfitListGearMenu::LLOutfitListGearMenu(LLOutfitListBase* olist)
|
||||
: LLOutfitListGearMenuBase(olist)
|
||||
{}
|
||||
|
|
|
|||
|
|
@ -96,6 +96,8 @@ public:
|
|||
virtual bool hasItemSelected() = 0;
|
||||
virtual bool canWearSelected() = 0;
|
||||
|
||||
virtual void deselectOutfit(const LLUUID& category_id);
|
||||
|
||||
void signalSelectionOutfitUUID(const LLUUID& category_id);
|
||||
|
||||
void collapseAllFolders();
|
||||
|
|
@ -162,7 +164,6 @@ public:
|
|||
protected:
|
||||
virtual void onUpdateItemsVisibility();
|
||||
virtual void onUploadFoto();
|
||||
virtual void onLoadAssets();
|
||||
const LLUUID& getSelectedOutfitID();
|
||||
|
||||
LLOutfitListBase* mOutfitList;
|
||||
|
|
@ -279,7 +280,7 @@ private:
|
|||
/**
|
||||
* Removes the outfit from selection.
|
||||
*/
|
||||
void deselectOutfit(const LLUUID& category_id);
|
||||
/*virtual*/ void deselectOutfit(const LLUUID& category_id);
|
||||
|
||||
/**
|
||||
* Try restoring selection for a temporary hidden tab.
|
||||
|
|
|
|||
|
|
@ -46,13 +46,6 @@
|
|||
<on_click
|
||||
function="Gear.UploadPhoto" />
|
||||
</menu_item_call>
|
||||
<menu_item_call
|
||||
label="Load assets"
|
||||
layout="topleft"
|
||||
name="load_assets">
|
||||
<on_click
|
||||
function="Gear.LoadAssets" />
|
||||
</menu_item_call>
|
||||
|
||||
<menu_item_separator name="sepatator1" />
|
||||
<!-- copied (with minor modifications) from menu_inventory_add.xml -->
|
||||
|
|
|
|||
Loading…
Reference in New Issue