Merge branch 'DRTVWR-577-maint-S' of https://github.com/secondlife/viewer

# Conflicts:
#	indra/llcommon/llsdserialize.h
#	indra/newview/llfilepicker_mac.mm
#	indra/newview/llviewermessage.cpp
#	indra/newview/skins/default/xui/de/floater_profile.xml
#	indra/newview/skins/default/xui/es/floater_profile.xml
#	indra/newview/skins/default/xui/fr/floater_profile.xml
#	indra/newview/skins/default/xui/it/floater_profile.xml
#	indra/newview/skins/default/xui/ja/floater_profile.xml
#	indra/newview/skins/default/xui/pt/floater_profile.xml
meow-7.2.2
Ansariel 2023-02-10 10:49:36 +01:00
commit 2c8130fd8d
11 changed files with 171 additions and 112 deletions

View File

@ -2298,7 +2298,7 @@ LLUZipHelper::EZipRresult LLUZipHelper::unzip_llsd(LLSD& data, const U8* in, S32
//This unzip function will only work with a gzip header and trailer - while the contents
//of the actual compressed data is the same for either format (gzip vs zlib ), the headers
//and trailers are different for the formats.
U8* unzip_llsdNavMesh(bool& valid, size_t& outsize, std::istream& is, S32 size)
U8* unzip_llsdNavMesh( bool& valid, size_t& outsize, std::istream& is, S32 size )
{
// <FS:Beq pp Rye> Add non-allocating variants of unzip_llsd
// if (size == 0)
@ -2434,7 +2434,7 @@ U8* unzip_llsdNavMesh(bool& valid, size_t& outsize, std::istream& is, S32 size)
return unzip_llsdNavMesh(valid, outsize, in.get(), size);
}
U8* unzip_llsdNavMesh(bool& valid, unsigned int& outsize, const U8* in, S32 size)
U8* unzip_llsdNavMesh(bool& valid, size_t& outsize, const U8* in, S32 size)
{
if (size == 0)
{
@ -2442,7 +2442,7 @@ U8* unzip_llsdNavMesh(bool& valid, unsigned int& outsize, const U8* in, S32 size
return nullptr;
}
U8* result = nullptr;
U32 cur_size = 0;
llssize cur_size = 0;
z_stream strm;
const U32 CHUNK = 0x4000;

View File

@ -872,7 +872,7 @@ LL_COMMON_API std::string zip_llsd(LLSD& data);
LL_COMMON_API U8* unzip_llsdNavMesh( bool& valid, size_t& outsize,std::istream& is, S32 size);
// <FS:Beq pp Rye> Add non-allocating variants of unzip_llsd
LL_COMMON_API U8* unzip_llsdNavMesh(bool& valid, unsigned int& outsize, const U8* in, S32 size);
LL_COMMON_API U8* unzip_llsdNavMesh(bool& valid, size_t& outsize, const U8* in, S32 size);
// returns a pointer to the array or past the array if the deprecated header exists
LL_COMMON_API char* strip_deprecated_header(char* in, llssize& cur_size, llssize* header_size = nullptr);

View File

@ -268,7 +268,9 @@ void LLAvatarNameCache::handleAvNameCacheSuccess(const LLSD &data, const LLSD &h
{
const LLUUID& agent_id = *it;
LL_WARNS("AvNameCache") << "LLAvatarNameResponder::result "
// If cap fails, response can contain a lot of names,
// don't spam too much
LL_DEBUGS("AvNameCache") << "LLAvatarNameResponder::result "
<< "failed id " << agent_id
<< LL_ENDL;
@ -296,7 +298,7 @@ void LLAvatarNameCache::handleAgentError(const LLUUID& agent_id)
// </FS:Ansariel>
// there is no existing cache entry, so make a temporary name from legacy
LL_WARNS("AvNameCache") << "LLAvatarNameCache get legacy for agent "
LL_DEBUGS("AvNameCache") << "LLAvatarNameCache get legacy for agent "
<< agent_id << LL_ENDL;
gCacheName->get(agent_id, false, // legacy compatibility
boost::bind(&LLAvatarNameCache::legacyNameFetch, _1, _2, _3));

View File

@ -252,31 +252,9 @@ void LLKeyboardWin32::scanKeyboard()
{
S32 key;
MSG msg;
BOOL pending_key_events = PeekMessage(&msg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_NOREMOVE | PM_NOYIELD);
PeekMessage(&msg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_NOREMOVE | PM_NOYIELD);
for (key = 0; key < KEY_COUNT; key++)
{
// On Windows, verify key down state. JC
// RN: only do this if we don't have further key events in the queue
// as otherwise there might be key repeat events still waiting for this key we are now dumping
if (!pending_key_events && mKeyLevel[key])
{
// *TODO: I KNOW there must be a better way of
// interrogating the key state than this, using async key
// state can cause ALL kinds of bugs - Doug
if ((key < KEY_BUTTON0) && ((key < '0') || (key > '9')))
{
// ...under windows make sure the key actually still is down.
// ...translate back to windows key
U16 virtual_key = inverseTranslateExtendedKey(key);
// keydown in highest bit
if (!pending_key_events && !(GetAsyncKeyState(virtual_key) & 0x8000))
{
//LL_INFOS() << "Key up event missed, resetting" << LL_ENDL;
mKeyLevel[key] = FALSE;
}
}
}
// Generate callback if any event has occurred on this key this frame.
// Can't just test mKeyLevel, because this could be a slow frame and
// key might have gone down then up. JC

View File

@ -785,9 +785,9 @@ bool LLFilePicker::doNavChooseDialogModeless(ELoadFilter filter,
return false;
}
std::vector<std::string> *allowed_types=navOpenFilterProc(filter);
std::unique_ptr<std::vector<std::string>> allowed_types=navOpenFilterProc(filter);
doLoadDialogModeless(allowed_types,
doLoadDialogModeless(allowed_types.get(),
mPickOptions,
callback,
userdata);

View File

@ -31,7 +31,6 @@
NSOpenPanel *init_panel(const std::vector<std::string>* allowed_types, unsigned int flags)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; // <FS> Fix mem leak by Cinder Roxley
int i;
NSOpenPanel *panel = [NSOpenPanel openPanel];
@ -72,35 +71,39 @@ NSOpenPanel *init_panel(const std::vector<std::string>* allowed_types, unsigned
return panel;
}
std::unique_ptr<std::vector<std::string>> doLoadDialog(const std::vector<std::string>* allowed_types,
std::unique_ptr<std::vector<std::string>> doLoadDialog(const std::vector<std::string>* allowed_types,
unsigned int flags)
{
std::unique_ptr<std::vector<std::string>> outfiles;
int result;
NSOpenPanel *panel = init_panel(allowed_types,flags);
result = [panel runModal];
if (result == NSOKButton)
{
NSArray *filesToOpen = [panel URLs];
int i, count = [filesToOpen count];
@autoreleasepool
{
int result;
//Aura TODO: We could init a small window and release it at the end of this routine
//for a modeless interface.
NSOpenPanel *panel = init_panel(allowed_types,flags);
result = [panel runModal];
if (count > 0)
if (result == NSOKButton)
{
outfiles.reset(new std::vector<std::string>);
}
for (i=0; i<count; i++) {
NSString *aFile = [[filesToOpen objectAtIndex:i] path];
std::string *afilestr = new std::string([aFile UTF8String]);
outfiles->push_back(*afilestr);
NSArray *filesToOpen = [panel URLs];
int i, count = [filesToOpen count];
if (count > 0)
{
outfiles.reset(new std::vector<std::string>);
}
for (i=0; i<count; i++) {
NSString *aFile = [[filesToOpen objectAtIndex:i] path];
std::string afilestr = std::string([aFile UTF8String]);
outfiles->push_back(afilestr);
}
}
}
[pool release]; // <FS> Fix mem leak by Cinder Roxley
return outfiles;
}
@ -109,11 +112,14 @@ void doLoadDialogModeless(const std::vector<std::string>* allowed_types,
void (*callback)(bool, std::vector<std::string> &, void*),
void *userdata)
{
// Note: might need to return and save this panel
// so that it does not close immediately
NSOpenPanel *panel = init_panel(allowed_types,flags);
@autoreleasepool
{
// Note: might need to return and save this panel
// so that it does not close immediately
NSOpenPanel *panel = init_panel(allowed_types,flags);
[panel beginWithCompletionHandler:^(NSModalResponse result)
[panel beginWithCompletionHandler:^(NSModalResponse result)
{
std::vector<std::string> outfiles;
if (result == NSOKButton)
@ -141,42 +147,41 @@ void doLoadDialogModeless(const std::vector<std::string>* allowed_types,
callback(false, outfiles, userdata);
}
}];
}
}
std::unique_ptr<std::string> doSaveDialog(const std::string* file,
std::unique_ptr<std::string> doSaveDialog(const std::string* file,
const std::string* type,
const std::string* creator,
const std::string* extension,
unsigned int flags)
{
std::unique_ptr<std::string> outfile;
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; // <FS> Fix mem leak by Cinder Roxley
NSSavePanel *panel = [NSSavePanel savePanel];
NSString *extensionns = [NSString stringWithCString:extension->c_str() encoding:[NSString defaultCStringEncoding]];
NSArray *fileType = [extensionns componentsSeparatedByString:@","];
//[panel setMessage:@"Save Image File"];
[panel setTreatsFilePackagesAsDirectories: ( flags & F_NAV_SUPPORT ) ];
[panel setCanSelectHiddenExtension:true];
[panel setAllowedFileTypes:fileType];
NSString *fileName = [NSString stringWithCString:file->c_str() encoding:[NSString defaultCStringEncoding]];
NSURL* url = [NSURL fileURLWithPath:fileName];
[panel setNameFieldStringValue: fileName];
[panel setDirectoryURL: url];
[panel setNameFieldStringValue: fileName]; // <FS:CR> Populate filename in the save panel
if([panel runModal] ==
NSFileHandlingPanelOKButton)
{
NSURL* url = [panel URL];
NSString* p = [url path];
outfile.reset(new std::string([p UTF8String]));
// write the file
@autoreleasepool
{
NSSavePanel *panel = [NSSavePanel savePanel];
NSString *extensionns = [NSString stringWithCString:extension->c_str() encoding:[NSString defaultCStringEncoding]];
NSArray *fileType = [extensionns componentsSeparatedByString:@","];
//[panel setMessage:@"Save Image File"];
[panel setTreatsFilePackagesAsDirectories: ( flags & F_NAV_SUPPORT ) ];
[panel setCanSelectHiddenExtension:true];
[panel setAllowedFileTypes:fileType];
NSString *fileName = [NSString stringWithCString:file->c_str() encoding:[NSString defaultCStringEncoding]];
NSURL* url = [NSURL fileURLWithPath:fileName];
[panel setNameFieldStringValue: fileName];
[panel setDirectoryURL: url];
if([panel runModal] ==
NSFileHandlingPanelOKButton)
{
NSURL* url = [panel URL];
NSString* p = [url path];
outfile.reset(new std::string([p UTF8String]));
// write the file
}
}
[pool release]; // <FS> Fix mem leak by Cinder Roxley
return outfile;
}
@ -188,38 +193,40 @@ void doSaveDialogModeless(const std::string* file,
void (*callback)(bool, std::string&, void*),
void *userdata)
{
NSSavePanel *panel = [NSSavePanel savePanel];
@autoreleasepool {
NSSavePanel *panel = [NSSavePanel savePanel];
NSString *extensionns = [NSString stringWithCString:extension->c_str() encoding:[NSString defaultCStringEncoding]];
NSArray *fileType = [extensionns componentsSeparatedByString:@","];
NSString *extensionns = [NSString stringWithCString:extension->c_str() encoding:[NSString defaultCStringEncoding]];
NSArray *fileType = [extensionns componentsSeparatedByString:@","];
//[panel setMessage:@"Save Image File"];
[panel setTreatsFilePackagesAsDirectories: ( flags & F_NAV_SUPPORT ) ];
[panel setCanSelectHiddenExtension:true];
[panel setAllowedFileTypes:fileType];
NSString *fileName = [NSString stringWithCString:file->c_str() encoding:[NSString defaultCStringEncoding]];
//[panel setMessage:@"Save Image File"];
[panel setTreatsFilePackagesAsDirectories: ( flags & F_NAV_SUPPORT ) ];
[panel setCanSelectHiddenExtension:true];
[panel setAllowedFileTypes:fileType];
NSString *fileName = [NSString stringWithCString:file->c_str() encoding:[NSString defaultCStringEncoding]];
NSURL* url = [NSURL fileURLWithPath:fileName];
[panel setNameFieldStringValue: fileName];
[panel setDirectoryURL: url];
NSURL* url = [NSURL fileURLWithPath:fileName];
[panel setNameFieldStringValue: fileName];
[panel setDirectoryURL: url];
[panel beginWithCompletionHandler:^(NSModalResponse result)
{
if (result == NSOKButton)
{
NSURL* url = [panel URL];
NSString* p = [url path];
std::string outfile([p UTF8String]);
[panel beginWithCompletionHandler:^(NSModalResponse result)
{
if (result == NSOKButton)
{
NSURL* url = [panel URL];
NSString* p = [url path];
std::string outfile([p UTF8String]);
callback(true, outfile, userdata);
}
else // cancel
{
std::string outfile;
callback(false, outfile, userdata);
}
}];
callback(true, outfile, userdata);
}
else // cancel
{
std::string outfile;
callback(false, outfile, userdata);
}
}];
}
}
#endif

View File

@ -546,6 +546,18 @@ void LLBingTranslationHandler::verifyKey(const std::string &key, LLTranslate::Ke
}
//=========================================================================
LLTranslate::LLTranslate():
mCharsSeen(0),
mCharsSent(0),
mFailureCount(0),
mSuccessCount(0)
{
}
LLTranslate::~LLTranslate()
{
}
/*static*/
void LLTranslate::translateMessage(const std::string &from_lang, const std::string &to_lang,
const std::string &mesg, TranslationSuccess_fn success, TranslationFailure_fn failure)
@ -634,6 +646,43 @@ bool LLTranslate::isTranslationConfigured()
return getPreferredHandler().isConfigured();
}
void LLTranslate::logCharsSeen(size_t count)
{
mCharsSeen += count;
}
void LLTranslate::logCharsSent(size_t count)
{
mCharsSent += count;
}
void LLTranslate::logSuccess(S32 count)
{
mSuccessCount += count;
}
void LLTranslate::logFailure(S32 count)
{
mFailureCount += count;
}
LLSD LLTranslate::asLLSD() const
{
LLSD res;
bool on = gSavedSettings.getBOOL("TranslateChat");
res["on"] = on;
res["chars_seen"] = (S32) mCharsSeen;
if (on)
{
res["chars_sent"] = (S32) mCharsSent;
res["success_count"] = mSuccessCount;
res["failure_count"] = mFailureCount;
res["language"] = getTranslateLanguage();
res["service"] = gSavedSettings.getString("TranslationService");
}
return res;
}
// static
LLTranslationAPIHandler& LLTranslate::getPreferredHandler()
{

View File

@ -30,6 +30,8 @@
#include "llbufferstream.h"
#include <boost/function.hpp>
#include "llsingleton.h"
namespace Json
{
class Value;
@ -48,8 +50,10 @@ class LLTranslationAPIHandler;
*
* API keys for translation are taken from saved settings.
*/
class LLTranslate
class LLTranslate: public LLSingleton<LLTranslate>
{
LLSINGLETON(LLTranslate);
~LLTranslate();
LOG_CLASS(LLTranslate);
public :
@ -94,9 +98,19 @@ public :
static std::string addNoTranslateTags(std::string mesg);
static std::string removeNoTranslateTags(std::string mesg);
void logCharsSeen(size_t count);
void logCharsSent(size_t count);
void logSuccess(S32 count);
void logFailure(S32 count);
LLSD asLLSD() const;
private:
static LLTranslationAPIHandler& getPreferredHandler();
static LLTranslationAPIHandler& getHandler(EService service);
size_t mCharsSeen;
size_t mCharsSent;
S32 mFailureCount;
S32 mSuccessCount;
};
#endif

View File

@ -2865,6 +2865,7 @@ void translateSuccess(LLChat chat, LLSD toastArgs, std::string originalMsg, std:
chat.mText += " (" + LLTranslate::removeNoTranslateTags(translation) + ")";
}
LLTranslate::instance().logSuccess(1);
LLNotificationsUI::LLNotificationManager::instance().onChat(chat, toastArgs);
}
@ -2874,6 +2875,7 @@ void translateFailure(LLChat chat, LLSD toastArgs, int status, const std::string
LLStringUtil::replaceString(msg, "\n", " "); // we want one-line error messages
chat.mText += " (" + msg + ")";
LLTranslate::instance().logFailure(1);
LLNotificationsUI::LLNotificationManager::instance().onChat(chat, toastArgs);
}
@ -3419,6 +3421,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)
}
// </FS:PP>
LLTranslate::instance().logCharsSeen(mesg.size());
// <FS:PP> gSavedSettings to LLCachedControl
// if (gSavedSettings.getBOOL("TranslateChat") && chat.mSourceType != CHAT_SOURCE_SYSTEM)
static LLCachedControl<bool> TranslateChat(gSavedSettings, "TranslateChat");
@ -3432,6 +3435,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)
const std::string from_lang = ""; // leave empty to trigger autodetect
const std::string to_lang = LLTranslate::getTranslateLanguage();
LLTranslate::instance().logCharsSent(mesg.size());
LLTranslate::translateMessage(from_lang, to_lang, mesg,
boost::bind(&translateSuccess, chat, args, mesg, from_lang, _1, _2),
boost::bind(&translateFailure, chat, args, _1, _2));

View File

@ -64,6 +64,7 @@
#include "llvoicevivox.h"
#include "llinventorymodel.h"
#include "lluiusage.h"
#include "lltranslate.h"
namespace LLStatViewer
{
@ -506,6 +507,7 @@ void send_viewer_stats(bool include_preferences)
agent["meters_traveled"] = gAgent.getDistanceTraveled();
agent["regions_visited"] = gAgent.getRegionsVisited();
agent["mem_use"] = LLMemory::getCurrentRSS() / 1024.0;
agent["translation"] = LLTranslate::instance().asLLSD();
LLSD &system = body["system"];
@ -536,6 +538,7 @@ void send_viewer_stats(bool include_preferences)
gGLManager.asLLSD(system["gl"]);
S32 shader_level = 0;
if (LLPipeline::sRenderDeferred)
{

View File

@ -47,6 +47,7 @@
width="359" />
<add_btn
name="add_wearable"
visible="false"
layout="topleft"
follows="top|right"
image_unselected="Add_Icon"
@ -58,6 +59,7 @@
tab_stop="false" />
<remove_btn
name="remove_wearable"
visible="false"
layout="topleft"
follows="top|right"
image_unselected="Remove_Icon"