diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llagentwearables.cpp | 16 | ||||
-rw-r--r-- | indra/newview/llappearancemgr.cpp | 16 | ||||
-rw-r--r-- | indra/newview/llappearancemgr.h | 1 | ||||
-rw-r--r-- | indra/newview/llpaneloutfitsinventory.cpp | 92 | ||||
-rw-r--r-- | indra/newview/llpaneloutfitsinventory.h | 4 | ||||
-rw-r--r-- | indra/newview/llsidepanelappearance.cpp | 14 | ||||
-rw-r--r-- | indra/newview/llsidepanelappearance.h | 2 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_outfit_save_as.xml | 59 |
8 files changed, 182 insertions, 22 deletions
diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index 10a2dd132a..c21cdf9508 100644 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -1364,15 +1364,15 @@ void LLAgentWearables::makeNewOutfit(const std::string& new_folder_name, } } -class LLAutoRenameFolder: public LLInventoryCallback +class LLShowCreatedOutfit: public LLInventoryCallback { public: - LLAutoRenameFolder(LLUUID& folder_id): + LLShowCreatedOutfit(LLUUID& folder_id): mFolderID(folder_id) { } - virtual ~LLAutoRenameFolder() + virtual ~LLShowCreatedOutfit() { LLSD key; LLSideTray::getInstance()->showPanel("panel_outfits_inventory", key); @@ -1382,13 +1382,15 @@ public: { outfit_panel->getRootFolder()->clearSelection(); outfit_panel->getRootFolder()->setSelectionByID(mFolderID, TRUE); - outfit_panel->getRootFolder()->setNeedsAutoRename(TRUE); } LLAccordionCtrlTab* tab_outfits = outfit_panel ? outfit_panel->findChild<LLAccordionCtrlTab>("tab_outfits") : 0; if (tab_outfits && !tab_outfits->getDisplayChildren()) { tab_outfits->changeOpenClose(tab_outfits->getDisplayChildren()); } + + LLAppearanceManager::instance().updateIsDirty(); + LLAppearanceManager::instance().updatePanelOutfitName(""); } virtual void fire(const LLUUID&) @@ -1413,10 +1415,10 @@ LLUUID LLAgentWearables::makeNewOutfitLinks(const std::string& new_folder_name) LLFolderType::FT_OUTFIT, new_folder_name); - LLPointer<LLInventoryCallback> cb = new LLAutoRenameFolder(folder_id); + LLPointer<LLInventoryCallback> cb = new LLShowCreatedOutfit(folder_id); LLAppearanceManager::instance().shallowCopyCategory(LLAppearanceManager::instance().getCOF(),folder_id, cb); - LLAppearanceManager::instance().createBaseOutfitLink(folder_id, NULL); - + LLAppearanceManager::instance().createBaseOutfitLink(folder_id, cb); + return folder_id; } diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 4d4a89bcd4..748d8bdfbf 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -392,6 +392,21 @@ const LLViewerInventoryItem* LLAppearanceManager::getBaseOutfitLink() return NULL; } +bool LLAppearanceManager::getBaseOutfitName(std::string& name) +{ + const LLViewerInventoryItem* outfit_link = getBaseOutfitLink(); + if(outfit_link) + { + const LLViewerInventoryCategory *cat = outfit_link->getLinkedCategory(); + if (cat) + { + name = cat->getName(); + return true; + } + } + return false; +} + // Update appearance from outfit folder. void LLAppearanceManager::changeOutfit(bool proceed, const LLUUID& category, bool append) { @@ -630,6 +645,7 @@ void LLAppearanceManager::createBaseOutfitLink(const LLUUID& category, LLPointer LLAssetType::AT_LINK_FOLDER, link_waiter); new_outfit_name = catp->getName(); } + updatePanelOutfitName(new_outfit_name); } diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index b954968998..20745b70e4 100644 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -63,6 +63,7 @@ public: // Finds the folder link to the currently worn outfit const LLViewerInventoryItem *getBaseOutfitLink(); + bool getBaseOutfitName(std::string &name); // Update the displayed outfit name in UI. void updatePanelOutfitName(const std::string& name); diff --git a/indra/newview/llpaneloutfitsinventory.cpp b/indra/newview/llpaneloutfitsinventory.cpp index 550fee71bf..c7dc7c0c7c 100644 --- a/indra/newview/llpaneloutfitsinventory.cpp +++ b/indra/newview/llpaneloutfitsinventory.cpp @@ -35,6 +35,7 @@ #include "llagent.h" #include "llagentwearables.h" +#include "llappearancemgr.h" #include "llbutton.h" #include "llfloaterreg.h" @@ -44,6 +45,8 @@ #include "llinventoryfunctions.h" #include "llinventorypanel.h" #include "lllandmark.h" +#include "lllineeditor.h" +#include "llmodaldialog.h" #include "llsidepanelappearance.h" #include "llsidetray.h" #include "lltabcontainer.h" @@ -61,12 +64,75 @@ static LLRegisterPanelClassWrapper<LLPanelOutfitsInventory> t_inventory("panel_outfits_inventory"); bool LLPanelOutfitsInventory::sShowDebugEditor = false; +class LLOutfitSaveAsDialog : public LLModalDialog +{ +private: + std::string mItemName; + std::string mTempItemName; + + boost::signals2::signal<void (const std::string&)> mSaveAsSignal; + +public: + LLOutfitSaveAsDialog( const LLSD& key ) + : LLModalDialog( key ), + mTempItemName(key.asString()) + { + } + + BOOL postBuild() + { + getChild<LLUICtrl>("Save")->setCommitCallback(boost::bind(&LLOutfitSaveAsDialog::onSave, this )); + getChild<LLUICtrl>("Cancel")->setCommitCallback(boost::bind(&LLOutfitSaveAsDialog::onCancel, this )); + + childSetTextArg("name ed", "[DESC]", mTempItemName); + return TRUE; + } + + void setSaveAsCommit( const boost::signals2::signal<void (const std::string&)>::slot_type& cb ) + { + mSaveAsSignal.connect(cb); + } + + virtual void onOpen(const LLSD& key) + { + LLLineEditor* edit = getChild<LLLineEditor>("name ed"); + if (edit) + { + edit->setFocus(TRUE); + edit->selectAll(); + } + } + + void onSave() + { + mItemName = childGetValue("name ed").asString(); + LLStringUtil::trim(mItemName); + if( !mItemName.empty() ) + { + mSaveAsSignal(mItemName); + closeFloater(); // destroys this object + } + } + + void onCancel() + { + closeFloater(); // destroys this object + } +}; + LLPanelOutfitsInventory::LLPanelOutfitsInventory() : mActivePanel(NULL), mParent(NULL) { mSavedFolderState = new LLSaveFolderState(); mSavedFolderState->setApply(FALSE); + + static bool registered_dialog = false; + if (!registered_dialog) + { + LLFloaterReg::add("outfit_save_as", "floater_outfit_save_as.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLOutfitSaveAsDialog>); + registered_dialog = true; + } } LLPanelOutfitsInventory::~LLPanelOutfitsInventory() @@ -177,10 +243,28 @@ void LLPanelOutfitsInventory::onEdit() { } -void LLPanelOutfitsInventory::onNew() +void LLPanelOutfitsInventory::onSave() +{ + std::string outfit_name; + + if (!LLAppearanceManager::getInstance()->getBaseOutfitName(outfit_name)) + { + outfit_name = LLViewerFolderType::lookupNewCategoryName(LLFolderType::FT_OUTFIT); + } + + LLOutfitSaveAsDialog* save_as_dialog = LLFloaterReg::showTypedInstance<LLOutfitSaveAsDialog>("outfit_save_as", LLSD(outfit_name), TRUE); + if (save_as_dialog) + { + save_as_dialog->setSaveAsCommit(boost::bind(&LLPanelOutfitsInventory::onSaveCommit, this, _1 )); + } +} + +void LLPanelOutfitsInventory::onSaveCommit(const std::string& outfit_name) { - const std::string& outfit_name = LLViewerFolderType::lookupNewCategoryName(LLFolderType::FT_OUTFIT); LLUUID outfit_folder = gAgentWearables.makeNewOutfitLinks(outfit_name); + LLSD key; + LLSideTray::getInstance()->showPanel("panel_outfits_inventory", key); + if (mAppearanceTabs) { mAppearanceTabs->selectTabByName("outfitslist_tab"); @@ -290,7 +374,7 @@ void LLPanelOutfitsInventory::onGearButtonClick() void LLPanelOutfitsInventory::onAddButtonClick() { - onNew(); + onSave(); } void LLPanelOutfitsInventory::showActionMenu(LLMenuGL* menu, std::string spawning_view_name) @@ -329,7 +413,7 @@ void LLPanelOutfitsInventory::onCustomAction(const LLSD& userdata) const std::string command_name = userdata.asString(); if (command_name == "new") { - onNew(); + onSave(); } if (command_name == "edit") { diff --git a/indra/newview/llpaneloutfitsinventory.h b/indra/newview/llpaneloutfitsinventory.h index b117311775..76110e2a3f 100644 --- a/indra/newview/llpaneloutfitsinventory.h +++ b/indra/newview/llpaneloutfitsinventory.h @@ -59,7 +59,9 @@ public: void onAdd(); void onRemove(); void onEdit(); - void onNew(); + void onSave(); + + void onSaveCommit(const std::string& item_name); void onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action); void onSelectorButtonClicked(); diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp index 77a370cc3f..43215f86bd 100644 --- a/indra/newview/llsidepanelappearance.cpp +++ b/indra/newview/llsidepanelappearance.cpp @@ -87,7 +87,7 @@ void LLWatchForOutfitRenameObserver::changed(U32 mask) mPanel->refreshCurrentOutfitName(); } } - + LLSidepanelAppearance::LLSidepanelAppearance() : LLPanel(), mFilterSubString(LLStringUtil::null), @@ -255,7 +255,7 @@ void LLSidepanelAppearance::onNewOutfitButtonClicked() { if (!mLookInfo->getVisible()) { - mPanelOutfitsInventory->onNew(); + mPanelOutfitsInventory->onSave(); } } @@ -321,15 +321,11 @@ void LLSidepanelAppearance::refreshCurrentOutfitName(const std::string& name) mOutfitDirtyTag->setVisible(LLAppearanceManager::getInstance()->isOutfitDirty()); if (name == "") { - const LLViewerInventoryItem *outfit_link = LLAppearanceManager::getInstance()->getBaseOutfitLink(); - if (outfit_link) + std::string outfit_name; + if (LLAppearanceManager::getInstance()->getBaseOutfitName(outfit_name)) { - const LLViewerInventoryCategory *cat = outfit_link->getLinkedCategory(); - if (cat && cat->getPreferredType() == LLFolderType::FT_OUTFIT) - { - mCurrentLookName->setText(cat->getName()); + mCurrentLookName->setText(outfit_name); return; - } } mCurrentLookName->setText(getString("No Outfit")); mOpenOutfitBtn->setEnabled(FALSE); diff --git a/indra/newview/llsidepanelappearance.h b/indra/newview/llsidepanelappearance.h index 9524b0ece9..aa2e67fd16 100644 --- a/indra/newview/llsidepanelappearance.h +++ b/indra/newview/llsidepanelappearance.h @@ -61,6 +61,7 @@ public: void fetchInventory(); void inventoryFetched(); void updateVerbs(); + void onNewOutfitButtonClicked(); private: void onFilterEdit(const std::string& search_string); @@ -68,7 +69,6 @@ private: void onOpenOutfitButtonClicked(); void onEditAppearanceButtonClicked(); void onEditButtonClicked(); - void onNewOutfitButtonClicked(); void onBackButtonClicked(); void onEditWearBackClicked(); void toggleLookInfoPanel(BOOL visible); diff --git a/indra/newview/skins/default/xui/en/floater_outfit_save_as.xml b/indra/newview/skins/default/xui/en/floater_outfit_save_as.xml new file mode 100644 index 0000000000..c3d84de9a7 --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_outfit_save_as.xml @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<floater + legacy_header_height="18" + border="true" + can_close="false" + can_minimize="false" + height="100" + layout="topleft" + name="modal container" + width="240"> + <button + height="20" + label="Save" + label_selected="Save" + layout="topleft" + left="20" + name="Save" + top="70" + width="82" /> + <button + height="20" + label="Cancel" + label_selected="Cancel" + layout="topleft" + left_pad="36" + name="Cancel" + top_delta="0" + width="82" /> + <text + type="string" + length="1" + follows="left|top" + font="SansSerif" + height="16" + layout="topleft" + left="20" + name="Save item as:" + top="10" + width="200"> + Save outfit as: + </text> + <line_editor + type="string" + length="1" + border_style="line" + border_thickness="1" + follows="left|top" + font="SansSerif" + handle_edit_keys_directly="true" + height="20" + layout="topleft" + left_delta="0" + max_length="63" + name="name ed" + top_pad="4" + width="200"> + [DESC] + </line_editor> +</floater> |