Merge branch 'master' of git://github.com/siana/SingularityViewer.git into V2MultiWear
Conflicts: indra/newview/llfloateravatarlist.cpp indra/newview/llfloateropenobject.cpp indra/newview/llinventorybridge.cpp indra/newview/llviewerinventory.cpp
This commit is contained in:
@@ -62,7 +62,7 @@
|
||||
#include "llevent.h"
|
||||
|
||||
template <class T>
|
||||
class LLMemberListener : public LLSimpleListener
|
||||
class LLMemberListener : public LLOldEvents::LLSimpleListener
|
||||
{
|
||||
public:
|
||||
LLMemberListener() : mPtr(NULL), mRegisteredName() { }
|
||||
@@ -75,7 +75,7 @@ public:
|
||||
}
|
||||
|
||||
// This is what you have to override to handle this event
|
||||
virtual bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) = 0;
|
||||
virtual bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata) = 0;
|
||||
|
||||
protected:
|
||||
T *mPtr; // The object that this listener manipulates
|
||||
|
||||
@@ -67,6 +67,8 @@
|
||||
#include <set>
|
||||
#include <boost/tokenizer.hpp>
|
||||
|
||||
using namespace LLOldEvents;
|
||||
|
||||
// static
|
||||
LLMenuHolderGL *LLMenuGL::sMenuContainer = NULL;
|
||||
|
||||
|
||||
@@ -263,7 +263,7 @@ public:
|
||||
// calls a user defined callback.
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
class LLMenuItemCallGL : public LLMenuItemGL, public LLObservable
|
||||
class LLMenuItemCallGL : public LLMenuItemGL, public LLOldEvents::LLObservable
|
||||
{
|
||||
public:
|
||||
// normal constructor
|
||||
|
||||
@@ -100,43 +100,12 @@
|
||||
#include "llinstancetracker.h"
|
||||
|
||||
// and we need this to manage the notification callbacks
|
||||
#include "llevents.h"
|
||||
#include "llfunctorregistry.h"
|
||||
#include "llui.h"
|
||||
#include "llxmlnode.h"
|
||||
#include "llnotificationptr.h"
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* Signal and handler declarations
|
||||
* Using a single handler signature means that we can have a common handler
|
||||
* type, rather than needing a distinct one for each different handler.
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
* A boost::signals2 Combiner that stops the first time a handler returns true
|
||||
* We need this because we want to have our handlers return bool, so that
|
||||
* we have the option to cause a handler to stop further processing. The
|
||||
* default handler fails when the signal returns a value but has no slots.
|
||||
*/
|
||||
struct LLStopWhenHandled
|
||||
{
|
||||
typedef bool result_type;
|
||||
|
||||
template<typename InputIterator>
|
||||
result_type operator()(InputIterator first, InputIterator last) const
|
||||
{
|
||||
for (InputIterator si = first; si != last; ++si)
|
||||
{
|
||||
if (*si)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
typedef enum e_notification_priority
|
||||
{
|
||||
NOTIFICATION_PRIORITY_UNSPECIFIED,
|
||||
@@ -146,27 +115,11 @@ typedef enum e_notification_priority
|
||||
NOTIFICATION_PRIORITY_CRITICAL
|
||||
} ENotificationPriority;
|
||||
|
||||
/**
|
||||
* We want to have a standard signature for all signals; this way,
|
||||
* we can easily document a protocol for communicating across
|
||||
* dlls and into scripting languages someday.
|
||||
* we want to return a bool to indicate whether the signal has been
|
||||
* handled and should NOT be passed on to other listeners.
|
||||
* Return true to stop further handling of the signal, and false
|
||||
* to continue.
|
||||
* We take an LLSD because this way the contents of the signal
|
||||
* are independent of the API used to communicate it.
|
||||
* It is const ref because then there's low cost to pass it;
|
||||
* if you only need to inspect it, it's very cheap.
|
||||
*/
|
||||
|
||||
typedef boost::function<void (const LLSD&, const LLSD&)> LLNotificationResponder;
|
||||
|
||||
typedef LLFunctorRegistry<LLNotificationResponder> LLNotificationFunctorRegistry;
|
||||
typedef LLFunctorRegistration<LLNotificationResponder> LLNotificationFunctorRegistration;
|
||||
|
||||
typedef boost::signals2::signal<bool(const LLSD&), LLStopWhenHandled> LLStandardSignal;
|
||||
|
||||
// context data that can be looked up via a notification's payload by the display logic
|
||||
// derive from this class to implement specific contexts
|
||||
class LLNotificationContext : public LLInstanceTracker<LLNotificationContext, LLUUID>
|
||||
|
||||
@@ -117,6 +117,69 @@ std::string LLTrans::getString(const std::string &xml_desc, const LLStringUtil::
|
||||
}
|
||||
}
|
||||
|
||||
//static
|
||||
std::string LLTrans::getString(const std::string &xml_desc, const LLSD& msg_args)
|
||||
{
|
||||
// Don't care about time as much as call count. Make sure we're not
|
||||
// calling LLTrans::getString() in an inner loop. JC
|
||||
//V3: LLFastTimer timer(FTM_GET_TRANS);
|
||||
|
||||
template_map_t::iterator iter = sStringTemplates.find(xml_desc);
|
||||
if (iter != sStringTemplates.end())
|
||||
{
|
||||
std::string text = iter->second.mText;
|
||||
LLStringUtil::format(text, msg_args);
|
||||
return text;
|
||||
}
|
||||
else
|
||||
{
|
||||
LL_WARNS_ONCE("configuration") << "Missing String in strings.xml: [" << xml_desc << "]" << LL_ENDL;
|
||||
return "MissingString("+xml_desc+")";
|
||||
}
|
||||
}
|
||||
|
||||
//static
|
||||
bool LLTrans::findString(std::string &result, const std::string &xml_desc, const LLStringUtil::format_map_t& msg_args)
|
||||
{
|
||||
//V3: LLFastTimer timer(FTM_GET_TRANS);
|
||||
|
||||
template_map_t::iterator iter = sStringTemplates.find(xml_desc);
|
||||
if (iter != sStringTemplates.end())
|
||||
{
|
||||
std::string text = iter->second.mText;
|
||||
LLStringUtil::format_map_t args = sDefaultArgs;
|
||||
args.insert(msg_args.begin(), msg_args.end());
|
||||
LLStringUtil::format(text, args);
|
||||
result = text;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
LL_WARNS_ONCE("configuration") << "Missing String in strings.xml: [" << xml_desc << "]" << LL_ENDL;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//static
|
||||
bool LLTrans::findString(std::string &result, const std::string &xml_desc, const LLSD& msg_args)
|
||||
{
|
||||
//V3: LLFastTimer timer(FTM_GET_TRANS);
|
||||
|
||||
template_map_t::iterator iter = sStringTemplates.find(xml_desc);
|
||||
if (iter != sStringTemplates.end())
|
||||
{
|
||||
std::string text = iter->second.mText;
|
||||
LLStringUtil::format(text, msg_args);
|
||||
result = text;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
LL_WARNS_ONCE("configuration") << "Missing String in strings.xml: [" << xml_desc << "]" << LL_ENDL;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void LLTrans::setDefaultArg(const std::string& name, const std::string& value)
|
||||
{
|
||||
sDefaultArgs[name] = value;
|
||||
|
||||
@@ -60,12 +60,14 @@ public:
|
||||
|
||||
/**
|
||||
* @brief Parses the xml file that holds the strings. Used once on startup
|
||||
* @param xml_filename Filename to parse
|
||||
// *FIXME * @param xml_filename Filename to parse
|
||||
* @param default_args Set of strings (expected to be in the file) to use as default replacement args, e.g. "SECOND_LIFE"
|
||||
* @returns true if the file was parsed successfully, true if something went wrong
|
||||
*/
|
||||
static bool parseStrings(const std::string& xml_filename, const std::set<std::string>& default_args);
|
||||
|
||||
//V3: static bool parseLanguageStrings(LLPointer<LLXMLNode> & root);
|
||||
|
||||
/**
|
||||
* @brief Returns a translated string
|
||||
* @param xml_desc String's description
|
||||
@@ -73,6 +75,9 @@ public:
|
||||
* @returns Translated string
|
||||
*/
|
||||
static std::string getString(const std::string &xml_desc, const LLStringUtil::format_map_t& args);
|
||||
static std::string getString(const std::string &xml_desc, const LLSD& args);
|
||||
static bool findString(std::string &result, const std::string &xml_desc, const LLStringUtil::format_map_t& args);
|
||||
static bool findString(std::string &result, const std::string &xml_desc, const LLSD& args);
|
||||
|
||||
/**
|
||||
* @brief Returns a translated string
|
||||
@@ -84,7 +89,20 @@ public:
|
||||
LLStringUtil::format_map_t empty;
|
||||
return getString(xml_desc, empty);
|
||||
}
|
||||
|
||||
|
||||
static bool findString(std::string &result, const std::string &xml_desc)
|
||||
{
|
||||
LLStringUtil::format_map_t empty;
|
||||
return findString(result, xml_desc, empty);
|
||||
}
|
||||
|
||||
static std::string getKeyboardString(const char* keystring)
|
||||
{
|
||||
std::string key_str(keystring);
|
||||
std::string trans_str;
|
||||
return findString(trans_str, key_str) ? trans_str : key_str;
|
||||
}
|
||||
|
||||
// get the default args
|
||||
static const LLStringUtil::format_map_t& getDefaultArgs()
|
||||
{
|
||||
|
||||
@@ -63,6 +63,8 @@
|
||||
#include "lldelayeduidelete.h"
|
||||
// </edit>
|
||||
|
||||
using namespace LLOldEvents;
|
||||
|
||||
//HACK: this allows you to instantiate LLView from xml with "<view/>" which we don't want
|
||||
static LLRegisterWidget<LLView> r("view");
|
||||
|
||||
|
||||
@@ -138,7 +138,7 @@ virtual void setControlName(const std::string& control, LLView *context);
|
||||
LLSliderCtrl, LLCheckBoxCtrl
|
||||
virtual std::string getControlName() const { return mControlName; }
|
||||
LLSliderCtrl, LLCheckBoxCtrl
|
||||
virtual bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
|
||||
virtual bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
|
||||
LLMenuItem
|
||||
virtual void setValue(const LLSD& value);
|
||||
*
|
||||
@@ -449,15 +449,15 @@ public:
|
||||
void localRectToScreen( const LLRect& local, LLRect* screen ) const;
|
||||
|
||||
// Listener dispatching functions (Dispatcher deletes pointers to listeners on deregistration or destruction)
|
||||
LLSimpleListener* getListenerByName(const std::string& callback_name);
|
||||
void registerEventListener(std::string name, LLSimpleListener* function);
|
||||
LLOldEvents::LLSimpleListener* getListenerByName(const std::string& callback_name);
|
||||
void registerEventListener(std::string name, LLOldEvents::LLSimpleListener* function);
|
||||
void deregisterEventListener(std::string name);
|
||||
|
||||
typedef boost::signals2::signal<void (LLPointer<LLEvent> event, const LLSD& userdata)> event_signal_t;
|
||||
typedef boost::signals2::signal<void (LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata)> event_signal_t;
|
||||
void registerEventListener(std::string name, event_signal_t::slot_type &cb);
|
||||
|
||||
std::string findEventListener(LLSimpleListener *listener) const;
|
||||
void addListenerToControl(LLEventDispatcher *observer, const std::string& name, LLSD filter, LLSD userdata);
|
||||
std::string findEventListener(LLOldEvents::LLSimpleListener *listener) const;
|
||||
void addListenerToControl(LLOldEvents::LLEventDispatcher *observer, const std::string& name, LLSD filter, LLSD userdata);
|
||||
|
||||
void addBoolControl(const std::string& name, bool initial_value);
|
||||
LLControlVariable *getControl(const std::string& name);
|
||||
@@ -466,7 +466,7 @@ public:
|
||||
bool setControlValue(const LLSD& value);
|
||||
virtual void setControlName(const std::string& control, LLView *context);
|
||||
virtual std::string getControlName() const { return mControlName; }
|
||||
// virtual bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
|
||||
// virtual bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
|
||||
virtual void setValue(const LLSD& value);
|
||||
virtual LLSD getValue() const;
|
||||
|
||||
@@ -676,7 +676,7 @@ private:
|
||||
|
||||
static LLWindow* sWindow; // All root views must know about their window.
|
||||
|
||||
typedef std::map<std::string, LLPointer<LLSimpleListener> > dispatch_list_t;
|
||||
typedef std::map<std::string, LLPointer<LLOldEvents::LLSimpleListener> > dispatch_list_t;
|
||||
dispatch_list_t mDispatchList;
|
||||
|
||||
std::string mControlName;
|
||||
|
||||
Reference in New Issue
Block a user