summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelgroupgeneral.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llpanelgroupgeneral.cpp')
-rwxr-xr-x[-rw-r--r--]indra/newview/llpanelgroupgeneral.cpp275
1 files changed, 61 insertions, 214 deletions
diff --git a/indra/newview/llpanelgroupgeneral.cpp b/indra/newview/llpanelgroupgeneral.cpp
index 1c2875bf46..7ffaa05919 100644..100755
--- a/indra/newview/llpanelgroupgeneral.cpp
+++ b/indra/newview/llpanelgroupgeneral.cpp
@@ -2,31 +2,25 @@
* @file llpanelgroupgeneral.cpp
* @brief General information about a group.
*
- * $LicenseInfo:firstyear=2006&license=viewergpl$
- *
- * Copyright (c) 2006-2009, Linden Research, Inc.
- *
+ * $LicenseInfo:firstyear=2006&license=viewerlgpl$
* 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
+ * 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.
*
- * 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
+ * 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.
*
- * 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.
+ * 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
*
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,8 +28,10 @@
#include "llpanelgroupgeneral.h"
-#include "lluictrlfactory.h"
+#include "llavatarnamecache.h"
#include "llagent.h"
+#include "llsdparam.h"
+#include "lluictrlfactory.h"
#include "roles_constants.h"
// UI elements
@@ -46,17 +42,18 @@
#include "llavataractions.h"
#include "llgroupactions.h"
#include "lllineeditor.h"
-#include "llnamebox.h"
#include "llnamelistctrl.h"
+#include "llnotificationsutil.h"
#include "llscrolllistitem.h"
#include "llspinctrl.h"
+#include "llslurl.h"
#include "lltextbox.h"
#include "lltexteditor.h"
#include "lltexturectrl.h"
#include "lltrans.h"
#include "llviewerwindow.h"
-static LLRegisterPanelClassWrapper<LLPanelGroupGeneral> t_panel_group_general("panel_group_general");
+static LLPanelInjector<LLPanelGroupGeneral> t_panel_group_general("panel_group_general");
// consts
const S32 MATURE_CONTENT = 1;
@@ -66,14 +63,12 @@ const S32 DECLINE_TO_STATE = 0;
LLPanelGroupGeneral::LLPanelGroupGeneral()
: LLPanelGroupTab(),
- mPendingMemberUpdate(FALSE),
mChanged(FALSE),
mFirstUse(TRUE),
mGroupNameEditor(NULL),
mFounderName(NULL),
mInsignia(NULL),
mEditCharter(NULL),
- mListVisibleMembers(NULL),
mCtrlShowInGroupList(NULL),
mComboMature(NULL),
mCtrlOpenEnrollment(NULL),
@@ -103,15 +98,6 @@ BOOL LLPanelGroupGeneral::postBuild()
mEditCharter->setFocusChangedCallback(boost::bind(onFocusEdit, _1, this));
}
-
-
- mListVisibleMembers = getChild<LLNameListCtrl>("visible_members", recurse);
- if (mListVisibleMembers)
- {
- mListVisibleMembers->setDoubleClickCallback(openProfile, this);
- mListVisibleMembers->setContextMenu(LLScrollListCtrl::MENU_AVATAR);
- }
-
// Options
mCtrlShowInGroupList = getChild<LLCheckBoxCtrl>("show_in_group_list", recurse);
if (mCtrlShowInGroupList)
@@ -181,8 +167,7 @@ BOOL LLPanelGroupGeneral::postBuild()
mComboActiveTitle = getChild<LLComboBox>("active_title", recurse);
if (mComboActiveTitle)
{
- mComboActiveTitle->setCommitCallback(onCommitTitle, this);
- mComboActiveTitle->resetDirty();
+ mComboActiveTitle->setCommitCallback(onCommitAny, this);
}
mIncompleteMemberDataStr = getString("incomplete_member_data_str");
@@ -205,14 +190,18 @@ BOOL LLPanelGroupGeneral::postBuild()
void LLPanelGroupGeneral::setupCtrls(LLPanel* panel_group)
{
- mInsignia = panel_group->getChild<LLTextureCtrl>("insignia");
+ mInsignia = getChild<LLTextureCtrl>("insignia");
if (mInsignia)
{
mInsignia->setCommitCallback(onCommitAny, this);
- mDefaultIconID = mInsignia->getImageAssetID();
}
- mFounderName = panel_group->getChild<LLNameBox>("founder_name");
+ mFounderName = getChild<LLTextBox>("founder_name");
+
+
mGroupNameEditor = panel_group->getChild<LLLineEditor>("group_name_editor");
+ mGroupNameEditor->setPrevalidate( LLTextValidate::validateASCII );
+
+
}
// static
@@ -271,43 +260,18 @@ void LLPanelGroupGeneral::onCommitEnrollment(LLUICtrl* ctrl, void* data)
}
// static
-void LLPanelGroupGeneral::onCommitTitle(LLUICtrl* ctrl, void* data)
-{
- LLPanelGroupGeneral* self = (LLPanelGroupGeneral*)data;
- if (self->mGroupID.isNull() || !self->mAllowEdit) return;
- LLGroupMgr::getInstance()->sendGroupTitleUpdate(self->mGroupID,self->mComboActiveTitle->getCurrentID());
- self->update(GC_TITLES);
- self->mComboActiveTitle->resetDirty();
-}
-
-// static
void LLPanelGroupGeneral::onClickInfo(void *userdata)
{
LLPanelGroupGeneral *self = (LLPanelGroupGeneral *)userdata;
if ( !self ) return;
- lldebugs << "open group info: " << self->mGroupID << llendl;
+ LL_DEBUGS() << "open group info: " << self->mGroupID << LL_ENDL;
LLGroupActions::show(self->mGroupID);
}
-// static
-void LLPanelGroupGeneral::openProfile(void* data)
-{
- LLPanelGroupGeneral* self = (LLPanelGroupGeneral*)data;
-
- if (self && self->mListVisibleMembers)
- {
- LLScrollListItem* selected = self->mListVisibleMembers->getFirstSelected();
- if (selected)
- {
- LLAvatarActions::showProfile(selected->getUUID());
- }
- }
-}
-
bool LLPanelGroupGeneral::needsApply(std::string& mesg)
{
updateChanged();
@@ -323,11 +287,10 @@ void LLPanelGroupGeneral::activate()
{
LLGroupMgr::getInstance()->sendGroupTitlesRequest(mGroupID);
LLGroupMgr::getInstance()->sendGroupPropertiesRequest(mGroupID);
-
if (!gdatap || !gdatap->isMemberDataComplete() )
{
- LLGroupMgr::getInstance()->sendGroupMembersRequest(mGroupID);
+ LLGroupMgr::getInstance()->sendCapGroupMembersRequest(mGroupID);
}
mFirstUse = FALSE;
@@ -340,26 +303,28 @@ void LLPanelGroupGeneral::activate()
void LLPanelGroupGeneral::draw()
{
LLPanelGroupTab::draw();
-
- if (mPendingMemberUpdate)
- {
- updateMembers();
- }
}
bool LLPanelGroupGeneral::apply(std::string& mesg)
{
+ if (!mGroupID.isNull() && mAllowEdit && mComboActiveTitle && mComboActiveTitle->isDirty())
+ {
+ LLGroupMgr::getInstance()->sendGroupTitleUpdate(mGroupID,mComboActiveTitle->getCurrentID());
+ update(GC_TITLES);
+ mComboActiveTitle->resetDirty();
+ }
+
BOOL has_power_in_group = gAgent.hasPowerInGroup(mGroupID,GP_GROUP_CHANGE_IDENTITY);
if (has_power_in_group || mGroupID.isNull())
{
- llinfos << "LLPanelGroupGeneral::apply" << llendl;
+ LL_INFOS() << "LLPanelGroupGeneral::apply" << LL_ENDL;
// Check to make sure mature has been set
if(mComboMature &&
mComboMature->getCurrentIndex() == DECLINE_TO_STATE)
{
- LLNotifications::instance().add("SetGroupMature", LLSD(), LLSD(),
+ LLNotificationsUtil::add("SetGroupMature", LLSD(), LLSD(),
boost::bind(&LLPanelGroupGeneral::confirmMatureApply, this, _1, _2));
return false;
}
@@ -378,7 +343,7 @@ bool LLPanelGroupGeneral::apply(std::string& mesg)
return false;
}
- LLNotifications::instance().add("CreateGroupCost", LLSD(), LLSD(), boost::bind(&LLPanelGroupGeneral::createGroupCallback, this, _1, _2));
+ LLNotificationsUtil::add("CreateGroupCost", LLSD(), LLSD(), boost::bind(&LLPanelGroupGeneral::createGroupCallback, this, _1, _2));
return false;
}
@@ -441,6 +406,8 @@ bool LLPanelGroupGeneral::apply(std::string& mesg)
gAgent.setUserGroupFlags(mGroupID, receive_notices, list_in_profile);
+ resetDirty();
+
mChanged = FALSE;
return true;
@@ -458,7 +425,7 @@ void LLPanelGroupGeneral::cancel()
// invoked from callbackConfirmMature
bool LLPanelGroupGeneral::confirmMatureApply(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotification::getSelectedOption(notification, response);
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
// 0 == Yes
// 1 == No
// 2 == Cancel
@@ -481,7 +448,7 @@ bool LLPanelGroupGeneral::confirmMatureApply(const LLSD& notification, const LLS
{
LLSD args;
args["MESSAGE"] = mesg;
- LLNotifications::instance().add("GenericAlert", args);
+ LLNotificationsUtil::add("GenericAlert", args);
}
return ret;
@@ -490,7 +457,7 @@ bool LLPanelGroupGeneral::confirmMatureApply(const LLSD& notification, const LLS
// static
bool LLPanelGroupGeneral::createGroupCallback(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotification::getSelectedOption(notification, response);
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
switch(option)
{
case 0:
@@ -517,10 +484,6 @@ bool LLPanelGroupGeneral::createGroupCallback(const LLSD& notification, const LL
return false;
}
-static F32 sSDTime = 0.0f;
-static F32 sElementTime = 0.0f;
-static F32 sAllTime = 0.0f;
-
// virtual
void LLPanelGroupGeneral::update(LLGroupChange gc)
{
@@ -578,9 +541,13 @@ void LLPanelGroupGeneral::update(LLGroupChange gc)
}
}
- mComboActiveTitle->resetDirty();
}
+ // After role member data was changed in Roles->Members
+ // need to update role titles. See STORM-918.
+ if (gc == GC_ROLE_MEMBER_DATA)
+ LLGroupMgr::getInstance()->sendGroupTitlesRequest(mGroupID);
+
// If this was just a titles update, we are done.
if (gc == GC_TITLES) return;
@@ -593,8 +560,6 @@ void LLPanelGroupGeneral::update(LLGroupChange gc)
{
mCtrlShowInGroupList->set(gdatap->mShowInList);
mCtrlShowInGroupList->setEnabled(mAllowEdit && can_change_ident);
- mCtrlShowInGroupList->resetDirty();
-
}
if (mComboMature)
{
@@ -608,19 +573,16 @@ void LLPanelGroupGeneral::update(LLGroupChange gc)
}
mComboMature->setEnabled(mAllowEdit && can_change_ident);
mComboMature->setVisible( !gAgent.isTeen() );
- mComboMature->resetDirty();
}
if (mCtrlOpenEnrollment)
{
mCtrlOpenEnrollment->set(gdatap->mOpenEnrollment);
mCtrlOpenEnrollment->setEnabled(mAllowEdit && can_change_member_opts);
- mCtrlOpenEnrollment->resetDirty();
}
if (mCtrlEnrollmentFee)
{
mCtrlEnrollmentFee->set(gdatap->mMembershipFee > 0);
mCtrlEnrollmentFee->setEnabled(mAllowEdit && can_change_member_opts);
- mCtrlEnrollmentFee->resetDirty();
}
if (mSpinEnrollmentFee)
@@ -630,7 +592,6 @@ void LLPanelGroupGeneral::update(LLGroupChange gc)
mSpinEnrollmentFee->setEnabled( mAllowEdit &&
(fee > 0) &&
can_change_member_opts);
- mSpinEnrollmentFee->resetDirty();
}
if (mCtrlReceiveNotices)
{
@@ -639,7 +600,6 @@ void LLPanelGroupGeneral::update(LLGroupChange gc)
{
mCtrlReceiveNotices->setEnabled(mAllowEdit);
}
- mCtrlReceiveNotices->resetDirty();
}
@@ -647,7 +607,7 @@ void LLPanelGroupGeneral::update(LLGroupChange gc)
if (mEditCharter) mEditCharter->setEnabled(mAllowEdit && can_change_ident);
if (mGroupNameEditor) mGroupNameEditor->setVisible(FALSE);
- if (mFounderName) mFounderName->setNameID(gdatap->mFounderID,FALSE);
+ if (mFounderName) mFounderName->setText(LLSLURL("agent", gdatap->mFounderID, "inspect").getSLURLString());
if (mInsignia)
{
if (gdatap->mInsigniaID.notNull())
@@ -656,122 +616,16 @@ void LLPanelGroupGeneral::update(LLGroupChange gc)
}
else
{
- mInsignia->setImageAssetID(mDefaultIconID);
+ mInsignia->setImageAssetName(mInsignia->getDefaultImageName());
}
}
if (mEditCharter)
{
mEditCharter->setText(gdatap->mCharter);
- mEditCharter->resetDirty();
}
- if (mListVisibleMembers)
- {
- mListVisibleMembers->deleteAllItems();
-
- if (gdatap->isMemberDataComplete())
- {
- mMemberProgress = gdatap->mMembers.begin();
- mPendingMemberUpdate = TRUE;
-
- sSDTime = 0.0f;
- sElementTime = 0.0f;
- sAllTime = 0.0f;
- }
- else
- {
- std::stringstream pending;
- pending << "Retrieving member list (" << gdatap->mMembers.size() << "\\" << gdatap->mMemberCount << ")";
-
- LLSD row;
- row["columns"][0]["value"] = pending.str();
-
- mListVisibleMembers->setEnabled(FALSE);
- mListVisibleMembers->addElement(row);
- }
- }
-}
-
-void LLPanelGroupGeneral::updateMembers()
-{
- mPendingMemberUpdate = FALSE;
-
- LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
-
- if (!mListVisibleMembers || !gdatap
- || !gdatap->isMemberDataComplete())
- {
- return;
- }
-
- static LLTimer all_timer;
- static LLTimer sd_timer;
- static LLTimer element_timer;
-
- all_timer.reset();
- S32 i = 0;
-
- for( ; mMemberProgress != gdatap->mMembers.end() && i<UPDATE_MEMBERS_PER_FRAME;
- ++mMemberProgress, ++i)
- {
- //llinfos << "Adding " << iter->first << ", " << iter->second->getTitle() << llendl;
- LLGroupMemberData* member = mMemberProgress->second;
- if (!member)
- {
- continue;
- }
- // Owners show up in bold.
- std::string style = "NORMAL";
- sd_timer.reset();
- LLSD row;
- row["id"] = member->getID();
-
- row["columns"][0]["column"] = "name";
- row["columns"][0]["font"]["name"] = "SANSSERIF_SMALL";
- row["columns"][0]["font"]["style"] = style;
- // value is filled in by name list control
-
- row["columns"][1]["column"] = "title";
- row["columns"][1]["value"] = member->getTitle();
- row["columns"][1]["font"]["name"] = "SANSSERIF_SMALL";
- row["columns"][1]["font"]["style"] = style;
-
- row["columns"][2]["column"] = "online";
- row["columns"][2]["value"] = member->getOnlineStatus();
- row["columns"][2]["font"]["name"] = "SANSSERIF_SMALL";
- row["columns"][2]["font"]["style"] = style;
-
- sSDTime += sd_timer.getElapsedTimeF32();
-
- element_timer.reset();
- LLScrollListItem* member_row = mListVisibleMembers->addElement(row);//, ADD_SORTED);
-
- if ( member->isOwner() )
- {
- LLScrollListText* name_textp = dynamic_cast<LLScrollListText*>(member_row->getColumn(0));
- if (name_textp)
- name_textp->setFontStyle(LLFontGL::BOLD);
- }
- sElementTime += element_timer.getElapsedTimeF32();
- }
- sAllTime += all_timer.getElapsedTimeF32();
-
- llinfos << "Updated " << i << " of " << UPDATE_MEMBERS_PER_FRAME << "members in the list." << llendl;
- if (mMemberProgress == gdatap->mMembers.end())
- {
- llinfos << " member list completed." << llendl;
- mListVisibleMembers->setEnabled(TRUE);
-
- llinfos << "All Time: " << sAllTime << llendl;
- llinfos << "SD Time: " << sSDTime << llendl;
- llinfos << "Element Time: " << sElementTime << llendl;
- }
- else
- {
- mPendingMemberUpdate = TRUE;
- mListVisibleMembers->setEnabled(FALSE);
- }
+ resetDirty();
}
void LLPanelGroupGeneral::updateChanged()
@@ -816,15 +670,15 @@ void LLPanelGroupGeneral::reset()
mCtrlListGroup->set(true);
- mCtrlReceiveNotices->setEnabled(true);
+ mCtrlReceiveNotices->setEnabled(false);
mCtrlReceiveNotices->setVisible(true);
- mCtrlListGroup->setEnabled(true);
+ mCtrlListGroup->setEnabled(false);
mGroupNameEditor->setEnabled(TRUE);
mEditCharter->setEnabled(TRUE);
- mCtrlShowInGroupList->setEnabled(TRUE);
+ mCtrlShowInGroupList->setEnabled(false);
mComboMature->setEnabled(TRUE);
mCtrlOpenEnrollment->setEnabled(TRUE);
@@ -842,6 +696,8 @@ void LLPanelGroupGeneral::reset()
mInsignia->setEnabled(true);
+ mInsignia->setImageAssetName(mInsignia->getDefaultImageName());
+
{
std::string empty_str = "";
mEditCharter->setText(empty_str);
@@ -849,16 +705,6 @@ void LLPanelGroupGeneral::reset()
}
{
- LLSD row;
- row["columns"][0]["value"] = "no members yet";
-
- mListVisibleMembers->deleteAllItems();
- mListVisibleMembers->setEnabled(FALSE);
- mListVisibleMembers->addElement(row);
- }
-
-
- {
mComboMature->setEnabled(true);
mComboMature->setVisible( !gAgent.isTeen() );
mComboMature->selectFirstItem();
@@ -929,6 +775,8 @@ void LLPanelGroupGeneral::setGroupID(const LLUUID& id)
mCtrlListGroup->setEnabled(data.mID.notNull());
}
+ mCtrlShowInGroupList->setEnabled(data.mID.notNull());
+
mActiveTitleLabel = getChild<LLTextBox>("active_title_label");
mComboActiveTitle = getChild<LLComboBox>("active_title");
@@ -941,4 +789,3 @@ void LLPanelGroupGeneral::setGroupID(const LLUUID& id)
activate();
}
-