diff options
author | pavelkproductengine <pavelkproductengine@lindenlab.com> | 2015-12-11 19:58:08 +0200 |
---|---|---|
committer | pavelkproductengine <pavelkproductengine@lindenlab.com> | 2015-12-11 19:58:08 +0200 |
commit | 6a02f5bbcec2b1a530ceeacb0dc564cfeb7cbc7f (patch) | |
tree | 0a811059e4982105c4fb506241b94e61602fb8e4 /indra/newview/lloutfitgallery.h | |
parent | 1be63209331d509396bd7ee79302d511fe83d72e (diff) |
Initial version of Visual Outfit Browser
Diffstat (limited to 'indra/newview/lloutfitgallery.h')
-rw-r--r-- | indra/newview/lloutfitgallery.h | 152 |
1 files changed, 152 insertions, 0 deletions
diff --git a/indra/newview/lloutfitgallery.h b/indra/newview/lloutfitgallery.h new file mode 100644 index 0000000000..93b9ba1e3f --- /dev/null +++ b/indra/newview/lloutfitgallery.h @@ -0,0 +1,152 @@ +/** + * @file lloutfitgallery.h + * @author Pavlo Kryvych + * @brief Visual gallery of agent's outfits for My Appearance side panel + * + * $LicenseInfo:firstyear=2015&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2015, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLOUTFITGALLERYCTRL_H +#define LL_LLOUTFITGALLERYCTRL_H + +#include "llextendedstatus.h" +#include "lliconctrl.h" +#include "lllayoutstack.h" +#include "lloutfitslist.h" +#include "llpanelappearancetab.h" +#include "llviewertexture.h" + +#include <vector> + +class LLVFS; +class LLOutfitGalleryItem; +class LLOutfitListGearMenuBase; +class LLOutfitGalleryGearMenu; + +class LLOutfitGallery : public LLOutfitListBase +{ +public: + friend class LLOutfitGalleryGearMenu; + LLOutfitGallery(); + virtual ~LLOutfitGallery(); + + /*virtual*/ BOOL postBuild(); + /*virtual*/ void onOpen(const LLSD& info); + + /*virtual*/ void setFilterSubString(const std::string& string); + + /*virtual*/ void getCurrentCategories(uuid_vec_t& vcur); + /*virtual*/ void updateAddedCategory(LLUUID cat_id); + /*virtual*/ void updateRemovedCategory(LLUUID cat_id); + /*virtual*/ void updateChangedCategoryName(LLViewerInventoryCategory *cat, std::string name); + + /*virtual*/ bool hasItemSelected(); + /*virtual*/ bool canWearSelected(); + + /*virtual*/ bool getHasExpandableFolders() { return FALSE; } + + void refreshTextures(const LLUUID& category_id); + void computeDifferenceOfTextures(const LLInventoryModel::item_array_t& vtextures, uuid_vec_t& vadded, uuid_vec_t& vremoved); + +protected: + /*virtual*/ void onHighlightBaseOutfit(LLUUID base_id, LLUUID prev_id); + /*virtual*/ void onSetSelectedOutfitByUUID(const LLUUID& outfit_uuid); + /*virtual*/ void onOutfitRightClick(LLUICtrl* ctrl, S32 x, S32 y, const LLUUID& cat_id); + /*virtual*/ void onChangeOutfitSelection(LLWearableItemsList* list, const LLUUID& category_id); + + /*virtual*/ void onCollapseAllFolders() {} + /*virtual*/ void onExpandAllFolders() {} + /*virtual*/ LLOutfitListGearMenuBase* createGearMenu(); + +private: + void rebuildGallery(); + void loadPhotos(); + void uploadPhoto(LLUUID outfit_id); + bool checkRemovePhoto(LLUUID outfit_id); + void setUploadedPhoto(LLUUID outfit_id, LLUUID asset_id); + + 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); + LLLayoutPanel* buildLayoutPanel(int left); + LLLayoutStack* buildLayoutStak(int left, int top); + + LLView* mView; + std::vector<LLLayoutStack*> mLayouts; + std::vector<LLLayoutPanel*> mPanels; + std::vector<LLOutfitGalleryItem*> mItems; + + typedef std::map<LLUUID, LLOutfitGalleryItem*> outfit_map_t; + typedef outfit_map_t::value_type outfit_map_value_t; + outfit_map_t mOutfitMap; + typedef std::map<LLUUID, LLViewerInventoryItem*> texture_map_t; + typedef texture_map_t::value_type texture_map_value_t; + texture_map_t mTextureMap; + + LLInventoryCategoriesObserver* mTexturesObserver; + +}; + +//static LLOutfitGallery* gOutfitGallery; + +class LLOutfitGalleryGearMenu : public LLOutfitListGearMenuBase +{ +public: + friend class LLOutfitGallery; + LLOutfitGalleryGearMenu(LLOutfitListBase* olist); + +protected: + /*virtual*/ void onUpdateItemsVisibility(); + +private: + /*virtual*/ void onUploadFoto(); + /*virtual*/ void onLoadAssets(); +}; + +class LLOutfitGalleryItem : public LLPanel +{ +public: + struct Params : public LLInitParam::Block<Params, LLPanel::Params> + {}; + + LLOutfitGalleryItem(const Params& p); + virtual ~LLOutfitGalleryItem(); + + /*virtual*/ BOOL postBuild(); + /*virtual*/ void draw(); + /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); + + void setDefaultImage(); + void setImageAssetId(LLUUID asset_id); + void setOutfitName(std::string name); + void setOutfitWorn(bool value); + void setSelected(bool value); +private: + LLPointer<LLViewerTexture> mTexturep; + LLTextBox* mOutfitNameText; + LLTextBox* mOutfitWornText; +}; + +#endif // LL_LLOUTFITGALLERYCTRL_H |