diff options
| -rw-r--r-- | indra/newview/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | indra/newview/llstartup.cpp | 13 | ||||
| -rw-r--r-- | indra/newview/llstartup.h | 8 | ||||
| -rw-r--r-- | indra/newview/llstartuplistener.cpp | 34 | ||||
| -rw-r--r-- | indra/newview/llstartuplistener.h | 30 | 
5 files changed, 84 insertions, 3 deletions
| diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 76b967eb82..f5abd3baab 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -389,6 +389,7 @@ set(viewer_SOURCE_FILES      llsplitbutton.cpp      llsprite.cpp      llstartup.cpp +    llstartuplistener.cpp      llstatusbar.cpp      llstylemap.cpp      llsurface.cpp @@ -891,6 +892,7 @@ set(viewer_HEADER_FILES      llsplitbutton.h      llsprite.h      llstartup.h +    llstartuplistener.h      llstatusbar.h      llstylemap.h      llsurface.h diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 58df2ffb19..12ae12d4ae 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -193,6 +193,7 @@  #include "lllogin.h"  #include "llevents.h" +#include "llstartuplistener.h"  #if LL_WINDOWS  #include "llwindebug.h" @@ -241,7 +242,8 @@ static std::string gFirstSimSeedCap;  static LLVector3 gAgentStartLookAt(1.0f, 0.f, 0.f);  static std::string gAgentStartLocation = "safe"; -static LLEventStream sStartupStateWatcher("StartupState"); +boost::scoped_ptr<LLEventPump> LLStartUp::sStateWatcher(new LLEventStream("StartupState")); +boost::scoped_ptr<LLStartupListener> LLStartUp::sListener(new LLStartupListener());  //  // local function declaration @@ -2725,10 +2727,15 @@ void LLStartUp::setStartupState( EStartupState state )  		getStartupStateString() << " to " <<    		startupStateToString(state) << LL_ENDL;  	gStartupState = state; +	postStartupState(); +} + +void LLStartUp::postStartupState() +{  	LLSD stateInfo;  	stateInfo["str"] = getStartupStateString(); -	stateInfo["enum"] = state; -	sStartupStateWatcher.post(stateInfo); +	stateInfo["enum"] = gStartupState; +	sStateWatcher->post(stateInfo);  } diff --git a/indra/newview/llstartup.h b/indra/newview/llstartup.h index 7f869d014f..ab11b42e74 100644 --- a/indra/newview/llstartup.h +++ b/indra/newview/llstartup.h @@ -33,7 +33,11 @@  #ifndef LL_LLSTARTUP_H  #define LL_LLSTARTUP_H +#include <boost/scoped_ptr.hpp> +  class LLViewerTexture ; +class LLEventPump; +class LLStartupListener;  // functions  bool idle_startup(); @@ -113,9 +117,13 @@ public:  		// *HACK: On startup, if we were passed a secondlife://app/do/foo  		// command URL, store it for later processing. +	static void postStartupState(); +  private:  	static std::string startupStateToString(EStartupState state);  	static EStartupState gStartupState; // Do not set directly, use LLStartup::setStartupState +	static boost::scoped_ptr<LLEventPump> sStateWatcher; +	static boost::scoped_ptr<LLStartupListener> sListener;  }; diff --git a/indra/newview/llstartuplistener.cpp b/indra/newview/llstartuplistener.cpp new file mode 100644 index 0000000000..5a76a297c7 --- /dev/null +++ b/indra/newview/llstartuplistener.cpp @@ -0,0 +1,34 @@ +/** + * @file   llstartuplistener.cpp + * @author Nat Goodspeed + * @date   2009-12-08 + * @brief  Implementation for llstartuplistener. + *  + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * Copyright (c) 2009, Linden Research, Inc. + * $/LicenseInfo$ + */ + +// Precompiled header +#include "llviewerprecompiledheaders.h" +// associated header +#include "llstartuplistener.h" +// STL headers +// std headers +// external library headers +// other Linden headers +#include "llstartup.h" + + +LLStartupListener::LLStartupListener(/* LLStartUp* instance */): +    LLEventAPI("LLStartUp", "Access e.g. LLStartup::postStartupState()") /* , +    mStartup(instance) */ +{ +    add("postStartupState", "Refresh \"StartupState\" listeners with current startup state", +        &LLStartupListener::postStartupState); +} + +void LLStartupListener::postStartupState(const LLSD&) const +{ +    LLStartUp::postStartupState(); +} diff --git a/indra/newview/llstartuplistener.h b/indra/newview/llstartuplistener.h new file mode 100644 index 0000000000..a2a4d3a08e --- /dev/null +++ b/indra/newview/llstartuplistener.h @@ -0,0 +1,30 @@ +/** + * @file   llstartuplistener.h + * @author Nat Goodspeed + * @date   2009-12-07 + * @brief  Event API to provide access to LLStartUp + *  + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * Copyright (c) 2009, Linden Research, Inc. + * $/LicenseInfo$ + */ + +#if ! defined(LL_LLSTARTUPLISTENER_H) +#define LL_LLSTARTUPLISTENER_H + +#include "lleventapi.h" +class LLStartUp; +class LLSD; + +class LLStartupListener: public LLEventAPI +{ +public: +    LLStartupListener(/* LLStartUp* instance */); // all static members! + +private: +    void postStartupState(const LLSD&) const; + +    //LLStartup* mStartup; +}; + +#endif /* ! defined(LL_LLSTARTUPLISTENER_H) */ | 
