Have Drop Targets with settings update when their settings update.

This commit is contained in:
Inusaito Sayori
2014-09-22 03:43:59 -04:00
parent 06584a38ab
commit 4a699d6160
2 changed files with 9 additions and 0 deletions

View File

@@ -37,6 +37,8 @@
#include "lldroptarget.h" #include "lldroptarget.h"
#include <boost/signals2/shared_connection_block.hpp>
#include "llinventorymodel.h" #include "llinventorymodel.h"
#include "llstartup.h" #include "llstartup.h"
#include "lltextbox.h" #include "lltextbox.h"
@@ -135,6 +137,7 @@ void LLDropTarget::setControlName(const std::string& control_name, LLView* conte
if (control_name.empty()) // The "empty set" if (control_name.empty()) // The "empty set"
{ {
mControl = NULL; mControl = NULL;
mConnection.disconnect();
return; // This DropTarget never changes text, it isn't tied to a control return; // This DropTarget never changes text, it isn't tied to a control
} }
@@ -159,6 +162,10 @@ void LLDropTarget::setControlName(const std::string& control_name, LLView* conte
else else
text = LLTrans::getString("CurrentlySetToAnItemNotOnThisAccount"); text = LLTrans::getString("CurrentlySetToAnItemNotOnThisAccount");
} }
if (mControl)
mConnection = mControl->getSignal()->connect(boost::bind(&LLView::setValue, this, _2));
else
mConnection.disconnect();
mText->setText(text); mText->setText(text);
} }
@@ -186,6 +193,7 @@ void LLDropTarget::setControlValue(const std::string& val)
{ {
if (mControl) if (mControl)
{ {
boost::signals2::shared_connection_block block(mConnection);
mControl->setValue(val); mControl->setValue(val);
} }
} }

View File

@@ -82,6 +82,7 @@ protected:
LLUUID mEntityID; LLUUID mEntityID;
class LLViewBorder* mBorder; class LLViewBorder* mBorder;
LLControlVariable* mControl; LLControlVariable* mControl;
boost::signals2::scoped_connection mConnection;
class LLTextBox* mText; class LLTextBox* mText;
}; };