summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterbuy.cpp
diff options
context:
space:
mode:
authorCallum Prentice <callum@lindenlab.com>2021-04-29 13:41:02 -0700
committerCallum Prentice <callum@lindenlab.com>2021-04-29 13:41:02 -0700
commite41412eddaa5e8fcc808018aadc844dd68c6c247 (patch)
tree9dea64df34a79e5d6454ab0f29c52e70243b388e /indra/newview/llfloaterbuy.cpp
parent75f26d123da0d90c13f1614118c4ace8c1f04598 (diff)
parentce65bc2f13409d75dbc6502c970030cc5ed2e5ad (diff)
Merge remote-tracking branch 'origin/master' into DRTVWR-531
Diffstat (limited to 'indra/newview/llfloaterbuy.cpp')
-rw-r--r--indra/newview/llfloaterbuy.cpp39
1 files changed, 38 insertions, 1 deletions
diff --git a/indra/newview/llfloaterbuy.cpp b/indra/newview/llfloaterbuy.cpp
index 4d3ebcda1e..ea93d3bfaa 100644
--- a/indra/newview/llfloaterbuy.cpp
+++ b/indra/newview/llfloaterbuy.cpp
@@ -49,7 +49,8 @@
#include "lltrans.h"
LLFloaterBuy::LLFloaterBuy(const LLSD& key)
-: LLFloater(key)
+: LLFloater(key),
+ mSelectionUpdateSlot()
{
}
@@ -179,12 +180,19 @@ void LLFloaterBuy::show(const LLSaleInfo& sale_info)
floater->getChild<LLUICtrl>("buy_text")->setTextArg("[AMOUNT]", llformat("%d", sale_info.getSalePrice()));
floater->getChild<LLUICtrl>("buy_name_text")->setTextArg("[NAME]", owner_name);
+ floater->showViews(true);
+
// Must do this after the floater is created, because
// sometimes the inventory is already there and
// the callback is called immediately.
LLViewerObject* obj = selection->getFirstRootObject();
floater->registerVOInventoryListener(obj,NULL);
floater->requestVOInventory();
+
+ if (!floater->mSelectionUpdateSlot.connected())
+ {
+ floater->mSelectionUpdateSlot = LLSelectMgr::getInstance()->mUpdateSignal.connect(boost::bind(&LLFloaterBuy::onSelectionChanged, floater));
+ }
}
void LLFloaterBuy::inventoryChanged(LLViewerObject* obj,
@@ -280,6 +288,30 @@ void LLFloaterBuy::inventoryChanged(LLViewerObject* obj,
removeVOInventoryListener();
}
+void LLFloaterBuy::onSelectionChanged()
+{
+
+ if (LLSelectMgr::getInstance()->getEditSelection()->getRootObjectCount() == 0)
+ {
+ removeVOInventoryListener();
+ closeFloater();
+ }
+ else if (LLSelectMgr::getInstance()->getEditSelection()->getRootObjectCount() > 1)
+ {
+ removeVOInventoryListener();
+ showViews(false);
+ reset();
+ setTitle(getString("mupliple_selected"));
+ }
+}
+
+void LLFloaterBuy::showViews(bool show)
+{
+ getChild<LLUICtrl>("buy_btn")->setEnabled(show);
+ getChild<LLUICtrl>("buy_text")->setVisible(show);
+ getChild<LLUICtrl>("buy_name_text")->setVisible(show);
+}
+
void LLFloaterBuy::onClickBuy()
{
// Put the items where we put new folders.
@@ -303,5 +335,10 @@ void LLFloaterBuy::onClickCancel()
// virtual
void LLFloaterBuy::onClose(bool app_quitting)
{
+ if (mSelectionUpdateSlot.connected())
+ {
+ mSelectionUpdateSlot.disconnect();
+ }
+
mObjectSelection.clear();
}