diff options
author | Mnikolenko Productengine <mnikolenko@productengine.com> | 2021-03-29 19:54:24 +0300 |
---|---|---|
committer | Mnikolenko Productengine <mnikolenko@productengine.com> | 2021-03-29 19:54:24 +0300 |
commit | 569ad2d248cd1297b937e2c003399937114d06b9 (patch) | |
tree | 7eb5f8c852b53dbb39298209233d0f93da69d91b | |
parent | 100fa900c09110f215ab241cd2fd3d237dfb96fd (diff) |
Separate "Save changes" and "Save as..." in Outfits floater
-rw-r--r-- | indra/newview/llpaneloutfitedit.cpp | 19 | ||||
-rw-r--r-- | indra/newview/llpaneloutfitedit.h | 3 | ||||
-rw-r--r-- | indra/newview/llpaneloutfitsinventory.cpp | 23 | ||||
-rw-r--r-- | indra/newview/llpaneloutfitsinventory.h | 3 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_outfit_edit.xml | 36 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_outfits_inventory.xml | 39 |
6 files changed, 77 insertions, 46 deletions
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<LLButton>(SAVE_BTN)->setCommitCallback(boost::bind(&LLPanelOutfitEdit::saveOutfit, this, false)); + getChild<LLButton>(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<LLSaveOutfitComboBtn> 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<LLPanelOutfitsInventory> 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<LLButton>(SAVE_BTN)->setCommitCallback(boost::bind(&LLPanelOutfitsInventory::saveOutfit, this, false)); + getChild<LLButton>(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<LLButton>(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<LLSidepanelAppearance*>(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<LLSaveOutfitComboBtn> 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 <button follows="bottom|left|right" height="23" - label="Save" + label="Save changes" left="1" layout="topleft" name="save_btn" top="0" width="155" /> - <button - follows="bottom|right" - height="23" - name="save_flyout_btn" - label="" - layout="topleft" - left_pad="-20" - tab_stop="false" - top="0" - image_selected="SegmentedBtn_Right_Selected_Press" - image_unselected="SegmentedBtn_Right_Off" - image_pressed="SegmentedBtn_Right_Press" - image_pressed_selected="SegmentedBtn_Right_Selected_Press" - image_overlay="Arrow_Small_Up" - width="20"/> + </layout_panel> + <layout_panel + follows="bottom|left|right" + height="23" + layout="bottomleft" + left_pad="3" + mouse_opaque="false" + name="save_as_btn_lp" + auto_resize="true" + width="156"> + <button + follows="bottom|left|right" + height="23" + label="Save as..." + layout="topleft" + name="save_as_btn" + top="0" + left="1" + width="155" /> </layout_panel> <layout_panel follows="bottom|left|right" diff --git a/indra/newview/skins/default/xui/en/panel_outfits_inventory.xml b/indra/newview/skins/default/xui/en/panel_outfits_inventory.xml index 6c8cc9d39a..7b898dbd7f 100644 --- a/indra/newview/skins/default/xui/en/panel_outfits_inventory.xml +++ b/indra/newview/skins/default/xui/en/panel_outfits_inventory.xml @@ -100,28 +100,33 @@ <button follows="bottom|left|right" height="23" - label="Save As" + label="Save changes" left="1" layout="topleft" name="save_btn" top="0" width="155" /> - <button - follows="bottom|right" - height="23" - name="save_flyout_btn" - label="" - layout="topleft" - left_pad="-20" - tab_stop="false" - image_selected="SegmentedBtn_Right_Selected_Press" - image_unselected="SegmentedBtn_Right_Off" - image_pressed="SegmentedBtn_Right_Press" - image_pressed_selected="SegmentedBtn_Right_Selected_Press" - image_overlay="Arrow_Small_Up" - width="20"/> - </layout_panel> - <layout_panel + </layout_panel> + <layout_panel + follows="bottom|left|right" + height="23" + layout="bottomleft" + left_pad="3" + mouse_opaque="false" + name="save_as_btn_lp" + auto_resize="true" + width="156"> + <button + follows="bottom|left|right" + height="23" + label="Save as..." + layout="topleft" + name="save_as_btn" + top="0" + left="1" + width="155" /> + </layout_panel> + <layout_panel follows="bottom|left|right" height="23" layout="bottomleft" |