summaryrefslogtreecommitdiff
path: root/indra/newview/llfloatergroups.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfloatergroups.cpp')
-rw-r--r--indra/newview/llfloatergroups.cpp116
1 files changed, 19 insertions, 97 deletions
diff --git a/indra/newview/llfloatergroups.cpp b/indra/newview/llfloatergroups.cpp
index 9e0b0d7230..a967a1833f 100644
--- a/indra/newview/llfloatergroups.cpp
+++ b/indra/newview/llfloatergroups.cpp
@@ -41,21 +41,15 @@
#include "llfloatergroups.h"
-#include "message.h"
#include "roles_constants.h"
#include "llagent.h"
#include "llbutton.h"
-#include "llfloatergroupinfo.h"
-#include "llfloaterdirectory.h"
-#include "llfocusmgr.h"
-#include "llalertdialog.h"
-#include "llselectmgr.h"
+#include "llgroupactions.h"
#include "llscrolllistctrl.h"
#include "lltextbox.h"
#include "lluictrlfactory.h"
-#include "llviewerwindow.h"
-#include "llimview.h"
+#include "lltrans.h"
using namespace LLOldEvents;
@@ -84,17 +78,16 @@ LLFloaterGroupPicker* LLFloaterGroupPicker::findInstance(const LLSD& seed)
LLFloaterGroupPicker* LLFloaterGroupPicker::createInstance(const LLSD &seed)
{
LLFloaterGroupPicker* pickerp = new LLFloaterGroupPicker(seed);
- LLUICtrlFactory::getInstance()->buildFloater(pickerp, "floater_choose_group.xml");
return pickerp;
}
-LLFloaterGroupPicker::LLFloaterGroupPicker(const LLSD& seed) :
- mSelectCallback(NULL),
- mCallbackUserdata(NULL),
+LLFloaterGroupPicker::LLFloaterGroupPicker(const LLSD& seed)
+: LLFloater(),
mPowersMask(GP_ALL_POWERS)
{
mID = seed.asUUID();
sInstances.insert(std::make_pair(mID, this));
+ LLUICtrlFactory::getInstance()->buildFloater(this, "floater_choose_group.xml");
}
LLFloaterGroupPicker::~LLFloaterGroupPicker()
@@ -102,13 +95,6 @@ LLFloaterGroupPicker::~LLFloaterGroupPicker()
sInstances.erase(mID);
}
-void LLFloaterGroupPicker::setSelectCallback(void (*callback)(LLUUID, void*),
- void* userdata)
-{
- mSelectCallback = callback;
- mCallbackUserdata = userdata;
-}
-
void LLFloaterGroupPicker::setPowersMask(U64 powers_mask)
{
mPowersMask = powers_mask;
@@ -126,8 +112,7 @@ BOOL LLFloaterGroupPicker::postBuild()
setDefaultBtn("OK");
- childSetDoubleClickCallback("group list", onBtnOK);
- childSetUserData("group list", this);
+ getChild<LLScrollListCtrl>("group list")->setDoubleClickCallback(onBtnOK, this);
childEnable("OK");
@@ -143,7 +128,7 @@ void LLFloaterGroupPicker::onBtnOK(void* userdata)
void LLFloaterGroupPicker::onBtnCancel(void* userdata)
{
LLFloaterGroupPicker* self = (LLFloaterGroupPicker*)userdata;
- if(self) self->close();
+ if(self) self->closeFloater();
}
@@ -155,12 +140,9 @@ void LLFloaterGroupPicker::ok()
{
group_id = group_list->getCurrentID();
}
- if(mSelectCallback)
- {
- mSelectCallback(group_id, mCallbackUserdata);
- }
+ mGroupSelectSignal(group_id);
- close();
+ closeFloater();
}
///----------------------------------------------------------------------------
@@ -229,8 +211,7 @@ BOOL LLPanelGroups::postBuild()
setDefaultBtn("IM");
- childSetDoubleClickCallback("group list", onBtnIM);
- childSetUserData("group list", this);
+ getChild<LLScrollListCtrl>("group list")->setDoubleClickCallback(onBtnIM, this);
reset();
@@ -315,113 +296,54 @@ void LLPanelGroups::onBtnSearch(void* userdata)
void LLPanelGroups::create()
{
- llinfos << "LLPanelGroups::create" << llendl;
- LLFloaterGroupInfo::showCreateGroup(NULL);
+ LLGroupActions::create();
}
void LLPanelGroups::activate()
{
- llinfos << "LLPanelGroups::activate" << llendl;
LLCtrlListInterface *group_list = childGetListInterface("group list");
LLUUID group_id;
if (group_list)
{
group_id = group_list->getCurrentID();
}
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_ActivateGroup);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->addUUIDFast(_PREHASH_GroupID, group_id);
- gAgent.sendReliableMessage();
+ LLGroupActions::activate(group_id);
}
void LLPanelGroups::info()
{
- llinfos << "LLPanelGroups::info" << llendl;
LLCtrlListInterface *group_list = childGetListInterface("group list");
LLUUID group_id;
if (group_list && (group_id = group_list->getCurrentID()).notNull())
{
- LLFloaterGroupInfo::showFromUUID(group_id);
+ LLGroupActions::info(group_id);
}
}
void LLPanelGroups::startIM()
{
- //llinfos << "LLPanelFriends::onClickIM()" << llendl;
LLCtrlListInterface *group_list = childGetListInterface("group list");
LLUUID group_id;
if (group_list && (group_id = group_list->getCurrentID()).notNull())
{
- LLGroupData group_data;
- if (gAgent.getGroupData(group_id, group_data))
- {
- gIMMgr->setFloaterOpen(TRUE);
- gIMMgr->addSession(
- group_data.mName,
- IM_SESSION_GROUP_START,
- group_id);
- make_ui_sound("UISndStartIM");
- }
- else
- {
- // this should never happen, as starting a group IM session
- // relies on you belonging to the group and hence having the group data
- make_ui_sound("UISndInvalidOp");
- }
+ LLGroupActions::startChat(group_id);
}
}
void LLPanelGroups::leave()
{
- llinfos << "LLPanelGroups::leave" << llendl;
LLCtrlListInterface *group_list = childGetListInterface("group list");
LLUUID group_id;
if (group_list && (group_id = group_list->getCurrentID()).notNull())
{
- S32 count = gAgent.mGroups.count();
- S32 i;
- for(i = 0; i < count; ++i)
- {
- if(gAgent.mGroups.get(i).mID == group_id)
- break;
- }
- if(i < count)
- {
- LLSD args;
- args["GROUP"] = gAgent.mGroups.get(i).mName;
- LLSD payload;
- payload["group_id"] = group_id;
- LLNotifications::instance().add("GroupLeaveConfirmMember", args, payload, callbackLeaveGroup);
- }
+ LLGroupActions::leave(group_id);
}
}
void LLPanelGroups::search()
{
- LLFloaterDirectory::showGroups();
-}
-
-// static
-bool LLPanelGroups::callbackLeaveGroup(const LLSD& notification, const LLSD& response)
-{
- S32 option = LLNotification::getSelectedOption(notification, response);
- LLUUID group_id = notification["payload"]["group_id"].asUUID();
- if(option == 0)
- {
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_LeaveGroupRequest);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_GroupData);
- msg->addUUIDFast(_PREHASH_GroupID, group_id);
- gAgent.sendReliableMessage();
- }
- return false;
+ LLGroupActions::search();
}
void LLPanelGroups::onGroupList(LLUICtrl* ctrl, void* userdata)
@@ -456,7 +378,7 @@ void init_group_list(LLScrollListCtrl* ctrl, const LLUUID& highlight_id, U64 pow
element["columns"][0]["column"] = "name";
element["columns"][0]["value"] = group_datap->mName;
element["columns"][0]["font"] = "SANSSERIF";
- element["columns"][0]["font-style"] = style;
+ element["columns"][0]["font"]["style"] = style;
group_list->addElement(element, ADD_SORTED);
}
@@ -472,9 +394,9 @@ void init_group_list(LLScrollListCtrl* ctrl, const LLUUID& highlight_id, U64 pow
LLSD element;
element["id"] = LLUUID::null;
element["columns"][0]["column"] = "name";
- element["columns"][0]["value"] = "none"; // *TODO: Translate
+ element["columns"][0]["value"] = LLTrans::getString("GroupsNone");
element["columns"][0]["font"] = "SANSSERIF";
- element["columns"][0]["font-style"] = style;
+ element["columns"][0]["font"]["style"] = style;
group_list->addElement(element, ADD_TOP);
}