Reduce string temporaries from LLFloaterReg find/get
parent
e834e77988
commit
49d60e0ded
|
|
@ -1273,7 +1273,7 @@ void LLButton::setFloaterToggle(LLUICtrl* ctrl, const LLSD& sdname)
|
|||
// Set the button control value (toggle state) to the floater visibility control (Sets the value as well)
|
||||
button->setControlVariable(LLFloater::getControlGroup()->getControl(vis_control_name));
|
||||
// Set the clicked callback to toggle the floater
|
||||
button->setClickedCallback(boost::bind(&LLFloaterReg::toggleInstance, sdname, LLSD()));
|
||||
button->setClickedCallback([=](LLUICtrl* ctrl, const LLSD& param) -> void { LLFloaterReg::toggleInstance(sdname.asString(), LLSD()); });
|
||||
}
|
||||
|
||||
// static
|
||||
|
|
|
|||
|
|
@ -40,9 +40,9 @@
|
|||
LLFloaterReg::instance_list_t LLFloaterReg::sNullInstanceList;
|
||||
LLFloaterReg::instance_map_t LLFloaterReg::sInstanceMap;
|
||||
LLFloaterReg::build_map_t LLFloaterReg::sBuildMap;
|
||||
std::map<std::string,std::string> LLFloaterReg::sGroupMap;
|
||||
std::map<std::string, std::string, std::less<>> LLFloaterReg::sGroupMap;
|
||||
bool LLFloaterReg::sBlockShowFloaters = false;
|
||||
std::set<std::string> LLFloaterReg::sAlwaysShowableList;
|
||||
std::set<std::string, std::less<>> LLFloaterReg::sAlwaysShowableList;
|
||||
|
||||
static LLFloaterRegListener sFloaterRegListener;
|
||||
|
||||
|
|
@ -58,27 +58,31 @@ void LLFloaterReg::add(const std::string& name, const std::string& filename, con
|
|||
}
|
||||
|
||||
//static
|
||||
bool LLFloaterReg::isRegistered(const std::string& name)
|
||||
bool LLFloaterReg::isRegistered(std::string_view name)
|
||||
{
|
||||
return sBuildMap.find(name) != sBuildMap.end();
|
||||
}
|
||||
|
||||
//static
|
||||
LLFloater* LLFloaterReg::getLastFloaterInGroup(const std::string& name)
|
||||
LLFloater* LLFloaterReg::getLastFloaterInGroup(std::string_view name)
|
||||
{
|
||||
const std::string& groupname = sGroupMap[name];
|
||||
if (!groupname.empty())
|
||||
auto it = sGroupMap.find(name);
|
||||
if (it != sGroupMap.end())
|
||||
{
|
||||
instance_list_t& list = sInstanceMap[groupname];
|
||||
if (!list.empty())
|
||||
const std::string& groupname = it->second;
|
||||
if (!groupname.empty())
|
||||
{
|
||||
for (instance_list_t::reverse_iterator iter = list.rbegin(); iter != list.rend(); ++iter)
|
||||
instance_list_t& list = sInstanceMap[groupname];
|
||||
if (!list.empty())
|
||||
{
|
||||
LLFloater* inst = *iter;
|
||||
|
||||
if (inst->getVisible() && !inst->isMinimized())
|
||||
for (instance_list_t::reverse_iterator iter = list.rbegin(), end = list.rend(); iter != end; ++iter)
|
||||
{
|
||||
return inst;
|
||||
LLFloater* inst = *iter;
|
||||
|
||||
if (inst->getVisible() && !inst->isMinimized())
|
||||
{
|
||||
return inst;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -99,10 +103,8 @@ LLFloater* LLFloaterReg::getLastFloaterCascading()
|
|||
|
||||
instance_list_t& instances = sInstanceMap[group_name];
|
||||
|
||||
for (instance_list_t::const_iterator iter = instances.begin(); iter != instances.end(); ++iter)
|
||||
for (LLFloater* inst : instances)
|
||||
{
|
||||
LLFloater* inst = *iter;
|
||||
|
||||
if (inst->getVisible()
|
||||
&& (inst->isPositioning(LLFloaterEnums::POSITIONING_CASCADING)
|
||||
|| inst->isPositioning(LLFloaterEnums::POSITIONING_CASCADE_GROUP)))
|
||||
|
|
@ -120,20 +122,23 @@ LLFloater* LLFloaterReg::getLastFloaterCascading()
|
|||
}
|
||||
|
||||
//static
|
||||
LLFloater* LLFloaterReg::findInstance(const std::string& name, const LLSD& key)
|
||||
LLFloater* LLFloaterReg::findInstance(std::string_view name, const LLSD& key)
|
||||
{
|
||||
LLFloater* res = NULL;
|
||||
const std::string& groupname = sGroupMap[name];
|
||||
if (!groupname.empty())
|
||||
auto it = sGroupMap.find(name);
|
||||
if (it != sGroupMap.end())
|
||||
{
|
||||
instance_list_t& list = sInstanceMap[groupname];
|
||||
for (instance_list_t::iterator iter = list.begin(); iter != list.end(); ++iter)
|
||||
const std::string& groupname = it->second;
|
||||
if (!groupname.empty())
|
||||
{
|
||||
LLFloater* inst = *iter;
|
||||
if (inst->matchesKey(key))
|
||||
instance_list_t& list = sInstanceMap[groupname];
|
||||
for (LLFloater* inst : list)
|
||||
{
|
||||
res = inst;
|
||||
break;
|
||||
if (inst->matchesKey(key))
|
||||
{
|
||||
res = inst;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -141,47 +146,55 @@ LLFloater* LLFloaterReg::findInstance(const std::string& name, const LLSD& key)
|
|||
}
|
||||
|
||||
//static
|
||||
LLFloater* LLFloaterReg::getInstance(const std::string& name, const LLSD& key)
|
||||
LLFloater* LLFloaterReg::getInstance(std::string_view name, const LLSD& key)
|
||||
{
|
||||
LLFloater* res = findInstance(name, key);
|
||||
if (!res)
|
||||
{
|
||||
const LLFloaterBuildFunc& build_func = sBuildMap[name].mFunc;
|
||||
const std::string& xui_file = sBuildMap[name].mFile;
|
||||
if (build_func)
|
||||
auto it = sBuildMap.find(name);
|
||||
if (it != sBuildMap.end())
|
||||
{
|
||||
const std::string& groupname = sGroupMap[name];
|
||||
if (!groupname.empty())
|
||||
const LLFloaterBuildFunc& build_func = it->second.mFunc;
|
||||
const std::string& xui_file = it->second.mFile;
|
||||
if (build_func)
|
||||
{
|
||||
instance_list_t& list = sInstanceMap[groupname];
|
||||
|
||||
res = build_func(key);
|
||||
if (!res)
|
||||
auto it = sGroupMap.find(name);
|
||||
if (it != sGroupMap.end())
|
||||
{
|
||||
LL_WARNS() << "Failed to build floater type: '" << name << "'." << LL_ENDL;
|
||||
return NULL;
|
||||
const std::string& groupname = it->second;
|
||||
if (!groupname.empty())
|
||||
{
|
||||
instance_list_t& list = sInstanceMap[groupname];
|
||||
|
||||
res = build_func(key);
|
||||
if (!res)
|
||||
{
|
||||
LL_WARNS() << "Failed to build floater type: '" << name << "'." << LL_ENDL;
|
||||
return NULL;
|
||||
}
|
||||
bool success = res->buildFromFile(xui_file);
|
||||
if (!success)
|
||||
{
|
||||
LL_WARNS() << "Failed to build floater type: '" << name << "'." << LL_ENDL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Note: key should eventually be a non optional LLFloater arg; for now, set mKey to be safe
|
||||
if (res->mKey.isUndefined())
|
||||
{
|
||||
res->mKey = key;
|
||||
}
|
||||
res->setInstanceName(std::string(name));
|
||||
|
||||
LLFloater* last_floater = (list.empty() ? NULL : list.back());
|
||||
|
||||
res->applyControlsAndPosition(last_floater);
|
||||
|
||||
gFloaterView->adjustToFitScreen(res, false);
|
||||
|
||||
list.push_back(res);
|
||||
}
|
||||
}
|
||||
bool success = res->buildFromFile(xui_file);
|
||||
if (!success)
|
||||
{
|
||||
LL_WARNS() << "Failed to build floater type: '" << name << "'." << LL_ENDL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Note: key should eventually be a non optional LLFloater arg; for now, set mKey to be safe
|
||||
if (res->mKey.isUndefined())
|
||||
{
|
||||
res->mKey = key;
|
||||
}
|
||||
res->setInstanceName(name);
|
||||
|
||||
LLFloater *last_floater = (list.empty() ? NULL : list.back());
|
||||
|
||||
res->applyControlsAndPosition(last_floater);
|
||||
|
||||
gFloaterView->adjustToFitScreen(res, false);
|
||||
|
||||
list.push_back(res);
|
||||
}
|
||||
}
|
||||
if (!res)
|
||||
|
|
@ -193,21 +206,25 @@ LLFloater* LLFloaterReg::getInstance(const std::string& name, const LLSD& key)
|
|||
}
|
||||
|
||||
//static
|
||||
LLFloater* LLFloaterReg::removeInstance(const std::string& name, const LLSD& key)
|
||||
LLFloater* LLFloaterReg::removeInstance(std::string_view name, const LLSD& key)
|
||||
{
|
||||
LLFloater* res = NULL;
|
||||
const std::string& groupname = sGroupMap[name];
|
||||
if (!groupname.empty())
|
||||
auto it = sGroupMap.find(name);
|
||||
if (it != sGroupMap.end())
|
||||
{
|
||||
instance_list_t& list = sInstanceMap[groupname];
|
||||
for (instance_list_t::iterator iter = list.begin(); iter != list.end(); ++iter)
|
||||
const std::string& groupname = it->second;
|
||||
if (!groupname.empty())
|
||||
{
|
||||
LLFloater* inst = *iter;
|
||||
if (inst->matchesKey(key))
|
||||
instance_list_t& list = sInstanceMap[groupname];
|
||||
for (instance_list_t::iterator iter = list.begin(); iter != list.end(); ++iter)
|
||||
{
|
||||
res = inst;
|
||||
list.erase(iter);
|
||||
break;
|
||||
LLFloater* inst = *iter;
|
||||
if (inst->matchesKey(key))
|
||||
{
|
||||
res = inst;
|
||||
list.erase(iter);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -216,7 +233,7 @@ LLFloater* LLFloaterReg::removeInstance(const std::string& name, const LLSD& key
|
|||
|
||||
//static
|
||||
// returns true if the instance existed
|
||||
bool LLFloaterReg::destroyInstance(const std::string& name, const LLSD& key)
|
||||
bool LLFloaterReg::destroyInstance(std::string_view name, const LLSD& key)
|
||||
{
|
||||
LLFloater* inst = removeInstance(name, key);
|
||||
if (inst)
|
||||
|
|
@ -232,7 +249,7 @@ bool LLFloaterReg::destroyInstance(const std::string& name, const LLSD& key)
|
|||
|
||||
// Iterators
|
||||
//static
|
||||
LLFloaterReg::const_instance_list_t& LLFloaterReg::getFloaterList(const std::string& name)
|
||||
LLFloaterReg::const_instance_list_t& LLFloaterReg::getFloaterList(std::string_view name)
|
||||
{
|
||||
instance_map_t::iterator iter = sInstanceMap.find(name);
|
||||
if (iter != sInstanceMap.end())
|
||||
|
|
@ -248,7 +265,7 @@ LLFloaterReg::const_instance_list_t& LLFloaterReg::getFloaterList(const std::str
|
|||
// Visibility Management
|
||||
|
||||
//static
|
||||
LLFloater* LLFloaterReg::showInstance(const std::string& name, const LLSD& key, bool focus)
|
||||
LLFloater* LLFloaterReg::showInstance(std::string_view name, const LLSD& key, bool focus)
|
||||
{
|
||||
if( sBlockShowFloaters
|
||||
// see EXT-7090
|
||||
|
|
@ -266,7 +283,7 @@ LLFloater* LLFloaterReg::showInstance(const std::string& name, const LLSD& key,
|
|||
|
||||
//static
|
||||
// returns true if the instance exists
|
||||
bool LLFloaterReg::hideInstance(const std::string& name, const LLSD& key)
|
||||
bool LLFloaterReg::hideInstance(std::string_view name, const LLSD& key)
|
||||
{
|
||||
LLFloater* instance = findInstance(name, key);
|
||||
if (instance)
|
||||
|
|
@ -278,7 +295,7 @@ bool LLFloaterReg::hideInstance(const std::string& name, const LLSD& key)
|
|||
|
||||
//static
|
||||
// returns true if the instance is visible when completed
|
||||
bool LLFloaterReg::toggleInstance(const std::string& name, const LLSD& key)
|
||||
bool LLFloaterReg::toggleInstance(std::string_view name, const LLSD& key)
|
||||
{
|
||||
LLFloater* instance = findInstance(name, key);
|
||||
if (instance && instance->isShown())
|
||||
|
|
@ -294,7 +311,7 @@ bool LLFloaterReg::toggleInstance(const std::string& name, const LLSD& key)
|
|||
|
||||
//static
|
||||
// returns true if the instance exists and is visible (doesnt matter minimized or not)
|
||||
bool LLFloaterReg::instanceVisible(const std::string& name, const LLSD& key)
|
||||
bool LLFloaterReg::instanceVisible(std::string_view name, const LLSD& key)
|
||||
{
|
||||
LLFloater* instance = findInstance(name, key);
|
||||
return LLFloater::isVisible(instance);
|
||||
|
|
|
|||
|
|
@ -51,26 +51,26 @@ public:
|
|||
// 2) We can change the key of a floater without altering the list.
|
||||
typedef std::list<LLFloater*> instance_list_t;
|
||||
typedef const instance_list_t const_instance_list_t;
|
||||
typedef std::map<std::string, instance_list_t> instance_map_t;
|
||||
typedef std::map<std::string, instance_list_t, std::less<>> instance_map_t;
|
||||
|
||||
struct BuildData
|
||||
{
|
||||
LLFloaterBuildFunc mFunc;
|
||||
std::string mFile;
|
||||
};
|
||||
typedef std::map<std::string, BuildData> build_map_t;
|
||||
typedef std::map<std::string, BuildData, std::less<>> build_map_t;
|
||||
|
||||
private:
|
||||
friend class LLFloaterRegListener;
|
||||
static instance_list_t sNullInstanceList;
|
||||
static instance_map_t sInstanceMap;
|
||||
static build_map_t sBuildMap;
|
||||
static std::map<std::string,std::string> sGroupMap;
|
||||
static std::map<std::string, std::string, std::less<>> sGroupMap;
|
||||
static bool sBlockShowFloaters;
|
||||
/**
|
||||
* Defines list of floater names that can be shown despite state of sBlockShowFloaters.
|
||||
*/
|
||||
static std::set<std::string> sAlwaysShowableList;
|
||||
static std::set<std::string, std::less<>> sAlwaysShowableList;
|
||||
|
||||
public:
|
||||
// Registration
|
||||
|
|
@ -85,30 +85,30 @@ public:
|
|||
|
||||
static void add(const std::string& name, const std::string& file, const LLFloaterBuildFunc& func,
|
||||
const std::string& groupname = LLStringUtil::null);
|
||||
static bool isRegistered(const std::string& name);
|
||||
static bool isRegistered(std::string_view name);
|
||||
|
||||
// Helpers
|
||||
static LLFloater* getLastFloaterInGroup(const std::string& name);
|
||||
static LLFloater* getLastFloaterInGroup(std::string_view name);
|
||||
static LLFloater* getLastFloaterCascading();
|
||||
|
||||
// Find / get (create) / remove / destroy
|
||||
static LLFloater* findInstance(const std::string& name, const LLSD& key = LLSD());
|
||||
static LLFloater* getInstance(const std::string& name, const LLSD& key = LLSD());
|
||||
static LLFloater* removeInstance(const std::string& name, const LLSD& key = LLSD());
|
||||
static bool destroyInstance(const std::string& name, const LLSD& key = LLSD());
|
||||
static LLFloater* findInstance(std::string_view name, const LLSD& key = LLSD());
|
||||
static LLFloater* getInstance(std::string_view name, const LLSD& key = LLSD());
|
||||
static LLFloater* removeInstance(std::string_view name, const LLSD& key = LLSD());
|
||||
static bool destroyInstance(std::string_view name, const LLSD& key = LLSD());
|
||||
|
||||
// Iterators
|
||||
static const_instance_list_t& getFloaterList(const std::string& name);
|
||||
static const_instance_list_t& getFloaterList(std::string_view name);
|
||||
|
||||
// Visibility Management
|
||||
// return NULL if instance not found or can't create instance (no builder)
|
||||
static LLFloater* showInstance(const std::string& name, const LLSD& key = LLSD(), bool focus = false);
|
||||
static LLFloater* showInstance(std::string_view name, const LLSD& key = LLSD(), bool focus = false);
|
||||
// Close a floater (may destroy or set invisible)
|
||||
// return false if can't find instance
|
||||
static bool hideInstance(const std::string& name, const LLSD& key = LLSD());
|
||||
static bool hideInstance(std::string_view name, const LLSD& key = LLSD());
|
||||
// return true if instance is visible:
|
||||
static bool toggleInstance(const std::string& name, const LLSD& key = LLSD());
|
||||
static bool instanceVisible(const std::string& name, const LLSD& key = LLSD());
|
||||
static bool toggleInstance(std::string_view name, const LLSD& key = LLSD());
|
||||
static bool instanceVisible(std::string_view name, const LLSD& key = LLSD());
|
||||
|
||||
static void showInitialVisibleInstances();
|
||||
static void hideVisibleInstances(const std::set<std::string>& exceptions = std::set<std::string>());
|
||||
|
|
@ -133,19 +133,19 @@ public:
|
|||
|
||||
// Typed find / get / show
|
||||
template <class T>
|
||||
static T* findTypedInstance(const std::string& name, const LLSD& key = LLSD())
|
||||
static T* findTypedInstance(std::string_view name, const LLSD& key = LLSD())
|
||||
{
|
||||
return dynamic_cast<T*>(findInstance(name, key));
|
||||
}
|
||||
|
||||
template <class T>
|
||||
static T* getTypedInstance(const std::string& name, const LLSD& key = LLSD())
|
||||
static T* getTypedInstance(std::string_view name, const LLSD& key = LLSD())
|
||||
{
|
||||
return dynamic_cast<T*>(getInstance(name, key));
|
||||
}
|
||||
|
||||
template <class T>
|
||||
static T* showTypedInstance(const std::string& name, const LLSD& key = LLSD(), bool focus = false)
|
||||
static T* showTypedInstance(std::string_view name, const LLSD& key = LLSD(), bool focus = false)
|
||||
{
|
||||
return dynamic_cast<T*>(showInstance(name, key, focus));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,22 +94,22 @@ void LLFloaterRegListener::getBuildMap(const LLSD& event) const
|
|||
|
||||
void LLFloaterRegListener::showInstance(const LLSD& event) const
|
||||
{
|
||||
LLFloaterReg::showInstance(event["name"], event["key"], event["focus"]);
|
||||
LLFloaterReg::showInstance(event["name"].asString(), event["key"], event["focus"]);
|
||||
}
|
||||
|
||||
void LLFloaterRegListener::hideInstance(const LLSD& event) const
|
||||
{
|
||||
LLFloaterReg::hideInstance(event["name"], event["key"]);
|
||||
LLFloaterReg::hideInstance(event["name"].asString(), event["key"]);
|
||||
}
|
||||
|
||||
void LLFloaterRegListener::toggleInstance(const LLSD& event) const
|
||||
{
|
||||
LLFloaterReg::toggleInstance(event["name"], event["key"]);
|
||||
LLFloaterReg::toggleInstance(event["name"].asString(), event["key"]);
|
||||
}
|
||||
|
||||
void LLFloaterRegListener::instanceVisible(const LLSD& event) const
|
||||
{
|
||||
sendReply(LLSDMap("visible", LLFloaterReg::instanceVisible(event["name"], event["key"])),
|
||||
sendReply(LLSDMap("visible", LLFloaterReg::instanceVisible(event["name"].asString(), event["key"])),
|
||||
event);
|
||||
}
|
||||
|
||||
|
|
@ -119,7 +119,7 @@ void LLFloaterRegListener::clickButton(const LLSD& event) const
|
|||
LLReqID reqID(event);
|
||||
LLSD reply(reqID.makeResponse());
|
||||
|
||||
LLFloater* floater = LLFloaterReg::findInstance(event["name"], event["key"]);
|
||||
LLFloater* floater = LLFloaterReg::findInstance(event["name"].asString(), event["key"]);
|
||||
if (! LLFloater::isShown(floater))
|
||||
{
|
||||
reply["type"] = "LLFloater";
|
||||
|
|
|
|||
|
|
@ -170,11 +170,11 @@ mHelpImpl(NULL)
|
|||
LLUICtrl::CommitCallbackRegistry::Registrar& reg = LLUICtrl::CommitCallbackRegistry::defaultRegistrar();
|
||||
|
||||
// Callbacks for associating controls with floater visibility:
|
||||
reg.add("Floater.Toggle", boost::bind(&LLFloaterReg::toggleInstance, _2, LLSD()));
|
||||
reg.add("Floater.ToggleOrBringToFront", boost::bind(&LLFloaterReg::toggleInstanceOrBringToFront, _2, LLSD()));
|
||||
reg.add("Floater.Show", boost::bind(&LLFloaterReg::showInstance, _2, LLSD(), false));
|
||||
reg.add("Floater.ShowOrBringToFront", boost::bind(&LLFloaterReg::showInstanceOrBringToFront, _2, LLSD()));
|
||||
reg.add("Floater.Hide", boost::bind(&LLFloaterReg::hideInstance, _2, LLSD()));
|
||||
reg.add("Floater.Toggle", [](LLUICtrl* ctrl, const LLSD& param) -> void { LLFloaterReg::toggleInstance(param.asStringRef()); });
|
||||
reg.add("Floater.ToggleOrBringToFront", [](LLUICtrl* ctrl, const LLSD& param) -> void { LLFloaterReg::toggleInstanceOrBringToFront(param.asStringRef()); });
|
||||
reg.add("Floater.Show", [](LLUICtrl* ctrl, const LLSD& param) -> void { LLFloaterReg::showInstance(param.asStringRef(), LLSD(), false); });
|
||||
reg.add("Floater.ShowOrBringToFront", [](LLUICtrl* ctrl, const LLSD& param) -> void { LLFloaterReg::showInstanceOrBringToFront(param.asStringRef(), LLSD()); });
|
||||
reg.add("Floater.Hide", [](LLUICtrl* ctrl, const LLSD& param) -> void { LLFloaterReg::hideInstance(param.asStringRef()); });
|
||||
|
||||
// Button initialization callback for toggle buttons
|
||||
reg.add("Button.SetFloaterToggle", boost::bind(&LLButton::setFloaterToggle, _1, _2));
|
||||
|
|
@ -189,8 +189,8 @@ mHelpImpl(NULL)
|
|||
reg.add("Button.ToggleFloater", boost::bind(&LLButton::toggleFloaterAndSetToggleState, _1, _2));
|
||||
|
||||
// Used by menus along with Floater.Toggle to display visibility as a check-mark
|
||||
LLUICtrl::EnableCallbackRegistry::defaultRegistrar().add("Floater.Visible", boost::bind(&LLFloaterReg::instanceVisible, _2, LLSD()));
|
||||
LLUICtrl::EnableCallbackRegistry::defaultRegistrar().add("Floater.IsOpen", boost::bind(&LLFloaterReg::instanceVisible, _2, LLSD()));
|
||||
LLUICtrl::EnableCallbackRegistry::defaultRegistrar().add("Floater.Visible", [](LLUICtrl* ctrl, const LLSD& param) -> bool { return LLFloaterReg::instanceVisible(param.asStringRef(), LLSD()); });
|
||||
LLUICtrl::EnableCallbackRegistry::defaultRegistrar().add("Floater.IsOpen", [](LLUICtrl* ctrl, const LLSD& param) -> bool { return LLFloaterReg::instanceVisible(param.asStringRef(), LLSD()); });
|
||||
|
||||
// Parse the master list of commands
|
||||
LLCommandManager::load();
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ LLFloater* LLFloaterSidePanelContainer::getTopmostInventoryFloater()
|
|||
return topmost_floater;
|
||||
}
|
||||
|
||||
LLPanel* LLFloaterSidePanelContainer::openChildPanel(const std::string& panel_name, const LLSD& params)
|
||||
LLPanel* LLFloaterSidePanelContainer::openChildPanel(std::string_view panel_name, const LLSD& params)
|
||||
{
|
||||
LLView* view = findChildView(panel_name, true);
|
||||
if (!view)
|
||||
|
|
@ -144,7 +144,7 @@ LLPanel* LLFloaterSidePanelContainer::openChildPanel(const std::string& panel_na
|
|||
return panel;
|
||||
}
|
||||
|
||||
void LLFloaterSidePanelContainer::showPanel(const std::string& floater_name, const LLSD& key)
|
||||
void LLFloaterSidePanelContainer::showPanel(std::string_view floater_name, const LLSD& key)
|
||||
{
|
||||
LLFloaterSidePanelContainer* floaterp = LLFloaterReg::getTypedInstance<LLFloaterSidePanelContainer>(floater_name);
|
||||
if (floaterp)
|
||||
|
|
@ -153,7 +153,7 @@ void LLFloaterSidePanelContainer::showPanel(const std::string& floater_name, con
|
|||
}
|
||||
}
|
||||
|
||||
void LLFloaterSidePanelContainer::showPanel(const std::string& floater_name, const std::string& panel_name, const LLSD& key)
|
||||
void LLFloaterSidePanelContainer::showPanel(std::string_view floater_name, std::string_view panel_name, const LLSD& key)
|
||||
{
|
||||
LLFloaterSidePanelContainer* floaterp = LLFloaterReg::getTypedInstance<LLFloaterSidePanelContainer>(floater_name);
|
||||
if (floaterp)
|
||||
|
|
@ -162,7 +162,7 @@ void LLFloaterSidePanelContainer::showPanel(const std::string& floater_name, con
|
|||
}
|
||||
}
|
||||
|
||||
LLPanel* LLFloaterSidePanelContainer::getPanel(const std::string& floater_name, const std::string& panel_name)
|
||||
LLPanel* LLFloaterSidePanelContainer::getPanel(std::string_view floater_name, std::string_view panel_name)
|
||||
{
|
||||
LLFloaterSidePanelContainer* floaterp = LLFloaterReg::getTypedInstance<LLFloaterSidePanelContainer>(floater_name);
|
||||
|
||||
|
|
@ -174,7 +174,7 @@ LLPanel* LLFloaterSidePanelContainer::getPanel(const std::string& floater_name,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
LLPanel* LLFloaterSidePanelContainer::findPanel(const std::string& floater_name, const std::string& panel_name)
|
||||
LLPanel* LLFloaterSidePanelContainer::findPanel(std::string_view floater_name, std::string_view panel_name)
|
||||
{
|
||||
LLFloaterSidePanelContainer* floaterp = LLFloaterReg::findTypedInstance<LLFloaterSidePanelContainer>(floater_name);
|
||||
|
||||
|
|
|
|||
|
|
@ -55,17 +55,17 @@ public:
|
|||
|
||||
void cleanup() { destroy(); }
|
||||
|
||||
LLPanel* openChildPanel(const std::string& panel_name, const LLSD& params);
|
||||
LLPanel* openChildPanel(std::string_view panel_name, const LLSD& params);
|
||||
|
||||
static LLFloater* getTopmostInventoryFloater();
|
||||
|
||||
static void showPanel(const std::string& floater_name, const LLSD& key);
|
||||
static void showPanel(std::string_view floater_name, const LLSD& key);
|
||||
|
||||
static void showPanel(const std::string& floater_name, const std::string& panel_name, const LLSD& key);
|
||||
static void showPanel(std::string_view floater_name, std::string_view panel_name, const LLSD& key);
|
||||
|
||||
static LLPanel* getPanel(const std::string& floater_name, const std::string& panel_name = sMainPanelName);
|
||||
static LLPanel* getPanel(std::string_view floater_name, std::string_view panel_name = sMainPanelName);
|
||||
|
||||
static LLPanel* findPanel(const std::string& floater_name, const std::string& panel_name = sMainPanelName);
|
||||
static LLPanel* findPanel(std::string_view floater_name, std::string_view panel_name = sMainPanelName);
|
||||
|
||||
/**
|
||||
* Gets the panel of given type T (doesn't show it or do anything else with it).
|
||||
|
|
@ -75,7 +75,7 @@ public:
|
|||
* @returns a pointer to the panel of given type T.
|
||||
*/
|
||||
template <typename T>
|
||||
static T* getPanel(const std::string& floater_name, const std::string& panel_name = sMainPanelName)
|
||||
static T* getPanel(std::string_view floater_name, std::string_view panel_name = sMainPanelName)
|
||||
{
|
||||
T* panel = dynamic_cast<T*>(getPanel(floater_name, panel_name));
|
||||
if (!panel)
|
||||
|
|
|
|||
|
|
@ -220,7 +220,7 @@ void LLFloaterWebContent::preCreate(LLFloaterWebContent::Params& p)
|
|||
// showInstance will open a new window. Figure out how many web browsers are already open,
|
||||
// and close the least recently opened one if this will put us over the limit.
|
||||
|
||||
LLFloaterReg::const_instance_list_t &instances = LLFloaterReg::getFloaterList(p.window_class);
|
||||
LLFloaterReg::const_instance_list_t &instances = LLFloaterReg::getFloaterList(p.window_class());
|
||||
|
||||
if(instances.size() >= (size_t)browser_window_limit)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -62,10 +62,10 @@ void LLSideTrayPanelContainer::onOpen(const LLSD& key)
|
|||
getCurrentPanel()->onOpen(key);
|
||||
}
|
||||
|
||||
void LLSideTrayPanelContainer::openPanel(const std::string& panel_name, const LLSD& key)
|
||||
void LLSideTrayPanelContainer::openPanel(std::string_view panel_name, const LLSD& key)
|
||||
{
|
||||
LLSD combined_key = key;
|
||||
combined_key[PARAM_SUB_PANEL_NAME] = panel_name;
|
||||
combined_key[PARAM_SUB_PANEL_NAME] = std::string(panel_name);
|
||||
onOpen(combined_key);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ public:
|
|||
/**
|
||||
* Opens given subpanel.
|
||||
*/
|
||||
void openPanel(const std::string& panel_name, const LLSD& key = LLSD::emptyMap());
|
||||
void openPanel(std::string_view panel_name, const LLSD& key = LLSD::emptyMap());
|
||||
|
||||
/**
|
||||
* Opens previous panel from panel navigation history.
|
||||
|
|
|
|||
Loading…
Reference in New Issue