EXT-7485 FIXED Updated 'save as new' button on inventory outfit pane to fit spec.
* moved logic related to combo button from LLPanelOutfitEdit to LLSaveOutfitComboBtn class; * used LLSaveOutfitComboBtn class in LLPanelOutfitsInventory; reviewed by Neal Orman at https://codereview.productengine.com/secondlife/r/459/ --HG-- branch : product-enginemeow-7.2.2
parent
9f91d43680
commit
bfced6d4c1
|
|
@ -379,6 +379,7 @@ set(viewer_SOURCE_FILES
|
|||
llregionposition.cpp
|
||||
llremoteparcelrequest.cpp
|
||||
llsavedsettingsglue.cpp
|
||||
llsaveoutfitcombobtn.cpp
|
||||
llscreenchannel.cpp
|
||||
llscriptfloater.cpp
|
||||
llscrollingpanelparam.cpp
|
||||
|
|
@ -894,6 +895,7 @@ set(viewer_HEADER_FILES
|
|||
llresourcedata.h
|
||||
llrootview.h
|
||||
llsavedsettingsglue.h
|
||||
llsaveoutfitcombobtn.h
|
||||
llscreenchannel.h
|
||||
llscriptfloater.h
|
||||
llscrollingpanelparam.h
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@
|
|||
#include "llinventorymodelbackgroundfetch.h"
|
||||
#include "llpaneloutfitsinventory.h"
|
||||
#include "lluiconstants.h"
|
||||
#include "llsaveoutfitcombobtn.h"
|
||||
#include "llscrolllistctrl.h"
|
||||
#include "lltextbox.h"
|
||||
#include "lluictrlfactory.h"
|
||||
|
|
@ -75,7 +76,6 @@ const U64 WEARABLE_MASK = (1LL << LLInventoryType::IT_WEARABLE);
|
|||
const U64 ATTACHMENT_MASK = (1LL << LLInventoryType::IT_ATTACHMENT) | (1LL << LLInventoryType::IT_OBJECT);
|
||||
const U64 ALL_ITEMS_MASK = WEARABLE_MASK | ATTACHMENT_MASK;
|
||||
|
||||
static const std::string SAVE_BTN("save_btn");
|
||||
static const std::string REVERT_BTN("revert_btn");
|
||||
|
||||
class LLCOFObserver : public LLInventoryObserver
|
||||
|
|
@ -307,14 +307,6 @@ BOOL LLPanelOutfitEdit::postBuild()
|
|||
|
||||
childSetAction(REVERT_BTN, boost::bind(&LLAppearanceMgr::wearBaseOutfit, LLAppearanceMgr::getInstance()));
|
||||
|
||||
childSetAction(SAVE_BTN, boost::bind(&LLPanelOutfitEdit::saveOutfit, this, false));
|
||||
childSetAction("save_flyout_btn", boost::bind(&LLPanelOutfitEdit::showSaveMenu, this));
|
||||
|
||||
LLUICtrl::CommitCallbackRegistry::ScopedRegistrar save_registar;
|
||||
save_registar.add("Outfit.Save.Action", boost::bind(&LLPanelOutfitEdit::saveOutfit, this, false));
|
||||
save_registar.add("Outfit.SaveAsNew.Action", boost::bind(&LLPanelOutfitEdit::saveOutfit, this, true));
|
||||
mSaveMenu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_save_outfit.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
|
||||
|
||||
mWearableListMaskCollector = new LLFindNonLinksByMask(ALL_ITEMS_MASK);
|
||||
mWearableListTypeCollector = new LLFindWearablesOfType(LLWearableType::WT_NONE);
|
||||
|
||||
|
|
@ -322,6 +314,7 @@ BOOL LLPanelOutfitEdit::postBuild()
|
|||
mWearableItemsList = getChild<LLInventoryItemsList>("filtered_wearables_list");
|
||||
mWearableListManager = new LLFilteredWearableListManager(mWearableItemsList, mWearableListMaskCollector);
|
||||
|
||||
mSaveComboBtn.reset(new LLSaveOutfitComboBtn(this));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -385,33 +378,6 @@ void LLPanelOutfitEdit::showFilteredFolderWearablesPanel()
|
|||
mFolderViewBtn->setToggleState(TRUE);
|
||||
}
|
||||
|
||||
void LLPanelOutfitEdit::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;
|
||||
}
|
||||
|
||||
LLPanelOutfitsInventory* panel_outfits_inventory = LLPanelOutfitsInventory::findInstance();
|
||||
if (panel_outfits_inventory)
|
||||
{
|
||||
panel_outfits_inventory->onSave();
|
||||
}
|
||||
|
||||
//*TODO how to get to know when base outfit is updated or new outfit is created?
|
||||
}
|
||||
|
||||
void LLPanelOutfitEdit::showSaveMenu()
|
||||
{
|
||||
S32 x, y;
|
||||
LLUI::getMousePositionLocal(this, &x, &y);
|
||||
|
||||
mSaveMenu->updateParent(LLMenuGL::sMenuContainer);
|
||||
LLMenuGL::showPopup(this, mSaveMenu, x, y);
|
||||
}
|
||||
|
||||
void LLPanelOutfitEdit::onTypeFilterChanged(LLUICtrl* ctrl)
|
||||
{
|
||||
LLComboBox* type_filter = dynamic_cast<LLComboBox*>(ctrl);
|
||||
|
|
@ -709,10 +675,10 @@ void LLPanelOutfitEdit::updateVerbs()
|
|||
bool outfit_is_dirty = LLAppearanceMgr::getInstance()->isOutfitDirty();
|
||||
bool has_baseoutfit = LLAppearanceMgr::getInstance()->getBaseOutfitUUID().notNull();
|
||||
|
||||
childSetEnabled(SAVE_BTN, outfit_is_dirty);
|
||||
mSaveComboBtn->setSaveBtnEnabled(outfit_is_dirty);
|
||||
childSetEnabled(REVERT_BTN, outfit_is_dirty && has_baseoutfit);
|
||||
|
||||
mSaveMenu->setItemEnabled("save_outfit", outfit_is_dirty);
|
||||
mSaveComboBtn->setMenuItemEnabled("save_outfit", outfit_is_dirty);
|
||||
|
||||
mStatus->setText(outfit_is_dirty ? getString("unsaved_changes") : getString("now_editing"));
|
||||
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ class LLFilteredWearableListManager;
|
|||
class LLMenuGL;
|
||||
class LLFindNonLinksByMask;
|
||||
class LLFindWearablesOfType;
|
||||
class LLSaveOutfitComboBtn;
|
||||
|
||||
class LLPanelOutfitEdit : public LLPanel
|
||||
{
|
||||
|
|
@ -95,8 +96,6 @@ public:
|
|||
void showWearablesFilter();
|
||||
void showFilteredWearablesPanel();
|
||||
void showFilteredFolderWearablesPanel();
|
||||
void saveOutfit(bool as_new = false);
|
||||
void showSaveMenu();
|
||||
|
||||
void onTypeFilterChanged(LLUICtrl* ctrl);
|
||||
void onSearchEdit(const std::string& string);
|
||||
|
|
@ -145,7 +144,6 @@ private:
|
|||
LLButton* mEditWearableBtn;
|
||||
LLButton* mFolderViewBtn;
|
||||
LLButton* mListViewBtn;
|
||||
LLToggleableMenu* mSaveMenu;
|
||||
LLPanel* mAddWearablesPanel;
|
||||
|
||||
LLFindNonLinksByMask* mWearableListMaskCollector;
|
||||
|
|
@ -163,6 +161,8 @@ private:
|
|||
LLCOFWearables* mCOFWearables;
|
||||
LLMenuGL* mGearMenu;
|
||||
bool mInitialized;
|
||||
std::auto_ptr<LLSaveOutfitComboBtn> mSaveComboBtn;
|
||||
|
||||
};
|
||||
|
||||
#endif // LL_LLPANELOUTFITEDIT_H
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@
|
|||
#include "llmodaldialog.h"
|
||||
#include "llnotificationsutil.h"
|
||||
#include "lloutfitslist.h"
|
||||
#include "llsaveoutfitcombobtn.h"
|
||||
#include "llsidepanelappearance.h"
|
||||
#include "llsidetray.h"
|
||||
#include "lltabcontainer.h"
|
||||
|
|
@ -101,6 +102,8 @@ BOOL LLPanelOutfitsInventory::postBuild()
|
|||
LLInventoryModelBackgroundFetch::instance().start(outfits_cat);
|
||||
}
|
||||
|
||||
mSaveComboBtn.reset(new LLSaveOutfitComboBtn(this, true));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -373,7 +376,6 @@ void LLPanelOutfitsInventory::initListCommandsHandlers()
|
|||
|
||||
mListCommands->childSetAction("options_gear_btn", boost::bind(&LLPanelOutfitsInventory::onGearButtonClick, this));
|
||||
mListCommands->childSetAction("trash_btn", boost::bind(&LLPanelOutfitsInventory::onTrashButtonClick, this));
|
||||
mListCommands->childSetAction("make_outfit_btn", boost::bind(&LLPanelOutfitsInventory::onAddButtonClick, this));
|
||||
mListCommands->childSetAction("wear_btn", boost::bind(&LLPanelOutfitsInventory::onWearButtonClick, this));
|
||||
|
||||
LLDragAndDropButton* trash_btn = mListCommands->getChild<LLDragAndDropButton>("trash_btn");
|
||||
|
|
@ -396,7 +398,7 @@ void LLPanelOutfitsInventory::updateListCommands()
|
|||
mListCommands->childSetEnabled("trash_btn", trash_enabled);
|
||||
mListCommands->childSetEnabled("wear_btn", wear_enabled);
|
||||
mListCommands->childSetVisible("wear_btn", wear_enabled);
|
||||
mListCommands->childSetEnabled("make_outfit_btn", make_outfit_enabled);
|
||||
mSaveComboBtn->setSaveBtnEnabled(make_outfit_enabled);
|
||||
}
|
||||
|
||||
void LLPanelOutfitsInventory::onGearButtonClick()
|
||||
|
|
@ -404,11 +406,6 @@ void LLPanelOutfitsInventory::onGearButtonClick()
|
|||
showActionMenu(mMenuGearDefault,"options_gear_btn");
|
||||
}
|
||||
|
||||
void LLPanelOutfitsInventory::onAddButtonClick()
|
||||
{
|
||||
onSave();
|
||||
}
|
||||
|
||||
void LLPanelOutfitsInventory::showActionMenu(LLMenuGL* menu, std::string spawning_view_name)
|
||||
{
|
||||
if (menu)
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ class LLButton;
|
|||
class LLMenuGL;
|
||||
class LLSidepanelAppearance;
|
||||
class LLTabContainer;
|
||||
class LLSaveOutfitComboBtn;
|
||||
|
||||
class LLPanelOutfitsInventory : public LLPanel
|
||||
{
|
||||
|
|
@ -86,7 +87,7 @@ private:
|
|||
LLSaveFolderState* mSavedFolderState;
|
||||
LLTabContainer* mAppearanceTabs;
|
||||
std::string mFilterSubString;
|
||||
|
||||
std::auto_ptr<LLSaveOutfitComboBtn> mSaveComboBtn;
|
||||
public:
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// tab panels
|
||||
|
|
@ -117,7 +118,6 @@ protected:
|
|||
void updateListCommands();
|
||||
void onGearButtonClick();
|
||||
void onWearButtonClick();
|
||||
void onAddButtonClick();
|
||||
void showActionMenu(LLMenuGL* menu, std::string spawning_view_name);
|
||||
void onTrashButtonClick();
|
||||
void onClipboardAction(const LLSD& userdata);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,98 @@
|
|||
/**
|
||||
* @file llsaveoutfitcombobtn.cpp
|
||||
* @brief Represents outfit save/save as combo button.
|
||||
*
|
||||
* $LicenseInfo:firstyear=2010&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2010, Linden Research, Inc.
|
||||
*
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
|
||||
#include "llappearancemgr.h"
|
||||
#include "llpaneloutfitsinventory.h"
|
||||
#include "llsaveoutfitcombobtn.h"
|
||||
#include "lltoggleablemenu.h"
|
||||
#include "llviewermenu.h"
|
||||
|
||||
static const std::string SAVE_BTN("save_btn");
|
||||
static const std::string SAVE_FLYOUT_BTN("save_flyout_btn");
|
||||
|
||||
LLSaveOutfitComboBtn::LLSaveOutfitComboBtn(LLPanel* parent, bool saveAsDefaultAction):
|
||||
mParent(parent), mSaveAsDefaultAction(saveAsDefaultAction)
|
||||
{
|
||||
// register action mapping before creating menu
|
||||
LLUICtrl::CommitCallbackRegistry::ScopedRegistrar save_registar;
|
||||
save_registar.add("Outfit.Save.Action", boost::bind(
|
||||
&LLSaveOutfitComboBtn::saveOutfit, this, false));
|
||||
save_registar.add("Outfit.SaveAs.Action", boost::bind(
|
||||
&LLSaveOutfitComboBtn::saveOutfit, this, true));
|
||||
|
||||
mParent->childSetAction(SAVE_BTN, boost::bind(&LLSaveOutfitComboBtn::saveOutfit, this, mSaveAsDefaultAction));
|
||||
mParent->childSetAction(SAVE_FLYOUT_BTN, boost::bind(&LLSaveOutfitComboBtn::showSaveMenu, this));
|
||||
|
||||
mSaveMenu.reset(LLUICtrlFactory::getInstance()->createFromFile<
|
||||
LLToggleableMenu> ("menu_save_outfit.xml", gMenuHolder,
|
||||
LLViewerMenuHolderGL::child_registry_t::instance()));
|
||||
}
|
||||
|
||||
void LLSaveOutfitComboBtn::showSaveMenu()
|
||||
{
|
||||
S32 x, y;
|
||||
LLUI::getMousePositionLocal(mParent, &x, &y);
|
||||
|
||||
mSaveMenu->updateParent(LLMenuGL::sMenuContainer);
|
||||
LLMenuGL::showPopup(mParent, mSaveMenu.get(), x, y);
|
||||
}
|
||||
|
||||
void LLSaveOutfitComboBtn::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;
|
||||
}
|
||||
|
||||
LLPanelOutfitsInventory* panel_outfits_inventory =
|
||||
LLPanelOutfitsInventory::findInstance();
|
||||
if (panel_outfits_inventory)
|
||||
{
|
||||
panel_outfits_inventory->onSave();
|
||||
}
|
||||
|
||||
//*TODO how to get to know when base outfit is updated or new outfit is created?
|
||||
}
|
||||
|
||||
void LLSaveOutfitComboBtn::setMenuItemEnabled(const std::string& item, bool enabled)
|
||||
{
|
||||
mSaveMenu->setItemEnabled("save_outfit", enabled);
|
||||
}
|
||||
|
||||
void LLSaveOutfitComboBtn::setSaveBtnEnabled(bool enabled)
|
||||
{
|
||||
mParent->childSetEnabled(SAVE_BTN, enabled);
|
||||
}
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
/**
|
||||
* @file llsaveoutfitcombobtn.h
|
||||
* @brief Represents outfit save/save as combo button.
|
||||
*
|
||||
* $LicenseInfo:firstyear=2010&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2010, Linden Research, Inc.
|
||||
*
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#ifndef LL_LLSAVEOUTFITCOMBOBTN_H
|
||||
#define LL_LLSAVEOUTFITCOMBOBTN_H
|
||||
|
||||
class LLButton;
|
||||
class LLToggleableMenu;
|
||||
|
||||
|
||||
/**
|
||||
* Represents outfit Save/Save As combo button.
|
||||
*/
|
||||
class LLSaveOutfitComboBtn
|
||||
{
|
||||
LOG_CLASS(LLSaveOutfitComboBtn);
|
||||
public:
|
||||
LLSaveOutfitComboBtn(LLPanel* parent, bool saveAsDefaultAction = false);
|
||||
|
||||
void showSaveMenu();
|
||||
void saveOutfit(bool as_new = false);
|
||||
void setMenuItemEnabled(const std::string& item, bool enabled);
|
||||
void setSaveBtnEnabled(bool enabled);
|
||||
|
||||
private:
|
||||
bool mSaveAsDefaultAction;
|
||||
LLPanel* mParent;
|
||||
std::auto_ptr<LLToggleableMenu> mSaveMenu;
|
||||
};
|
||||
|
||||
#endif // LL_LLSAVEOUTFITCOMBOBTN_H
|
||||
|
|
@ -14,9 +14,9 @@
|
|||
</menu_item_call>
|
||||
<menu_item_call
|
||||
name="save_as_new_outfit"
|
||||
label="Save As New">
|
||||
label="Save As">
|
||||
<menu_item_call.on_click
|
||||
function="Outfit.SaveAsNew.Action"
|
||||
function="Outfit.SaveAs.Action"
|
||||
userdata="" />
|
||||
</menu_item_call>
|
||||
</toggleable_menu>
|
||||
|
|
|
|||
|
|
@ -93,17 +93,30 @@
|
|||
left_pad="1"
|
||||
name="trash_btn"
|
||||
tool_tip="Remove selected item"
|
||||
width="31"/>
|
||||
<button
|
||||
follows="bottom|left"
|
||||
height="23"
|
||||
label="Save Outfit"
|
||||
layout="topleft"
|
||||
name="make_outfit_btn"
|
||||
tool_tip="Save appearance as an outfit"
|
||||
width="31"/>
|
||||
<button
|
||||
follows="bottom|left"
|
||||
height="23"
|
||||
label="Save As"
|
||||
left="0"
|
||||
layout="topleft"
|
||||
name="save_btn"
|
||||
top_pad="6"
|
||||
left="0"
|
||||
width="153" />
|
||||
width="155" />
|
||||
<button
|
||||
follows="bottom|left"
|
||||
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"/>
|
||||
<button
|
||||
follows="bottom|left|right"
|
||||
height="23"
|
||||
|
|
|
|||
Loading…
Reference in New Issue