Change SignaledTyped signal to pass the new value to the callback method

Thu, 07 Dec 2017 00:00:14 +0100

author
Ansariel
date
Thu, 07 Dec 2017 00:00:14 +0100
changeset 53553
6ab387a6b37f
parent 53552
87c50836d294
child 53554
24e35bc49c23

Change SignaledTyped signal to pass the new value to the callback method

indra/newview/lfsimfeaturehandler.cpp file | annotate | diff | revisions
indra/newview/lfsimfeaturehandler.h file | annotate | diff | revisions
indra/newview/llfloateravatar.cpp file | annotate | diff | revisions
indra/newview/llfloateravatar.h file | annotate | diff | revisions
indra/newview/llfloaterdestinations.cpp file | annotate | diff | revisions
indra/newview/llfloaterdestinations.h file | annotate | diff | revisions
     1.1 --- a/indra/newview/lfsimfeaturehandler.cpp	Wed Dec 06 17:15:16 2017 +0100
     1.2 +++ b/indra/newview/lfsimfeaturehandler.cpp	Thu Dec 07 00:00:14 2017 +0100
     1.3 @@ -271,37 +271,37 @@
     1.4  }
     1.5  // </COLOSI opensim multi-currency support>
     1.6  
     1.7 -boost::signals2::connection LFSimFeatureHandler::setSupportsExportCallback(const boost::signals2::signal<void()>::slot_type& slot)
     1.8 +boost::signals2::connection LFSimFeatureHandler::setSupportsExportCallback(const SignaledType<bool>::changed_signal_t& slot)
     1.9  {
    1.10  	return mSupportsExport.connect(slot);
    1.11  }
    1.12  
    1.13 -boost::signals2::connection LFSimFeatureHandler::setSearchURLCallback(const boost::signals2::signal<void()>::slot_type& slot)
    1.14 +boost::signals2::connection LFSimFeatureHandler::setSearchURLCallback(const SignaledType<std::string>::changed_signal_t& slot)
    1.15  {
    1.16  	return mSearchURL.connect(slot);
    1.17  }
    1.18  
    1.19 -boost::signals2::connection LFSimFeatureHandler::setSayRangeCallback(const boost::signals2::signal<void()>::slot_type& slot)
    1.20 +boost::signals2::connection LFSimFeatureHandler::setSayRangeCallback(const SignaledType<U32>::changed_signal_t& slot)
    1.21  {
    1.22  	return mSayRange.connect(slot);
    1.23  }
    1.24  
    1.25 -boost::signals2::connection LFSimFeatureHandler::setShoutRangeCallback(const boost::signals2::signal<void()>::slot_type& slot)
    1.26 +boost::signals2::connection LFSimFeatureHandler::setShoutRangeCallback(const SignaledType<U32>::changed_signal_t& slot)
    1.27  {
    1.28  	return mShoutRange.connect(slot);
    1.29  }
    1.30  
    1.31 -boost::signals2::connection LFSimFeatureHandler::setWhisperRangeCallback(const boost::signals2::signal<void()>::slot_type& slot)
    1.32 +boost::signals2::connection LFSimFeatureHandler::setWhisperRangeCallback(const SignaledType<U32>::changed_signal_t& slot)
    1.33  {
    1.34  	return mWhisperRange.connect(slot);
    1.35  }
    1.36  
    1.37 -boost::signals2::connection LFSimFeatureHandler::setAvatarPickerCallback(const boost::signals2::signal<void()>::slot_type& slot)
    1.38 +boost::signals2::connection LFSimFeatureHandler::setAvatarPickerCallback(const SignaledType<std::string>::changed_signal_t& slot)
    1.39  {
    1.40  	return mAvatarPickerURL.connect(slot);
    1.41  }
    1.42  
    1.43 -boost::signals2::connection LFSimFeatureHandler::setDestinationGuideCallback(const boost::signals2::signal<void()>::slot_type& slot)
    1.44 +boost::signals2::connection LFSimFeatureHandler::setDestinationGuideCallback(const SignaledType<std::string>::changed_signal_t& slot)
    1.45  {
    1.46  	return mDestinationGuideURL.connect(slot);
    1.47  }
     2.1 --- a/indra/newview/lfsimfeaturehandler.h	Wed Dec 06 17:15:16 2017 +0100
     2.2 +++ b/indra/newview/lfsimfeaturehandler.h	Thu Dec 07 00:00:14 2017 +0100
     2.3 @@ -21,21 +21,22 @@
     2.4  #include "llsingleton.h"
     2.5  #include "llpermissions.h"	// ExportPolicy
     2.6  
     2.7 -template<typename Type, typename Signal = boost::signals2::signal<void()> >
     2.8 +template<typename Type, typename Signal = boost::signals2::signal<void(Type)> >
     2.9  class SignaledType
    2.10  {
    2.11  public:
    2.12  	SignaledType() : mValue() {}
    2.13  	SignaledType(Type b) : mValue(b) {}
    2.14  
    2.15 -	boost::signals2::connection connect(const typename Signal::slot_type& slot) { return mSignal.connect(slot); }
    2.16 +	typedef typename Signal::slot_type changed_signal_t;
    2.17 +	boost::signals2::connection connect(const typename changed_signal_t& slot) { return mSignal.connect(slot); }
    2.18  
    2.19  	SignaledType& operator =(Type val)
    2.20  	{
    2.21  		if (val != mValue)
    2.22  		{
    2.23  			mValue = val;
    2.24 -			mSignal();
    2.25 +			mSignal(mValue);
    2.26  		}
    2.27  		return *this;
    2.28  	}
    2.29 @@ -76,13 +77,13 @@
    2.30  	// </COLOSI opensim multi-currency support>
    2.31  
    2.32  	// Connection setters
    2.33 -	boost::signals2::connection setSupportsExportCallback(const boost::signals2::signal<void()>::slot_type& slot);
    2.34 -	boost::signals2::connection setSearchURLCallback(const boost::signals2::signal<void()>::slot_type& slot);
    2.35 -	boost::signals2::connection setSayRangeCallback(const boost::signals2::signal<void()>::slot_type& slot);
    2.36 -	boost::signals2::connection setShoutRangeCallback(const boost::signals2::signal<void()>::slot_type& slot);
    2.37 -	boost::signals2::connection setWhisperRangeCallback(const boost::signals2::signal<void()>::slot_type& slot);
    2.38 -	boost::signals2::connection setAvatarPickerCallback(const boost::signals2::signal<void()>::slot_type& slot);
    2.39 -	boost::signals2::connection setDestinationGuideCallback(const boost::signals2::signal<void()>::slot_type& slot);
    2.40 +	boost::signals2::connection setSupportsExportCallback(const SignaledType<bool>::changed_signal_t& slot);
    2.41 +	boost::signals2::connection setSearchURLCallback(const SignaledType<std::string>::changed_signal_t& slot);
    2.42 +	boost::signals2::connection setSayRangeCallback(const SignaledType<U32>::changed_signal_t& slot);
    2.43 +	boost::signals2::connection setShoutRangeCallback(const SignaledType<U32>::changed_signal_t& slot);
    2.44 +	boost::signals2::connection setWhisperRangeCallback(const SignaledType<U32>::changed_signal_t& slot);
    2.45 +	boost::signals2::connection setAvatarPickerCallback(const SignaledType<std::string>::changed_signal_t& slot);
    2.46 +	boost::signals2::connection setDestinationGuideCallback(const SignaledType<std::string>::changed_signal_t& slot);
    2.47  
    2.48  	// Accessors
    2.49  	bool simSupportsExport() const { return mSupportsExport; }
     3.1 --- a/indra/newview/llfloateravatar.cpp	Wed Dec 06 17:15:16 2017 +0100
     3.2 +++ b/indra/newview/llfloateravatar.cpp	Thu Dec 07 00:00:14 2017 +0100
     3.3 @@ -80,13 +80,13 @@
     3.4  	// region the avatar logs into as well.
     3.5  	if (!mAvatarPickerUrlChangedSignal.connected())
     3.6  	{
     3.7 -		mAvatarPickerUrlChangedSignal = LFSimFeatureHandler::instance().setAvatarPickerCallback(boost::bind(&LLFloaterAvatar::handleUrlChanged, this));
     3.8 +		mAvatarPickerUrlChangedSignal = LFSimFeatureHandler::instance().setAvatarPickerCallback(boost::bind(&LLFloaterAvatar::handleUrlChanged, this, _1));
     3.9  	}
    3.10  }
    3.11  
    3.12 -void LLFloaterAvatar::handleUrlChanged()
    3.13 +void LLFloaterAvatar::handleUrlChanged(const std::string& url)
    3.14  {
    3.15 -	getChild<LLMediaCtrl>("avatar_picker_contents")->navigateTo(LLWeb::expandURLSubstitutions(LFSimFeatureHandler::instance().avatarPickerURL(), LLSD()), HTTP_CONTENT_TEXT_HTML);
    3.16 +	getChild<LLMediaCtrl>("avatar_picker_contents")->navigateTo(LLWeb::expandURLSubstitutions(url, LLSD()), HTTP_CONTENT_TEXT_HTML);
    3.17  }
    3.18  // </FS:Ansariel>
    3.19  
     4.1 --- a/indra/newview/llfloateravatar.h	Wed Dec 06 17:15:16 2017 +0100
     4.2 +++ b/indra/newview/llfloateravatar.h	Thu Dec 07 00:00:14 2017 +0100
     4.3 @@ -41,7 +41,7 @@
     4.4  
     4.5  	// <FS:Ansariel> Avatar chooser does not change between OpenSim grids
     4.6  	/*virtual*/ void onOpen(const LLSD& key);
     4.7 -	void handleUrlChanged();
     4.8 +	void handleUrlChanged(const std::string& url);
     4.9  
    4.10  	boost::signals2::connection mAvatarPickerUrlChangedSignal;
    4.11  	// </FS:Ansariel>
     5.1 --- a/indra/newview/llfloaterdestinations.cpp	Wed Dec 06 17:15:16 2017 +0100
     5.2 +++ b/indra/newview/llfloaterdestinations.cpp	Thu Dec 07 00:00:14 2017 +0100
     5.3 @@ -72,14 +72,14 @@
     5.4  	// region the avatar logs into as well.
     5.5  	if (!mDestinationGuideUrlChangedSignal.connected())
     5.6  	{
     5.7 -		mDestinationGuideUrlChangedSignal = LFSimFeatureHandler::instance().setDestinationGuideCallback(boost::bind(&LLFloaterDestinations::handleUrlChanged, this));
     5.8 +		mDestinationGuideUrlChangedSignal = LFSimFeatureHandler::instance().setDestinationGuideCallback(boost::bind(&LLFloaterDestinations::handleUrlChanged, this, _1));
     5.9  	}
    5.10  
    5.11 -	handleUrlChanged();
    5.12 +	handleUrlChanged(LFSimFeatureHandler::instance().destinationGuideURL());
    5.13  }
    5.14  
    5.15 -void LLFloaterDestinations::handleUrlChanged()
    5.16 +void LLFloaterDestinations::handleUrlChanged(const std::string& url)
    5.17  {
    5.18 -	getChild<LLMediaCtrl>("destination_guide_contents")->navigateTo(LLWeb::expandURLSubstitutions(LFSimFeatureHandler::instance().destinationGuideURL(), LLSD()), HTTP_CONTENT_TEXT_HTML);
    5.19 +	getChild<LLMediaCtrl>("destination_guide_contents")->navigateTo(LLWeb::expandURLSubstitutions(url, LLSD()), HTTP_CONTENT_TEXT_HTML);
    5.20  }
    5.21  // </FS:Ansariel>
     6.1 --- a/indra/newview/llfloaterdestinations.h	Wed Dec 06 17:15:16 2017 +0100
     6.2 +++ b/indra/newview/llfloaterdestinations.h	Thu Dec 07 00:00:14 2017 +0100
     6.3 @@ -41,7 +41,7 @@
     6.4  
     6.5  	// <FS:Ansariel> FIRE-16833: Destination guide does not change between OpenSim grids
     6.6  	/*virtual*/ void onOpen(const LLSD& key);
     6.7 -	void handleUrlChanged();
     6.8 +	void handleUrlChanged(const std::string& url);
     6.9  
    6.10  	boost::signals2::connection mDestinationGuideUrlChangedSignal;
    6.11  	// </FS:Ansariel>

mercurial