diff options
Diffstat (limited to 'indra/newview/llpanelmarketplaceinbox.cpp')
-rw-r--r-- | indra/newview/llpanelmarketplaceinbox.cpp | 44 |
1 files changed, 29 insertions, 15 deletions
diff --git a/indra/newview/llpanelmarketplaceinbox.cpp b/indra/newview/llpanelmarketplaceinbox.cpp index 35961da579..d10e12d3a8 100644 --- a/indra/newview/llpanelmarketplaceinbox.cpp +++ b/indra/newview/llpanelmarketplaceinbox.cpp @@ -52,6 +52,8 @@ LLPanelMarketplaceInbox::LLPanelMarketplaceInbox(const Params& p) , mInboxButton(NULL) , mInventoryPanel(NULL) , mSavedFolderState(NULL) + , mLastItemCount(-1) + , mLastFreshItemCount(-1) { mSavedFolderState = new LLSaveFolderState(); mSavedFolderState->setApply(false); @@ -253,28 +255,40 @@ void LLPanelMarketplaceInbox::draw() llassert(mFreshCountCtrl != NULL); - if (item_count > 0) + if (mLastItemCount != item_count) { - std::string item_count_str = llformat("%d", item_count); - - LLStringUtil::format_map_t args; - args["[NUM]"] = item_count_str; - mInboxButton->setLabel(getString("InboxLabelWithArg", args)); - - // set green text to fresh item count - U32 fresh_item_count = getFreshItemCount(); - mFreshCountCtrl->setVisible((fresh_item_count > 0)); + mLastItemCount = item_count; + if (item_count > 0) + { + std::string item_count_str = llformat("%d", item_count); - if (fresh_item_count > 0) + LLStringUtil::format_map_t args; + args["[NUM]"] = item_count_str; + // setLabel is expensive, causes buffer regeneration + mInboxButton->setLabel(getString("InboxLabelWithArg", args)); + } + else { - mFreshCountCtrl->setTextArg("[NUM]", llformat("%d", fresh_item_count)); + mInboxButton->setLabel(getString("InboxLabelNoArg")); + + mFreshCountCtrl->setVisible(false); } } - else + + if (item_count > 0) { - mInboxButton->setLabel(getString("InboxLabelNoArg")); + // set green text to fresh item count + U32 fresh_item_count = getFreshItemCount(); + if (mLastFreshItemCount != fresh_item_count) + { + mLastFreshItemCount = fresh_item_count; + mFreshCountCtrl->setVisible((fresh_item_count > 0)); - mFreshCountCtrl->setVisible(false); + if (fresh_item_count > 0) + { + mFreshCountCtrl->setTextArg("[NUM]", llformat("%d", fresh_item_count)); + } + } } LLPanel::draw(); |