implemented minor task EXT-3454 Code improvements: Replace old-style calback with boost::function in the LLFloaterAvatarPicker

--HG--
branch : product-engine
meow-7.2.2
Denis Serdjuk 2009-12-28 17:44:54 +02:00
parent 79fba14bd4
commit d89793616e
18 changed files with 140 additions and 195 deletions

View File

@ -51,8 +51,7 @@
#include "lluictrlfactory.h"
#include "message.h"
LLFloaterAvatarPicker* LLFloaterAvatarPicker::show(callback_t callback,
void* userdata,
LLFloaterAvatarPicker* LLFloaterAvatarPicker::show(select_callback_t callback,
BOOL allow_multiple,
BOOL closeOnSelect)
{
@ -60,8 +59,7 @@ LLFloaterAvatarPicker* LLFloaterAvatarPicker::show(callback_t callback,
LLFloaterAvatarPicker* floater =
LLFloaterReg::showTypedInstance<LLFloaterAvatarPicker>("avatar_picker");
floater->mCallback = callback;
floater->mCallbackUserdata = userdata;
floater->mSelectionCallback = callback;
floater->setAllowMultiple(allow_multiple);
floater->mNearMeListComplete = FALSE;
floater->mCloseOnSelect = closeOnSelect;
@ -82,8 +80,6 @@ LLFloaterAvatarPicker* LLFloaterAvatarPicker::show(callback_t callback,
LLFloaterAvatarPicker::LLFloaterAvatarPicker(const LLSD& key)
: LLFloater(key),
mNumResultsReturned(0),
mCallback(NULL),
mCallbackUserdata(NULL),
mNearMeListComplete(FALSE),
mCloseOnSelect(FALSE)
{
@ -93,29 +89,29 @@ LLFloaterAvatarPicker::LLFloaterAvatarPicker(const LLSD& key)
BOOL LLFloaterAvatarPicker::postBuild()
{
getChild<LLLineEditor>("Edit")->setKeystrokeCallback(editKeystroke, this);
getChild<LLLineEditor>("Edit")->setKeystrokeCallback( boost::bind(&LLFloaterAvatarPicker::editKeystroke, this, _1, _2),NULL);
childSetAction("Find", onBtnFind, this);
childSetAction("Find", boost::bind(&LLFloaterAvatarPicker::onBtnFind, this));
childDisable("Find");
childSetAction("Refresh", onBtnRefresh, this);
childSetCommitCallback("near_me_range", onRangeAdjust, this);
childSetAction("Refresh", boost::bind(&LLFloaterAvatarPicker::onBtnRefresh, this));
getChild<LLUICtrl>("near_me_range")->setCommitCallback(boost::bind(&LLFloaterAvatarPicker::onRangeAdjust, this));
LLScrollListCtrl* searchresults = getChild<LLScrollListCtrl>("SearchResults");
searchresults->setDoubleClickCallback(onBtnSelect, this);
childSetCommitCallback("SearchResults", onList, this);
searchresults->setDoubleClickCallback( boost::bind(&LLFloaterAvatarPicker::onBtnSelect, this));
searchresults->setCommitCallback(boost::bind(&LLFloaterAvatarPicker::onList, this));
childDisable("SearchResults");
LLScrollListCtrl* nearme = getChild<LLScrollListCtrl>("NearMe");
nearme->setDoubleClickCallback(onBtnSelect, this);
childSetCommitCallback("NearMe", onList, this);
nearme->setDoubleClickCallback(boost::bind(&LLFloaterAvatarPicker::onBtnSelect, this));
nearme->setCommitCallback(boost::bind(&LLFloaterAvatarPicker::onList, this));
LLScrollListCtrl* friends = getChild<LLScrollListCtrl>("Friends");
friends->setDoubleClickCallback(onBtnSelect, this);
childSetCommitCallback("Friends", onList, this);
friends->setDoubleClickCallback(boost::bind(&LLFloaterAvatarPicker::onBtnSelect, this));
getChild<LLUICtrl>("Friends")->setCommitCallback(boost::bind(&LLFloaterAvatarPicker::onList, this));
childSetAction("ok_btn", onBtnSelect, this);
childSetAction("ok_btn", boost::bind(&LLFloaterAvatarPicker::onBtnSelect, this));
childDisable("ok_btn");
childSetAction("cancel_btn", onBtnClose, this);
childSetAction("cancel_btn", boost::bind(&LLFloaterAvatarPicker::onBtnClose, this));
childSetFocus("Edit");
@ -156,10 +152,9 @@ LLFloaterAvatarPicker::~LLFloaterAvatarPicker()
gFocusMgr.releaseFocusIfNeeded( this );
}
void LLFloaterAvatarPicker::onBtnFind(void* userdata)
void LLFloaterAvatarPicker::onBtnFind()
{
LLFloaterAvatarPicker* self = (LLFloaterAvatarPicker*)userdata;
if(self) self->find();
find();
}
static void getSelectedAvatarData(const LLScrollListCtrl* from, std::vector<std::string>& avatar_names, std::vector<LLUUID>& avatar_ids)
@ -176,34 +171,33 @@ static void getSelectedAvatarData(const LLScrollListCtrl* from, std::vector<std:
}
}
void LLFloaterAvatarPicker::onBtnSelect(void* userdata)
void LLFloaterAvatarPicker::onBtnSelect()
{
LLFloaterAvatarPicker* self = (LLFloaterAvatarPicker*)userdata;
// If select btn not enabled then do not callback
if (!self || !self->isSelectBtnEnabled())
if (!isSelectBtnEnabled())
return;
if(self->mCallback)
if(mSelectionCallback)
{
std::string acvtive_panel_name;
LLScrollListCtrl* list = NULL;
LLPanel* active_panel = self->childGetVisibleTab("ResidentChooserTabs");
LLPanel* active_panel = childGetVisibleTab("ResidentChooserTabs");
if(active_panel)
{
acvtive_panel_name = active_panel->getName();
}
if(acvtive_panel_name == "SearchPanel")
{
list = self->getChild<LLScrollListCtrl>("SearchResults");
list = getChild<LLScrollListCtrl>("SearchResults");
}
else if(acvtive_panel_name == "NearMePanel")
{
list =self->getChild<LLScrollListCtrl>("NearMe");
list = getChild<LLScrollListCtrl>("NearMe");
}
else if (acvtive_panel_name == "FriendsPanel")
{
list =self->getChild<LLScrollListCtrl>("Friends");
list = getChild<LLScrollListCtrl>("Friends");
}
if(list)
@ -211,50 +205,39 @@ void LLFloaterAvatarPicker::onBtnSelect(void* userdata)
std::vector<std::string> avatar_names;
std::vector<LLUUID> avatar_ids;
getSelectedAvatarData(list, avatar_names, avatar_ids);
self->mCallback(avatar_names, avatar_ids, self->mCallbackUserdata);
mSelectionCallback(avatar_names, avatar_ids);
}
}
self->getChild<LLScrollListCtrl>("SearchResults")->deselectAllItems(TRUE);
self->getChild<LLScrollListCtrl>("NearMe")->deselectAllItems(TRUE);
self->getChild<LLScrollListCtrl>("Friends")->deselectAllItems(TRUE);
if(self->mCloseOnSelect)
getChild<LLScrollListCtrl>("SearchResults")->deselectAllItems(TRUE);
getChild<LLScrollListCtrl>("NearMe")->deselectAllItems(TRUE);
getChild<LLScrollListCtrl>("Friends")->deselectAllItems(TRUE);
if(mCloseOnSelect)
{
self->mCloseOnSelect = FALSE;
self->closeFloater();
mCloseOnSelect = FALSE;
closeFloater();
}
}
void LLFloaterAvatarPicker::onBtnRefresh(void* userdata)
void LLFloaterAvatarPicker::onBtnRefresh()
{
LLFloaterAvatarPicker* self = (LLFloaterAvatarPicker*)userdata;
if (!self)
{
return;
}
self->getChild<LLScrollListCtrl>("NearMe")->deleteAllItems();
self->getChild<LLScrollListCtrl>("NearMe")->setCommentText(self->getString("searching"));
self->mNearMeListComplete = FALSE;
getChild<LLScrollListCtrl>("NearMe")->deleteAllItems();
getChild<LLScrollListCtrl>("NearMe")->setCommentText(getString("searching"));
mNearMeListComplete = FALSE;
}
void LLFloaterAvatarPicker::onBtnClose(void* userdata)
void LLFloaterAvatarPicker::onBtnClose()
{
LLFloaterAvatarPicker* self = (LLFloaterAvatarPicker*)userdata;
if(self) self->closeFloater();
closeFloater();
}
void LLFloaterAvatarPicker::onRangeAdjust(LLUICtrl* source, void* data)
void LLFloaterAvatarPicker::onRangeAdjust()
{
LLFloaterAvatarPicker::onBtnRefresh(data);
onBtnRefresh();
}
void LLFloaterAvatarPicker::onList(LLUICtrl* ctrl, void* userdata)
void LLFloaterAvatarPicker::onList()
{
LLFloaterAvatarPicker* self = (LLFloaterAvatarPicker*)userdata;
if (self)
{
self->childSetEnabled("ok_btn", self->isSelectBtnEnabled());
}
childSetEnabled("ok_btn", isSelectBtnEnabled());
}
void LLFloaterAvatarPicker::populateNearMe()
@ -297,7 +280,7 @@ void LLFloaterAvatarPicker::populateNearMe()
childEnable("NearMe");
childEnable("ok_btn");
near_me_scroller->selectFirstItem();
onList(near_me_scroller, this);
onList();
near_me_scroller->setFocus(TRUE);
}
@ -451,7 +434,7 @@ void LLFloaterAvatarPicker::processAvatarPickerReply(LLMessageSystem* msg, void*
{
floater->childEnable("ok_btn");
search_results->selectFirstItem();
floater->onList(search_results, floater);
floater->onList();
search_results->setFocus(TRUE);
}
}
@ -459,8 +442,7 @@ void LLFloaterAvatarPicker::processAvatarPickerReply(LLMessageSystem* msg, void*
//static
void LLFloaterAvatarPicker::editKeystroke(LLLineEditor* caller, void* user_data)
{
LLFloaterAvatarPicker* self = (LLFloaterAvatarPicker*)user_data;
self->childSetEnabled("Find", caller->getText().size() >= 3);
childSetEnabled("Find", caller->getText().size() >= 3);
}
// virtual
@ -470,11 +452,11 @@ BOOL LLFloaterAvatarPicker::handleKeyHere(KEY key, MASK mask)
{
if (childHasFocus("Edit"))
{
onBtnFind(this);
onBtnFind();
}
else
{
onBtnSelect(this);
onBtnSelect();
}
return TRUE;
}

View File

@ -43,11 +43,10 @@ public:
typedef boost::signals2::signal<bool(const std::vector<LLUUID>&), boost_boolean_combiner> validate_signal_t;
typedef validate_signal_t::slot_type validate_callback_t;
// Call this to select an avatar.
// The callback function will be called with an avatar name and UUID.
typedef void(*callback_t)(const std::vector<std::string>&, const std::vector<LLUUID>&, void*);
static LLFloaterAvatarPicker* show(callback_t callback,
void* userdata,
typedef boost::function<void (const std::vector<std::string>&, const std::vector<LLUUID>&)> select_callback_t;
// Call this to select an avatar.
static LLFloaterAvatarPicker* show(select_callback_t callback,
BOOL allow_multiple = FALSE,
BOOL closeOnSelect = FALSE);
@ -61,16 +60,16 @@ public:
static void processAvatarPickerReply(class LLMessageSystem* msg, void**);
private:
static void editKeystroke(class LLLineEditor* caller, void* user_data);
void editKeystroke(class LLLineEditor* caller, void* user_data);
static void onBtnFind(void* userdata);
static void onBtnSelect(void* userdata);
static void onBtnRefresh(void* userdata);
static void onRangeAdjust(LLUICtrl* source, void* data);
static void onBtnClose(void* userdata);
static void onList(class LLUICtrl* ctrl, void* userdata);
void onTabChanged();
bool isSelectBtnEnabled();
void onBtnFind();
void onBtnSelect();
void onBtnRefresh();
void onRangeAdjust();
void onBtnClose();
void onList();
void onTabChanged();
bool isSelectBtnEnabled();
void populateNearMe();
void populateFriend();
@ -87,9 +86,8 @@ private:
BOOL mNearMeListComplete;
BOOL mCloseOnSelect;
void (*mCallback)(const std::vector<std::string>& name, const std::vector<LLUUID>& id, void* userdata);
void* mCallbackUserdata;
validate_signal_t mOkButtonValidateSignal;
select_callback_t mSelectionCallback;
};
#endif

View File

@ -572,8 +572,7 @@ void LLPanelFriends::onClickIM(void* user_data)
// static
void LLPanelFriends::onPickAvatar(const std::vector<std::string>& names,
const std::vector<LLUUID>& ids,
void* )
const std::vector<LLUUID>& ids)
{
if (names.empty()) return;
if (ids.empty()) return;
@ -585,7 +584,7 @@ void LLPanelFriends::onClickAddFriend(void* user_data)
{
LLPanelFriends* panelp = (LLPanelFriends*)user_data;
LLFloater* root_floater = gFloaterView->getParentFloater(panelp);
LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(onPickAvatar, user_data, FALSE, TRUE);
LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLPanelFriends::onPickAvatar, _1,_2), FALSE, TRUE);
if (root_floater)
{
root_floater->addDependentFloater(picker);

View File

@ -116,7 +116,7 @@ private:
static void onSelectName(LLUICtrl* ctrl, void* user_data);
static bool callbackAddFriend(const LLSD& notification, const LLSD& response);
static bool callbackAddFriendWithMessage(const LLSD& notification, const LLSD& response);
static void onPickAvatar(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* user_data);
static void onPickAvatar(const std::vector<std::string>& names, const std::vector<LLUUID>& ids);
static void onMaximumSelect();
static void onClickIM(void* user_data);

View File

@ -1165,7 +1165,7 @@ bool LLPanelObjectTools::callbackSimWideDeletes( const LLSD& notification, const
void LLPanelObjectTools::onClickSet()
{
// grandparent is a floater, which can have a dependent
gFloaterView->getParentFloater(this)->addDependentFloater(LLFloaterAvatarPicker::show(callbackAvatarID, this));
gFloaterView->getParentFloater(this)->addDependentFloater(LLFloaterAvatarPicker::show(boost::bind(&LLPanelObjectTools::callbackAvatarID, this, _1,_2)));
}
void LLPanelObjectTools::onClickSetBySelection(void* data)
@ -1189,14 +1189,12 @@ void LLPanelObjectTools::onClickSetBySelection(void* data)
panelp->childSetValue("target_avatar_name", name);
}
// static
void LLPanelObjectTools::callbackAvatarID(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* data)
void LLPanelObjectTools::callbackAvatarID(const std::vector<std::string>& names, const std::vector<LLUUID>& ids)
{
LLPanelObjectTools* object_tools = (LLPanelObjectTools*) data;
if (ids.empty() || names.empty()) return;
object_tools->mTargetAvatar = ids[0];
object_tools->childSetValue("target_avatar_name", names[0]);
object_tools->refresh();
mTargetAvatar = ids[0];
childSetValue("target_avatar_name", names[0]);
refresh();
}
void LLPanelObjectTools::onChangeAnything()

View File

@ -234,7 +234,7 @@ public:
void onChangeAnything();
void onApplyChanges();
void onClickSet();
static void callbackAvatarID(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* data);
void callbackAvatarID(const std::vector<std::string>& names, const std::vector<LLUUID>& ids);
void onClickDeletePublicOwnedBy();
void onClickDeleteAllScriptedOwnedBy();
void onClickDeleteAllOwnedBy();

View File

@ -2284,9 +2284,9 @@ BOOL LLPanelLandAccess::postBuild()
childSetCommitCallback("PriceSpin", onCommitAny, this);
childSetCommitCallback("HoursSpin", onCommitAny, this);
childSetAction("add_allowed", onClickAddAccess, this);
childSetAction("add_allowed", boost::bind(&LLPanelLandAccess::onClickAddAccess, this));
childSetAction("remove_allowed", onClickRemoveAccess, this);
childSetAction("add_banned", onClickAddBanned, this);
childSetAction("add_banned", boost::bind(&LLPanelLandAccess::onClickAddBanned, this));
childSetAction("remove_banned", onClickRemoveBanned, this);
mListAccess = getChild<LLNameListCtrl>("AccessList");
@ -2694,29 +2694,22 @@ void LLPanelLandAccess::onCommitAny(LLUICtrl *ctrl, void *userdata)
self->refresh();
}
// static
void LLPanelLandAccess::onClickAddAccess(void* data)
void LLPanelLandAccess::onClickAddAccess()
{
LLPanelLandAccess* panelp = (LLPanelLandAccess*)data;
if (panelp)
{
gFloaterView->getParentFloater(panelp)->addDependentFloater(LLFloaterAvatarPicker::show(callbackAvatarCBAccess, data) );
}
gFloaterView->getParentFloater(this)->addDependentFloater(LLFloaterAvatarPicker::show(boost::bind(&LLPanelLandAccess::callbackAvatarCBAccess, this, _1,_2)) );
}
// static
void LLPanelLandAccess::callbackAvatarCBAccess(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* userdata)
void LLPanelLandAccess::callbackAvatarCBAccess(const std::vector<std::string>& names, const std::vector<LLUUID>& ids)
{
LLPanelLandAccess* panelp = (LLPanelLandAccess*)userdata;
if (!names.empty() && !ids.empty())
{
LLUUID id = ids[0];
LLParcel* parcel = panelp->mParcel->getParcel();
LLParcel* parcel = mParcel->getParcel();
if (parcel)
{
parcel->addToAccessList(id, 0);
LLViewerParcelMgr::getInstance()->sendParcelAccessListUpdate(AL_ACCESS);
panelp->refresh();
refresh();
}
}
}
@ -2745,25 +2738,23 @@ void LLPanelLandAccess::onClickRemoveAccess(void* data)
}
// static
void LLPanelLandAccess::onClickAddBanned(void* data)
void LLPanelLandAccess::onClickAddBanned()
{
LLPanelLandAccess* panelp = (LLPanelLandAccess*)data;
gFloaterView->getParentFloater(panelp)->addDependentFloater(LLFloaterAvatarPicker::show(callbackAvatarCBBanned, data) );
gFloaterView->getParentFloater(this)->addDependentFloater(LLFloaterAvatarPicker::show(boost::bind(&LLPanelLandAccess::callbackAvatarCBBanned, this, _1,_2)));
}
// static
void LLPanelLandAccess::callbackAvatarCBBanned(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* userdata)
void LLPanelLandAccess::callbackAvatarCBBanned(const std::vector<std::string>& names, const std::vector<LLUUID>& ids)
{
LLPanelLandAccess* panelp = (LLPanelLandAccess*)userdata;
if (!names.empty() && !ids.empty())
{
LLUUID id = ids[0];
LLParcel* parcel = panelp->mParcel->getParcel();
LLParcel* parcel = mParcel->getParcel();
if (parcel)
{
parcel->addToBanList(id, 0);
LLViewerParcelMgr::getInstance()->sendParcelAccessListUpdate(AL_BAN);
panelp->refresh();
refresh();
}
}
}

View File

@ -367,14 +367,15 @@ public:
static void onCommitPublicAccess(LLUICtrl* ctrl, void *userdata);
static void onCommitAny(LLUICtrl* ctrl, void *userdata);
static void onClickAddAccess(void*);
static void callbackAvatarCBAccess(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* userdata);
static void onClickRemoveAccess(void*);
static void onClickAddBanned(void*);
static void callbackAvatarCBBanned(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* userdata);
static void onClickRemoveBanned(void*);
virtual BOOL postBuild();
void onClickAddAccess();
void onClickAddBanned();
void callbackAvatarCBBanned(const std::vector<std::string>& names, const std::vector<LLUUID>& ids);
void callbackAvatarCBAccess(const std::vector<std::string>& names, const std::vector<LLUUID>& ids);
protected:
LLNameListCtrl* mListAccess;

View File

@ -586,7 +586,7 @@ BOOL LLPanelRegionGeneralInfo::postBuild()
initCtrl("restrict_pushobject");
initCtrl("block_parcel_search_check");
childSetAction("kick_btn", onClickKick, this);
childSetAction("kick_btn", boost::bind(&LLPanelRegionGeneralInfo::onClickKick, this));
childSetAction("kick_all_btn", onClickKickAll, this);
childSetAction("im_btn", onClickMessage, this);
// childSetAction("manage_telehub_btn", onClickManageTelehub, this);
@ -594,27 +594,22 @@ BOOL LLPanelRegionGeneralInfo::postBuild()
return LLPanelRegionInfo::postBuild();
}
// static
void LLPanelRegionGeneralInfo::onClickKick(void* userdata)
void LLPanelRegionGeneralInfo::onClickKick()
{
llinfos << "LLPanelRegionGeneralInfo::onClickKick" << llendl;
LLPanelRegionGeneralInfo* panelp = (LLPanelRegionGeneralInfo*)userdata;
// this depends on the grandparent view being a floater
// in order to set up floater dependency
LLFloater* parent_floater = gFloaterView->getParentFloater(panelp);
LLFloater* child_floater = LLFloaterAvatarPicker::show(onKickCommit, userdata, FALSE, TRUE);
LLFloater* parent_floater = gFloaterView->getParentFloater(this);
LLFloater* child_floater = LLFloaterAvatarPicker::show(boost::bind(&LLPanelRegionGeneralInfo::onKickCommit, this, _1,_2), FALSE, TRUE);
parent_floater->addDependentFloater(child_floater);
}
// static
void LLPanelRegionGeneralInfo::onKickCommit(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* userdata)
void LLPanelRegionGeneralInfo::onKickCommit(const std::vector<std::string>& names, const std::vector<LLUUID>& ids)
{
if (names.empty() || ids.empty()) return;
if(ids[0].notNull())
{
LLPanelRegionGeneralInfo* self = (LLPanelRegionGeneralInfo*)userdata;
if(!self) return;
strings_t strings;
// [0] = our agent id
// [1] = target agent id
@ -626,7 +621,7 @@ void LLPanelRegionGeneralInfo::onKickCommit(const std::vector<std::string>& name
strings.push_back(strings_t::value_type(buffer));
LLUUID invoice(LLFloaterRegionInfo::getLastInvoice());
self->sendEstateOwnerMessage(gMessageSystem, "teleporthomeuser", invoice, strings);
sendEstateOwnerMessage(gMessageSystem, "teleporthomeuser", invoice, strings);
}
}
@ -790,7 +785,7 @@ BOOL LLPanelRegionDebugInfo::postBuild()
initCtrl("disable_collisions_check");
initCtrl("disable_physics_check");
childSetAction("choose_avatar_btn", onClickChooseAvatar, this);
childSetAction("choose_avatar_btn", boost::bind(&LLPanelRegionDebugInfo::onClickChooseAvatar, this));
childSetAction("return_btn", onClickReturn, this);
childSetAction("top_colliders_btn", onClickTopColliders, this);
childSetAction("top_scripts_btn", onClickTopScripts, this);
@ -842,19 +837,18 @@ BOOL LLPanelRegionDebugInfo::sendUpdate()
return TRUE;
}
void LLPanelRegionDebugInfo::onClickChooseAvatar(void* data)
void LLPanelRegionDebugInfo::onClickChooseAvatar()
{
LLFloaterAvatarPicker::show(callbackAvatarID, data, FALSE, TRUE);
LLFloaterAvatarPicker::show(boost::bind(&LLPanelRegionDebugInfo::callbackAvatarID, this, _1, _2), FALSE, TRUE);
}
// static
void LLPanelRegionDebugInfo::callbackAvatarID(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* data)
void LLPanelRegionDebugInfo::callbackAvatarID(const std::vector<std::string>& names, const std::vector<LLUUID>& ids)
{
LLPanelRegionDebugInfo* self = (LLPanelRegionDebugInfo*) data;
if (ids.empty() || names.empty()) return;
self->mTargetAvatar = ids[0];
self->childSetValue("target_avatar_name", LLSD(names[0]));
self->refreshFromRegion( gAgent.getRegion() );
mTargetAvatar = ids[0];
childSetValue("target_avatar_name", LLSD(names[0]));
refreshFromRegion( gAgent.getRegion() );
}
// static
@ -1528,18 +1522,16 @@ struct LLKickFromEstateInfo
LLUUID mAgentID;
};
void LLPanelEstateInfo::onClickKickUser(void *user_data)
void LLPanelEstateInfo::onClickKickUser()
{
LLPanelEstateInfo* panelp = (LLPanelEstateInfo*)user_data;
// this depends on the grandparent view being a floater
// in order to set up floater dependency
LLFloater* parent_floater = gFloaterView->getParentFloater(panelp);
LLFloater* child_floater = LLFloaterAvatarPicker::show(LLPanelEstateInfo::onKickUserCommit, user_data, FALSE, TRUE);
LLFloater* parent_floater = gFloaterView->getParentFloater(this);
LLFloater* child_floater = LLFloaterAvatarPicker::show(boost::bind(&LLPanelEstateInfo::onKickUserCommit, this, _1, _2), FALSE, TRUE);
parent_floater->addDependentFloater(child_floater);
}
void LLPanelEstateInfo::onKickUserCommit(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* userdata)
void LLPanelEstateInfo::onKickUserCommit(const std::vector<std::string>& names, const std::vector<LLUUID>& ids)
{
if (names.empty() || ids.empty()) return;
@ -1550,12 +1542,9 @@ void LLPanelEstateInfo::onKickUserCommit(const std::vector<std::string>& names,
return;
}
LLPanelEstateInfo* self = (LLPanelEstateInfo*)userdata;
if(!self) return;
//keep track of what user they want to kick and other misc info
LLKickFromEstateInfo *kick_info = new LLKickFromEstateInfo();
kick_info->mEstatePanelp = self;
kick_info->mEstatePanelp = this;
kick_info->mAgentID = ids[0];
//Bring up a confirmation dialog
@ -1563,7 +1552,7 @@ void LLPanelEstateInfo::onKickUserCommit(const std::vector<std::string>& names,
args["EVIL_USER"] = names[0];
LLSD payload;
payload["agent_id"] = ids[0];
LLNotificationsUtil::add("EstateKickUser", args, payload, boost::bind(&LLPanelEstateInfo::kickUserConfirm, self, _1, _2));
LLNotificationsUtil::add("EstateKickUser", args, payload, boost::bind(&LLPanelEstateInfo::kickUserConfirm, this, _1, _2));
}
@ -1727,7 +1716,7 @@ bool LLPanelEstateInfo::accessAddCore2(const LLSD& notification, const LLSD& res
LLEstateAccessChangeInfo* change_info = new LLEstateAccessChangeInfo(notification["payload"]);
// avatar picker yes multi-select, yes close-on-select
LLFloaterAvatarPicker::show(accessAddCore3, (void*)change_info, TRUE, TRUE);
LLFloaterAvatarPicker::show(boost::bind(&LLPanelEstateInfo::accessAddCore3, _1, _2, (void*)change_info), TRUE, TRUE);
return false;
}
@ -2107,7 +2096,7 @@ BOOL LLPanelEstateInfo::postBuild()
childSetAction("add_estate_manager_btn", onClickAddEstateManager, this);
childSetAction("remove_estate_manager_btn", onClickRemoveEstateManager, this);
childSetAction("message_estate_btn", onClickMessageEstate, this);
childSetAction("kick_user_from_estate_btn", onClickKickUser, this);
childSetAction("kick_user_from_estate_btn", boost::bind(&LLPanelEstateInfo::onClickKickUser, this));
childSetAction("WLEditSky", onClickEditSky, this);
childSetAction("WLEditDayCycle", onClickEditDayCycle, this);

View File

@ -167,8 +167,8 @@ public:
protected:
virtual BOOL sendUpdate();
static void onClickKick(void* userdata);
static void onKickCommit(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* userdata);
void onClickKick();
void onKickCommit(const std::vector<std::string>& names, const std::vector<LLUUID>& ids);
static void onClickKickAll(void* userdata);
bool onKickAllCommit(const LLSD& notification, const LLSD& response);
static void onClickMessage(void* userdata);
@ -192,8 +192,8 @@ public:
protected:
virtual BOOL sendUpdate();
static void onClickChooseAvatar(void*);
static void callbackAvatarID(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* data);
void onClickChooseAvatar();
void callbackAvatarID(const std::vector<std::string>& names, const std::vector<LLUUID>& ids);
static void onClickReturn(void *);
bool callbackReturn(const LLSD& notification, const LLSD& response);
static void onClickTopColliders(void*);
@ -275,7 +275,7 @@ public:
static void onClickRemoveBannedAgent(void* user_data);
static void onClickAddEstateManager(void* user_data);
static void onClickRemoveEstateManager(void* user_data);
static void onClickKickUser(void* userdata);
void onClickKickUser();
// Group picker callback is different, can't use core methods below
bool addAllowedGroup(const LLSD& notification, const LLSD& response);
@ -296,7 +296,7 @@ public:
// Send the actual EstateOwnerRequest "estateaccessdelta" message
static void sendEstateAccessDelta(U32 flags, const LLUUID& agent_id);
static void onKickUserCommit(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* userdata);
void onKickUserCommit(const std::vector<std::string>& names, const std::vector<LLUUID>& ids);
static void onClickMessageEstate(void* data);
bool onMessageCommit(const LLSD& notification, const LLSD& response);

View File

@ -172,7 +172,7 @@ BOOL LLFloaterReporter::postBuild()
std::string("tool_face_active.tga") );
childSetAction("pick_btn", onClickObjPicker, this);
childSetAction("select_abuser", onClickSelectAbuser, this);
childSetAction("select_abuser", boost::bind(&LLFloaterReporter::onClickSelectAbuser, this));
childSetAction("send_btn", onClickSend, this);
childSetAction("cancel_btn", onClickCancel, this);
@ -306,26 +306,20 @@ void LLFloaterReporter::getObjectInfo(const LLUUID& object_id)
}
// static
void LLFloaterReporter::onClickSelectAbuser(void *userdata)
void LLFloaterReporter::onClickSelectAbuser()
{
LLFloaterReporter *self = (LLFloaterReporter *)userdata;
gFloaterView->getParentFloater(self)->addDependentFloater(LLFloaterAvatarPicker::show(callbackAvatarID, userdata, FALSE, TRUE ));
gFloaterView->getParentFloater(this)->addDependentFloater(LLFloaterAvatarPicker::show(boost::bind(&LLFloaterReporter::callbackAvatarID, this, _1, _2), FALSE, TRUE ));
}
// static
void LLFloaterReporter::callbackAvatarID(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* data)
void LLFloaterReporter::callbackAvatarID(const std::vector<std::string>& names, const std::vector<LLUUID>& ids)
{
LLFloaterReporter* self = (LLFloaterReporter*) data;
if (ids.empty() || names.empty()) return;
self->childSetText("abuser_name_edit", names[0] );
childSetText("abuser_name_edit", names[0] );
self->mAbuserID = ids[0];
mAbuserID = ids[0];
self->refresh();
refresh();
}

View File

@ -97,7 +97,7 @@ public:
static void onClickSend (void *userdata);
static void onClickCancel (void *userdata);
static void onClickObjPicker (void *userdata);
static void onClickSelectAbuser (void *userdata);
void onClickSelectAbuser ();
static void closePickTool (void *userdata);
static void uploadDoneCallback(const LLUUID &uuid, void* user_data, S32 result, LLExtStat ext_status);
static void addDescription(const std::string& description, LLMeanCollisionData *mcd = NULL);
@ -120,7 +120,7 @@ private:
void setPosBox(const LLVector3d &pos);
void enableControls(BOOL own_avatar);
void getObjectInfo(const LLUUID& object_id);
static void callbackAvatarID(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* data);
void callbackAvatarID(const std::vector<std::string>& names, const std::vector<LLUUID>& ids);
private:
EReportType mReportType;

View File

@ -89,14 +89,14 @@ private:
void setBadge(const char* id, Badge badge);
static void onChangeValue(LLUICtrl *ctrl, void *userdata);
static void doSelectAgent(void *userdata);
void doSelectAgent();
static void doCancel(void *userdata);
static void doSellLand(void *userdata);
bool onConfirmSale(const LLSD& notification, const LLSD& response);
static void doShowObjects(void *userdata);
static bool callbackHighlightTransferable(const LLSD& notification, const LLSD& response);
static void callbackAvatarPick(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* data);
void callbackAvatarPick(const std::vector<std::string>& names, const std::vector<LLUUID>& ids);
public:
virtual BOOL postBuild();
@ -165,7 +165,7 @@ BOOL LLFloaterSellLandUI::postBuild()
childSetCommitCallback("price", onChangeValue, this);
childSetPrevalidate("price", LLLineEditor::prevalidateNonNegativeS32);
childSetCommitCallback("sell_objects", onChangeValue, this);
childSetAction("sell_to_select_agent", doSelectAgent, this);
childSetAction("sell_to_select_agent", boost::bind( &LLFloaterSellLandUI::doSelectAgent, this));
childSetAction("cancel_btn", doCancel, this);
childSetAction("sell_btn", doSellLand, this);
childSetAction("show_objects", doShowObjects, this);
@ -361,7 +361,7 @@ void LLFloaterSellLandUI::onChangeValue(LLUICtrl *ctrl, void *userdata)
self->mSellToBuyer = true;
if (self->mAuthorizedBuyer.isNull())
{
doSelectAgent(self);
self->doSelectAgent();
}
}
else if (sell_to == "anyone")
@ -384,30 +384,26 @@ void LLFloaterSellLandUI::onChangeValue(LLUICtrl *ctrl, void *userdata)
self->refreshUI();
}
// static
void LLFloaterSellLandUI::doSelectAgent(void *userdata)
void LLFloaterSellLandUI::doSelectAgent()
{
LLFloaterSellLandUI* floaterp = (LLFloaterSellLandUI*)userdata;
// grandparent is a floater, in order to set up dependency
floaterp->addDependentFloater(LLFloaterAvatarPicker::show(callbackAvatarPick, floaterp, FALSE, TRUE));
addDependentFloater(LLFloaterAvatarPicker::show(boost::bind(&LLFloaterSellLandUI::callbackAvatarPick, this, _1, _2), FALSE, TRUE));
}
// static
void LLFloaterSellLandUI::callbackAvatarPick(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* data)
void LLFloaterSellLandUI::callbackAvatarPick(const std::vector<std::string>& names, const std::vector<LLUUID>& ids)
{
LLFloaterSellLandUI* floaterp = (LLFloaterSellLandUI*)data;
LLParcel* parcel = floaterp->mParcelSelection->getParcel();
LLParcel* parcel = mParcelSelection->getParcel();
if (names.empty() || ids.empty()) return;
LLUUID id = ids[0];
parcel->setAuthorizedBuyerID(id);
floaterp->mAuthorizedBuyer = ids[0];
mAuthorizedBuyer = ids[0];
floaterp->childSetText("sell_to_agent", names[0]);
childSetText("sell_to_agent", names[0]);
floaterp->refreshUI();
refreshUI();
}
// static

View File

@ -171,7 +171,7 @@ void LLPanelBlockedList::onPickBtnClick()
{
const BOOL allow_multiple = FALSE;
const BOOL close_on_select = TRUE;
/*LLFloaterAvatarPicker* picker = */LLFloaterAvatarPicker::show(callbackBlockPicked, this, allow_multiple, close_on_select);
/*LLFloaterAvatarPicker* picker = */LLFloaterAvatarPicker::show(boost::bind(&LLPanelBlockedList::callbackBlockPicked, this, _1, _2), allow_multiple, close_on_select);
// *TODO: mantipov: should LLFloaterAvatarPicker be closed when panel is closed?
// old Floater dependency is not enable in panel
@ -183,8 +183,7 @@ void LLPanelBlockedList::onBlockByNameClick()
LLFloaterGetBlockedObjectName::show(&LLPanelBlockedList::callbackBlockByName);
}
//static
void LLPanelBlockedList::callbackBlockPicked(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* user_data)
void LLPanelBlockedList::callbackBlockPicked(const std::vector<std::string>& names, const std::vector<LLUUID>& ids)
{
if (names.empty() || ids.empty()) return;
LLMute mute(ids[0], names[0], LLMute::AGENT);

View File

@ -78,7 +78,7 @@ private:
void onPickBtnClick();
void onBlockByNameClick();
static void callbackBlockPicked(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* user_data);
void callbackBlockPicked(const std::vector<std::string>& names, const std::vector<LLUUID>& ids);
static void callbackBlockByName(const std::string& text);
private:

View File

@ -292,8 +292,8 @@ void LLPanelGroupInvite::impl::callbackClickAdd(void* userdata)
LLFloater* parentp;
parentp = gFloaterView->getParentFloater(panelp);
parentp->addDependentFloater(LLFloaterAvatarPicker::show(callbackAddUsers,
panelp->mImplementation,
parentp->addDependentFloater(LLFloaterAvatarPicker::show(boost::bind(impl::callbackAddUsers, _1, _2,
panelp->mImplementation),
TRUE));
}
}

View File

@ -1069,7 +1069,7 @@ bool LLPanelPeople::isItemsFreeOfFriends(const std::vector<LLUUID>& uuids)
void LLPanelPeople::onAddFriendWizButtonClicked()
{
// Show add friend wizard.
LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(onAvatarPicked, NULL, FALSE, TRUE);
LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLPanelPeople::onAvatarPicked, _1, _2), FALSE, TRUE);
// Need to disable 'ok' button when friend occurs in selection
if (picker) picker->setOkBtnEnableCb(boost::bind(&LLPanelPeople::isItemsFreeOfFriends, this, _1));
LLFloater* root_floater = gFloaterView->getParentFloater(this);
@ -1130,8 +1130,7 @@ void LLPanelPeople::onActivateButtonClicked()
// static
void LLPanelPeople::onAvatarPicked(
const std::vector<std::string>& names,
const std::vector<LLUUID>& ids,
void*)
const std::vector<LLUUID>& ids)
{
if (!names.empty() && !ids.empty())
LLAvatarActions::requestFriendshipDialog(ids[0], names[0]);

View File

@ -129,8 +129,7 @@ private:
// misc callbacks
static void onAvatarPicked(
const std::vector<std::string>& names,
const std::vector<LLUUID>& ids,
void*);
const std::vector<LLUUID>& ids);
void onFriendsAccordionExpandedCollapsed(LLUICtrl* ctrl, const LLSD& param, LLAvatarList* avatar_list);