diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llfolderviewitem.h | 4 | ||||
-rw-r--r-- | indra/newview/llpanelmarketplaceinbox.cpp | 15 | ||||
-rw-r--r-- | indra/newview/llpanelmarketplaceinboxinventory.cpp | 107 | ||||
-rw-r--r-- | indra/newview/llpanelmarketplaceinboxinventory.h | 36 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/widgets/inbox_folder_view_item.xml | 19 |
5 files changed, 154 insertions, 27 deletions
diff --git a/indra/newview/llfolderviewitem.h b/indra/newview/llfolderviewitem.h index 676eaf825d..a26515821d 100644 --- a/indra/newview/llfolderviewitem.h +++ b/indra/newview/llfolderviewitem.h @@ -556,6 +556,10 @@ public: folders_t::const_iterator getFoldersBegin() const { return mFolders.begin(); } folders_t::const_iterator getFoldersEnd() const { return mFolders.end(); } folders_t::size_type getFoldersCount() const { return mFolders.size(); } + + items_t::const_iterator getItemsBegin() const { return mItems.begin(); } + items_t::const_iterator getItemsEnd() const { return mItems.end(); } + items_t::size_type getItemsCount() const { return mItems.size(); } }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/indra/newview/llpanelmarketplaceinbox.cpp b/indra/newview/llpanelmarketplaceinbox.cpp index ac528947a4..7cb4bbf891 100644 --- a/indra/newview/llpanelmarketplaceinbox.cpp +++ b/indra/newview/llpanelmarketplaceinbox.cpp @@ -151,6 +151,20 @@ U32 LLPanelMarketplaceInbox::getFreshItemCount() const fresh_item_count++; } } + + LLFolderViewFolder::items_t::const_iterator items_it = inbox_folder->getItemsBegin(); + LLFolderViewFolder::items_t::const_iterator items_end = inbox_folder->getItemsEnd(); + + for (; items_it != items_end; ++items_it) + { + const LLFolderViewItem * item_view = *items_it; + const LLInboxFolderViewItem * inbox_item_view = dynamic_cast<const LLInboxFolderViewItem*>(item_view); + + if (inbox_item_view && inbox_item_view->isFresh()) + { + fresh_item_count++; + } + } } } @@ -171,6 +185,7 @@ U32 LLPanelMarketplaceInbox::getTotalItemCount() const if (inbox_folder) { item_count += inbox_folder->getFoldersCount(); + item_count += inbox_folder->getItemsCount(); } } diff --git a/indra/newview/llpanelmarketplaceinboxinventory.cpp b/indra/newview/llpanelmarketplaceinboxinventory.cpp index 2e4bf55d51..b9fb5b8c55 100644 --- a/indra/newview/llpanelmarketplaceinboxinventory.cpp +++ b/indra/newview/llpanelmarketplaceinboxinventory.cpp @@ -45,6 +45,7 @@ static LLDefaultChildRegistry::Register<LLInboxInventoryPanel> r1("inbox_inventory_panel"); static LLDefaultChildRegistry::Register<LLInboxFolderViewFolder> r2("inbox_folder_view_folder"); +static LLDefaultChildRegistry::Register<LLInboxFolderViewItem> r3("inbox_folder_view_item"); // @@ -137,7 +138,7 @@ LLFolderViewFolder * LLInboxInventoryPanel::createFolderViewFolder(LLInvFVBridge LLFolderViewItem * LLInboxInventoryPanel::createFolderViewItem(LLInvFVBridge * bridge) { - LLFolderViewItem::Params params; + LLInboxFolderViewItem::Params params; params.name = bridge->getDisplayName(); params.icon = bridge->getIcon(); @@ -171,10 +172,6 @@ LLInboxFolderViewFolder::LLInboxFolderViewFolder(const Params& p) #endif } -LLInboxFolderViewFolder::~LLInboxFolderViewFolder() -{ -} - // virtual void LLInboxFolderViewFolder::draw() { @@ -190,6 +187,20 @@ void LLInboxFolderViewFolder::draw() LLFolderViewFolder::draw(); } +void LLInboxFolderViewFolder::selectItem() +{ + LLFolderViewFolder::selectItem(); + + deFreshify(); +} + +void LLInboxFolderViewFolder::toggleOpen() +{ + LLFolderViewFolder::toggleOpen(); + + deFreshify(); +} + void LLInboxFolderViewFolder::computeFreshness() { const U32 last_expansion_utc = gSavedPerAccountSettings.getU32("LastInventoryInboxActivity"); @@ -218,20 +229,6 @@ void LLInboxFolderViewFolder::deFreshify() gSavedPerAccountSettings.setU32("LastInventoryInboxActivity", time_corrected()); } -void LLInboxFolderViewFolder::selectItem() -{ - LLFolderViewFolder::selectItem(); - - deFreshify(); -} - -void LLInboxFolderViewFolder::toggleOpen() -{ - LLFolderViewFolder::toggleOpen(); - - deFreshify(); -} - void LLInboxFolderViewFolder::setCreationDate(time_t creation_date_utc) { mCreationDate = creation_date_utc; @@ -246,9 +243,81 @@ void LLInboxFolderViewFolder::setCreationDate(time_t creation_date_utc) // LLInboxFolderViewItem Implementation // +LLInboxFolderViewItem::LLInboxFolderViewItem(const Params& p) + : LLFolderViewItem(p) + , LLBadgeOwner(getHandle()) + , mFresh(false) +{ +#if SUPPORTING_FRESH_ITEM_COUNT + computeFreshness(); + + initBadgeParams(p.new_badge()); +#endif +} + BOOL LLInboxFolderViewItem::handleDoubleClick(S32 x, S32 y, MASK mask) { return TRUE; } +// virtual +void LLInboxFolderViewItem::draw() +{ +#if SUPPORTING_FRESH_ITEM_COUNT + if (!badgeHasParent()) + { + addBadgeToParentPanel(); + } + + setBadgeVisibility(mFresh); +#endif + + LLFolderViewItem::draw(); +} + +void LLInboxFolderViewItem::selectItem() +{ + LLFolderViewItem::selectItem(); + + deFreshify(); +} + +void LLInboxFolderViewItem::computeFreshness() +{ + const U32 last_expansion_utc = gSavedPerAccountSettings.getU32("LastInventoryInboxActivity"); + + if (last_expansion_utc > 0) + { + mFresh = (mCreationDate > last_expansion_utc); + +#if DEBUGGING_FRESHNESS + if (mFresh) + { + llinfos << "Item is fresh! -- creation " << mCreationDate << ", saved_freshness_date " << last_expansion_utc << llendl; + } +#endif + } + else + { + mFresh = true; + } +} + +void LLInboxFolderViewItem::deFreshify() +{ + mFresh = false; + + gSavedPerAccountSettings.setU32("LastInventoryInboxActivity", time_corrected()); +} + +void LLInboxFolderViewItem::setCreationDate(time_t creation_date_utc) +{ + mCreationDate = creation_date_utc; + + if (mParentFolder == mRoot) + { + computeFreshness(); + } +} + // eof diff --git a/indra/newview/llpanelmarketplaceinboxinventory.h b/indra/newview/llpanelmarketplaceinboxinventory.h index 46eeb9ea7f..09b14ec547 100644 --- a/indra/newview/llpanelmarketplaceinboxinventory.h +++ b/indra/newview/llpanelmarketplaceinboxinventory.h @@ -69,16 +69,15 @@ public: }; LLInboxFolderViewFolder(const Params& p); - ~LLInboxFolderViewFolder(); void draw(); - void computeFreshness(); - void deFreshify(); - void selectItem(); void toggleOpen(); + void computeFreshness(); + void deFreshify(); + bool isFresh() const { return mFresh; } protected: @@ -88,15 +87,36 @@ protected: }; -class LLInboxFolderViewItem : public LLFolderViewItem +class LLInboxFolderViewItem : public LLFolderViewItem, public LLBadgeOwner { public: - LLInboxFolderViewItem(const Params& p) - : LLFolderViewItem(p) + struct Params : public LLInitParam::Block<Params, LLFolderViewItem::Params> { - } + Optional<LLBadge::Params> new_badge; + + Params() + : new_badge("new_badge") + { + } + }; + + LLInboxFolderViewItem(const Params& p); BOOL handleDoubleClick(S32 x, S32 y, MASK mask); + + void draw(); + + void selectItem(); + + void computeFreshness(); + void deFreshify(); + + bool isFresh() const { return mFresh; } + +protected: + void setCreationDate(time_t creation_date_utc); + + bool mFresh; }; #endif //LL_INBOXINVENTORYPANEL_H diff --git a/indra/newview/skins/default/xui/en/widgets/inbox_folder_view_item.xml b/indra/newview/skins/default/xui/en/widgets/inbox_folder_view_item.xml new file mode 100644 index 0000000000..7a7a6e9a09 --- /dev/null +++ b/indra/newview/skins/default/xui/en/widgets/inbox_folder_view_item.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<inbox_folder_view_item + item_height="20" + item_top_pad="4" + selection_image="Rounded_Square" + > + <new_badge + label="New" + label_offset_horiz="-1" + location="right" + padding_horiz="12.5" + padding_vert="2" + location_offset_hcenter="-23" + border_image="New_Tag_Border" + border_color="DkGray2" + image="New_Tag_Background" + image_color="Black" + /> +</inbox_folder_view_item> |