diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/lloutfitgallery.cpp | 57 | ||||
-rw-r--r-- | indra/newview/lloutfitgallery.h | 7 | ||||
-rw-r--r-- | indra/newview/lloutfitslist.cpp | 8 | ||||
-rw-r--r-- | indra/newview/lloutfitslist.h | 1 | ||||
-rwxr-xr-x | indra/newview/skins/default/xui/en/menu_gallery_outfit_tab.xml | 11 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_outfit_gear.xml | 8 |
6 files changed, 85 insertions, 7 deletions
diff --git a/indra/newview/lloutfitgallery.cpp b/indra/newview/lloutfitgallery.cpp index a4315b9189..f414179f9c 100644 --- a/indra/newview/lloutfitgallery.cpp +++ b/indra/newview/lloutfitgallery.cpp @@ -147,7 +147,7 @@ void LLOutfitGallery::updateRowsIfNeeded() bool compareGalleryItem(LLOutfitGalleryItem* item1, LLOutfitGalleryItem* item2) { - if((item1->mIsDefaultImage() && item2->mIsDefaultImage()) || (!item1->mIsDefaultImage() && !item2->mIsDefaultImage())) + if((item1->isDefaultImage() && item2->isDefaultImage()) || (!item1->isDefaultImage() && !item2->isDefaultImage())) { std::string name1 = item1->getItemName(); std::string name2 = item2->getItemName(); @@ -158,7 +158,7 @@ bool compareGalleryItem(LLOutfitGalleryItem* item1, LLOutfitGalleryItem* item2) } else { - return item2->mIsDefaultImage(); + return item2->isDefaultImage(); } } @@ -577,6 +577,15 @@ bool LLOutfitGallery::canWearSelected() return false; } +bool LLOutfitGallery::hasDefaultImage(const LLUUID& outfit_cat_id) +{ + if (mOutfitMap[outfit_cat_id]) + { + return mOutfitMap[outfit_cat_id]->isDefaultImage(); + } + return false; +} + void LLOutfitGallery::updateMessageVisibility() { if(mItems.empty()) @@ -731,7 +740,7 @@ LLContextMenu* LLOutfitGalleryContextMenu::createMenu() registrar.add("Outfit.UploadPhoto", boost::bind(&LLOutfitGalleryContextMenu::onUploadPhoto, this, selected_id)); registrar.add("Outfit.SelectPhoto", boost::bind(&LLOutfitGalleryContextMenu::onSelectPhoto, this, selected_id)); registrar.add("Outfit.TakeSnapshot", boost::bind(&LLOutfitGalleryContextMenu::onTakeSnapshot, this, selected_id)); - + registrar.add("Outfit.RemovePhoto", boost::bind(&LLOutfitGalleryContextMenu::onRemovePhoto, this, selected_id)); enable_registrar.add("Outfit.OnEnable", boost::bind(&LLOutfitGalleryContextMenu::onEnable, this, _2)); enable_registrar.add("Outfit.OnVisible", boost::bind(&LLOutfitGalleryContextMenu::onVisible, this, _2)); @@ -756,6 +765,16 @@ void LLOutfitGalleryContextMenu::onSelectPhoto(const LLUUID& outfit_cat_id) } } +void LLOutfitGalleryContextMenu::onRemovePhoto(const LLUUID& outfit_cat_id) +{ + LLOutfitGallery* gallery = dynamic_cast<LLOutfitGallery*>(mOutfitList); + if (gallery && outfit_cat_id.notNull()) + { + gallery->checkRemovePhoto(outfit_cat_id); + gallery->refreshOutfit(outfit_cat_id); + } +} + void LLOutfitGalleryContextMenu::onTakeSnapshot(const LLUUID& outfit_cat_id) { LLOutfitGallery* gallery = dynamic_cast<LLOutfitGallery*>(mOutfitList); @@ -800,6 +819,15 @@ bool LLOutfitGalleryContextMenu::onEnable(LLSD::String param) bool LLOutfitGalleryContextMenu::onVisible(LLSD::String param) { + if ("remove_photo" == param) + { + LLOutfitGallery* gallery = dynamic_cast<LLOutfitGallery*>(mOutfitList); + LLUUID selected_id = mUUIDs.front(); + if (gallery && selected_id.notNull()) + { + return !gallery->hasDefaultImage(selected_id); + } + } return LLOutfitContextMenu::onVisible(param); } @@ -817,6 +845,7 @@ void LLOutfitGalleryGearMenu::onUpdateItemsVisibility() mMenu->setItemVisible("upload_photo", have_selection); mMenu->setItemVisible("select_photo", have_selection); mMenu->setItemVisible("take_snapshot", have_selection); + mMenu->setItemVisible("remove_photo", !hasDefaultImage()); LLOutfitListGearMenuBase::onUpdateItemsVisibility(); } @@ -840,6 +869,17 @@ void LLOutfitGalleryGearMenu::onSelectPhoto() } } +void LLOutfitGalleryGearMenu::onRemovePhoto() +{ + LLOutfitGallery* gallery = dynamic_cast<LLOutfitGallery*>(mOutfitList); + LLUUID selected_outfit_id = getSelectedOutfitID(); + if (gallery && !selected_outfit_id.isNull()) + { + gallery->checkRemovePhoto(selected_outfit_id); + gallery->refreshOutfit(selected_outfit_id); + } +} + void LLOutfitGalleryGearMenu::onTakeSnapshot() { LLOutfitGallery* gallery = dynamic_cast<LLOutfitGallery*>(mOutfitList); @@ -850,6 +890,17 @@ void LLOutfitGalleryGearMenu::onTakeSnapshot() } } +bool LLOutfitGalleryGearMenu::hasDefaultImage() +{ + LLOutfitGallery* gallery = dynamic_cast<LLOutfitGallery*>(mOutfitList); + LLUUID selected_outfit_id = getSelectedOutfitID(); + if (gallery && selected_outfit_id.notNull()) + { + return gallery->hasDefaultImage(selected_outfit_id); + } + return true; +} + void LLOutfitGallery::onTextureSelectionChanged(LLInventoryItem* itemp) { } diff --git a/indra/newview/lloutfitgallery.h b/indra/newview/lloutfitgallery.h index 385a1e1c7a..19bfc10586 100644 --- a/indra/newview/lloutfitgallery.h +++ b/indra/newview/lloutfitgallery.h @@ -105,6 +105,7 @@ public: /*virtual*/ bool getHasExpandableFolders() { return FALSE; } void updateMessageVisibility(); + bool hasDefaultImage(const LLUUID& outfit_cat_id); void refreshTextures(const LLUUID& category_id); void refreshOutfit(const LLUUID& category_id); @@ -209,6 +210,7 @@ protected: bool onVisible(LLSD::String param); void onUploadPhoto(const LLUUID& outfit_cat_id); void onSelectPhoto(const LLUUID& outfit_cat_id); + void onRemovePhoto(const LLUUID& outfit_cat_id); void onTakeSnapshot(const LLUUID& outfit_cat_id); void onCreate(const LLSD& data); void onRemoveOutfit(const LLUUID& outfit_cat_id); @@ -230,6 +232,9 @@ private: /*virtual*/ void onUploadFoto(); /*virtual*/ void onSelectPhoto(); /*virtual*/ void onTakeSnapshot(); + /*virtual*/ void onRemovePhoto(); + + bool hasDefaultImage(); }; class LLOutfitGalleryItem : public LLPanel @@ -254,7 +259,7 @@ public: void setSelected(bool value); std::string getItemName() {return mOutfitName;} - bool mIsDefaultImage() {return mDefaultImage;} + bool isDefaultImage() {return mDefaultImage;} bool isHidden() {return mHidden;} void setHidden(bool hidden) {mHidden = hidden;} diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 31fe6839f3..2e6599090a 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -1093,6 +1093,7 @@ LLOutfitListGearMenuBase::LLOutfitListGearMenuBase(LLOutfitListBase* olist) registrar.add("Gear.UploadPhoto", boost::bind(&LLOutfitListGearMenuBase::onUploadFoto, this)); registrar.add("Gear.SelectPhoto", boost::bind(&LLOutfitListGearMenuBase::onSelectPhoto, this)); registrar.add("Gear.TakeSnapshot", boost::bind(&LLOutfitListGearMenuBase::onTakeSnapshot, this)); + registrar.add("Gear.RemovePhoto", boost::bind(&LLOutfitListGearMenuBase::onRemovePhoto, this)); enable_registrar.add("Gear.OnEnable", boost::bind(&LLOutfitListGearMenuBase::onEnable, this, _2)); enable_registrar.add("Gear.OnVisible", boost::bind(&LLOutfitListGearMenuBase::onVisible, this, _2)); @@ -1241,6 +1242,10 @@ void LLOutfitListGearMenuBase::onTakeSnapshot() } +void LLOutfitListGearMenuBase::onRemovePhoto() +{ + +} LLOutfitListGearMenu::LLOutfitListGearMenu(LLOutfitListBase* olist) : LLOutfitListGearMenuBase(olist) {} @@ -1255,7 +1260,8 @@ void LLOutfitListGearMenu::onUpdateItemsVisibility() mMenu->setItemVisible("collapse", TRUE); mMenu->setItemVisible("upload_photo", FALSE); mMenu->setItemVisible("select_photo", FALSE); - mMenu->setItemVisible("take_snapshot", FALSE); + mMenu->setItemVisible("take_snapshot", FALSE); + mMenu->setItemVisible("remove_photo", FALSE); LLOutfitListGearMenuBase::onUpdateItemsVisibility(); } diff --git a/indra/newview/lloutfitslist.h b/indra/newview/lloutfitslist.h index 696a18a36a..c4dd2cd075 100644 --- a/indra/newview/lloutfitslist.h +++ b/indra/newview/lloutfitslist.h @@ -166,6 +166,7 @@ protected: virtual void onUploadFoto(); virtual void onSelectPhoto(); virtual void onTakeSnapshot(); + virtual void onRemovePhoto(); const LLUUID& getSelectedOutfitID(); diff --git a/indra/newview/skins/default/xui/en/menu_gallery_outfit_tab.xml b/indra/newview/skins/default/xui/en/menu_gallery_outfit_tab.xml index b9e29788dc..1b08767edc 100755 --- a/indra/newview/skins/default/xui/en/menu_gallery_outfit_tab.xml +++ b/indra/newview/skins/default/xui/en/menu_gallery_outfit_tab.xml @@ -62,7 +62,16 @@ <on_click function="Outfit.TakeSnapshot" /> </menu_item_call> - + <menu_item_call + label="Remove Photo" + layout="topleft" + name="remove_photo"> + <on_click + function="Outfit.RemovePhoto" /> + <on_visible + function="Outfit.OnVisible" + parameter="remove_photo" /> + </menu_item_call> <menu_item_separator name="sepatator1" /> <menu height="175" diff --git a/indra/newview/skins/default/xui/en/menu_outfit_gear.xml b/indra/newview/skins/default/xui/en/menu_outfit_gear.xml index e527e1f901..6b8a784560 100644 --- a/indra/newview/skins/default/xui/en/menu_outfit_gear.xml +++ b/indra/newview/skins/default/xui/en/menu_outfit_gear.xml @@ -60,7 +60,13 @@ <on_click function="Gear.TakeSnapshot" /> </menu_item_call> - + <menu_item_call + label="Remove Photo" + layout="topleft" + name="remove_photo"> + <on_click + function="Gear.RemovePhoto" /> + </menu_item_call> <menu_item_separator name="sepatator1" /> <!-- copied (with minor modifications) from menu_inventory_add.xml --> <!-- *TODO: generate dynamically? --> |