summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorLeslie Linden <none@none>2011-06-14 16:35:15 -0700
committerLeslie Linden <none@none>2011-06-14 16:35:15 -0700
commit142c2fc29c9645df1bff924d6a61c09f04713a7b (patch)
treeb4a578097f712518c4a805013596bc9dc2efa729 /indra
parent3eeb14ee0abb5720e010d94eba52db09fa32237e (diff)
EXP-896 FIX -- Inbox not opened by default when new items are received
EXP-894 FIX -- When scrolling to the bottom of the inbox, the last item is c... EXP-856 FIX -- Inbox item count reflected as badge on inventory button * Inbox auto-expands when "fresh" items are reported * Logic for "fresh" item determination is still in progress but works for purchases while logged in * Badges now only displayed when the inventory side panel is collapsed or when inventory not visible Reviewed by Leyla
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llfolderviewitem.h10
-rw-r--r--indra/newview/llpanelmarketplaceinbox.cpp65
-rw-r--r--indra/newview/llpanelmarketplaceinbox.h14
-rw-r--r--indra/newview/llsidepanelinventory.cpp15
-rw-r--r--indra/newview/skins/default/xui/en/sidepanel_inventory.xml61
5 files changed, 118 insertions, 47 deletions
diff --git a/indra/newview/llfolderviewitem.h b/indra/newview/llfolderviewitem.h
index dbd7d5a370..789e104e8b 100644
--- a/indra/newview/llfolderviewitem.h
+++ b/indra/newview/llfolderviewitem.h
@@ -167,7 +167,7 @@ protected:
void extendSelectionFromRoot(LLFolderViewItem* selection);
// this is an internal method used for adding items to folders. A
- // no-op at this leve, but reimplemented in derived classes.
+ // no-op at this level, but reimplemented in derived classes.
virtual BOOL addItem(LLFolderViewItem*) { return FALSE; }
virtual BOOL addFolder(LLFolderViewFolder*) { return FALSE; }
@@ -366,6 +366,9 @@ public:
UNKNOWN, TRASH, NOT_TRASH
} ETrash;
+ typedef std::list<LLFolderViewItem*> items_t;
+ typedef std::list<LLFolderViewFolder*> folders_t;
+
private:
S32 mNumDescendantsSelected;
@@ -374,8 +377,6 @@ public: // Accessed needed by LLFolderViewItem
S32 numSelected(void) const { return mNumDescendantsSelected + (isSelected() ? 1 : 0); }
protected:
- typedef std::list<LLFolderViewItem*> items_t;
- typedef std::list<LLFolderViewFolder*> folders_t;
items_t mItems;
folders_t mFolders;
LLInventorySort mSortFunction;
@@ -537,6 +538,9 @@ public:
time_t getCreationDate() const;
bool isTrash() const;
S32 getNumSelectedDescendants(void) const { return mNumDescendantsSelected; }
+
+ folders_t::const_iterator getFoldersBegin() const { return mFolders.cbegin(); }
+ folders_t::const_iterator getFoldersEnd() const { return mFolders.cend(); }
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/indra/newview/llpanelmarketplaceinbox.cpp b/indra/newview/llpanelmarketplaceinbox.cpp
index a6d6308dc2..0fe2560fbf 100644
--- a/indra/newview/llpanelmarketplaceinbox.cpp
+++ b/indra/newview/llpanelmarketplaceinbox.cpp
@@ -34,9 +34,14 @@
static LLRegisterPanelClassWrapper<LLPanelMarketplaceInbox> t_panel_marketplace_inbox("panel_marketplace_inbox");
+const LLPanelMarketplaceInbox::Params& LLPanelMarketplaceInbox::getDefaultParams()
+{
+ return LLUICtrlFactory::getDefaultParams<LLPanelMarketplaceInbox>();
+}
+
// protected
-LLPanelMarketplaceInbox::LLPanelMarketplaceInbox()
- : LLPanel()
+LLPanelMarketplaceInbox::LLPanelMarketplaceInbox(const Params& p)
+ : LLPanel(p)
, mInventoryPanel(NULL)
{
}
@@ -69,7 +74,31 @@ BOOL LLPanelMarketplaceInbox::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL dr
return TRUE;
}
-U32 LLPanelMarketplaceInbox::getItemCount() const
+U32 LLPanelMarketplaceInbox::getFreshItemCount() const
+{
+ U32 fresh_item_count = 0;
+
+ LLFolderView * root_folder = mInventoryPanel->getRootFolder();
+
+ const LLFolderViewFolder * inbox_folder = *(root_folder->getFoldersBegin());
+
+ LLFolderViewFolder::folders_t::const_iterator folders_it = inbox_folder->getFoldersBegin();
+ LLFolderViewFolder::folders_t::const_iterator folders_end = inbox_folder->getFoldersEnd();
+
+ for (; folders_it != folders_end; ++folders_it)
+ {
+ const LLFolderViewFolder * folder = *folders_it;
+
+ if (folder->getCreationDate() > 1500)
+ {
+ fresh_item_count++;
+ }
+ }
+
+ return fresh_item_count;
+}
+
+U32 LLPanelMarketplaceInbox::getTotalItemCount() const
{
LLInventoryModel* model = mInventoryPanel->getModel();
@@ -96,11 +125,16 @@ U32 LLPanelMarketplaceInbox::getItemCount() const
std::string LLPanelMarketplaceInbox::getBadgeString() const
{
std::string item_count_str("");
- U32 item_count = getItemCount();
- if (item_count)
+ // If side panel collapsed or expanded and not inventory
+ if (LLSideTray::getInstance()->getCollapsed() || !LLSideTray::getInstance()->isPanelActive("sidepanel_inventory"))
{
- item_count_str = llformat("%d", item_count);
+ U32 item_count = getFreshItemCount();
+
+ if (item_count)
+ {
+ item_count_str = llformat("%d", item_count);
+ }
}
return item_count_str;
@@ -108,17 +142,32 @@ std::string LLPanelMarketplaceInbox::getBadgeString() const
void LLPanelMarketplaceInbox::draw()
{
- std::string item_count_str = getBadgeString();
+ U32 item_count = getTotalItemCount();
+
+ LLView * fresh_new_count_view = getChildView("inbox_fresh_new_count");
- if (item_count_str.length() > 0)
+ if (item_count > 0)
{
+ std::string item_count_str = llformat("%d", item_count);
+
LLStringUtil::format_map_t args;
args["[NUM]"] = item_count_str;
getChild<LLButton>("inbox_btn")->setLabel(getString("InboxLabelWithArg", args));
+
+ // set green text to fresh item count
+ U32 fresh_item_count = getFreshItemCount();
+ fresh_new_count_view->setVisible((fresh_item_count > 0));
+
+ if (fresh_item_count > 0)
+ {
+ getChild<LLUICtrl>("inbox_fresh_new_count")->setTextArg("[NUM]", llformat("%d", fresh_item_count));
+ }
}
else
{
getChild<LLButton>("inbox_btn")->setLabel(getString("InboxLabelNoArg"));
+
+ fresh_new_count_view->setVisible(FALSE);
}
LLPanel::draw();
diff --git a/indra/newview/llpanelmarketplaceinbox.h b/indra/newview/llpanelmarketplaceinbox.h
index 61e8cf3c1f..21069a0ea1 100644
--- a/indra/newview/llpanelmarketplaceinbox.h
+++ b/indra/newview/llpanelmarketplaceinbox.h
@@ -36,9 +36,17 @@ class LLPanelMarketplaceInbox : public LLPanel, public LLSideTrayTabBadgeDriver
{
public:
+ struct Params : public LLInitParam::Block<Params, LLPanel::Params>
+ {
+ Params() {}
+ };
+
LOG_CLASS(LLPanelMarketplaceInbox);
- LLPanelMarketplaceInbox();
+ // RN: for some reason you can't just use LLUICtrlFactory::getDefaultParams as a default argument in VC8
+ static const LLPanelMarketplaceInbox::Params& getDefaultParams();
+
+ LLPanelMarketplaceInbox(const Params& p = getDefaultParams());
~LLPanelMarketplaceInbox();
/*virtual*/ BOOL postBuild();
@@ -47,7 +55,9 @@ public:
/*virtual*/ void draw();
- U32 getItemCount() const;
+ U32 getFreshItemCount() const;
+ U32 getTotalItemCount() const;
+
std::string getBadgeString() const;
private:
diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp
index 6ac845385b..33d512d89e 100644
--- a/indra/newview/llsidepanelinventory.cpp
+++ b/indra/newview/llsidepanelinventory.cpp
@@ -43,6 +43,7 @@
#include "lllayoutstack.h"
#include "lloutfitobserver.h"
#include "llpanelmaininventory.h"
+#include "llpanelmarketplaceinbox.h"
#include "llselectmgr.h"
#include "llsidepaneliteminfo.h"
#include "llsidepaneltaskinfo.h"
@@ -341,12 +342,6 @@ void LLSidepanelInventory::onToggleInboxBtn()
{
// Save current time as a setting for future new-ness tests
gSavedSettings.setString(INBOX_EXPAND_TIME_SETTING, LLDate::now().asString());
-
- // TODO: Hide inbox badge
- }
- else
- {
- // TODO: Show inbox badge
}
}
@@ -365,6 +360,14 @@ void LLSidepanelInventory::onOpen(const LLSD& key)
{
LLFirstUse::newInventory(false);
+ // Expand the inbox if we have fresh items
+ LLPanelMarketplaceInbox * inbox = getChild<LLPanelMarketplaceInbox>("marketplace_inbox");
+ if (inbox && (inbox->getFreshItemCount() > 0))
+ {
+ getChild<LLButton>(INBOX_BUTTON_NAME)->setToggleState(true);
+ onToggleInboxBtn();
+ }
+
if(key.size() == 0)
return;
diff --git a/indra/newview/skins/default/xui/en/sidepanel_inventory.xml b/indra/newview/skins/default/xui/en/sidepanel_inventory.xml
index 373a9011a1..9a91f90f79 100644
--- a/indra/newview/skins/default/xui/en/sidepanel_inventory.xml
+++ b/indra/newview/skins/default/xui/en/sidepanel_inventory.xml
@@ -54,8 +54,8 @@
follows="bottom|left|right"
min_dim="35"
name="inbox_layout_panel"
- max_dim="125"
- height="125">
+ max_dim="200"
+ height="200">
<panel
follows="all"
layout="topleft"
@@ -64,12 +64,12 @@
class="panel_marketplace_inbox"
top="0"
label=""
- height="125"
+ height="200"
width="330">
- <string name="InboxLabelWithArg">MARKETPLACE INBOX ([NUM])</string>
- <string name="InboxLabelNoArg">MARKETPLACE INBOX</string>
+ <string name="InboxLabelWithArg">Received Items ([NUM])</string>
+ <string name="InboxLabelNoArg">Received Items</string>
<button
- label="MARKETPLACE INBOX"
+ label="Received Items"
name="inbox_btn"
height="35"
width="308"
@@ -82,28 +82,33 @@
pad_left="35"
top="0"
left="10" />
+ <text
+ type="string"
+ length="1"
+ follows="right|top"
+ layout="topleft"
+ height="13"
+ top="10"
+ right="-20"
+ name="inbox_fresh_new_count"
+ font="SansSerifMedium"
+ halign="right"
+ text_color="EmphasisColor"
+ top_pad="0"
+ width="300">
+ [NUM] New
+ </text>
<panel
follows="all"
left="10"
- height="90"
+ bottom="200"
width="308"
top="35"
bg_opaque_color="InventoryBackgroundColor"
background_visible="true"
background_opaque="true"
- >
- <text
- type="string"
- length="1"
- follows="top|left|right"
- font="SansSerifSmall"
- use_ellipses="true"
- name="move_items_text"
- top="5"
- left="4"
- height="20"
- width="304"
- >Move items to your inventory to manage and use them.</text>
+ tool_tip="Drag and drop items to your inventory to manage and use them"
+ >
<inventory_panel
bg_opaque_color="DkGray2"
bg_alpha_color="DkGray2"
@@ -112,8 +117,8 @@
border="false"
bevel_style="none"
follows="all"
- top="25"
- height="70"
+ top="0"
+ height="165"
start_folder="Inbox"
layout="topleft"
left="0"
@@ -134,8 +139,8 @@
follows="bottom|left|right"
name="outbox_layout_panel"
min_dim="35"
- max_dim="125"
- height="125">
+ max_dim="200"
+ height="200">
<panel
follows="all"
layout="topleft"
@@ -144,10 +149,10 @@
class="panel_marketplace_outbox"
top="0"
label=""
- height="125"
+ height="200"
width="310">
<button
- label="MARKETPLACE OUTBOX"
+ label="Merchant Outbox"
is_toggle="true"
name="outbox_btn"
follows="top|left|right"
@@ -203,7 +208,7 @@
<panel
follows="all"
left="0"
- bottom="125"
+ bottom="200"
width="330"
top="35"
>
@@ -215,7 +220,7 @@
border="false"
bevel_style="none"
follows="all"
- height="90"
+ height="165"
start_folder="Outbox"
layout="topleft"
left="0"