MAINT-6474 FIXED No easy way to remove an image from a VOB Folder

meow-7.2.2
Mnikolenko Productengine 2016-06-06 16:47:09 +03:00
parent 2da3148759
commit 3cbab4d820
6 changed files with 85 additions and 7 deletions

View File

@ -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)
{
}

View File

@ -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;}

View File

@ -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();
}

View File

@ -166,6 +166,7 @@ protected:
virtual void onUploadFoto();
virtual void onSelectPhoto();
virtual void onTakeSnapshot();
virtual void onRemovePhoto();
const LLUUID& getSelectedOutfitID();

View File

@ -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"

View File

@ -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? -->