Merge branch 'SL-14862' into DRTVWR-518-ui

# Conflicts:
#	indra/newview/llstartup.cpp
meow-7.2.2
Andrey Lihatskiy 2021-04-22 18:26:54 +03:00
commit 6da0a6873b
16 changed files with 261 additions and 3 deletions

View File

@ -122,6 +122,7 @@ set(llui_SOURCE_FILES
lluictrl.cpp
lluictrlfactory.cpp
lluistring.cpp
lluiusage.cpp
llundo.cpp
llurlaction.cpp
llurlentry.cpp
@ -241,6 +242,7 @@ set(llui_HEADER_FILES
llui.h
lluicolor.h
lluistring.h
lluiusage.h
llundo.h
llurlaction.h
llurlentry.h

View File

@ -47,6 +47,7 @@
#include "llnotificationsutil.h"
#include "llrender.h"
#include "lluictrlfactory.h"
#include "lluiusage.h"
#include "llhelp.h"
#include "lldockablefloater.h"
#include "llviewereventrecorder.h"
@ -437,6 +438,13 @@ BOOL LLButton::handleMouseDown(S32 x, S32 y, MASK mask)
setFocus(TRUE);
}
if (!mFunctionName.empty())
{
LL_DEBUGS("UIUsage") << "calling mouse down function " << mFunctionName << LL_ENDL;
LLUIUsage::instance().logCommand(mFunctionName);
LLUIUsage::instance().logControl(getPathname());
}
/*
* ATTENTION! This call fires another mouse down callback.
* If you wish to remove this call emit that signal directly

View File

@ -58,6 +58,7 @@
#include "llhelp.h"
#include "llmultifloater.h"
#include "llsdutil.h"
#include "lluiusage.h"
#include <boost/foreach.hpp>
@ -1631,6 +1632,7 @@ void LLFloater::bringToFront( S32 x, S32 y )
// virtual
void LLFloater::setVisibleAndFrontmost(BOOL take_focus,const LLSD& key)
{
LLUIUsage::instance().logFloater(getInstanceName());
LLMultiFloater* hostp = getHost();
if (hostp)
{

View File

@ -32,6 +32,7 @@
#include "llfloater.h"
#include "llmultifloater.h"
#include "llfloaterreglistener.h"
#include "lluiusage.h"
//*******************************************************
@ -472,7 +473,6 @@ void LLFloaterReg::toggleInstanceOrBringToFront(const LLSD& sdname, const LLSD&
std::string name = sdname.asString();
LLFloater* instance = getInstance(name, key);
if (!instance)
{
LL_DEBUGS() << "Unable to get instance of floater '" << name << "'" << LL_ENDL;

View File

@ -38,6 +38,7 @@
#include "llrender.h"
#include "llfloater.h"
#include "lltrans.h"
#include "lluiusage.h"
//----------------------------------------------------------------------------
@ -1556,6 +1557,8 @@ BOOL LLTabContainer::setTab(S32 which)
if (is_selected)
{
LLUIUsage::instance().logPanel(tuple->mTabPanel->getName());
// Make sure selected tab is within scroll region
if (mIsVertical)
{

View File

@ -967,6 +967,8 @@ LLToolBarButton* LLToolBar::createButton(const LLCommandId& id)
executeStopParam.function_name = executeStopFunction;
executeStopParam.parameter = commandp->executeStopParameters();
LLUICtrl::commit_callback_t execute_func = initCommitCallback(executeParam);
button->setFunctionName(commandp->executeFunctionName());
LL_DEBUGS("UIUsage") << "button function name a -> " << commandp->executeFunctionName() << LL_ENDL;
LLUICtrl::commit_callback_t stop_func = initCommitCallback(executeStopParam);
button->setMouseDownCallback(boost::bind(&LLToolBarButton::callIfEnabled, button, execute_func, _1, _2));
@ -974,6 +976,8 @@ LLToolBarButton* LLToolBar::createButton(const LLCommandId& id)
}
else
{
button->setFunctionName(commandp->executeFunctionName());
LL_DEBUGS("UIUsage") << "button function name b -> " << commandp->executeFunctionName() << LL_ENDL;
button->setCommitCallback(executeParam);
}

View File

@ -35,6 +35,7 @@
#include "lluictrlfactory.h"
#include "lltabcontainer.h"
#include "llaccordionctrltab.h"
#include "lluiusage.h"
static LLDefaultChildRegistry::Register<LLUICtrl> r("ui_ctrl");
@ -282,6 +283,7 @@ LLUICtrl::commit_signal_t::slot_type LLUICtrl::initCommitCallback(const CommitCa
else
{
std::string function_name = cb.function_name;
setFunctionName(function_name);
commit_callback_t* func = (CommitCallbackRegistry::getValue(function_name));
if (func)
{
@ -422,7 +424,19 @@ BOOL LLUICtrl::canFocusChildren() const
void LLUICtrl::onCommit()
{
if (mCommitSignal)
(*mCommitSignal)(this, getValue());
{
if (!mFunctionName.empty())
{
LL_DEBUGS("UIUsage") << "calling commit function " << mFunctionName << LL_ENDL;
LLUIUsage::instance().logCommand(mFunctionName);
LLUIUsage::instance().logControl(getPathname());
}
else
{
//LL_DEBUGS("UIUsage") << "calling commit function " << "UNKNOWN" << LL_ENDL;
}
(*mCommitSignal)(this, getValue());
}
}
//virtual
@ -597,6 +611,12 @@ void LLUICtrl::setMakeInvisibleControlVariable(LLControlVariable* control)
setVisible(!(mMakeInvisibleControlVariable->getValue().asBoolean()));
}
}
void LLUICtrl::setFunctionName(const std::string& function_name)
{
mFunctionName = function_name;
}
// static
bool LLUICtrl::controlListener(const LLSD& newvalue, LLHandle<LLUICtrl> handle, std::string type)
{

View File

@ -183,6 +183,8 @@ public:
void setMakeVisibleControlVariable(LLControlVariable* control);
void setMakeInvisibleControlVariable(LLControlVariable* control);
void setFunctionName(const std::string& function_name);
virtual void setTentative(BOOL b);
virtual BOOL getTentative() const;
virtual void setValue(const LLSD& value);
@ -310,6 +312,8 @@ protected:
LLControlVariable* mMakeInvisibleControlVariable;
boost::signals2::connection mMakeInvisibleControlConnection;
std::string mFunctionName;
static F32 sActiveControlTransparency;
static F32 sInactiveControlTransparency;

146
indra/llui/lluiusage.cpp Normal file
View File

@ -0,0 +1,146 @@
/**
* @file lluiuisage.cpp
* @brief Source file for LLUIUsage
*
* $LicenseInfo:firstyear=2021&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2021, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "linden_common.h"
#include "lluiusage.h"
#include <boost/algorithm/string.hpp>
LLUIUsage::LLUIUsage()
{
}
LLUIUsage::~LLUIUsage()
{
}
// static
std::string LLUIUsage::sanitized(const std::string& s)
{
// Remove characters that make the ViewerStats db unhappy
std::string result(s);
std::replace(result.begin(), result.end(), '.', '_');
std::replace(result.begin(), result.end(), ' ', '_');
return result;
}
// static
void LLUIUsage::setLLSDPath(LLSD& sd, const std::string& path, S32 max_elts, const LLSD& val)
{
// Keep the last max_elts components of the specified path
std::vector<std::string> fields;
boost::split(fields, path, boost::is_any_of("/"));
auto first_pos = std::max(fields.begin(), fields.end() - max_elts);
auto end_pos = fields.end();
std::vector<std::string> last_fields(first_pos,end_pos);
setLLSDNested(sd, last_fields, val);
}
// 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)
{
LLSD* fsd = &sd;
for (auto it=fields.begin(); it!=fields.end(); ++it)
{
if (it == fields.end()-1)
{
(*fsd)[*it] = val;
}
else
{
if (!(*fsd)[*it].isMap())
{
(*fsd)[*it] = LLSD::emptyMap();
}
fsd = &(*fsd)[*it];
}
}
}
void LLUIUsage::logCommand(const std::string& command)
{
mCommandCounts[sanitized(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)]++;
LL_DEBUGS("UIUsage") << "floater " << floater << LL_ENDL;
}
void LLUIUsage::logPanel(const std::string& p)
{
mPanelCounts[sanitized(p)]++;
LL_DEBUGS("UIUsage") << "panel " << p << LL_ENDL;
}
LLSD LLUIUsage::asLLSD() const
{
LLSD result;
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);
}
return result;
}
// Clear up some junk content generated during initial login/UI initialization
void LLUIUsage::clear()
{
LL_DEBUGS("UIUsage") << "clear" << LL_ENDL;
mCommandCounts.clear();
mControlCounts.clear();
mFloaterCounts.clear();
mPanelCounts.clear();
}

57
indra/llui/lluiusage.h Normal file
View File

@ -0,0 +1,57 @@
/**
* @file lluiuisage.h
* @brief Header file for LLUIUsage
*
* $LicenseInfo:firstyear=2021&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2021, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLUIUSAGE_H
#define LL_LLUIUSAGE_H
#include <map>
#include "llsd.h"
#include "llsingleton.h"
// UIUsage tracking to see which operations and UI elements are most popular in a session
class LLUIUsage : public LLSingleton<LLUIUsage>
{
public:
LLSINGLETON(LLUIUsage);
~LLUIUsage();
public:
static std::string sanitized(const std::string& s);
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);
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;
};
#endif // LLUIUIUSAGE.h

View File

@ -58,6 +58,7 @@
#include "llmultigesture.h"
#include "llui.h"
#include "lluictrlfactory.h"
#include "lluiusage.h"
//
// Globals
@ -566,6 +567,8 @@ void LLChatBar::sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL
// as soon as we say something, we no longer care about teaching the user
// how to chat
gWarningSettings.setBOOL("FirstOtherChatBeforeUser", FALSE);
LLUIUsage::instance().logCommand("Chat.Send"); // Pseudo-command
// Look for "/20 foo" channel chats.
S32 channel = 0;

View File

@ -67,6 +67,7 @@
#include "llviewerchat.h"
#include "lltranslate.h"
#include "llautoreplace.h"
#include "lluiusage.h"
S32 LLFloaterIMNearbyChat::sLastSpecialChatChannel = 0;
@ -697,6 +698,7 @@ void LLFloaterIMNearbyChat::sendChatFromViewer(const std::string &utf8text, ECha
void LLFloaterIMNearbyChat::sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL animate)
{
LLUIUsage::instance().logCommand("Chat.Send"); // pseuo-command
// Look for "/20 foo" channel chats.
S32 channel = 0;
LLWString out_text = stripChannelNumber(wtext, &channel);

View File

@ -144,6 +144,7 @@
#include "lltoolmgr.h"
#include "lltrans.h"
#include "llui.h"
#include "lluiusage.h"
#include "llurldispatcher.h"
#include "llurlentry.h"
#include "llslurl.h"
@ -2271,6 +2272,8 @@ bool idle_startup()
LLParcel::C_ANY,
"");
LLUIUsage::instance().clear();
return TRUE;
}

View File

@ -116,7 +116,6 @@
#include "llviewerregion.h"
#include "llfloaterregionrestarting.h"
#include <boost/algorithm/string/split.hpp> //
#include <boost/foreach.hpp>
#include "llnotificationmanager.h" //

View File

@ -63,6 +63,7 @@
#include "llsdutil.h"
#include "llcorehttputil.h"
#include "llvoicevivox.h"
#include "lluiusage.h"
namespace LLStatViewer
{
@ -577,6 +578,8 @@ void send_viewer_stats(bool include_preferences)
fail["invalid"] = (S32) gMessageSystem->mInvalidOnCircuitPackets;
fail["missing_updater"] = (S32) LLAppViewer::instance()->isUpdaterMissing();
body["ui"] = LLUIUsage::instance().asLLSD();
body["stats"]["voice"] = LLVoiceVivoxStats::getInstance()->read();
// Misc stats, two strings and two ints

View File

@ -190,6 +190,8 @@ LLPointer<LLViewerFetchedTexture> LLWorldMipmap::loadObjectsTile(U32 grid_x, U32
//LL_INFOS("WorldMap") << "LLWorldMipmap::loadObjectsTile(), URL = " << imageurl << LL_ENDL;
LLPointer<LLViewerFetchedTexture> img = LLViewerTextureManager::getFetchedTextureFromUrl(imageurl, FTT_MAP_TILE, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE);
LL_INFOS("MAPURL") << "fetching map tile from " << imageurl << LL_ENDL;
img->setBoostLevel(LLGLTexture::BOOST_MAP);
// Return the smart pointer