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)
meow-7.2.2
Leslie Linden 2011-06-16 17:14:51 -07:00
parent 1be0392d4a
commit 0d246c0c5f
8 changed files with 123 additions and 14 deletions

View File

@ -193,6 +193,9 @@ BOOL LLPanelMainInventory::postBuild()
mMenuAdd->getChild<LLMenuItemGL>("Upload Animation")->setLabelArg("[COST]", upload_cost);
mMenuAdd->getChild<LLMenuItemGL>("Bulk Upload")->setLabelArg("[COST]", upload_cost);
// Trigger callback for focus received so we can deselect items in inbox/outbox
LLFocusableElement::setFocusReceivedCallback(boost::bind(&LLPanelMainInventory::onFocusReceived, this));
return TRUE;
}
@ -572,6 +575,23 @@ void LLPanelMainInventory::updateItemcountText()
getChild<LLUICtrl>("ItemcountText")->setValue(text);
}
void LLPanelMainInventory::onFocusReceived()
{
LLInventoryPanel * inbox_panel = findChild<LLInventoryPanel>("inventory_inbox");
if (inbox_panel)
{
inbox_panel->clearSelection();
}
LLInventoryPanel * outbox_panel = findChild<LLInventoryPanel>("inventory_outbox");
if (outbox_panel)
{
outbox_panel->clearSelection();
}
}
void LLPanelMainInventory::setFilterTextFromFilter()
{
mFilterText = mActivePanel->getFilter()->getFilterText();

View File

@ -114,6 +114,8 @@ protected:
bool isSaveTextureEnabled(const LLSD& userdata);
void updateItemcountText();
void onFocusReceived();
private:
LLFloaterInventoryFinder* getFinder();

View File

@ -31,6 +31,11 @@
#include "llappviewer.h"
#include "llbutton.h"
#include "llinventorypanel.h"
#include "llsidepanelinventory.h"
#define SUPPORTING_FRESH_ITEM_COUNT 0
static LLRegisterPanelClassWrapper<LLPanelMarketplaceInbox> 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<LLSidepanelInventory>("sidepanel_inventory");
if (sidepanel_inventory)
{
LLInventoryPanel * inv_panel = sidepanel_inventory->getActivePanel();
if (inv_panel)
{
inv_panel->clearSelection();
}
LLInventoryPanel * outbox_panel = sidepanel_inventory->findChild<LLInventoryPanel>("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<LLButton>("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<LLUICtrl>("inbox_fresh_new_count")->setTextArg("[NUM]", llformat("%d", fresh_item_count));
}
#else
fresh_new_count_view->setVisible(FALSE);
#endif
}
else
{

View File

@ -63,6 +63,8 @@ public:
private:
void handleLoginComplete();
void onFocusReceived();
private:
LLInventoryPanel* mInventoryPanel;
};

View File

@ -31,7 +31,11 @@
#include "llbutton.h"
#include "llcoros.h"
#include "lleventcoro.h"
#include "llinventorypanel.h"
#include "llloadingindicator.h"
#include "llpanelmarketplaceinbox.h"
#include "llsidepanelinventory.h"
#include "llsidetray.h"
#include "lltimer.h"
@ -60,9 +64,33 @@ BOOL LLPanelMarketplaceOutbox::postBuild()
mSyncButton->setEnabled(!isOutboxEmpty());
LLFocusableElement::setFocusReceivedCallback(boost::bind(&LLPanelMarketplaceOutbox::onFocusReceived, this));
return TRUE;
}
void LLPanelMarketplaceOutbox::onFocusReceived()
{
LLSidepanelInventory * sidepanel_inventory = LLSideTray::getInstance()->getPanel<LLSidepanelInventory>("sidepanel_inventory");
if (sidepanel_inventory)
{
LLInventoryPanel * inv_panel = sidepanel_inventory->getActivePanel();
if (inv_panel)
{
inv_panel->clearSelection();
}
LLInventoryPanel * inbox_panel = sidepanel_inventory->findChild<LLInventoryPanel>("inventory_inbox");
if (inbox_panel)
{
inbox_panel->clearSelection();
}
}
}
bool LLPanelMarketplaceOutbox::isOutboxEmpty() const
{
// TODO: Check for contents of outbox

View File

@ -54,6 +54,8 @@ protected:
void onSyncButtonClicked();
void updateSyncButtonStatus();
void onFocusReceived();
private:
LLButton * mSyncButton;
LLLoadingIndicator * mSyncIndicator;

View File

@ -32,10 +32,10 @@
#include "llappviewer.h"
#include "llavataractions.h"
#include "llbutton.h"
#include "llcurl.h"
#include "lldate.h"
#include "llfirstuse.h"
#include "llfoldertype.h"
#include "llhttpclient.h"
#include "llinventorybridge.h"
#include "llinventoryfunctions.h"
#include "llinventorymodel.h"
@ -69,6 +69,9 @@ static const char * const INBOX_LAYOUT_PANEL_NAME = "inbox_layout_panel";
static const char * const OUTBOX_LAYOUT_PANEL_NAME = "outbox_layout_panel";
static const char * const MAIN_INVENTORY_LAYOUT_PANEL = "main_inventory_layout_panel";
static const char * const INBOX_INVENTORY_PANEL = "inventory_inbox";
static const char * const OUTBOX_INVENTORY_PANEL = "inventory_outbox";
static const char * const INVENTORY_LAYOUT_STACK_NAME = "inventory_layout_stack";
//
@ -84,14 +87,23 @@ public:
{
}
void errorWithContent(U32 status, const std::string& reason, const LLSD& content)
void completed(U32 status, const std::string& reason, const LLSD& content)
{
llinfos << "Marketplace Inbox Disabled" << llendl;
}
void result(const LLSD& content)
{
mSidepanelInventory->enableInbox(true);
if (isGoodStatus(status))
{
// Complete success
mSidepanelInventory->enableInbox(true);
}
else if (status == 401)
{
// API is available for use but OpenID authorization failed
mSidepanelInventory->enableInbox(true);
}
else
{
// API in unavailable
llinfos << "Marketplace API is unavailable -- Inbox Disabled" << llendl;
}
}
private:
@ -106,7 +118,8 @@ LLSidepanelInventory::LLSidepanelInventory()
: LLPanel()
, mItemPanel(NULL)
, mPanelMainInventory(NULL)
, mInventoryFetched(false)
, mInboxEnabled(false)
, mOutboxEnabled(false)
, mCategoriesObserver(NULL)
{
//buildFromFile( "panel_inventory.xml"); // Called from LLRegisterPanelClass::defaultPanelClassBuilder()
@ -205,8 +218,8 @@ BOOL LLSidepanelInventory::postBuild()
outbox_button->setCommitCallback(boost::bind(&LLSidepanelInventory::onToggleOutboxBtn, this));
// Set the inbox and outbox visible based on debug settings (final setting comes from http request below)
inbox_panel->setVisible(gSavedSettings.getBOOL("InventoryDisplayInbox"));
outbox_panel->setVisible(gSavedSettings.getBOOL("InventoryDisplayOutbox"));
enableInbox(gSavedSettings.getBOOL("InventoryDisplayInbox"));
enableOutbox(gSavedSettings.getBOOL("InventoryDisplayOutbox"));
// Trigger callback for after login so we can setup to track inbox and outbox changes after initial inventory load
LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&LLSidepanelInventory::handleLoginComplete, this));
@ -258,11 +271,13 @@ void LLSidepanelInventory::handleLoginComplete()
void LLSidepanelInventory::enableInbox(bool enabled)
{
mInboxEnabled = enabled;
getChild<LLLayoutPanel>(INBOX_LAYOUT_PANEL_NAME)->setVisible(enabled);
}
void LLSidepanelInventory::enableOutbox(bool enabled)
{
mOutboxEnabled = enabled;
getChild<LLLayoutPanel>(OUTBOX_LAYOUT_PANEL_NAME)->setVisible(enabled);
}

View File

@ -43,8 +43,10 @@ public:
LLSidepanelInventory();
virtual ~LLSidepanelInventory();
private:
void handleLoginComplete();
public:
/*virtual*/ BOOL postBuild();
/*virtual*/ void onOpen(const LLSD& key);
@ -65,6 +67,9 @@ public:
void enableInbox(bool enabled);
void enableOutbox(bool enabled);
bool isInboxEnabled() const { return mInboxEnabled; }
bool isOutboxEnabled() const { return mOutboxEnabled; }
protected:
// Tracks highlighted (selected) item in inventory panel.
LLInventoryItem *getSelectedItem();
@ -107,7 +112,8 @@ private:
LLButton* mOverflowBtn;
LLButton* mShopBtn;
bool mInventoryFetched;
bool mInboxEnabled;
bool mOutboxEnabled;
LLInventoryCategoriesObserver* mCategoriesObserver;
};