diff options
author | Cinder <cinder.roxley@phoenixviewer.com> | 2014-05-11 23:17:31 -0600 |
---|---|---|
committer | Cinder <cinder.roxley@phoenixviewer.com> | 2014-05-11 23:17:31 -0600 |
commit | 059a29e976a41c30ec9fb346ae53bbc51aa682fc (patch) | |
tree | d03f6bbadedcfcf04be1e86605e46edd62b325b5 /indra | |
parent | a354d0efb33ddace2ef97e702b1e4449adcf51ad (diff) |
Fix callback signal, Eliminate some unnecessary statics
Diffstat (limited to 'indra')
-rwxr-xr-x | indra/newview/llpreviewscript.cpp | 5 | ||||
-rw-r--r-- | indra/newview/llsyntaxid.cpp | 35 | ||||
-rw-r--r-- | indra/newview/llsyntaxid.h | 20 |
3 files changed, 25 insertions, 35 deletions
diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index befec98849..d83a2bc3a6 100755 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -374,7 +374,6 @@ LLScriptEdCore::LLScriptEdCore( setXMLFilename("panel_script_ed.xml"); llassert_always(mContainer != NULL); - mRegionChangedCallback = gAgent.addRegionChangedCallback(boost::bind(&LLScriptEdCore::updateKeywords, this)); } LLScriptEdCore::~LLScriptEdCore() @@ -391,6 +390,7 @@ LLScriptEdCore::~LLScriptEdCore() delete mLiveFile; mRegionChangedCallback.disconnect(); + mFileFetchedCallback.disconnect(); } BOOL LLScriptEdCore::postBuild() @@ -409,7 +409,7 @@ BOOL LLScriptEdCore::postBuild() initMenu(); - LLSyntaxIdLSL::getInstance()->addFileFetchedCallback(boost::bind(&LLScriptEdCore::processKeywords, this)); + mFileFetchedCallback = LLSyntaxIdLSL::getInstance()->addFileFetchedCallback(boost::bind(&LLScriptEdCore::processKeywords, this)); // Intialise keyword highlighting for the current simulator's version of LSL LLSyntaxIdLSL::getInstance()->initialize(); @@ -422,6 +422,7 @@ BOOL LLScriptEdCore::postBuild() { LL_DEBUGS("SyntaxLSL") << "Hashes are the same, no need to update highlighter." << LL_ENDL; } + mRegionChangedCallback = gAgent.addRegionChangedCallback(boost::bind(&LLScriptEdCore::updateKeywords, this)); return TRUE; } diff --git a/indra/newview/llsyntaxid.cpp b/indra/newview/llsyntaxid.cpp index 3582ac024d..093caf3ecf 100644 --- a/indra/newview/llsyntaxid.cpp +++ b/indra/newview/llsyntaxid.cpp @@ -49,7 +49,7 @@ void fetchKeywordsFileResponder::errorWithContent(U32 status, const std::string& reason, const LLSD& content) { - LLSyntaxIdLSL::sLoadFailed = true; + LLSyntaxIdLSL::getInstance()->sLoadFailed = true; LL_WARNS("SyntaxLSL") << "fetchKeywordsFileResponder error [status:" << status << "]: " << content @@ -64,35 +64,35 @@ void fetchKeywordsFileResponder::result(const LLSD& content_ref) LL_DEBUGS("SyntaxLSL") << "content_ref isMap so assuming valid XML." << LL_ENDL; - if (LLSyntaxIdLSL::isSupportedVersion(content_ref)) + if (LLSyntaxIdLSL::getInstance()->isSupportedVersion(content_ref)) { LL_INFOS("SyntaxLSL") << "Supported verson of syntax file." << LL_ENDL; - LLSyntaxIdLSL::setKeywordsXml(content_ref); - LLSyntaxIdLSL::sInitialized = true; - LLSyntaxIdLSL::sLoaded = true; - LLSyntaxIdLSL::sLoadFailed = false; + LLSyntaxIdLSL::getInstance()->setKeywordsXml(content_ref); + LLSyntaxIdLSL::getInstance()->sInitialized = true; + LLSyntaxIdLSL::getInstance()->sLoaded = true; + LLSyntaxIdLSL::getInstance()->sLoadFailed = false; cacheFile(content_ref); } else { - LLSyntaxIdLSL::sLoaded = false; - LLSyntaxIdLSL::sLoadFailed = true; + LLSyntaxIdLSL::getInstance()->sLoaded = false; + LLSyntaxIdLSL::getInstance()->sLoadFailed = true; LL_WARNS("SyntaxLSL") << "Unknown or unsupported version of syntax file." << LL_ENDL; } } else { - LLSyntaxIdLSL::sLoaded = false; - LLSyntaxIdLSL::sLoadFailed = true; + LLSyntaxIdLSL::getInstance()->sLoaded = false; + LLSyntaxIdLSL::getInstance()->sLoadFailed = true; LL_WARNS("SyntaxLSL") << "Syntax file '" << mFileSpec << "' contains invalid LLSD!" << LL_ENDL; } - LLSyntaxIdLSL::sFileFetchedSignal(); + LLSyntaxIdLSL::getInstance()->sFileFetchedSignal(); } void fetchKeywordsFileResponder::cacheFile(const LLSD& content_ref) @@ -113,16 +113,9 @@ void fetchKeywordsFileResponder::cacheFile(const LLSD& content_ref) //----------------------------------------------------------------------------- // LLSyntaxIdLSL //----------------------------------------------------------------------------- -const std::string LLSyntaxIdLSL::CAPABILITY_NAME = "LSLSyntax"; -const std::string LLSyntaxIdLSL::FILENAME_DEFAULT = "keywords_lsl_default.xml"; -const std::string LLSyntaxIdLSL::SIMULATOR_FEATURE = "LSLSyntaxId"; - -bool LLSyntaxIdLSL::sInitialized; -LLSD LLSyntaxIdLSL::sKeywordsXml; -bool LLSyntaxIdLSL::sLoaded; -bool LLSyntaxIdLSL::sLoadFailed; -bool LLSyntaxIdLSL::sVersionChanged; -LLSyntaxIdLSL::file_fetched_signal_t LLSyntaxIdLSL::sFileFetchedSignal; +const std::string CAPABILITY_NAME = "LSLSyntax"; +const std::string FILENAME_DEFAULT = "keywords_lsl_default.xml"; +const std::string SIMULATOR_FEATURE = "LSLSyntaxId"; /** * @brief LLSyntaxIdLSL constructor diff --git a/indra/newview/llsyntaxid.h b/indra/newview/llsyntaxid.h index b68f3f4237..179d622286 100644 --- a/indra/newview/llsyntaxid.h +++ b/indra/newview/llsyntaxid.h @@ -42,17 +42,13 @@ friend class fetchKeywordsFileResponder; public: typedef boost::signals2::signal<void()> file_fetched_signal_t; - static const std::string CAPABILITY_NAME; - static const std::string FILENAME_DEFAULT; - static const std::string SIMULATOR_FEATURE; - protected: - static bool sInitialized; - static LLSD sKeywordsXml; - static bool sLoaded; - static bool sLoadFailed; - static bool sVersionChanged; - static file_fetched_signal_t sFileFetchedSignal; + bool sInitialized; + LLSD sKeywordsXml; + bool sLoaded; + bool sLoadFailed; + bool sVersionChanged; + file_fetched_signal_t sFileFetchedSignal; private: std::string mCapabilityName; @@ -85,8 +81,8 @@ public: void initialize(); bool isLoaded() { return sLoaded; } - static bool isSupportedVersion(const LLSD& content); - static void setKeywordsXml(const LLSD& content) { sKeywordsXml = content; } + bool isSupportedVersion(const LLSD& content); + void setKeywordsXml(const LLSD& content) { sKeywordsXml = content; } boost::signals2::connection addFileFetchedCallback(const file_fetched_signal_t::slot_type& cb); |