From bf34eccf9c68f204c41d3daea791e50e87d868db Mon Sep 17 00:00:00 2001 From: Baker Linden Date: Mon, 9 Sep 2013 17:29:33 -0700 Subject: - Start of code cleanup - Added refresh button to ban list panel - Added an additional signal to LLNameListCtrl to indicate when the entire name cache is complete. --- indra/newview/llgroupmgr.cpp | 9 +- indra/newview/llgroupmgr.h | 15 - indra/newview/llnamelistctrl.cpp | 58 +- indra/newview/llnamelistctrl.h | 17 +- indra/newview/llpanelgrouproles.cpp | 195 +-- indra/newview/llpanelgrouproles.h | 13 +- .../skins/default/xui/en/panel_group_roles.xml | 1251 ++++++++++---------- 7 files changed, 830 insertions(+), 728 deletions(-) (limited to 'indra') diff --git a/indra/newview/llgroupmgr.cpp b/indra/newview/llgroupmgr.cpp index bfdb8588e4..7cb53066ea 100755 --- a/indra/newview/llgroupmgr.cpp +++ b/indra/newview/llgroupmgr.cpp @@ -235,7 +235,6 @@ LLGroupMgrGroupData::LLGroupMgrGroupData(const LLUUID& id) : mRoleDataComplete(false), mRoleMemberDataComplete(false), mGroupPropertiesDataComplete(false), - mGroupBanStatus(LLGroupMgrGroupData::STATUS_INIT), mPendingRoleMemberRequest(false), mAccessTime(0.0f) { @@ -747,14 +746,11 @@ void LLGroupMgrGroupData::cancelRoleChanges() void LLGroupMgrGroupData::createBanEntry(const LLUUID& ban_id, const LLGroupBanData& ban_data) { mBanList[ban_id] = ban_data; - // Refresh the list } void LLGroupMgrGroupData::removeBanEntry(const LLUUID& ban_id) { - // Once we get this hooked up to the backend, we want to confirm the create or delete worked. mBanList.erase(ban_id); - // Refresh the list } @@ -1948,9 +1944,6 @@ void LLGroupMgr::processGroupBanRequest(const LLSD& content) if (!gdatap) return; - //LLSD banlist = LLSD::emptyMap(); - - LLSD::map_const_iterator i = content["ban_list"].beginMap(); LLSD::map_const_iterator iEnd = content["ban_list"].endMap(); for(;i != iEnd; ++i) @@ -1963,7 +1956,7 @@ void LLGroupMgr::processGroupBanRequest(const LLSD& content) } gdatap->mChanged = TRUE; - gdatap->setGroupBanStatus(LLGroupMgrGroupData::STATUS_COMPLETE); +// gdatap->setGroupBanStatus(LLGroupMgrGroupData::STATUS_COMPLETE); LLGroupMgr::getInstance()->notifyObservers(GC_BANLIST); } diff --git a/indra/newview/llgroupmgr.h b/indra/newview/llgroupmgr.h index 49e354a26c..7e3297b757 100755 --- a/indra/newview/llgroupmgr.h +++ b/indra/newview/llgroupmgr.h @@ -212,14 +212,6 @@ struct LLGroupTitle class LLGroupMgrGroupData { friend class LLGroupMgr; -public: - enum EGroupDataStatus - { - STATUS_INIT, - STATUS_REQUESTING, - STATUS_COMPLETE - }; - public: LLGroupMgrGroupData(const LLUUID& id); @@ -250,9 +242,6 @@ public: bool isRoleDataComplete() { return mRoleDataComplete; } bool isRoleMemberDataComplete() { return mRoleMemberDataComplete; } bool isGroupPropertiesDataComplete() { return mGroupPropertiesDataComplete; } - - EGroupDataStatus getGroupBanStatus() { return mGroupBanStatus; } - void setGroupBanStatus(EGroupDataStatus status) { mGroupBanStatus = status; } F32 getAccessTime() const { return mAccessTime; } void setAccessed(); @@ -271,8 +260,6 @@ public: void removeBanEntry(const LLUUID& ban_id); - - public: typedef std::map member_list_t; typedef std::map role_list_t; @@ -319,8 +306,6 @@ private: bool mRoleDataComplete; bool mRoleMemberDataComplete; bool mGroupPropertiesDataComplete; - - EGroupDataStatus mGroupBanStatus; bool mPendingRoleMemberRequest; F32 mAccessTime; diff --git a/indra/newview/llnamelistctrl.cpp b/indra/newview/llnamelistctrl.cpp index 7f396b7b7e..ed684004f0 100755 --- a/indra/newview/llnamelistctrl.cpp +++ b/indra/newview/llnamelistctrl.cpp @@ -65,7 +65,8 @@ LLNameListCtrl::LLNameListCtrl(const LLNameListCtrl::Params& p) mNameColumn(p.name_column.column_name), mAllowCallingCardDrop(p.allow_calling_card_drop), mShortNames(p.short_names), - mAvatarNameCacheConnection() + mAvatarNameCacheConnection(), + mPendingLookupsRemaining(0) {} // public @@ -79,6 +80,12 @@ LLScrollListItem* LLNameListCtrl::addNameItem(const LLUUID& agent_id, EAddPositi item.enabled = enabled; item.target = INDIVIDUAL; + ////////////////////////////////////////////////////////////////////////// + // BAKER - FIX NameListCtrl + //mPendingLookupsRemaining--; + ////////////////////////////////////////////////////////////////////////// + + return addNameItemRow(item, pos, suffix); } @@ -275,6 +282,12 @@ void LLNameListCtrl::addGroupNameItem(LLNameListCtrl::NameItem& item, EAddPositi LLScrollListItem* LLNameListCtrl::addNameItem(LLNameListCtrl::NameItem& item, EAddPosition pos) { item.target = INDIVIDUAL; + + ////////////////////////////////////////////////////////////////////////// + // BAKER - FIX NameListCtrl + //mPendingLookupsRemaining--; + ////////////////////////////////////////////////////////////////////////// + return addNameItemRow(item, pos); } @@ -284,6 +297,12 @@ LLScrollListItem* LLNameListCtrl::addElement(const LLSD& element, EAddPosition p LLParamSDParser parser; parser.readSD(element, item_params); item_params.userdata = userdata; + + ////////////////////////////////////////////////////////////////////////// + // BAKER - FIX NameListCtrl + //mPendingLookupsRemaining--; + ////////////////////////////////////////////////////////////////////////// + return addNameItemRow(item_params, pos); } @@ -335,6 +354,20 @@ LLScrollListItem* LLNameListCtrl::addNameItemRow( mAvatarNameCacheConnection.disconnect(); } mAvatarNameCacheConnection = LLAvatarNameCache::get(id,boost::bind(&LLNameListCtrl::onAvatarNameCache,this, _1, _2, item->getHandle())); + + ////////////////////////////////////////////////////////////////////////// + // BAKER - FIX NameListCtrl + if(mPendingLookupsRemaining <= 0) + { + // We might get into a state where mPendingLookupsRemaining might + // go negative. So just reset it right now and figure out if it's + // possible later :) + mPendingLookupsRemaining = 0; + mNameListCompleteSignal(false); + } + mPendingLookupsRemaining++; + ////////////////////////////////////////////////////////////////////////// + } break; } @@ -386,6 +419,12 @@ void LLNameListCtrl::removeNameItem(const LLUUID& agent_id) { selectNthItem(idx); // not sure whether this is needed, taken from previous implementation deleteSingleItem(idx); + + ////////////////////////////////////////////////////////////////////////// + // BAKER - FIX NameListCtrl + mPendingLookupsRemaining--; + ////////////////////////////////////////////////////////////////////////// + } } @@ -412,6 +451,23 @@ void LLNameListCtrl::onAvatarNameCache(const LLUUID& agent_id, } } + ////////////////////////////////////////////////////////////////////////// + // BAKER - FIX NameListCtrl + //if (mPendingLookupsRemaining <= 0) + { + // We might get into a state where mPendingLookupsRemaining might + // go negative. So just reset it right now and figure out if it's + // possible later :) + //mPendingLookupsRemaining = 0; + + mNameListCompleteSignal(true); + } + //else + { + // mPendingLookupsRemaining--; + } + ////////////////////////////////////////////////////////////////////////// + dirtyColumns(); } diff --git a/indra/newview/llnamelistctrl.h b/indra/newview/llnamelistctrl.h index 271802d48a..80ed081fd3 100755 --- a/indra/newview/llnamelistctrl.h +++ b/indra/newview/llnamelistctrl.h @@ -67,6 +67,8 @@ class LLNameListCtrl : public LLScrollListCtrl, public LLInstanceTracker { public: + typedef boost::signals2::signal namelist_complete_signal_t; + typedef enum e_name_type { INDIVIDUAL, @@ -151,7 +153,7 @@ public: /*virtual*/ void updateColumns(); - /*virtual*/ void mouseOverHighlightNthItem( S32 index ); + /*virtual*/ void mouseOverHighlightNthItem( S32 index ); private: void showInspector(const LLUUID& avatar_id, bool is_group); void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name, LLHandle item); @@ -162,6 +164,19 @@ private: BOOL mAllowCallingCardDrop; bool mShortNames; // display name only, no SLID boost::signals2::connection mAvatarNameCacheConnection; + + ////////////////////////////////////////////////////////////////////////// + // BAKER: Fixing name list control not being updated properly. + S32 mPendingLookupsRemaining; + namelist_complete_signal_t mNameListCompleteSignal; + +public: + boost::signals2::connection setOnNameListCompleteCallback(boost::function onNameListCompleteCallback) + { + return mNameListCompleteSignal.connect(onNameListCompleteCallback); + } + ////////////////////////////////////////////////////////////////////////// + }; diff --git a/indra/newview/llpanelgrouproles.cpp b/indra/newview/llpanelgrouproles.cpp index f3cb9900fe..76cb3cc498 100755 --- a/indra/newview/llpanelgrouproles.cpp +++ b/indra/newview/llpanelgrouproles.cpp @@ -1304,6 +1304,8 @@ void LLPanelGroupMembersSubTab::deactivate() bool LLPanelGroupMembersSubTab::needsApply(std::string& mesg) { + LL_INFOS("BAKER") << "[BAKER] needsApply()" << LL_ENDL; + return mChanged; } @@ -2711,8 +2713,6 @@ void LLPanelGroupActionsSubTab::setGroupID(const LLUUID& id) LLPanelGroupSubTab::setGroupID(id); } -////////////////////////////////////////////////////////////////////////// - //////////////////////////// // LLPanelGroupBanListSubTab @@ -2724,14 +2724,10 @@ LLPanelGroupBanListSubTab::LLPanelGroupBanListSubTab() mBanList(NULL), mCreateBanButton(NULL), mDeleteBanButton(NULL) -{ - LL_INFOS("BAKER") << "[BAKER] LLPanelGroupBanListSubTab::ctor()" << LL_ENDL; -} +{} BOOL LLPanelGroupBanListSubTab::postBuildSubTab(LLView* root) { - LL_INFOS("BAKER") << "[BAKER] LLPanelGroupBanListSubTab::postBuildSubTab()" << LL_ENDL; - LLPanelGroupSubTab::postBuildSubTab(root); // Upcast parent so we can ask it for sibling controls. @@ -2740,49 +2736,50 @@ BOOL LLPanelGroupBanListSubTab::postBuildSubTab(LLView* root) // Look recursively from the parent to find all our widgets. bool recurse = true; - // BAKER TODO: - // What are these? Looks like something inhereted from LLPanelGroupSubTab - mHeader = parent->getChild("banlist_header", recurse); - mFooter = parent->getChild("banlist_footer", recurse); - ////////////////////////////////////////////////////////////////////////// + mHeader = parent->getChild("banlist_header", recurse); + mFooter = parent->getChild("banlist_footer", recurse); mBanList = parent->getChild("ban_list", recurse); - mCreateBanButton = parent->getChild("ban_create", recurse); - mDeleteBanButton = parent->getChild("ban_delete", recurse); + + mCreateBanButton = parent->getChild("ban_create", recurse); + mDeleteBanButton = parent->getChild("ban_delete", recurse); + mRefreshBanListButton = parent->getChild("ban_refresh", recurse); - if(!mBanList || !mCreateBanButton || !mDeleteBanButton) + if(!mBanList || !mCreateBanButton || !mDeleteBanButton || !mRefreshBanListButton) return FALSE; mBanList->setCommitOnSelectionChange(TRUE); mBanList->setCommitCallback(onBanEntrySelect, this); mCreateBanButton->setClickedCallback(onCreateBanEntry, this); - mCreateBanButton->setEnabled(FALSE); - + mCreateBanButton->setEnabled(TRUE); + mDeleteBanButton->setClickedCallback(onDeleteBanEntry, this); mDeleteBanButton->setEnabled(FALSE); - setFooterEnabled(FALSE); - - LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); - if(gdatap && (gdatap->getGroupBanStatus() == LLGroupMgrGroupData::STATUS_INIT)) - { - LLGroupMgr::getInstance()->sendGroupBanRequest(LLGroupMgr::REQUEST_GET, mGroupID); - gdatap->setGroupBanStatus(LLGroupMgrGroupData::STATUS_REQUESTING); - } + mRefreshBanListButton->setClickedCallback(onRefreshBanList, this); + mRefreshBanListButton->setEnabled(FALSE); + mBanList->setOnNameListCompleteCallback(boost::bind(&LLPanelGroupBanListSubTab::onBanListCompleted, this, _1)); + + setFooterEnabled(FALSE); return TRUE; } void LLPanelGroupBanListSubTab::activate() { - LL_INFOS("BAKER") << "[BAKER] LLPanelGroupBanListSubTab::activate()" << LL_ENDL; - LLPanelGroupSubTab::activate(); mBanList->deselectAllItems(); mDeleteBanButton->setEnabled(FALSE); + // BAKER: Should I really request everytime activate() is called? + // Perhaps I should only do it on a force refresh, or if an action on the list happens... + // Because it's not going to live-update the list anyway... You'd have to refresh if you + // wanted to see someone else's additions anyway... + // + LLGroupMgr::getInstance()->sendGroupBanRequest(LLGroupMgr::REQUEST_GET, mGroupID); + setFooterEnabled(FALSE); update(GC_ALL); } @@ -2820,68 +2817,53 @@ void LLPanelGroupBanListSubTab::update(LLGroupChange gc) //if (gc != GC_ALL && gc != GC_BANLIST) // return; - LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); - if(!gdatap) - { - LL_INFOS("BAKER") << "[BAKER] No group data!" << LL_ENDL; - return; - } - - switch(gdatap->getGroupBanStatus()) - { - // Must be initial update [ Check if I should request this at panel creation - // with everything else -- might as well] - // Request our ban list! - case LLGroupMgrGroupData::STATUS_INIT: - LLGroupMgr::getInstance()->sendGroupBanRequest(LLGroupMgr::REQUEST_GET, mGroupID); - gdatap->setGroupBanStatus(LLGroupMgrGroupData::STATUS_REQUESTING); - break; +// LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); +// if(!gdatap) +// { +// LL_INFOS("BAKER") << "[BAKER] No group data!" << LL_ENDL; +// return; +// } + + populateBanList(); +// // Do I even need this anymore? +// switch(gdatap->getGroupBanStatus()) +// { +// // Must be initial update [ Check if I should request this at panel creation +// // with everything else -- might as well] +// // Request our ban list! +// case LLGroupMgrGroupData::STATUS_INIT: +// LLGroupMgr::getInstance()->sendGroupBanRequest(LLGroupMgr::REQUEST_GET, mGroupID); +// gdatap->setGroupBanStatus(LLGroupMgrGroupData::STATUS_REQUESTING); +// break; +// +// // Already have a request out -- don't bother sending another one +// // Repeat sending won't make a difference, as it'll be behind a load balancer +// case LLGroupMgrGroupData::STATUS_REQUESTING: +// // Maybe here we call populate ban list as well, and see about how many +// // more names we need to complete the ban list +// break; +// +// // See if the list needs updating -- if we call update, but nothing changed, +// // there's no reason to send another request. +// // [NOTHING CHANGED] - Do Nothing! +// // [SOMETHING CHANGED] - Don't panic! Just repopulate the ban list! +// case LLGroupMgrGroupData::STATUS_COMPLETE: +// populateBanList(); +// break; +// } +// - // Already have a request out -- don't bother sending another one - // Repeat sending won't make a difference, as it'll be behind a load balancer - case LLGroupMgrGroupData::STATUS_REQUESTING: - break; - - // See if the list needs updating -- if we call update, but nothing changed, - // there's no reason to send another request. - // [NOTHING CHANGED] - Do Nothing! - // [SOMETHING CHANGED] - Don't panic! Just repopulate the ban list! - case LLGroupMgrGroupData::STATUS_COMPLETE: - populateBanList(); - break; - } + } void LLPanelGroupBanListSubTab::draw() { LLPanelGroupSubTab::draw(); - // if(mPendingBanUpdate) + //if(mPendingBanUpdate) // populateBanList(); } -void LLPanelGroupBanListSubTab::populateBanList() -{ - LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); - if(!gdatap) - { - LL_INFOS("BAKER") << "[BAKER] No group data!" << LL_ENDL; - return; - } - - if(gdatap->getGroupBanStatus() != LLGroupMgrGroupData::STATUS_COMPLETE) - return; - - mBanList->deleteAllItems(); - std::map::const_iterator entry = gdatap->mBanList.begin(); - for(; entry != gdatap->mBanList.end(); entry++) - { - LLNameListCtrl::NameItem ban_entry; - ban_entry.value = entry->first; - mBanList->addNameItemRow(ban_entry); - } -} - void LLPanelGroupBanListSubTab::onBanEntrySelect(LLUICtrl* ctrl, void* user_data) { @@ -3035,10 +3017,59 @@ void LLPanelGroupBanListSubTab::handleDeleteBanEntry() } -void LLPanelGroupBanListSubTab::setGroupID(const LLUUID& id) +void LLPanelGroupBanListSubTab::onRefreshBanList(void* user_data) { - LL_INFOS("BAKER") << "[BAKER] LLPanelGroupBanListSubTab::setGroupID()" << LL_ENDL; + LL_INFOS("BAKER") << "[BAKER] LLPanelGroupBanListSubTab::onRefreshBanList()" << LL_ENDL; + + LLPanelGroupBanListSubTab* self = static_cast(user_data); + if (!self) + return; + + self->handleRefreshBanList(); +} + +void LLPanelGroupBanListSubTab::handleRefreshBanList() +{ + LL_INFOS("BAKER") << "[BAKER] LLPanelGroupBanListSubTab::handleRefreshBanList()" << LL_ENDL; + mRefreshBanListButton->setEnabled(FALSE); + LLGroupMgr::getInstance()->sendGroupBanRequest(LLGroupMgr::REQUEST_GET, mGroupID); +} + + +void LLPanelGroupBanListSubTab::onBanListCompleted(bool isComplete) +{ + if(isComplete) + { + mRefreshBanListButton->setEnabled(TRUE); + populateBanList(); + } +} + +void LLPanelGroupBanListSubTab::populateBanList() +{ + LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); + if(!gdatap) + { + LL_INFOS("BAKER") << "[BAKER] No group data!" << LL_ENDL; + return; + } + + mBanList->deleteAllItems(); + std::map::const_iterator entry = gdatap->mBanList.begin(); + for(; entry != gdatap->mBanList.end(); entry++) + { + LLNameListCtrl::NameItem ban_entry; + ban_entry.value = entry->first; + mBanList->addNameItemRow(ban_entry); + } + + mRefreshBanListButton->setEnabled(TRUE); +} + + +void LLPanelGroupBanListSubTab::setGroupID(const LLUUID& id) +{ if(mBanList) mBanList->deleteAllItems(); @@ -3050,3 +3081,5 @@ void LLPanelGroupBanListSubTab::setGroupID(const LLUUID& id) + + diff --git a/indra/newview/llpanelgrouproles.h b/indra/newview/llpanelgrouproles.h index 01c1d8c16d..2f37805f48 100755 --- a/indra/newview/llpanelgrouproles.h +++ b/indra/newview/llpanelgrouproles.h @@ -335,7 +335,6 @@ public: // Triggered when group information changes in the group manager. virtual void update(LLGroupChange gc); - // virtual void draw(); static void onBanEntrySelect(LLUICtrl* ctrl, void* user_data); @@ -349,18 +348,24 @@ public: static void onDeleteBanEntry(void* user_data); void handleDeleteBanEntry(); - - virtual void setGroupID(const LLUUID& id); + + static void onRefreshBanList(void* user_data); + void handleRefreshBanList(); + + void onBanListCompleted(bool isComplete); protected: void populateBanList(); +public: + virtual void setGroupID(const LLUUID& id); protected: LLNameListCtrl* mBanList; LLButton* mCreateBanButton; LLButton* mDeleteBanButton; - + LLButton* mRefreshBanListButton; + }; #endif // LL_LLPANELGROUPROLES_H diff --git a/indra/newview/skins/default/xui/en/panel_group_roles.xml b/indra/newview/skins/default/xui/en/panel_group_roles.xml index 9817f70ac7..70d19de848 100755 --- a/indra/newview/skins/default/xui/en/panel_group_roles.xml +++ b/indra/newview/skins/default/xui/en/panel_group_roles.xml @@ -7,132 +7,132 @@ top="0" name="roles_tab" width="304"> - - There are unsaved changes - - - Do you want to save your changes? - - - + There are unsaved changes + + + Do you want to save your changes? + + + + - - - You can add or remove Roles assigned to Members. -Select multiple Members by holding the Ctrl key and -clicking on their names. - - - [AREA] m² - - - Inv_FolderClosed - - - Checkbox_On - - - Checkbox_Off - - - - - - - -