From 569ad2d248cd1297b937e2c003399937114d06b9 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Mon, 29 Mar 2021 19:54:24 +0300 Subject: Separate "Save changes" and "Save as..." in Outfits floater --- indra/newview/llpaneloutfitedit.cpp | 19 ++++++++--- indra/newview/llpaneloutfitedit.h | 3 +- indra/newview/llpaneloutfitsinventory.cpp | 23 ++++++++++--- indra/newview/llpaneloutfitsinventory.h | 3 +- .../skins/default/xui/en/panel_outfit_edit.xml | 36 +++++++++++--------- .../default/xui/en/panel_outfits_inventory.xml | 39 ++++++++++++---------- 6 files changed, 77 insertions(+), 46 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp index 28a020870f..5be9ab6095 100644 --- a/indra/newview/llpaneloutfitedit.cpp +++ b/indra/newview/llpaneloutfitedit.cpp @@ -58,7 +58,6 @@ #include "llmenubutton.h" #include "llpaneloutfitsinventory.h" #include "lluiconstants.h" -#include "llsaveoutfitcombobtn.h" #include "llscrolllistctrl.h" #include "lltextbox.h" #include "lltoggleablemenu.h" @@ -80,6 +79,8 @@ const U64 ATTACHMENT_MASK = (1LL << LLInventoryType::IT_ATTACHMENT) | (1LL << LL const U64 ALL_ITEMS_MASK = WEARABLE_MASK | ATTACHMENT_MASK; static const std::string REVERT_BTN("revert_btn"); +static const std::string SAVE_AS_BTN("save_as_btn"); +static const std::string SAVE_BTN("save_btn"); /////////////////////////////////////////////////////////////////////////////// @@ -562,7 +563,8 @@ BOOL LLPanelOutfitEdit::postBuild() mGearMenu = LLPanelOutfitEditGearMenu::create(); mGearMenuBtn->setMenu(mGearMenu); - mSaveComboBtn.reset(new LLSaveOutfitComboBtn(this)); + getChild(SAVE_BTN)->setCommitCallback(boost::bind(&LLPanelOutfitEdit::saveOutfit, this, false)); + getChild(SAVE_AS_BTN)->setCommitCallback(boost::bind(&LLPanelOutfitEdit::saveOutfit, this, true)); onOutfitChanging(gAgentWearables.isCOFChangeInProgress()); return TRUE; @@ -1239,11 +1241,9 @@ void LLPanelOutfitEdit::updateVerbs() bool outfit_locked = LLAppearanceMgr::getInstance()->isOutfitLocked(); bool has_baseoutfit = LLAppearanceMgr::getInstance()->getBaseOutfitUUID().notNull(); - mSaveComboBtn->setSaveBtnEnabled(!outfit_locked && outfit_is_dirty); + getChildView(SAVE_BTN)->setEnabled(!outfit_locked && outfit_is_dirty); getChildView(REVERT_BTN)->setEnabled(outfit_is_dirty && has_baseoutfit); - mSaveComboBtn->setMenuItemEnabled("save_outfit", !outfit_locked && outfit_is_dirty); - mStatus->setText(outfit_is_dirty ? getString("unsaved_changes") : getString("now_editing")); updateCurrentOutfitName(); @@ -1429,4 +1429,13 @@ void LLPanelOutfitEdit::saveListSelection() } } +void LLPanelOutfitEdit::saveOutfit(bool as_new) +{ + LLPanelOutfitsInventory* panel_outfits_inventory = LLPanelOutfitsInventory::findInstance(); + if (panel_outfits_inventory) + { + panel_outfits_inventory->saveOutfit(as_new); + } +} + // EOF diff --git a/indra/newview/llpaneloutfitedit.h b/indra/newview/llpaneloutfitedit.h index 3c6efac0e7..d0597fb72b 100644 --- a/indra/newview/llpaneloutfitedit.h +++ b/indra/newview/llpaneloutfitedit.h @@ -58,7 +58,6 @@ class LLMenuButton; class LLMenuGL; class LLFindNonLinksByMask; class LLFindWearablesOfType; -class LLSaveOutfitComboBtn; class LLWearableItemTypeNameComparator; class LLPanelOutfitEdit : public LLPanel @@ -195,6 +194,7 @@ private: void getSelectedItemsUUID(uuid_vec_t& uuid_list); void getCurrentItemUUID(LLUUID& selected_id); void onCOFChanged(); + void saveOutfit(bool as_new = false); /** * Method preserves selection while switching between folder/list view modes @@ -237,7 +237,6 @@ private: LLToggleableMenu* mGearMenu; LLToggleableMenu* mAddWearablesGearMenu; bool mInitialized; - std::auto_ptr mSaveComboBtn; LLMenuButton* mWearablesGearMenuBtn; LLMenuButton* mGearMenuBtn; diff --git a/indra/newview/llpaneloutfitsinventory.cpp b/indra/newview/llpaneloutfitsinventory.cpp index 8fff52ca4e..baacdd65b5 100644 --- a/indra/newview/llpaneloutfitsinventory.cpp +++ b/indra/newview/llpaneloutfitsinventory.cpp @@ -40,7 +40,6 @@ #include "lloutfitgallery.h" #include "lloutfitslist.h" #include "llpanelwearing.h" -#include "llsaveoutfitcombobtn.h" #include "llsidepanelappearance.h" #include "llviewercontrol.h" #include "llviewerfoldertype.h" @@ -49,6 +48,9 @@ static const std::string OUTFITS_TAB_NAME = "outfitslist_tab"; static const std::string OUTFIT_GALLERY_TAB_NAME = "outfit_gallery_tab"; static const std::string COF_TAB_NAME = "cof_tab"; +static const std::string SAVE_AS_BTN("save_as_btn"); +static const std::string SAVE_BTN("save_btn"); + static LLPanelInjector t_inventory("panel_outfits_inventory"); LLPanelOutfitsInventory::LLPanelOutfitsInventory() : @@ -90,8 +92,9 @@ BOOL LLPanelOutfitsInventory::postBuild() { LLInventoryModelBackgroundFetch::instance().start(outfits_cat); } - - mSaveComboBtn.reset(new LLSaveOutfitComboBtn(this, true)); + + getChild(SAVE_BTN)->setCommitCallback(boost::bind(&LLPanelOutfitsInventory::saveOutfit, this, false)); + getChild(SAVE_AS_BTN)->setCommitCallback(boost::bind(&LLPanelOutfitsInventory::saveOutfit, this, true)); return TRUE; } @@ -269,7 +272,7 @@ void LLPanelOutfitsInventory::updateListCommands() mOutfitGalleryPanel->childSetEnabled("trash_btn", trash_enabled); wear_btn->setEnabled(wear_enabled); wear_btn->setVisible(wear_visible); - mSaveComboBtn->setMenuItemEnabled("save_outfit", make_outfit_enabled); + getChild(SAVE_BTN)->setEnabled(make_outfit_enabled); wear_btn->setToolTip(getString((!isOutfitsGalleryPanelActive() && mMyOutfitsPanel->hasItemSelected()) ? "wear_items_tooltip" : "wear_outfit_tooltip")); } @@ -368,3 +371,15 @@ LLSidepanelAppearance* LLPanelOutfitsInventory::getAppearanceSP() dynamic_cast(LLFloaterSidePanelContainer::getPanel("appearance")); return panel_appearance; } + +void LLPanelOutfitsInventory::saveOutfit(bool as_new) +{ + if (!as_new && LLAppearanceMgr::getInstance()->updateBaseOutfit()) + { + // we don't need to ask for an outfit name, and updateBaseOutfit() successfully saved. + // If updateBaseOutfit fails, ask for an outfit name anyways + return; + } + + onSave(); +} diff --git a/indra/newview/llpaneloutfitsinventory.h b/indra/newview/llpaneloutfitsinventory.h index 6a0ea04fa6..e68f04e28d 100644 --- a/indra/newview/llpaneloutfitsinventory.h +++ b/indra/newview/llpaneloutfitsinventory.h @@ -38,7 +38,6 @@ class LLPanelWearing; class LLMenuGL; class LLSidepanelAppearance; class LLTabContainer; -class LLSaveOutfitComboBtn; class LLPanelOutfitsInventory : public LLPanel { @@ -52,6 +51,7 @@ public: void onSearchEdit(const std::string& string); void onSave(); + void saveOutfit(bool as_new = false); bool onSaveCommit(const LLSD& notification, const LLSD& response); @@ -65,7 +65,6 @@ protected: private: LLTabContainer* mAppearanceTabs; std::string mFilterSubString; - std::auto_ptr mSaveComboBtn; ////////////////////////////////////////////////////////////////////////////////// // tab panels // diff --git a/indra/newview/skins/default/xui/en/panel_outfit_edit.xml b/indra/newview/skins/default/xui/en/panel_outfit_edit.xml index 6fd54d7c6a..c4c51afa82 100644 --- a/indra/newview/skins/default/xui/en/panel_outfit_edit.xml +++ b/indra/newview/skins/default/xui/en/panel_outfit_edit.xml @@ -510,27 +510,31 @@ It is calculated as border_size + 2*UIResizeBarOverlap