Skip to content
Snippets Groups Projects
Commit 1f46b1d8 authored by Tofu Linden's avatar Tofu Linden
Browse files

merge storm-93

parents 02fac563 36f3535f
No related branches found
No related tags found
No related merge requests found
...@@ -310,6 +310,7 @@ set(viewer_SOURCE_FILES ...@@ -310,6 +310,7 @@ set(viewer_SOURCE_FILES
lloutfitslist.cpp lloutfitslist.cpp
lloutfitobserver.cpp lloutfitobserver.cpp
lloutputmonitorctrl.cpp lloutputmonitorctrl.cpp
llpanelappearancetab.cpp
llpanelavatar.cpp llpanelavatar.cpp
llpanelavatartag.cpp llpanelavatartag.cpp
llpanelblockedlist.cpp llpanelblockedlist.cpp
......
...@@ -972,23 +972,6 @@ void LLOutfitsList::applyFilterToTab( ...@@ -972,23 +972,6 @@ void LLOutfitsList::applyFilterToTab(
} }
} }
bool LLOutfitsList::canTakeOffSelected()
{
uuid_vec_t selected_uuids;
getSelectedItemsUUIDs(selected_uuids);
LLFindWearablesEx is_worn(/*is_worn=*/ true, /*include_body_parts=*/ false);
for (uuid_vec_t::const_iterator it=selected_uuids.begin(); it != selected_uuids.end(); ++it)
{
LLViewerInventoryItem* item = gInventory.getItem(*it);
if (!item) continue;
if (is_worn(NULL, item)) return true;
}
return false;
}
bool LLOutfitsList::canWearSelected() bool LLOutfitsList::canWearSelected()
{ {
uuid_vec_t selected_items; uuid_vec_t selected_items;
......
...@@ -98,7 +98,7 @@ public: ...@@ -98,7 +98,7 @@ public:
const LLUUID& getSelectedOutfitUUID() const { return mSelectedOutfitUUID; } const LLUUID& getSelectedOutfitUUID() const { return mSelectedOutfitUUID; }
void getSelectedItemsUUIDs(uuid_vec_t& selected_uuids) const; /*virtual*/ void getSelectedItemsUUIDs(uuid_vec_t& selected_uuids) const;
boost::signals2::connection setSelectionChangeCallback(selection_change_callback_t cb); boost::signals2::connection setSelectionChangeCallback(selection_change_callback_t cb);
...@@ -173,11 +173,6 @@ private: ...@@ -173,11 +173,6 @@ private:
*/ */
void applyFilterToTab(const LLUUID& category_id, LLAccordionCtrlTab* tab, const std::string& filter_substring); void applyFilterToTab(const LLUUID& category_id, LLAccordionCtrlTab* tab, const std::string& filter_substring);
/**
* Returns true if there are any items that can be taken off among currently selected, otherwise false.
*/
bool canTakeOffSelected();
/** /**
* Returns true if all selected items can be worn. * Returns true if all selected items can be worn.
*/ */
......
/**
* @file llpanelappearancetab.h
* @brief Tabs interface for Side Bar "My Appearance" panel
*
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
#include "llpanelappearancetab.h"
#include "llinventoryfunctions.h"
#include "llinventorymodel.h"
//virtual
bool LLPanelAppearanceTab::canTakeOffSelected()
{
uuid_vec_t selected_uuids;
getSelectedItemsUUIDs(selected_uuids);
LLFindWearablesEx is_worn(/*is_worn=*/ true, /*include_body_parts=*/ false);
for (uuid_vec_t::const_iterator it=selected_uuids.begin(); it != selected_uuids.end(); ++it)
{
LLViewerInventoryItem* item = gInventory.getItem(*it);
if (!item) continue;
if (is_worn(NULL, item)) return true;
}
return false;
}
...@@ -41,9 +41,17 @@ public: ...@@ -41,9 +41,17 @@ public:
virtual void showGearMenu(LLView* spawning_view) = 0; virtual void showGearMenu(LLView* spawning_view) = 0;
virtual void getSelectedItemsUUIDs(uuid_vec_t& selected_uuids) const {}
static const std::string& getFilterSubString() { return sFilterSubString; } static const std::string& getFilterSubString() { return sFilterSubString; }
protected: protected:
/**
* Returns true if there are any items that can be taken off among currently selected, otherwise false.
*/
bool canTakeOffSelected();
static std::string sFilterSubString; static std::string sFilterSubString;
}; };
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "llpanelwearing.h" #include "llpanelwearing.h"
#include "llappearancemgr.h" #include "llappearancemgr.h"
#include "llinventoryfunctions.h"
#include "llinventorymodel.h" #include "llinventorymodel.h"
#include "llinventoryobserver.h" #include "llinventoryobserver.h"
#include "llsidetray.h" #include "llsidetray.h"
...@@ -46,12 +47,16 @@ static void edit_outfit() ...@@ -46,12 +47,16 @@ static void edit_outfit()
class LLWearingGearMenu class LLWearingGearMenu
{ {
public: public:
LLWearingGearMenu() LLWearingGearMenu(LLPanelWearing* panel_wearing)
: mMenu(NULL) : mMenu(NULL), mPanelWearing(panel_wearing)
{ {
LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar; LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar;
registrar.add("Gear.Edit", boost::bind(&edit_outfit)); registrar.add("Gear.Edit", boost::bind(&edit_outfit));
registrar.add("Gear.TakeOff", boost::bind(&LLWearingGearMenu::onTakeOff, this));
enable_registrar.add("Gear.OnEnable", boost::bind(&LLPanelWearing::isActionEnabled, mPanelWearing, _2));
mMenu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>( mMenu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>(
"menu_wearing_gear.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); "menu_wearing_gear.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
...@@ -70,7 +75,20 @@ public: ...@@ -70,7 +75,20 @@ public:
} }
private: private:
void onTakeOff()
{
uuid_vec_t selected_uuids;
mPanelWearing->getSelectedItemsUUIDs(selected_uuids);
for (uuid_vec_t::const_iterator it=selected_uuids.begin(); it != selected_uuids.end(); ++it)
{
LLAppearanceMgr::instance().removeItemFromAvatar(*it);
}
}
LLMenuGL* mMenu; LLMenuGL* mMenu;
LLPanelWearing* mPanelWearing;
}; };
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
...@@ -150,7 +168,7 @@ LLPanelWearing::LLPanelWearing() ...@@ -150,7 +168,7 @@ LLPanelWearing::LLPanelWearing()
{ {
mCategoriesObserver = new LLInventoryCategoriesObserver(); mCategoriesObserver = new LLInventoryCategoriesObserver();
mGearMenu = new LLWearingGearMenu(); mGearMenu = new LLWearingGearMenu(this);
mContextMenu = new LLWearingContextMenu(); mContextMenu = new LLWearingContextMenu();
} }
...@@ -226,6 +244,12 @@ bool LLPanelWearing::isActionEnabled(const LLSD& userdata) ...@@ -226,6 +244,12 @@ bool LLPanelWearing::isActionEnabled(const LLSD& userdata)
// allow save only if outfit isn't locked and is dirty // allow save only if outfit isn't locked and is dirty
return !outfit_locked && outfit_dirty; return !outfit_locked && outfit_dirty;
} }
if (command_name == "take_off")
{
return hasItemSelected() && canTakeOffSelected();
}
return false; return false;
} }
...@@ -255,4 +279,14 @@ void LLPanelWearing::onWearableItemsListRightClick(LLUICtrl* ctrl, S32 x, S32 y) ...@@ -255,4 +279,14 @@ void LLPanelWearing::onWearableItemsListRightClick(LLUICtrl* ctrl, S32 x, S32 y)
mContextMenu->show(ctrl, selected_uuids, x, y); mContextMenu->show(ctrl, selected_uuids, x, y);
} }
bool LLPanelWearing::hasItemSelected()
{
return mCOFItemsList->getSelectedItem() != NULL;
}
void LLPanelWearing::getSelectedItemsUUIDs(uuid_vec_t& selected_uuids) const
{
mCOFItemsList->getSelectedUUIDs(selected_uuids);
}
// EOF // EOF
...@@ -60,8 +60,12 @@ public: ...@@ -60,8 +60,12 @@ public:
/*virtual*/ void showGearMenu(LLView* spawning_view); /*virtual*/ void showGearMenu(LLView* spawning_view);
/*virtual*/ void getSelectedItemsUUIDs(uuid_vec_t& selected_uuids) const;
boost::signals2::connection setSelectionChangeCallback(commit_callback_t cb); boost::signals2::connection setSelectionChangeCallback(commit_callback_t cb);
bool hasItemSelected();
private: private:
void onWearableItemsListRightClick(LLUICtrl* ctrl, S32 x, S32 y); void onWearableItemsListRightClick(LLUICtrl* ctrl, S32 x, S32 y);
......
...@@ -10,4 +10,14 @@ ...@@ -10,4 +10,14 @@
<on_click <on_click
function="Gear.Edit" /> function="Gear.Edit" />
</menu_item_call> </menu_item_call>
<menu_item_call
label="Take Off"
layout="topleft"
name="takeoff">
<on_click
function="Gear.TakeOff" />
<on_enable
function="Gear.OnEnable"
parameter="take_off" />
</menu_item_call>
</menu> </menu>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment