SL-14862 - renamed widgets to the more descriptive controls

master
Brad Payne (Vir Linden) 2021-03-11 15:11:51 +00:00
parent e3babd1f8d
commit acb2e87d94
4 changed files with 23 additions and 21 deletions

View File

@ -442,7 +442,7 @@ BOOL LLButton::handleMouseDown(S32 x, S32 y, MASK mask)
{
LL_DEBUGS("UIUsage") << "calling mouse down function " << mFunctionName << LL_ENDL;
LLUIUsage::instance().logCommand(mFunctionName);
LLUIUsage::instance().logWidget(getPathname());
LLUIUsage::instance().logControl(getPathname());
}
/*

View File

@ -429,7 +429,7 @@ void LLUICtrl::onCommit()
{
LL_DEBUGS("UIUsage") << "calling commit function " << mFunctionName << LL_ENDL;
LLUIUsage::instance().logCommand(mFunctionName);
LLUIUsage::instance().logWidget(getPathname());
LLUIUsage::instance().logControl(getPathname());
}
else
{

View File

@ -39,7 +39,7 @@ LLUIUsage::~LLUIUsage()
// static
std::string LLUIUsage::sanitized(const std::string& s)
{
// ViewerStats db doesn't like "." in keys
// Remove characters that make the ViewerStats db unhappy
std::string result(s);
std::replace(result.begin(), result.end(), '.', '_');
std::replace(result.begin(), result.end(), ' ', '_');
@ -59,10 +59,11 @@ void LLUIUsage::setLLSDPath(LLSD& sd, const std::string& path, S32 max_elts, con
setLLSDNested(sd, last_fields, val);
}
// setLLSDNested
// setLLSDNested()
// Accomplish the equivalent of
// sd[fields[0]][fields[1]]... = val;
// for an arbitrary number of fields.
// This might be useful as an LLSD utility function; is not specific to LLUIUsage
//
// static
void LLUIUsage::setLLSDNested(LLSD& sd, const std::vector<std::string>& fields, const LLSD& val)
@ -91,6 +92,13 @@ void LLUIUsage::logCommand(const std::string& command)
LL_DEBUGS("UIUsage") << "command " << command << LL_ENDL;
}
void LLUIUsage::logControl(const std::string& control)
{
mControlCounts[sanitized(control)]++;
LL_DEBUGS("UIUsage") << "control " << control << LL_ENDL;
}
void LLUIUsage::logFloater(const std::string& floater)
{
mFloaterCounts[sanitized(floater)]++;
@ -103,31 +111,25 @@ void LLUIUsage::logPanel(const std::string& p)
LL_DEBUGS("UIUsage") << "panel " << p << LL_ENDL;
}
void LLUIUsage::logWidget(const std::string& w)
{
mWidgetCounts[sanitized(w)]++;
LL_DEBUGS("UIUsage") << "widget " << w << LL_ENDL;
}
LLSD LLUIUsage::asLLSD() const
{
LLSD result;
for (auto const& it : mFloaterCounts)
{
result["floaters"][it.first] = LLSD::Integer(it.second);
}
for (auto const& it : mCommandCounts)
{
result["commands"][it.first] = LLSD::Integer(it.second);
}
for (auto const& it : mControlCounts)
{
setLLSDPath(result["controls"], it.first, 2, LLSD::Integer(it.second));
}
for (auto const& it : mFloaterCounts)
{
result["floaters"][it.first] = LLSD::Integer(it.second);
}
for (auto const& it : mPanelCounts)
{
result["panels"][it.first] = LLSD::Integer(it.second);
}
for (auto const& it : mWidgetCounts)
{
setLLSDPath(result["widgets"], it.first, 2, LLSD::Integer(it.second));
}
return result;
}
@ -137,8 +139,8 @@ void LLUIUsage::clear()
LL_DEBUGS("UIUsage") << "clear" << LL_ENDL;
mCommandCounts.clear();
mControlCounts.clear();
mFloaterCounts.clear();
mPanelCounts.clear();
mWidgetCounts.clear();
}

View File

@ -42,16 +42,16 @@ public:
static void setLLSDPath(LLSD& sd, const std::string& path, S32 max_elts, const LLSD& val);
static void setLLSDNested(LLSD& sd, const std::vector<std::string>& fields, const LLSD& val);
void logCommand(const std::string& command);
void logControl(const std::string& control);
void logFloater(const std::string& floater);
void logPanel(const std::string& p);
void logWidget(const std::string& w);
LLSD asLLSD() const;
void clear();
private:
std::map<std::string,U32> mCommandCounts;
std::map<std::string,U32> mControlCounts;
std::map<std::string,U32> mFloaterCounts;
std::map<std::string,U32> mPanelCounts;
std::map<std::string,U32> mWidgetCounts;
};
#endif // LLUIUIUSAGE.h