From 95b8020d21b1ad60f82c767df7d7aac019ad8353 Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Mon, 23 May 2011 16:11:50 -0700 Subject: adding marketplace inbox and outbox reviewed by Leslie --- indra/newview/llpanelmarketplaceinbox.cpp | 47 +++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 indra/newview/llpanelmarketplaceinbox.cpp (limited to 'indra/newview/llpanelmarketplaceinbox.cpp') diff --git a/indra/newview/llpanelmarketplaceinbox.cpp b/indra/newview/llpanelmarketplaceinbox.cpp new file mode 100644 index 0000000000..b3afaea20e --- /dev/null +++ b/indra/newview/llpanelmarketplaceinbox.cpp @@ -0,0 +1,47 @@ +/** + * @file llpanelmarketplaceinbox.cpp + * @brief Panel for marketplace inbox + * +* $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llpanelmarketplaceinbox.h" + +static LLRegisterPanelClassWrapper t_panel_marketplace_inbox("panel_marketplace_inbox"); + +// protected +LLPanelMarketplaceInbox::LLPanelMarketplaceInbox() +: LLPanel() +{ +} + +LLPanelMarketplaceInbox::~LLPanelMarketplaceInbox() +{ +} + +// virtual +BOOL LLPanelMarketplaceInbox::postBuild() +{ + return TRUE; +} -- cgit v1.2.3 From 0c0f7558782edccda375609777967184b8440441 Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Mon, 6 Jun 2011 16:30:22 -0700 Subject: fixing drag and drop for inbox, adding inbox text and cleaning up context menus --- indra/newview/llpanelmarketplaceinbox.cpp | 38 +++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'indra/newview/llpanelmarketplaceinbox.cpp') diff --git a/indra/newview/llpanelmarketplaceinbox.cpp b/indra/newview/llpanelmarketplaceinbox.cpp index b3afaea20e..b401087345 100644 --- a/indra/newview/llpanelmarketplaceinbox.cpp +++ b/indra/newview/llpanelmarketplaceinbox.cpp @@ -28,6 +28,9 @@ #include "llpanelmarketplaceinbox.h" +#include "llbutton.h" +#include "llinventorypanel.h" + static LLRegisterPanelClassWrapper t_panel_marketplace_inbox("panel_marketplace_inbox"); // protected @@ -43,5 +46,40 @@ LLPanelMarketplaceInbox::~LLPanelMarketplaceInbox() // virtual BOOL LLPanelMarketplaceInbox::postBuild() { + mInventoryPanel = getChild("inventory_inbox"); + + mInventoryPanel->setSortOrder(LLInventoryFilter::SO_DATE); + + return TRUE; +} + +BOOL LLPanelMarketplaceInbox::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string& tooltip_msg) +{ + *accept = ACCEPT_NO; return TRUE; } + +void LLPanelMarketplaceInbox::draw() +{ + LLInventoryModel* model = mInventoryPanel->getModel(); + + LLInventoryModel::cat_array_t* cats; + LLInventoryModel::item_array_t* items; + + model->getDirectDescendentsOf(model->findCategoryUUIDForType(LLFolderType::FT_INBOX, false, false), cats, items); + + S32 item_count = cats->size() + items->size(); + + if (item_count) + { + LLStringUtil::format_map_t args; + args["[NUM]"] = llformat ("%d", item_count); + getChild("inbox_btn")->setLabel(getString("InboxLabelWithArg", args)); + } + else + { + getChild("inbox_btn")->setLabel(getString("InboxLabelNoArg")); + } + + LLPanel::draw(); +} -- cgit v1.2.3 From 98bcd9e2efe4cc0dc5e51da09c6f18424b9d9144 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Mon, 6 Jun 2011 17:00:59 -0700 Subject: EXP-859 FIX -- Save setting for last time inbox expanded EXP-841 PROGRESS -- Create outbox sync button with basic enable/disable logic and animation EXP-866 PROGRESS -- Create inbox observer to dynamically update inbox item count and badge value EXP-872 PROGRESS -- Hide inbox and outbox unless applicable Inbox expansion time is now saved as setting variable "LastInventoryInboxExpand". New outbox sync button art. Observers for items and categories are now implemented in the LLSidepanelInventory but the exact method of use is still to be determined. Functions are in place to show and hide the inbox and outbox panels but the logic around the decision is TBD. The resize bar for the inbox/outbox is now disabled when both inbox and outbox are collapsed. Reviewed by Leyla. --- indra/newview/llpanelmarketplaceinbox.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'indra/newview/llpanelmarketplaceinbox.cpp') diff --git a/indra/newview/llpanelmarketplaceinbox.cpp b/indra/newview/llpanelmarketplaceinbox.cpp index b401087345..6cebc5dd5a 100644 --- a/indra/newview/llpanelmarketplaceinbox.cpp +++ b/indra/newview/llpanelmarketplaceinbox.cpp @@ -68,7 +68,17 @@ void LLPanelMarketplaceInbox::draw() model->getDirectDescendentsOf(model->findCategoryUUIDForType(LLFolderType::FT_INBOX, false, false), cats, items); - S32 item_count = cats->size() + items->size(); + S32 item_count = 0; + + if (cats) + { + item_count += cats->size(); + } + + if (items) + { + item_count += items->size(); + } if (item_count) { -- cgit v1.2.3 From 3eeb14ee0abb5720e010d94eba52db09fa32237e Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Fri, 10 Jun 2011 16:20:30 -0700 Subject: EXP-856 FIX -- Inbox item count reflected as badge on inventory button * Modified badges to be parented to their owners if their owners have no parents * Modified side tray tab panels to create badges on side tab buttons when the xml specifies a badge. * Modified inbox to drive the badge value of the sidebar_inventory button. * Updated inbox and outbox sizes so scroll bars function as expected * Updated inventory_panel.xml to allow scroll tag to specify scroll bar properties, instead of just having them hardcoded. Reviewed by Richard --- indra/newview/llpanelmarketplaceinbox.cpp | 40 +++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 5 deletions(-) (limited to 'indra/newview/llpanelmarketplaceinbox.cpp') diff --git a/indra/newview/llpanelmarketplaceinbox.cpp b/indra/newview/llpanelmarketplaceinbox.cpp index 6cebc5dd5a..a6d6308dc2 100644 --- a/indra/newview/llpanelmarketplaceinbox.cpp +++ b/indra/newview/llpanelmarketplaceinbox.cpp @@ -28,6 +28,7 @@ #include "llpanelmarketplaceinbox.h" +#include "llappviewer.h" #include "llbutton.h" #include "llinventorypanel.h" @@ -35,7 +36,8 @@ static LLRegisterPanelClassWrapper t_panel_marketplace_ // protected LLPanelMarketplaceInbox::LLPanelMarketplaceInbox() -: LLPanel() + : LLPanel() + , mInventoryPanel(NULL) { } @@ -50,16 +52,24 @@ BOOL LLPanelMarketplaceInbox::postBuild() mInventoryPanel->setSortOrder(LLInventoryFilter::SO_DATE); + LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&LLPanelMarketplaceInbox::handleLoginComplete, this)); + return TRUE; } +void LLPanelMarketplaceInbox::handleLoginComplete() +{ + // Set us up as the class to drive the badge value for the sidebar_inventory button + LLSideTray::getInstance()->setTabButtonBadgeDriver("sidebar_inventory", this); +} + BOOL LLPanelMarketplaceInbox::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string& tooltip_msg) { *accept = ACCEPT_NO; return TRUE; } -void LLPanelMarketplaceInbox::draw() +U32 LLPanelMarketplaceInbox::getItemCount() const { LLInventoryModel* model = mInventoryPanel->getModel(); @@ -68,8 +78,8 @@ void LLPanelMarketplaceInbox::draw() model->getDirectDescendentsOf(model->findCategoryUUIDForType(LLFolderType::FT_INBOX, false, false), cats, items); - S32 item_count = 0; - + U32 item_count = 0; + if (cats) { item_count += cats->size(); @@ -80,10 +90,30 @@ void LLPanelMarketplaceInbox::draw() item_count += items->size(); } + return item_count; +} + +std::string LLPanelMarketplaceInbox::getBadgeString() const +{ + std::string item_count_str(""); + U32 item_count = getItemCount(); + if (item_count) + { + item_count_str = llformat("%d", item_count); + } + + return item_count_str; +} + +void LLPanelMarketplaceInbox::draw() +{ + std::string item_count_str = getBadgeString(); + + if (item_count_str.length() > 0) { LLStringUtil::format_map_t args; - args["[NUM]"] = llformat ("%d", item_count); + args["[NUM]"] = item_count_str; getChild("inbox_btn")->setLabel(getString("InboxLabelWithArg", args)); } else -- cgit v1.2.3 From 142c2fc29c9645df1bff924d6a61c09f04713a7b Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Tue, 14 Jun 2011 16:35:15 -0700 Subject: 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 --- indra/newview/llpanelmarketplaceinbox.cpp | 65 +++++++++++++++++++++++++++---- 1 file changed, 57 insertions(+), 8 deletions(-) (limited to 'indra/newview/llpanelmarketplaceinbox.cpp') 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 t_panel_marketplace_inbox("panel_marketplace_inbox"); +const LLPanelMarketplaceInbox::Params& LLPanelMarketplaceInbox::getDefaultParams() +{ + return LLUICtrlFactory::getDefaultParams(); +} + // 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("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("inbox_fresh_new_count")->setTextArg("[NUM]", llformat("%d", fresh_item_count)); + } } else { getChild("inbox_btn")->setLabel(getString("InboxLabelNoArg")); + + fresh_new_count_view->setVisible(FALSE); } LLPanel::draw(); -- cgit v1.2.3 From 0d246c0c5fc3ddef2022572b560eaec0018a722e Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Thu, 16 Jun 2011 17:14:51 -0700 Subject: EXP-872 PROGRESS -- Hide Inbox unless applicable EXP-910 FIX -- Newness badge shown on suitcase inventory icon when InventoryDisplayInbox is set to False EXP-895 FIX -- Selecting items in Marketplace Inbox does not change focus in inventory panel away from items selected in inventory panel * Main inventory, outbox and inbox all clear the selection of the others when they gain focus * The Fresh Item Count badge is no longer displayed on the inventory side tab button when the inbox is disabled * The New Item Count text is no longer displayed. (we will enable it again when freshness is supported) --- indra/newview/llpanelmarketplaceinbox.cpp | 38 +++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpanelmarketplaceinbox.cpp') diff --git a/indra/newview/llpanelmarketplaceinbox.cpp b/indra/newview/llpanelmarketplaceinbox.cpp index 0fe2560fbf..eff27aa541 100644 --- a/indra/newview/llpanelmarketplaceinbox.cpp +++ b/indra/newview/llpanelmarketplaceinbox.cpp @@ -31,6 +31,11 @@ #include "llappviewer.h" #include "llbutton.h" #include "llinventorypanel.h" +#include "llsidepanelinventory.h" + + +#define SUPPORTING_FRESH_ITEM_COUNT 0 + static LLRegisterPanelClassWrapper t_panel_marketplace_inbox("panel_marketplace_inbox"); @@ -59,6 +64,8 @@ BOOL LLPanelMarketplaceInbox::postBuild() LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&LLPanelMarketplaceInbox::handleLoginComplete, this)); + LLFocusableElement::setFocusReceivedCallback(boost::bind(&LLPanelMarketplaceInbox::onFocusReceived, this)); + return TRUE; } @@ -68,6 +75,28 @@ void LLPanelMarketplaceInbox::handleLoginComplete() LLSideTray::getInstance()->setTabButtonBadgeDriver("sidebar_inventory", this); } +void LLPanelMarketplaceInbox::onFocusReceived() +{ + LLSidepanelInventory * sidepanel_inventory = LLSideTray::getInstance()->getPanel("sidepanel_inventory"); + + if (sidepanel_inventory) + { + LLInventoryPanel * inv_panel = sidepanel_inventory->getActivePanel(); + + if (inv_panel) + { + inv_panel->clearSelection(); + } + + LLInventoryPanel * outbox_panel = sidepanel_inventory->findChild("inventory_outbox"); + + if (outbox_panel) + { + outbox_panel->clearSelection(); + } + } +} + BOOL LLPanelMarketplaceInbox::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string& tooltip_msg) { *accept = ACCEPT_NO; @@ -126,8 +155,9 @@ std::string LLPanelMarketplaceInbox::getBadgeString() const { std::string item_count_str(""); - // If side panel collapsed or expanded and not inventory - if (LLSideTray::getInstance()->getCollapsed() || !LLSideTray::getInstance()->isPanelActive("sidepanel_inventory")) + // If the inbox is visible, and the side panel is collapsed or expanded and not the inventory panel + if (getParent()->getVisible() && + (LLSideTray::getInstance()->getCollapsed() || !LLSideTray::getInstance()->isPanelActive("sidepanel_inventory"))) { U32 item_count = getFreshItemCount(); @@ -154,6 +184,7 @@ void LLPanelMarketplaceInbox::draw() args["[NUM]"] = item_count_str; getChild("inbox_btn")->setLabel(getString("InboxLabelWithArg", args)); +#if SUPPORTING_FRESH_ITEM_COUNT // set green text to fresh item count U32 fresh_item_count = getFreshItemCount(); fresh_new_count_view->setVisible((fresh_item_count > 0)); @@ -162,6 +193,9 @@ void LLPanelMarketplaceInbox::draw() { getChild("inbox_fresh_new_count")->setTextArg("[NUM]", llformat("%d", fresh_item_count)); } +#else + fresh_new_count_view->setVisible(FALSE); +#endif } else { -- cgit v1.2.3 From 917e2d18973bd17929d589ee58b3f47a09c7157b Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Tue, 21 Jun 2011 14:16:27 -0700 Subject: EXP-895 Selecting items in Marketplace Inbox does not change focus in inventory panel away from items selected in inventory panel --- indra/newview/llpanelmarketplaceinbox.cpp | 426 +++++++++++++++--------------- 1 file changed, 218 insertions(+), 208 deletions(-) (limited to 'indra/newview/llpanelmarketplaceinbox.cpp') diff --git a/indra/newview/llpanelmarketplaceinbox.cpp b/indra/newview/llpanelmarketplaceinbox.cpp index eff27aa541..1962724891 100644 --- a/indra/newview/llpanelmarketplaceinbox.cpp +++ b/indra/newview/llpanelmarketplaceinbox.cpp @@ -1,208 +1,218 @@ -/** - * @file llpanelmarketplaceinbox.cpp - * @brief Panel for marketplace inbox - * -* $LicenseInfo:firstyear=2011&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" - -#include "llpanelmarketplaceinbox.h" - -#include "llappviewer.h" -#include "llbutton.h" -#include "llinventorypanel.h" -#include "llsidepanelinventory.h" - - -#define SUPPORTING_FRESH_ITEM_COUNT 0 - - -static LLRegisterPanelClassWrapper t_panel_marketplace_inbox("panel_marketplace_inbox"); - -const LLPanelMarketplaceInbox::Params& LLPanelMarketplaceInbox::getDefaultParams() -{ - return LLUICtrlFactory::getDefaultParams(); -} - -// protected -LLPanelMarketplaceInbox::LLPanelMarketplaceInbox(const Params& p) - : LLPanel(p) - , mInventoryPanel(NULL) -{ -} - -LLPanelMarketplaceInbox::~LLPanelMarketplaceInbox() -{ -} - -// virtual -BOOL LLPanelMarketplaceInbox::postBuild() -{ - mInventoryPanel = getChild("inventory_inbox"); - - mInventoryPanel->setSortOrder(LLInventoryFilter::SO_DATE); - - LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&LLPanelMarketplaceInbox::handleLoginComplete, this)); - - LLFocusableElement::setFocusReceivedCallback(boost::bind(&LLPanelMarketplaceInbox::onFocusReceived, this)); - - return TRUE; -} - -void LLPanelMarketplaceInbox::handleLoginComplete() -{ - // Set us up as the class to drive the badge value for the sidebar_inventory button - LLSideTray::getInstance()->setTabButtonBadgeDriver("sidebar_inventory", this); -} - -void LLPanelMarketplaceInbox::onFocusReceived() -{ - LLSidepanelInventory * sidepanel_inventory = LLSideTray::getInstance()->getPanel("sidepanel_inventory"); - - if (sidepanel_inventory) - { - LLInventoryPanel * inv_panel = sidepanel_inventory->getActivePanel(); - - if (inv_panel) - { - inv_panel->clearSelection(); - } - - LLInventoryPanel * outbox_panel = sidepanel_inventory->findChild("inventory_outbox"); - - if (outbox_panel) - { - outbox_panel->clearSelection(); - } - } -} - -BOOL LLPanelMarketplaceInbox::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string& tooltip_msg) -{ - *accept = ACCEPT_NO; - return TRUE; -} - -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(); - - LLInventoryModel::cat_array_t* cats; - LLInventoryModel::item_array_t* items; - - model->getDirectDescendentsOf(model->findCategoryUUIDForType(LLFolderType::FT_INBOX, false, false), cats, items); - - U32 item_count = 0; - - if (cats) - { - item_count += cats->size(); - } - - if (items) - { - item_count += items->size(); - } - - return item_count; -} - -std::string LLPanelMarketplaceInbox::getBadgeString() const -{ - std::string item_count_str(""); - - // If the inbox is visible, and the side panel is collapsed or expanded and not the inventory panel - if (getParent()->getVisible() && - (LLSideTray::getInstance()->getCollapsed() || !LLSideTray::getInstance()->isPanelActive("sidepanel_inventory"))) - { - U32 item_count = getFreshItemCount(); - - if (item_count) - { - item_count_str = llformat("%d", item_count); - } - } - - return item_count_str; -} - -void LLPanelMarketplaceInbox::draw() -{ - U32 item_count = getTotalItemCount(); - - LLView * fresh_new_count_view = getChildView("inbox_fresh_new_count"); - - if (item_count > 0) - { - std::string item_count_str = llformat("%d", item_count); - - LLStringUtil::format_map_t args; - args["[NUM]"] = item_count_str; - getChild("inbox_btn")->setLabel(getString("InboxLabelWithArg", args)); - -#if SUPPORTING_FRESH_ITEM_COUNT - // 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("inbox_fresh_new_count")->setTextArg("[NUM]", llformat("%d", fresh_item_count)); - } -#else - fresh_new_count_view->setVisible(FALSE); -#endif - } - else - { - getChild("inbox_btn")->setLabel(getString("InboxLabelNoArg")); - - fresh_new_count_view->setVisible(FALSE); - } - - LLPanel::draw(); -} +/** + * @file llpanelmarketplaceinbox.cpp + * @brief Panel for marketplace inbox + * +* $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llpanelmarketplaceinbox.h" + +#include "llappviewer.h" +#include "llbutton.h" +#include "llinventorypanel.h" +#include "llsidepanelinventory.h" + + +#define SUPPORTING_FRESH_ITEM_COUNT 0 + + +static LLRegisterPanelClassWrapper t_panel_marketplace_inbox("panel_marketplace_inbox"); + +const LLPanelMarketplaceInbox::Params& LLPanelMarketplaceInbox::getDefaultParams() +{ + return LLUICtrlFactory::getDefaultParams(); +} + +// protected +LLPanelMarketplaceInbox::LLPanelMarketplaceInbox(const Params& p) + : LLPanel(p) + , mInventoryPanel(NULL) +{ +} + +LLPanelMarketplaceInbox::~LLPanelMarketplaceInbox() +{ +} + +// virtual +BOOL LLPanelMarketplaceInbox::postBuild() +{ + mInventoryPanel = getChild("inventory_inbox"); + + mInventoryPanel->setSortOrder(LLInventoryFilter::SO_DATE); + + LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&LLPanelMarketplaceInbox::handleLoginComplete, this)); + + LLFocusableElement::setFocusReceivedCallback(boost::bind(&LLPanelMarketplaceInbox::onFocusReceived, this)); + + mInventoryPanel->setSelectCallback(boost::bind(&LLPanelMarketplaceInbox::onSelectionChange, this)); + + return TRUE; +} + +void LLPanelMarketplaceInbox::onSelectionChange() +{ + LLSidepanelInventory* sidepanel_inventory = dynamic_cast(LLSideTray::getInstance()->getPanel("sidepanel_inventory")); + + sidepanel_inventory->updateVerbs(); +} + + +void LLPanelMarketplaceInbox::handleLoginComplete() +{ + // Set us up as the class to drive the badge value for the sidebar_inventory button + LLSideTray::getInstance()->setTabButtonBadgeDriver("sidebar_inventory", this); +} + +void LLPanelMarketplaceInbox::onFocusReceived() +{ + LLSidepanelInventory * sidepanel_inventory = LLSideTray::getInstance()->getPanel("sidepanel_inventory"); + + if (sidepanel_inventory) + { + LLInventoryPanel * inv_panel = sidepanel_inventory->getActivePanel(); + + if (inv_panel) + { + inv_panel->clearSelection(); + } + + LLInventoryPanel * outbox_panel = sidepanel_inventory->findChild("inventory_outbox"); + + if (outbox_panel) + { + outbox_panel->clearSelection(); + } + } +} + +BOOL LLPanelMarketplaceInbox::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string& tooltip_msg) +{ + *accept = ACCEPT_NO; + return TRUE; +} + +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(); + + LLInventoryModel::cat_array_t* cats; + LLInventoryModel::item_array_t* items; + + model->getDirectDescendentsOf(model->findCategoryUUIDForType(LLFolderType::FT_INBOX, false, false), cats, items); + + U32 item_count = 0; + + if (cats) + { + item_count += cats->size(); + } + + if (items) + { + item_count += items->size(); + } + + return item_count; +} + +std::string LLPanelMarketplaceInbox::getBadgeString() const +{ + std::string item_count_str(""); + + // If the inbox is visible, and the side panel is collapsed or expanded and not the inventory panel + if (getParent()->getVisible() && + (LLSideTray::getInstance()->getCollapsed() || !LLSideTray::getInstance()->isPanelActive("sidepanel_inventory"))) + { + U32 item_count = getFreshItemCount(); + + if (item_count) + { + item_count_str = llformat("%d", item_count); + } + } + + return item_count_str; +} + +void LLPanelMarketplaceInbox::draw() +{ + U32 item_count = getTotalItemCount(); + + LLView * fresh_new_count_view = getChildView("inbox_fresh_new_count"); + + if (item_count > 0) + { + std::string item_count_str = llformat("%d", item_count); + + LLStringUtil::format_map_t args; + args["[NUM]"] = item_count_str; + getChild("inbox_btn")->setLabel(getString("InboxLabelWithArg", args)); + +#if SUPPORTING_FRESH_ITEM_COUNT + // 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("inbox_fresh_new_count")->setTextArg("[NUM]", llformat("%d", fresh_item_count)); + } +#else + fresh_new_count_view->setVisible(FALSE); +#endif + } + else + { + getChild("inbox_btn")->setLabel(getString("InboxLabelNoArg")); + + fresh_new_count_view->setVisible(FALSE); + } + + LLPanel::draw(); +} -- cgit v1.2.3 From c61a7fbaace20415be3003eaab95ce359ff8621a Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Thu, 23 Jun 2011 10:34:44 -0400 Subject: EXP-926 FIX -- Received items badge count and item count shown in inbox do not always match * getFreshItemCount() function returns getTotalItemCount() for now, until we properly support item fresh-ness --- indra/newview/llpanelmarketplaceinbox.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/newview/llpanelmarketplaceinbox.cpp') diff --git a/indra/newview/llpanelmarketplaceinbox.cpp b/indra/newview/llpanelmarketplaceinbox.cpp index 1962724891..14c4c46fe7 100644 --- a/indra/newview/llpanelmarketplaceinbox.cpp +++ b/indra/newview/llpanelmarketplaceinbox.cpp @@ -115,6 +115,7 @@ BOOL LLPanelMarketplaceInbox::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL dr U32 LLPanelMarketplaceInbox::getFreshItemCount() const { +#if SUPPORTING_FRESH_ITEM_COUNT U32 fresh_item_count = 0; LLFolderView * root_folder = mInventoryPanel->getRootFolder(); @@ -135,6 +136,9 @@ U32 LLPanelMarketplaceInbox::getFreshItemCount() const } return fresh_item_count; +#else + return getTotalItemCount(); +#endif } U32 LLPanelMarketplaceInbox::getTotalItemCount() const -- cgit v1.2.3 From e74f9fcc147edd24576a25bb6a0af69ac8d6a600 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Thu, 23 Jun 2011 18:11:55 -0400 Subject: EXP-919 FIX -- Toggling InventoryDisplayInbox value to True in Viewer on Agni creates Inbox and Outbox system folders * The badge no longer displays (2) when the folder does not exist. * The inbox panel no longer displays the inventory and library folders. * The inbox is supposed to display a string for the item not being found, but doesn't for an unknown reason. --- indra/newview/llpanelmarketplaceinbox.cpp | 43 ++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 15 deletions(-) (limited to 'indra/newview/llpanelmarketplaceinbox.cpp') diff --git a/indra/newview/llpanelmarketplaceinbox.cpp b/indra/newview/llpanelmarketplaceinbox.cpp index 14c4c46fe7..1f3fbb40b4 100644 --- a/indra/newview/llpanelmarketplaceinbox.cpp +++ b/indra/newview/llpanelmarketplaceinbox.cpp @@ -59,7 +59,7 @@ LLPanelMarketplaceInbox::~LLPanelMarketplaceInbox() BOOL LLPanelMarketplaceInbox::postBuild() { mInventoryPanel = getChild("inventory_inbox"); - + mInventoryPanel->setSortOrder(LLInventoryFilter::SO_DATE); LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&LLPanelMarketplaceInbox::handleLoginComplete, this)); @@ -67,7 +67,10 @@ BOOL LLPanelMarketplaceInbox::postBuild() LLFocusableElement::setFocusReceivedCallback(boost::bind(&LLPanelMarketplaceInbox::onFocusReceived, this)); mInventoryPanel->setSelectCallback(boost::bind(&LLPanelMarketplaceInbox::onSelectionChange, this)); - + + // Set up the note to display when the inbox is empty + mInventoryPanel->getFilter()->setEmptyLookupMessage("InboxNoItems"); + return TRUE; } @@ -116,6 +119,12 @@ BOOL LLPanelMarketplaceInbox::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL dr U32 LLPanelMarketplaceInbox::getFreshItemCount() const { #if SUPPORTING_FRESH_ITEM_COUNT + + // + // NOTE: When turning this on, be sure to test the no inbox/outbox case because this code probably + // will return "2" for the Inventory and LIBRARY top-levels when that happens. + // + U32 fresh_item_count = 0; LLFolderView * root_folder = mInventoryPanel->getRootFolder(); @@ -143,23 +152,27 @@ U32 LLPanelMarketplaceInbox::getFreshItemCount() const U32 LLPanelMarketplaceInbox::getTotalItemCount() const { + U32 item_count = 0; + LLInventoryModel* model = mInventoryPanel->getModel(); + const LLUUID inbox_id = model->findCategoryUUIDForType(LLFolderType::FT_INBOX, false, false); + + if (!inbox_id.isNull()) + { + LLInventoryModel::cat_array_t* cats; + LLInventoryModel::item_array_t* items; - LLInventoryModel::cat_array_t* cats; - LLInventoryModel::item_array_t* items; - - model->getDirectDescendentsOf(model->findCategoryUUIDForType(LLFolderType::FT_INBOX, false, false), cats, items); - - U32 item_count = 0; + model->getDirectDescendentsOf(inbox_id, cats, items); - if (cats) - { - item_count += cats->size(); - } + if (cats) + { + item_count += cats->size(); + } - if (items) - { - item_count += items->size(); + if (items) + { + item_count += items->size(); + } } return item_count; -- cgit v1.2.3 From 71b6d9d842e03a4a1eece88ec20a50b041b6137f Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Thu, 23 Jun 2011 17:50:52 -0700 Subject: fixing non-dnd portion of EXT-895 --- indra/newview/llpanelmarketplaceinbox.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/newview/llpanelmarketplaceinbox.cpp') diff --git a/indra/newview/llpanelmarketplaceinbox.cpp b/indra/newview/llpanelmarketplaceinbox.cpp index 1f3fbb40b4..2b04987084 100644 --- a/indra/newview/llpanelmarketplaceinbox.cpp +++ b/indra/newview/llpanelmarketplaceinbox.cpp @@ -69,7 +69,7 @@ BOOL LLPanelMarketplaceInbox::postBuild() mInventoryPanel->setSelectCallback(boost::bind(&LLPanelMarketplaceInbox::onSelectionChange, this)); // Set up the note to display when the inbox is empty - mInventoryPanel->getFilter()->setEmptyLookupMessage("InboxNoItems"); + //mInventoryPanel->getFilter()->setEmptyLookupMessage("InboxNoItems"); return TRUE; } @@ -108,6 +108,8 @@ void LLPanelMarketplaceInbox::onFocusReceived() outbox_panel->clearSelection(); } } + + sidepanel_inventory->updateVerbs(); } BOOL LLPanelMarketplaceInbox::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string& tooltip_msg) -- cgit v1.2.3 From 6c12a5ca550e06730e06d1a909fbf43d7bda16f5 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Thu, 30 Jun 2011 16:25:19 -0700 Subject: EXP-919 FIX -- Items not shown in Received Items panel EXP-929 FIX -- First Direct Delivery item purchased while logged in: Received Items folder visible in inventory and item not visible in Received items panel - no badge count update * Inbox and Outbox inventory panels now live in their own XML files and are hot loaded into place when appropriate, like when the "Received Items" folder is first created, for example. * The Inbox and Outbox panels now show relevant default messages when the folders are empty or do not exist * Added LLInventoryCategoryAddedObserver, a new inventory observer type to observe added folders * Hacked LLInventoryPanel to properly set up inbox and outbox inventory views for the "Received Items" folder and the "Merchant Outbox" folder that aren't created with the proper system folder type * Changed inventory badge count computation to use LLFolderView rather than the inventory directly * Applied various focus, selection and other inbox fixes to the outbox Reviewed by Richard. --- indra/newview/llpanelmarketplaceinbox.cpp | 90 +++++++++++++++++-------------- 1 file changed, 50 insertions(+), 40 deletions(-) (limited to 'indra/newview/llpanelmarketplaceinbox.cpp') diff --git a/indra/newview/llpanelmarketplaceinbox.cpp b/indra/newview/llpanelmarketplaceinbox.cpp index 2b04987084..4e7e72a469 100644 --- a/indra/newview/llpanelmarketplaceinbox.cpp +++ b/indra/newview/llpanelmarketplaceinbox.cpp @@ -58,18 +58,9 @@ LLPanelMarketplaceInbox::~LLPanelMarketplaceInbox() // virtual BOOL LLPanelMarketplaceInbox::postBuild() { - mInventoryPanel = getChild("inventory_inbox"); - - mInventoryPanel->setSortOrder(LLInventoryFilter::SO_DATE); - LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&LLPanelMarketplaceInbox::handleLoginComplete, this)); LLFocusableElement::setFocusReceivedCallback(boost::bind(&LLPanelMarketplaceInbox::onFocusReceived, this)); - - mInventoryPanel->setSelectCallback(boost::bind(&LLPanelMarketplaceInbox::onSelectionChange, this)); - - // Set up the note to display when the inbox is empty - //mInventoryPanel->getFilter()->setEmptyLookupMessage("InboxNoItems"); return TRUE; } @@ -88,6 +79,31 @@ void LLPanelMarketplaceInbox::handleLoginComplete() LLSideTray::getInstance()->setTabButtonBadgeDriver("sidebar_inventory", this); } +void LLPanelMarketplaceInbox::setupInventoryPanel() +{ + LLView * inbox_inventory_placeholder = getChild("inbox_inventory_placeholder"); + LLView * inbox_inventory_parent = inbox_inventory_placeholder->getParent(); + + mInventoryPanel = + LLUICtrlFactory::createFromFile("panel_inbox_inventory.xml", + inbox_inventory_parent, + LLInventoryPanel::child_registry_t::instance()); + + // Reshape the inventory to the proper size + LLRect inventory_placeholder_rect = inbox_inventory_placeholder->getRect(); + mInventoryPanel->setShape(inventory_placeholder_rect); + + // Set the sort order newest to oldest, and a selection change callback + mInventoryPanel->setSortOrder(LLInventoryFilter::SO_DATE); + mInventoryPanel->setSelectCallback(boost::bind(&LLPanelMarketplaceInbox::onSelectionChange, this)); + + // Set up the note to display when the inbox is empty + mInventoryPanel->getFilter()->setEmptyLookupMessage("InventoryInboxNoItems"); + + // Hide the placeholder text + inbox_inventory_placeholder->setVisible(FALSE); +} + void LLPanelMarketplaceInbox::onFocusReceived() { LLSidepanelInventory * sidepanel_inventory = LLSideTray::getInstance()->getPanel("sidepanel_inventory"); @@ -107,9 +123,9 @@ void LLPanelMarketplaceInbox::onFocusReceived() { outbox_panel->clearSelection(); } + + sidepanel_inventory->updateVerbs(); } - - sidepanel_inventory->updateVerbs(); } BOOL LLPanelMarketplaceInbox::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string& tooltip_msg) @@ -129,20 +145,25 @@ 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) + if (mInventoryPanel) { - const LLFolderViewFolder * folder = *folders_it; - - if (folder->getCreationDate() > 1500) + const LLFolderViewFolder * inbox_folder = mInventoryPanel->getRootFolder(); + + if (inbox_folder) { - fresh_item_count++; + 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; + + // TODO: Replace this check with new "fresh" flag + if (folder->getCreationDate() > 1500) + { + fresh_item_count++; + } + } } } @@ -156,27 +177,16 @@ U32 LLPanelMarketplaceInbox::getTotalItemCount() const { U32 item_count = 0; - LLInventoryModel* model = mInventoryPanel->getModel(); - const LLUUID inbox_id = model->findCategoryUUIDForType(LLFolderType::FT_INBOX, false, false); - - if (!inbox_id.isNull()) + if (mInventoryPanel) { - LLInventoryModel::cat_array_t* cats; - LLInventoryModel::item_array_t* items; - - model->getDirectDescendentsOf(inbox_id, cats, items); - - if (cats) - { - item_count += cats->size(); - } - - if (items) + const LLFolderViewFolder * inbox_folder = mInventoryPanel->getRootFolder(); + + if (inbox_folder) { - item_count += items->size(); + item_count += inbox_folder->getFoldersCount(); } } - + return item_count; } -- cgit v1.2.3 From e92d3dcf1013ab340fdef514b41ebf790f79e04c Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 5 Jul 2011 23:40:19 -0700 Subject: EXP-971 FIX New Direct Delivery item does not sort as most recent item in Recent Tab if that tab is open when item delivered --- indra/newview/llpanelmarketplaceinbox.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llpanelmarketplaceinbox.cpp') diff --git a/indra/newview/llpanelmarketplaceinbox.cpp b/indra/newview/llpanelmarketplaceinbox.cpp index 4e7e72a469..af74f8f261 100644 --- a/indra/newview/llpanelmarketplaceinbox.cpp +++ b/indra/newview/llpanelmarketplaceinbox.cpp @@ -31,6 +31,7 @@ #include "llappviewer.h" #include "llbutton.h" #include "llinventorypanel.h" +#include "llfolderview.h" #include "llsidepanelinventory.h" -- cgit v1.2.3