diff options
author | Tofu Linden <tofu.linden@lindenlab.com> | 2010-02-23 16:37:13 +0000 |
---|---|---|
committer | Tofu Linden <tofu.linden@lindenlab.com> | 2010-02-23 16:37:13 +0000 |
commit | e06c96d7e753536981ba8175148a9b1527e0f100 (patch) | |
tree | 57a3a0fd985343c4b143ec42407313ba03a6c454 /indra | |
parent | 01ad8456a2566d258124677e0c7ce5eaa5003569 (diff) | |
parent | 8bf9bc2dc7e7af3e229ba6c02bdabdf1aa82ba71 (diff) |
PE merge.
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llui/llscrolllistctrl.cpp | 26 | ||||
-rw-r--r-- | indra/llui/llscrolllistctrl.h | 35 | ||||
-rw-r--r-- | indra/newview/llgroupmgr.cpp | 3 | ||||
-rw-r--r-- | indra/newview/lllocationinputctrl.cpp | 26 | ||||
-rw-r--r-- | indra/newview/llpanelavatar.cpp | 16 | ||||
-rw-r--r-- | indra/newview/llpanelavatar.h | 2 | ||||
-rw-r--r-- | indra/newview/llpanelgroupgeneral.cpp | 16 | ||||
-rw-r--r-- | indra/newview/llpanelgroupgeneral.h | 3 | ||||
-rw-r--r-- | indra/newview/llstartup.cpp | 1 |
9 files changed, 89 insertions, 39 deletions
diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index ac4811210b..77caaaa425 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -71,8 +71,9 @@ static LLDefaultChildRegistry::Register<LLScrollListCtrl> r("scroll_list"); // local structures & classes. struct SortScrollListItem { - SortScrollListItem(const std::vector<std::pair<S32, BOOL> >& sort_orders) + SortScrollListItem(const std::vector<std::pair<S32, BOOL> >& sort_orders,const LLScrollListCtrl::sort_signal_t* sort_signal) : mSortOrders(sort_orders) + , mSortSignal(sort_signal) {} bool operator()(const LLScrollListItem* i1, const LLScrollListItem* i2) @@ -85,12 +86,20 @@ struct SortScrollListItem S32 col_idx = it->first; BOOL sort_ascending = it->second; + S32 order = sort_ascending ? 1 : -1; // ascending or descending sort for this column? + const LLScrollListCell *cell1 = i1->getColumn(col_idx); const LLScrollListCell *cell2 = i2->getColumn(col_idx); - S32 order = sort_ascending ? 1 : -1; // ascending or descending sort for this column? if (cell1 && cell2) { - sort_result = order * LLStringUtil::compareDict(cell1->getValue().asString(), cell2->getValue().asString()); + if(mSortSignal) + { + sort_result = order * (*mSortSignal)(col_idx,i1, i2); + } + else + { + sort_result = order * LLStringUtil::compareDict(cell1->getValue().asString(), cell2->getValue().asString()); + } if (sort_result != 0) { break; // we have a sort order! @@ -100,8 +109,10 @@ struct SortScrollListItem return sort_result < 0; } + typedef std::vector<std::pair<S32, BOOL> > sort_order_t; + const LLScrollListCtrl::sort_signal_t* mSortSignal; const sort_order_t& mSortOrders; }; @@ -169,6 +180,7 @@ LLScrollListCtrl::LLScrollListCtrl(const LLScrollListCtrl::Params& p) mOnSortChangedCallback( NULL ), mHighlightedItem(-1), mBorder(NULL), + mSortCallback(NULL), mPopupMenu(NULL), mNumDynamicWidthColumns(0), mTotalStaticColumnWidth(0), @@ -309,6 +321,8 @@ bool LLScrollListCtrl::preProcessChildNode(LLXMLNodePtr child) LLScrollListCtrl::~LLScrollListCtrl() { + delete mSortCallback; + std::for_each(mItemList.begin(), mItemList.end(), DeletePointer()); if( gEditMenuHandler == this ) @@ -540,7 +554,7 @@ BOOL LLScrollListCtrl::addItem( LLScrollListItem* item, EAddPosition pos, BOOL r std::stable_sort( mItemList.begin(), mItemList.end(), - SortScrollListItem(single_sort_column)); + SortScrollListItem(single_sort_column,mSortCallback)); // ADD_SORTED just sorts by first column... // this might not match user sort criteria, so flag list as being in unsorted state @@ -2395,7 +2409,7 @@ void LLScrollListCtrl::updateSort() const std::stable_sort( mItemList.begin(), mItemList.end(), - SortScrollListItem(mSortColumns)); + SortScrollListItem(mSortColumns,mSortCallback)); mSorted = true; } @@ -2411,7 +2425,7 @@ void LLScrollListCtrl::sortOnce(S32 column, BOOL ascending) std::stable_sort( mItemList.begin(), mItemList.end(), - SortScrollListItem(sort_column)); + SortScrollListItem(sort_column,mSortCallback)); } void LLScrollListCtrl::dirtyColumns() diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h index d2d2379328..bfff85315d 100644 --- a/indra/llui/llscrolllistctrl.h +++ b/indra/llui/llscrolllistctrl.h @@ -73,6 +73,32 @@ public: // *TODO: Add callbacks to Params typedef boost::function<void (void)> callback_t; + + template<typename T> struct maximum
+ {
+ typedef T result_type;
+
+ template<typename InputIterator>
+ T operator()(InputIterator first, InputIterator last) const
+ {
+ // If there are no slots to call, just return the
+ // default-constructed value
+ if(first == last ) return T();
+ T max_value = *first++;
+ while (first != last) {
+ if (max_value < *first)
+ max_value = *first;
+ ++first;
+ }
+
+ return max_value;
+ }
+ };
+ + + //typedef boost::signals2::signal<void (S32,const LLScrollListItem*,const LLScrollListItem*),maximum<S32>> sort_signal_t; + //typedef boost::signals2::signal<void (S32,const LLScrollListItem*,const LLScrollListItem*)> sort_signal_t; + typedef boost::signals2::signal<S32 (S32,const LLScrollListItem*,const LLScrollListItem*),maximum<S32>> sort_signal_t; struct Params : public LLInitParam::Block<Params, LLUICtrl::Params> { @@ -362,6 +388,13 @@ public: void setNeedsSort(bool val = true) { mSorted = !val; } void dirtyColumns(); // some operation has potentially affected column layout or ordering + boost::signals2::connection setSortCallback(sort_signal_t::slot_type cb ) + { + if (!mSortCallback) mSortCallback = new sort_signal_t(); + return mSortCallback->connect(cb); + } + + protected: // "Full" interface: use this when you're creating a list that has one or more of the following: // * contains icons @@ -474,6 +507,8 @@ private: typedef std::pair<S32, BOOL> sort_column_t; std::vector<sort_column_t> mSortColumns; + + sort_signal_t* mSortCallback; }; // end class LLScrollListCtrl #endif // LL_SCROLLLISTCTRL_H diff --git a/indra/newview/llgroupmgr.cpp b/indra/newview/llgroupmgr.cpp index 6e7321f739..ea5462a3e3 100644 --- a/indra/newview/llgroupmgr.cpp +++ b/indra/newview/llgroupmgr.cpp @@ -838,7 +838,8 @@ static void formatDateString(std::string &date_string) std::string day = result[2]; // ISO 8601 date format - date_string = llformat("%02s/%02s/%04s", month.c_str(), day.c_str(), year.c_str()); + //date_string = llformat("%02s/%02s/%04s", month.c_str(), day.c_str(), year.c_str()); + date_string = llformat("%04s/%02s/%04s", year.c_str(), month.c_str(), day.c_str()); } } diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp index a9ead36a70..f8f9ea7379 100644 --- a/indra/newview/lllocationinputctrl.cpp +++ b/indra/newview/lllocationinputctrl.cpp @@ -788,15 +788,19 @@ void LLLocationInputCtrl::refreshParcelIcons() // Our "cursor" moving right to left S32 x = mAddLandmarkBtn->getRect().mLeft; - if (gSavedSettings.getBOOL("NavBarShowParcelProperties")) - { - LLViewerParcelMgr* vpm = LLViewerParcelMgr::getInstance(); + LLViewerParcelMgr* vpm = LLViewerParcelMgr::getInstance(); + + LLViewerRegion* agent_region = gAgent.getRegion(); + LLParcel* agent_parcel = vpm->getAgentParcel(); + if (!agent_region || !agent_parcel) + return; + + mForSaleBtn->setVisible(vpm->canAgentBuyParcel(agent_parcel, false)); - LLViewerRegion* agent_region = gAgent.getRegion(); - LLParcel* agent_parcel = vpm->getAgentParcel(); - if (!agent_region || !agent_parcel) - return; + x = layout_widget(mForSaleBtn, x); + if (gSavedSettings.getBOOL("NavBarShowParcelProperties")) + { LLParcel* current_parcel; LLViewerRegion* selection_region = vpm->getSelectionRegion(); LLParcel* selected_parcel = vpm->getParcelSelection()->getParcel(); @@ -816,7 +820,6 @@ void LLLocationInputCtrl::refreshParcelIcons() current_parcel = agent_parcel; } - bool allow_buy = vpm->canAgentBuyParcel(current_parcel, false); bool allow_voice = vpm->allowAgentVoice(agent_region, current_parcel); bool allow_fly = vpm->allowAgentFly(agent_region, current_parcel); bool allow_push = vpm->allowAgentPush(agent_region, current_parcel); @@ -825,7 +828,6 @@ void LLLocationInputCtrl::refreshParcelIcons() bool allow_damage = vpm->allowAgentDamage(agent_region, current_parcel); // Most icons are "block this ability" - mForSaleBtn->setVisible(allow_buy); mParcelIcon[VOICE_ICON]->setVisible( !allow_voice ); mParcelIcon[FLY_ICON]->setVisible( !allow_fly ); mParcelIcon[PUSH_ICON]->setVisible( !allow_push ); @@ -833,11 +835,10 @@ void LLLocationInputCtrl::refreshParcelIcons() mParcelIcon[SCRIPTS_ICON]->setVisible( !allow_scripts ); mParcelIcon[DAMAGE_ICON]->setVisible( allow_damage ); mDamageText->setVisible(allow_damage); - - x = layout_widget(mForSaleBtn, x); + // Padding goes to left of both landmark star and for sale btn x -= mAddLandmarkHPad; - + // Slide the parcel icons rect from right to left, adjusting rectangles for (S32 i = 0; i < ICON_COUNT; ++i) { @@ -849,7 +850,6 @@ void LLLocationInputCtrl::refreshParcelIcons() } else { - mForSaleBtn->setVisible(false); for (S32 i = 0; i < ICON_COUNT; ++i) { mParcelIcon[i]->setVisible(false); diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp index b61d3ef371..57b478ffef 100644 --- a/indra/newview/llpanelavatar.cpp +++ b/indra/newview/llpanelavatar.cpp @@ -47,7 +47,6 @@ #include "lltooldraganddrop.h" #include "llscrollcontainer.h" #include "llavatariconctrl.h" -#include "llweb.h" #include "llfloaterreg.h" #include "llnotificationsutil.h" #include "llvoiceclient.h" @@ -486,7 +485,6 @@ LLPanelAvatarProfile::LLPanelAvatarProfile() BOOL LLPanelAvatarProfile::postBuild() { - childSetActionTextbox("homepage_edit", boost::bind(&LLPanelAvatarProfile::onHomepageTextboxClicked, this)); childSetCommitCallback("add_friend",(boost::bind(&LLPanelAvatarProfile::onAddFriendButtonClick,this)),NULL); childSetCommitCallback("im",(boost::bind(&LLPanelAvatarProfile::onIMButtonClick,this)),NULL); childSetCommitCallback("call",(boost::bind(&LLPanelAvatarProfile::onCallButtonClick,this)),NULL); @@ -732,20 +730,6 @@ void LLPanelAvatarProfile::csr() LLAvatarActions::csr(getAvatarId(), name); } -void LLPanelAvatarProfile::onUrlTextboxClicked(const std::string& url) -{ - LLWeb::loadURL(url); -} - -void LLPanelAvatarProfile::onHomepageTextboxClicked() -{ - std::string url = childGetValue("homepage_edit").asString(); - if(!url.empty()) - { - onUrlTextboxClicked(url); - } -} - void LLPanelAvatarProfile::onAddFriendButtonClick() { LLAvatarActions::requestFriendshipDialog(getAvatarId()); diff --git a/indra/newview/llpanelavatar.h b/indra/newview/llpanelavatar.h index babbe534b4..2bd23b6e9c 100644 --- a/indra/newview/llpanelavatar.h +++ b/indra/newview/llpanelavatar.h @@ -207,8 +207,6 @@ protected: bool enableGod(); - void onUrlTextboxClicked(const std::string& url); - void onHomepageTextboxClicked(); void onAddFriendButtonClick(); void onIMButtonClick(); void onCallButtonClick(); diff --git a/indra/newview/llpanelgroupgeneral.cpp b/indra/newview/llpanelgroupgeneral.cpp index 555e277ce5..517204b232 100644 --- a/indra/newview/llpanelgroupgeneral.cpp +++ b/indra/newview/llpanelgroupgeneral.cpp @@ -111,6 +111,8 @@ BOOL LLPanelGroupGeneral::postBuild() { mListVisibleMembers->setDoubleClickCallback(openProfile, this); mListVisibleMembers->setContextMenu(LLScrollListCtrl::MENU_AVATAR); + + mListVisibleMembers->setSortCallback(boost::bind(&LLPanelGroupGeneral::sortMembersList,this,_1,_2,_3)); } // Options @@ -944,4 +946,18 @@ void LLPanelGroupGeneral::setGroupID(const LLUUID& id) activate(); } +S32 LLPanelGroupGeneral::sortMembersList(S32 col_idx,const LLScrollListItem* i1,const LLScrollListItem* i2) +{ + const LLScrollListCell *cell1 = i1->getColumn(col_idx); + const LLScrollListCell *cell2 = i2->getColumn(col_idx); + + if(col_idx == 2) + { + if(LLStringUtil::compareDict(cell1->getValue().asString(),"Online") == 0 ) + return 1; + if(LLStringUtil::compareDict(cell2->getValue().asString(),"Online") == 0 ) + return -1; + } + return LLStringUtil::compareDict(cell1->getValue().asString(), cell2->getValue().asString()); +} diff --git a/indra/newview/llpanelgroupgeneral.h b/indra/newview/llpanelgroupgeneral.h index 7e90e43cf9..cc3101539a 100644 --- a/indra/newview/llpanelgroupgeneral.h +++ b/indra/newview/llpanelgroupgeneral.h @@ -83,6 +83,9 @@ private: static void onReceiveNotices(LLUICtrl* ctrl, void* data); static void openProfile(void* data); + S32 sortMembersList(S32,const LLScrollListItem*,const LLScrollListItem*); + //void sortMembersList(S32 column); + static bool joinDlgCB(const LLSD& notification, const LLSD& response); void updateMembers(); diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 83f773fadc..025dd6029a 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -121,7 +121,6 @@ #include "lllogininstance.h" // Host the login module. #include "llpanellogin.h" #include "llmutelist.h" -#include "llpanelavatar.h" #include "llavatarpropertiesprocessor.h" #include "llfloaterevent.h" #include "llpanelclassified.h" |