diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llcommon/lldate.cpp | 31 | ||||
-rw-r--r-- | indra/llcommon/lldate.h | 1 | ||||
-rw-r--r-- | indra/llui/lltabcontainer.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llpanelteleporthistory.cpp | 173 | ||||
-rw-r--r-- | indra/newview/llpanelteleporthistory.h | 17 | ||||
-rw-r--r-- | indra/newview/lltoastimpanel.cpp | 14 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_teleport_history.xml | 162 |
7 files changed, 345 insertions, 55 deletions
diff --git a/indra/llcommon/lldate.cpp b/indra/llcommon/lldate.cpp index 41150ad057..7c0ac6c554 100644 --- a/indra/llcommon/lldate.cpp +++ b/indra/llcommon/lldate.cpp @@ -155,6 +155,37 @@ void LLDate::toStream(std::ostream& s) const s << 'Z'; } +bool LLDate::split(S32 *year, S32 *month, S32 *day, S32 *hour, S32 *min, S32 *sec) const +{ + apr_time_t time = (apr_time_t)(mSecondsSinceEpoch * LL_APR_USEC_PER_SEC); + + apr_time_exp_t exp_time; + if (apr_time_exp_gmt(&exp_time, time) != APR_SUCCESS) + { + return false; + } + + if (year) + *year = exp_time.tm_year + 1900; + + if (month) + *month = exp_time.tm_mon + 1; + + if (day) + *day = exp_time.tm_mday; + + if (hour) + *hour = exp_time.tm_hour; + + if (min) + *min = exp_time.tm_min; + + if (sec) + *sec = exp_time.tm_sec; + + return true; +} + bool LLDate::fromString(const std::string& iso8601_date) { std::istringstream stream(iso8601_date); diff --git a/indra/llcommon/lldate.h b/indra/llcommon/lldate.h index 9dcce9117f..38c4c8cb60 100644 --- a/indra/llcommon/lldate.h +++ b/indra/llcommon/lldate.h @@ -84,6 +84,7 @@ public: std::string asString() const; std::string asRFC1123() const; void toStream(std::ostream&) const; + bool split(S32 *year, S32 *month = NULL, S32 *day = NULL, S32 *hour = NULL, S32 *min = NULL, S32 *sec = NULL) const; std::string toHTTPDateString (std::string fmt) const; static std::string toHTTPDateString (tm * gmt, std::string fmt); /** diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index 3a13c91fac..720ca692f7 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -306,7 +306,7 @@ void LLTabContainer::draw() setScrollPosPixels((S32)lerp((F32)getScrollPosPixels(), (F32)target_pixel_scroll, LLCriticalDamp::getInterpolant(0.08f))); - BOOL has_scroll_arrows = (mMaxScrollPos > 0) || (mScrollPosPixels > 0); + BOOL has_scroll_arrows = !getTabsHidden() && ((mMaxScrollPos > 0) || (mScrollPosPixels > 0)); if (!mIsVertical) { mJumpPrevArrowBtn->setVisible( has_scroll_arrows ); diff --git a/indra/newview/llpanelteleporthistory.cpp b/indra/newview/llpanelteleporthistory.cpp index df48ee5d08..1fd7928bfc 100644 --- a/indra/newview/llpanelteleporthistory.cpp +++ b/indra/newview/llpanelteleporthistory.cpp @@ -38,6 +38,8 @@ #include "llsidetray.h" #include "llworldmap.h" #include "llteleporthistorystorage.h" +#include "llaccordionctrl.h" +#include "llaccordionctrltab.h" // Not yet implemented; need to remove buildPanel() from constructor when we switch //static LLRegisterPanelClassWrapper<LLTeleportHistoryPanel> t_teleport_history("panel_teleport_history"); @@ -46,7 +48,8 @@ LLTeleportHistoryPanel::LLTeleportHistoryPanel() : LLPanelPlacesTab(), mFilterSubString(LLStringUtil::null), mTeleportHistory(NULL), - mHistoryItems(NULL) + mHistoryAccordeon(NULL), + mLastSelectedScrollList(NULL) { LLUICtrlFactory::getInstance()->buildPanel(this, "panel_teleport_history.xml"); } @@ -63,12 +66,28 @@ BOOL LLTeleportHistoryPanel::postBuild() mTeleportHistory->setHistoryChangedCallback(boost::bind(&LLTeleportHistoryPanel::showTeleportHistory, this)); } - mHistoryItems = getChild<LLScrollListCtrl>("history_items"); - if (mHistoryItems) + mHistoryAccordeon = getChild<LLAccordionCtrl>("history_accordion"); + + if (mHistoryAccordeon) { - mHistoryItems->setDoubleClickCallback(onDoubleClickItem, this); - mHistoryItems->setCommitOnSelectionChange(FALSE); - mHistoryItems->setCommitCallback(boost::bind(&LLTeleportHistoryPanel::handleItemSelect, this, _2)); + + for (child_list_const_iter_t iter = mHistoryAccordeon->beginChild(); iter != mHistoryAccordeon->endChild(); iter++) + { + if (dynamic_cast<LLAccordionCtrlTab*>(*iter)) + { + LLAccordionCtrlTab* tab = (LLAccordionCtrlTab*)*iter; + mItemContainers.put(tab); + + LLScrollListCtrl* sl = getScrollListFromTab(tab); + if (sl) + { + sl->setDoubleClickCallback(onDoubleClickItem, this); + sl->setCommitOnSelectionChange(FALSE); + sl->setCommitCallback(boost::bind(&LLTeleportHistoryPanel::handleItemSelect, this, sl)); + } + + } + } } return TRUE; @@ -87,13 +106,16 @@ void LLTeleportHistoryPanel::onSearchEdit(const std::string& string) // virtual void LLTeleportHistoryPanel::onShowOnMap() { - LLScrollListItem* itemp = mHistoryItems->getFirstSelected(); + if (!mLastSelectedScrollList) + return; + + LLScrollListItem* itemp = mLastSelectedScrollList->getFirstSelected(); if(!itemp) return; S32 index = itemp->getColumn(LIST_INDEX)->getValue().asInteger(); - LLVector3d global_pos = mTeleportHistory->getItems()[index].mGlobalPos; + LLVector3d global_pos = mTeleportHistory->getItems()[mTeleportHistory->getItems().size() - 1 - index].mGlobalPos; if (!global_pos.isExactlyZero()) { @@ -105,14 +127,17 @@ void LLTeleportHistoryPanel::onShowOnMap() // virtual void LLTeleportHistoryPanel::onTeleport() { - LLScrollListItem* itemp = mHistoryItems->getFirstSelected(); + if (!mLastSelectedScrollList) + return; + + LLScrollListItem* itemp = mLastSelectedScrollList->getFirstSelected(); if(!itemp) return; S32 index = itemp->getColumn(LIST_INDEX)->getValue().asInteger(); // teleport to existing item in history, so we don't add it again - mTeleportHistory->goToItem(index); + mTeleportHistory->goToItem(mTeleportHistory->getItems().size() - 1 - index); } /* @@ -145,28 +170,41 @@ void LLTeleportHistoryPanel::updateVerbs() if (!isTabVisible()) return; - S32 index = 0; - S32 cur_item = 0; - - LLScrollListItem* itemp = mHistoryItems->getFirstSelected(); - if (itemp) + if (!mLastSelectedScrollList) { - index = itemp->getColumn(LIST_INDEX)->getValue().asInteger(); - cur_item = mTeleportHistory->getItems().size() - 1; + mTeleportBtn->setEnabled(false); + mShowOnMapBtn->setEnabled(false); + return; } - mTeleportBtn->setEnabled(index != cur_item); - mShowOnMapBtn->setEnabled(itemp != NULL); + LLScrollListItem* itemp = mLastSelectedScrollList->getFirstSelected(); + + mTeleportBtn->setEnabled(NULL != itemp && 0 < itemp->getColumn(LIST_INDEX)->getValue().asInteger()); + mShowOnMapBtn->setEnabled(NULL != itemp); } void LLTeleportHistoryPanel::showTeleportHistory() { + if (!mHistoryAccordeon) + return; + const LLTeleportHistoryStorage::slurl_list_t& hist_items = mTeleportHistory->getItems(); - mHistoryItems->deleteAllItems(); + const U32 seconds_in_day = 24 * 60 * 60; + LLDate curr_date = LLDate::now(); + + curr_date.secondsSinceEpoch(curr_date.secondsSinceEpoch() + seconds_in_day); + + S32 curr_tab = -1; + S32 tabs_cnt = mItemContainers.size(); + S32 curr_year = 0, curr_month = 0, curr_day = 0; + + LLScrollListCtrl *curr_scroll_list = NULL; - for (LLTeleportHistoryStorage::slurl_list_t::const_iterator iter = hist_items.begin(); - iter != hist_items.end(); ++iter) + S32 index = 0; + + for (LLTeleportHistoryStorage::slurl_list_t::const_reverse_iterator iter = hist_items.rbegin(); + iter != hist_items.rend(); ++iter) { std::string landmark_title = (*iter).mTitle; LLStringUtil::toUpper(landmark_title); @@ -176,45 +214,83 @@ void LLTeleportHistoryPanel::showTeleportHistory() if (!passed) continue; + + if (curr_tab < tabs_cnt - 1) + { + const LLDate &date = (*iter).mDate; + + S32 year, month, day; + if (!date.split(&year, &month, &day)) + { + llwarns << "Failed to split date: " << date << llendl; + continue; + } + + if (day != curr_day || month != curr_month || year != curr_year) + { + LLAccordionCtrlTab* tab = NULL; + while (curr_tab < tabs_cnt - 1 && (day != curr_day || month != curr_month || year != curr_year)) + { + curr_tab++; + + tab = mItemContainers.get(mItemContainers.size() - 1 - curr_tab); + tab->setVisible(false); + + curr_date.secondsSinceEpoch(curr_date.secondsSinceEpoch() - seconds_in_day); + curr_date.split(&curr_year, &curr_month, &curr_day); + } + + tab->setVisible(true); + + curr_scroll_list = getScrollListFromTab(tab); + if (curr_scroll_list) + { + curr_scroll_list->deleteAllItems(); + } + } + } - S32 index = iter - hist_items.begin(); LLSD row; row["id"] = index; - LLSD& icon_column = row["columns"][LIST_ICON]; - icon_column["column"] = "landmark_icon"; - icon_column["type"] = "icon"; - icon_column["value"] = "inv_item_landmark.tga"; + if (curr_scroll_list) + { + LLSD& icon_column = row["columns"][LIST_ICON]; + icon_column["column"] = "landmark_icon"; + icon_column["type"] = "icon"; + icon_column["value"] = "inv_item_landmark.tga"; + + LLSD& region_column = row["columns"][LIST_ITEM_TITLE]; + region_column["column"] = "region"; + region_column["type"] = "text"; + region_column["value"] = (*iter).mTitle; - LLSD& region_column = row["columns"][LIST_ITEM_TITLE]; - region_column["column"] = "region"; - region_column["type"] = "text"; - region_column["value"] = (*iter).mTitle; + LLSD& index_column = row["columns"][LIST_INDEX]; + index_column["column"] = "index"; + index_column["type"] = "text"; + index_column["value"] = index; - LLSD& index_column = row["columns"][LIST_INDEX]; - index_column["column"] = "index"; - index_column["type"] = "text"; - index_column["value"] = index; + index++; - mHistoryItems->addElement(row, ADD_TOP); + curr_scroll_list->addElement(row); + } } - // Consider last item (most recent) as current - LLScrollListItem* itemp = mHistoryItems->getItem((S32)hist_items.size() - 1); - ((LLScrollListText*)itemp->getColumn(LIST_ITEM_TITLE))->setFontStyle(LLFontGL::BOLD); + mHistoryAccordeon->arrange(); updateVerbs(); } -void LLTeleportHistoryPanel::handleItemSelect(const LLSD& data) +void LLTeleportHistoryPanel::handleItemSelect(LLScrollListCtrl* sl) { + mLastSelectedScrollList = sl; updateVerbs(); } //static void LLTeleportHistoryPanel::onDoubleClickItem(void* user_data) { - LLTeleportHistoryPanel* self = (LLTeleportHistoryPanel*)user_data; + /*LLTeleportHistoryPanel* self = (LLTeleportHistoryPanel*)user_data; LLScrollListItem* itemp = self->mHistoryItems->getFirstSelected(); if(!itemp) @@ -224,5 +300,18 @@ void LLTeleportHistoryPanel::onDoubleClickItem(void* user_data) key["type"] = "teleport_history"; key["id"] = itemp->getColumn(LIST_INDEX)->getValue().asInteger(); - LLSideTray::getInstance()->showPanel("panel_places", key); + LLSideTray::getInstance()->showPanel("panel_places", key);*/ +} + +LLScrollListCtrl* LLTeleportHistoryPanel::getScrollListFromTab(LLAccordionCtrlTab *tab) +{ + for (child_list_const_iter_t iter = tab->beginChild(); iter != tab->endChild(); iter++) + { + if (dynamic_cast<LLScrollListCtrl*>(*iter)) + { + return (LLScrollListCtrl*)*iter; // There should be one scroll list per tab. + } + } + + return NULL; } diff --git a/indra/newview/llpanelteleporthistory.h b/indra/newview/llpanelteleporthistory.h index 023b04c3fa..a1c15d087b 100644 --- a/indra/newview/llpanelteleporthistory.h +++ b/indra/newview/llpanelteleporthistory.h @@ -40,6 +40,8 @@ #include "llteleporthistory.h" class LLTeleportHistoryStorage; +class LLAccordionCtrl; +class LLAccordionCtrlTab; class LLTeleportHistoryPanel : public LLPanelPlacesTab { @@ -53,13 +55,14 @@ public: /*virtual*/ void onTeleport(); ///*virtual*/ void onCopySLURL(); /*virtual*/ void updateVerbs(); - - void showTeleportHistory(); - void handleItemSelect(const LLSD& data); + +private: static void onDoubleClickItem(void* user_data); + void showTeleportHistory(); + void handleItemSelect(LLScrollListCtrl* ); + LLScrollListCtrl* getScrollListFromTab(LLAccordionCtrlTab *); -private: enum TELEPORT_HISTORY_COLUMN_ORDER { LIST_ICON, @@ -68,8 +71,12 @@ private: }; LLTeleportHistoryStorage* mTeleportHistory; - LLScrollListCtrl* mHistoryItems; + LLAccordionCtrl* mHistoryAccordeon; + LLScrollListCtrl* mLastSelectedScrollList; std::string mFilterSubString; + + typedef LLDynamicArray<LLAccordionCtrlTab*> item_containers_t; + item_containers_t mItemContainers; }; #endif //LL_LLPANELTELEPORTHISTORY_H diff --git a/indra/newview/lltoastimpanel.cpp b/indra/newview/lltoastimpanel.cpp index 15d54d8b3b..d401943020 100644 --- a/indra/newview/lltoastimpanel.cpp +++ b/indra/newview/lltoastimpanel.cpp @@ -57,7 +57,19 @@ LLToastIMPanel::LLToastIMPanel(LLToastIMPanel::Params &p) : LLToastPanel(p.notif mSessionID = p.session_id; mNotification = p.notification; - mReplyBtn->setClickedCallback(boost::bind(&LLToastIMPanel::onClickReplyBtn, this)); + // if message comes from the system - there shouldn't be a reply btn + if(p.from == "Second Life") + { + mReplyBtn->setVisible(FALSE); + S32 btn_height = mReplyBtn->getRect().getHeight(); + LLRect msg_rect = mMessage->getRect(); + msg_rect.setLeftTopAndSize(msg_rect.mLeft, msg_rect.mTop, msg_rect.getWidth(), msg_rect.getHeight() + btn_height); + mMessage->setRect(msg_rect); + } + else + { + mReplyBtn->setClickedCallback(boost::bind(&LLToastIMPanel::onClickReplyBtn, this)); + } S32 maxLinesCount; std::istringstream ss( getString("message_max_lines_count") ); diff --git a/indra/newview/skins/default/xui/en/panel_teleport_history.xml b/indra/newview/skins/default/xui/en/panel_teleport_history.xml index 82d6945e0f..70198dc626 100644 --- a/indra/newview/skins/default/xui/en/panel_teleport_history.xml +++ b/indra/newview/skins/default/xui/en/panel_teleport_history.xml @@ -1,12 +1,162 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <panel name="Teleport History" bottom="0" height="326" left="0" width="380" - border="true" follows="left|top|right|bottom"> - <scroll_list bottom="0" column_padding="0" draw_heading="false" - draw_stripes="false" follows="left|top|bottom|right" left="0" - multi_select="false" name="history_items" search_column="1" - sort_column="1" height="326" width="380" > + border="true" follows="left|top|right|bottom"> + <accordion + follows="left|top|right|bottom" + height="326" + layout="topleft" + left="0" + top="0" + name="history_accordion" + width="380"> + + <accordion_tab + can_resize="false" + layout="topleft" + min_height="100" + name="today" + title="Today"> + <scroll_list + draw_heading="false" + follows="all" + height="150" + layout="topleft" + left="0" + name="today_items" + top="0" + width="285"> <column name="landmark_icon" width="20" /> <column dynamic_width="true" label="Region" name="region" /> <column name="index" width="0" /> - </scroll_list> + </scroll_list> + </accordion_tab> + + <accordion_tab + can_resize="false" + layout="topleft" + min_height="100" + name="yesterday" + title="Yesterday"> + <scroll_list + draw_heading="false" + follows="all" + height="150" + layout="topleft" + left="0" + name="yesterday_items" + top="0" + width="285"> + <column name="landmark_icon" width="20" /> + <column dynamic_width="true" label="Region" name="region" /> + <column name="index" width="0" /> + </scroll_list> + </accordion_tab> + + <accordion_tab + can_resize="false" + layout="topleft" + min_height="100" + name="3_days_ago" + title="3 days ago"> + <scroll_list + draw_heading="false" + follows="all" + height="150" + layout="topleft" + left="0" + name="3_days_ago" + top="0" + width="285"> + <column name="landmark_icon" width="20" /> + <column dynamic_width="true" label="Region" name="region" /> + <column name="index" width="0" /> + </scroll_list> + </accordion_tab> + + <accordion_tab + can_resize="false" + layout="topleft" + min_height="100" + name="4_days_ago" + title="4 days ago"> + <scroll_list + draw_heading="false" + follows="all" + height="150" + layout="topleft" + left="0" + name="4_days_ago" + top="0" + width="285"> + <column name="landmark_icon" width="20" /> + <column dynamic_width="true" label="Region" name="region" /> + <column name="index" width="0" /> + </scroll_list> + </accordion_tab> + + <accordion_tab + can_resize="false" + layout="topleft" + min_height="100" + name="5_days_ago" + title="5 days ago"> + <scroll_list + draw_heading="false" + follows="all" + height="150" + layout="topleft" + left="0" + name="5_days_ago_items" + top="0" + width="285"> + <column name="landmark_icon" width="20" /> + <column dynamic_width="true" label="Region" name="region" /> + <column name="index" width="0" /> + </scroll_list> + </accordion_tab> + + <accordion_tab + can_resize="false" + layout="topleft" + min_height="100" + name="6_days_ago" + title="6 days ago"> + <scroll_list + draw_heading="false" + follows="all" + height="150" + layout="topleft" + left="0" + name="6_days_ago" + top="0" + width="285"> + <column name="landmark_icon" width="20" /> + <column dynamic_width="true" label="Region" name="region" /> + <column name="index" width="0" /> + </scroll_list> + </accordion_tab> + + <accordion_tab + can_resize="false" + layout="topleft" + min_height="100" + name="older_than_6_days" + title="Older than 6 days"> + <scroll_list + draw_heading="false" + follows="all" + height="150" + layout="topleft" + left="0" + name="older_than_6_days_items" + top="0" + width="285"> + <column name="landmark_icon" width="20" /> + <column dynamic_width="true" label="Region" name="region" /> + <column name="index" width="0" /> + </scroll_list> + </accordion_tab> + + </accordion> + </panel> |