Clean up and refactor LLAvatarActions & LLGroupActions

Mon, 18 Apr 2016 12:39:45 +0200

author
Ansariel
date
Mon, 18 Apr 2016 12:39:45 +0200
changeset 48953
a023d711ba5c
parent 48952
040e26898579
child 48954
296c54647556

Clean up and refactor LLAvatarActions & LLGroupActions

indra/newview/llavataractions.cpp file | annotate | diff | revisions
indra/newview/llgroupactions.cpp file | annotate | diff | revisions
     1.1 --- a/indra/newview/llavataractions.cpp	Mon Apr 18 09:46:50 2016 +0200
     1.2 +++ b/indra/newview/llavataractions.cpp	Mon Apr 18 12:39:45 2016 +0200
     1.3 @@ -440,15 +440,15 @@
     1.4  	if (id.notNull())
     1.5  	{
     1.6  //<FS:KC legacy profiles>
     1.7 -        if (gSavedSettings.getBOOL("FSUseWebProfiles"))
     1.8 +//		LLAvatarNameCache::get(id, boost::bind(&on_avatar_name_show_profile, _1, _2));
     1.9 +		if (gSavedSettings.getBOOL("FSUseWebProfiles"))
    1.10  		{
    1.11 -            showProfileWeb(id);
    1.12 -        }
    1.13 -        else
    1.14 -        {
    1.15 +			showProfileWeb(id);
    1.16 +		}
    1.17 +		else
    1.18 +		{
    1.19  			showProfileLegacy(id);
    1.20  		}
    1.21 -//		LLAvatarNameCache::get(id, boost::bind(&on_avatar_name_show_profile, _1, _2));
    1.22  //</FS:KC legacy profiles>
    1.23  	}
    1.24  }
    1.25 @@ -466,12 +466,11 @@
    1.26  LLFloater* LLAvatarActions::getProfileFloater(const LLUUID& id)
    1.27  {
    1.28  //<FS:KC legacy profiles>
    1.29 -    if (!gSavedSettings.getBOOL("FSUseWebProfiles"))
    1.30 -    {
    1.31 -        FSFloaterProfile *browser = dynamic_cast<FSFloaterProfile*>
    1.32 -            (LLFloaterReg::findInstance("floater_profile", LLSD().with("id", id)));
    1.33 -        return browser;
    1.34 -    }
    1.35 +	if (!gSavedSettings.getBOOL("FSUseWebProfiles"))
    1.36 +	{
    1.37 +		FSFloaterProfile* browser = LLFloaterReg::findTypedInstance<FSFloaterProfile>("floater_profile", LLSD().with("id", id));
    1.38 +		return browser;
    1.39 +	}
    1.40  //</FS:KC legacy profiles>
    1.41  	LLFloaterWebContent *browser = dynamic_cast<LLFloaterWebContent*>
    1.42  		(LLFloaterReg::findInstance(get_profile_floater_name(id), LLSD().with("id", id)));
    1.43 @@ -493,7 +492,7 @@
    1.44  {
    1.45  	if (id.notNull())
    1.46  	{
    1.47 -        LLFloaterReg::showInstance("floater_profile", LLSD().with("id", id));
    1.48 +		LLFloaterReg::showInstance("floater_profile", LLSD().with("id", id));
    1.49  	}
    1.50  }
    1.51  //</FS:KC legacy profiles>
    1.52 @@ -758,49 +757,42 @@
    1.53  	 * Checks My Inventory visibility.
    1.54  	 */
    1.55  
    1.56 -//      static bool is_give_inventory_acceptable()
    1.57 +//	static bool is_give_inventory_acceptable()
    1.58  // [SL:KB] - Patch: Inventory-ShareSelection | Checked: 2011-06-29 (Catznip-2.6.0e) | Added: Catznip-2.6.0e
    1.59 -        static bool is_give_inventory_acceptable(const uuid_set_t inventory_selected_uuids)
    1.60 +	static bool is_give_inventory_acceptable(const uuid_set_t inventory_selected_uuids)
    1.61  // [/SL:KB]
    1.62 -        {
    1.63 -//              LLInventoryPanel* active_panel = get_active_inventory_panel();
    1.64 -//              if (!active_panel) return false;
    1.65 +	{
    1.66 +//		// check selection in the panel
    1.67 +//		const std::set<LLUUID> inventory_selected_uuids = LLAvatarActions::getInventorySelectedUUIDs();
    1.68 +		if (inventory_selected_uuids.empty()) return false; // nothing selected
    1.69  
    1.70 -//              // check selection in the panel
    1.71 -//		const std::set<LLUUID> inventory_selected_uuids = LLAvatarActions::getInventorySelectedUUIDs();
    1.72 -//
    1.73 -                if (inventory_selected_uuids.empty()) return false; // nothing selected
    1.74 +		bool acceptable = false;
    1.75 +		std::set<LLUUID>::const_iterator it = inventory_selected_uuids.begin();
    1.76 +		const std::set<LLUUID>::const_iterator it_end = inventory_selected_uuids.end();
    1.77 +		for (; it != it_end; ++it)
    1.78 +		{
    1.79 +				LLViewerInventoryCategory* inv_cat = gInventory.getCategory(*it);
    1.80 +				// any category can be offered.
    1.81 +				if (inv_cat)
    1.82 +				{
    1.83 +					acceptable = true;
    1.84 +					continue;
    1.85 +				}
    1.86  
    1.87 -                bool acceptable = false;
    1.88 -//                std::set<LLUUID>::const_iterator it = inventory_selected_uuids.begin();
    1.89 -//                const std::set<LLUUID>::const_iterator it_end = inventory_selected_uuids.end();
    1.90 +				LLViewerInventoryItem* inv_item = gInventory.getItem(*it);
    1.91 +				// check if inventory item can be given
    1.92 +				if (LLGiveInventory::isInventoryGiveAcceptable(inv_item))
    1.93 +				{
    1.94 +					acceptable = true;
    1.95 +					continue;
    1.96 +				}
    1.97  
    1.98 -                uuid_set_t::const_iterator it = inventory_selected_uuids.begin();
    1.99 -                const uuid_set_t::const_iterator it_end = inventory_selected_uuids.end();
   1.100 -                for (; it != it_end; ++it)
   1.101 -                {
   1.102 -                        LLViewerInventoryCategory* inv_cat = gInventory.getCategory(*it);
   1.103 -                        // any category can be offered.
   1.104 -                        if (inv_cat)
   1.105 -                        {
   1.106 -                                acceptable = true;
   1.107 -                                continue;
   1.108 -                        }
   1.109 -
   1.110 -                        LLViewerInventoryItem* inv_item = gInventory.getItem(*it);
   1.111 -                        // check if inventory item can be given
   1.112 -                        if (LLGiveInventory::isInventoryGiveAcceptable(inv_item))
   1.113 -                        {
   1.114 -                                acceptable = true;
   1.115 -                                continue;
   1.116 -                        }
   1.117 -
   1.118 -                        // there are neither item nor category in inventory
   1.119 -                        acceptable = false;
   1.120 -                        break;
   1.121 -                }
   1.122 -                return acceptable;
   1.123 -        }
   1.124 +				// there are neither item nor category in inventory
   1.125 +				acceptable = false;
   1.126 +				break;
   1.127 +		}
   1.128 +		return acceptable;
   1.129 +	}
   1.130  
   1.131  
   1.132  	static void build_items_string(const std::set<LLUUID>& inventory_selected_uuids , std::string& items_string)
     2.1 --- a/indra/newview/llgroupactions.cpp	Mon Apr 18 09:46:50 2016 +0200
     2.2 +++ b/indra/newview/llgroupactions.cpp	Mon Apr 18 12:39:45 2016 +0200
     2.3 @@ -44,6 +44,7 @@
     2.4  
     2.5  // Firestorm includes
     2.6  #include "exogroupmutelist.h"
     2.7 +#include "fscommon.h"
     2.8  #include "fsdata.h"
     2.9  #include "fsfloatercontacts.h"
    2.10  #include "fsfloatergroup.h"
    2.11 @@ -98,7 +99,7 @@
    2.12  				//LLSD params;
    2.13  				//params["people_panel_tab_name"] = "groups_panel";
    2.14  				//LLFloaterSidePanelContainer::showPanel("people", "panel_people", params);
    2.15 -				if (gSavedSettings.getBOOL("FSUseV2Friends") && gSavedSettings.getString("FSInternalSkinCurrent") != "Vintage")
    2.16 +				if (gSavedSettings.getBOOL("FSUseV2Friends") && !FSCommon::isLegacySkin())
    2.17  				{
    2.18  					LLSD params;
    2.19  					params["people_panel_tab_name"] = "groups_panel";
    2.20 @@ -621,15 +622,6 @@
    2.21  	}
    2.22  // [/RLVa:KB]
    2.23  
    2.24 -// [RLVa:KB] - Checked: 2013-05-09 (RLVa-1.4.9)
    2.25 -	if ( (!RlvActions::canStartIM(group_id)) && (!RlvActions::hasOpenGroupSession(group_id)) )
    2.26 -	{
    2.27 -		make_ui_sound("UISndInvalidOp");
    2.28 -		RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_STARTIM, LLSD().with("RECIPIENT", LLSLURL("group", group_id, "about").getSLURLString()));
    2.29 -		return LLUUID::null;
    2.30 -	}
    2.31 -// [/RLVa:KB]
    2.32 -
    2.33  	LLGroupData group_data;
    2.34  	if (gAgent.getGroupData(group_id, group_data))
    2.35  	{
    2.36 @@ -838,13 +830,6 @@
    2.37  
    2.38  void LLGroupActions::ejectFromGroup(const LLUUID& idGroup, const LLUUID& idAgent)
    2.39  {
    2.40 -	// <FS:CR> FIRE-8499 - Eject from group confirmation 
    2.41 -	//if (!canEjectFromGroup(idGroup, idAgent))
    2.42 -	//	return;
    2.43 -
    2.44 -	//uuid_vec_t idAgents;
    2.45 -	//idAgents.push_back(idAgent);
    2.46 -	//LLGroupMgr::instance().sendGroupMemberEjects(idGroup, idAgents);
    2.47  	LLSD args;
    2.48  	LLSD payload;
    2.49  	payload["avatar_id"] = idAgent;
    2.50 @@ -877,7 +862,6 @@
    2.51  		LLGroupMgr::instance().sendGroupMemberEjects(idGroup, idAgents);
    2.52  	}
    2.53  	return false;
    2.54 -	// </FS:CR>
    2.55  }
    2.56  // [/SL:KB]
    2.57  

mercurial