diff --git a/indra/llcommon/llsdserialize.cpp b/indra/llcommon/llsdserialize.cpp index c7e69e29cb..5b6a3affb3 100644 --- a/indra/llcommon/llsdserialize.cpp +++ b/indra/llcommon/llsdserialize.cpp @@ -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 ) { // 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; diff --git a/indra/llcommon/llsdserialize.h b/indra/llcommon/llsdserialize.h index 49880ec1b5..8fe077579a 100644 --- a/indra/llcommon/llsdserialize.h +++ b/indra/llcommon/llsdserialize.h @@ -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); // 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); diff --git a/indra/llmessage/llavatarnamecache.cpp b/indra/llmessage/llavatarnamecache.cpp index df9224139d..2591642f7a 100644 --- a/indra/llmessage/llavatarnamecache.cpp +++ b/indra/llmessage/llavatarnamecache.cpp @@ -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) // // 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)); diff --git a/indra/llwindow/llkeyboardwin32.cpp b/indra/llwindow/llkeyboardwin32.cpp index 04b99187eb..179e69a7ce 100644 --- a/indra/llwindow/llkeyboardwin32.cpp +++ b/indra/llwindow/llkeyboardwin32.cpp @@ -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 diff --git a/indra/newview/llfilepicker.cpp b/indra/newview/llfilepicker.cpp index 7f69a15b0a..bdb03f287b 100644 --- a/indra/newview/llfilepicker.cpp +++ b/indra/newview/llfilepicker.cpp @@ -785,9 +785,9 @@ bool LLFilePicker::doNavChooseDialogModeless(ELoadFilter filter, return false; } - std::vector *allowed_types=navOpenFilterProc(filter); + std::unique_ptr> allowed_types=navOpenFilterProc(filter); - doLoadDialogModeless(allowed_types, + doLoadDialogModeless(allowed_types.get(), mPickOptions, callback, userdata); diff --git a/indra/newview/llfilepicker_mac.mm b/indra/newview/llfilepicker_mac.mm index 4537235204..e5965abbd6 100644 --- a/indra/newview/llfilepicker_mac.mm +++ b/indra/newview/llfilepicker_mac.mm @@ -31,7 +31,6 @@ NSOpenPanel *init_panel(const std::vector* allowed_types, unsigned int flags) { - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; // Fix mem leak by Cinder Roxley int i; NSOpenPanel *panel = [NSOpenPanel openPanel]; @@ -72,35 +71,39 @@ NSOpenPanel *init_panel(const std::vector* allowed_types, unsigned return panel; } -std::unique_ptr> doLoadDialog(const std::vector* allowed_types, +std::unique_ptr> doLoadDialog(const std::vector* allowed_types, unsigned int flags) { std::unique_ptr> 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); - } - - for (i=0; ipush_back(*afilestr); + NSArray *filesToOpen = [panel URLs]; + int i, count = [filesToOpen count]; + + if (count > 0) + { + outfiles.reset(new std::vector); + } + + for (i=0; ipush_back(afilestr); + } } } - [pool release]; // Fix mem leak by Cinder Roxley - + return outfiles; } @@ -109,11 +112,14 @@ void doLoadDialogModeless(const std::vector* allowed_types, void (*callback)(bool, std::vector &, 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 outfiles; if (result == NSOKButton) @@ -141,42 +147,41 @@ void doLoadDialogModeless(const std::vector* allowed_types, callback(false, outfiles, userdata); } }]; + } } -std::unique_ptr doSaveDialog(const std::string* file, +std::unique_ptr doSaveDialog(const std::string* file, const std::string* type, const std::string* creator, const std::string* extension, unsigned int flags) { std::unique_ptr outfile; - - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; // 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]; // 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]; // 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 diff --git a/indra/newview/lltranslate.cpp b/indra/newview/lltranslate.cpp index adee90cd28..fe416ba2d5 100644 --- a/indra/newview/lltranslate.cpp +++ b/indra/newview/lltranslate.cpp @@ -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() { diff --git a/indra/newview/lltranslate.h b/indra/newview/lltranslate.h index e0722fbd83..58707e2d36 100644 --- a/indra/newview/lltranslate.h +++ b/indra/newview/lltranslate.h @@ -30,6 +30,8 @@ #include "llbufferstream.h" #include +#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 { + 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 diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index b339b463c4..aecc61873c 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -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) } // + LLTranslate::instance().logCharsSeen(mesg.size()); // gSavedSettings to LLCachedControl // if (gSavedSettings.getBOOL("TranslateChat") && chat.mSourceType != CHAT_SOURCE_SYSTEM) static LLCachedControl 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)); diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp index 2b258967dc..e98ae8a8a6 100644 --- a/indra/newview/llviewerstats.cpp +++ b/indra/newview/llviewerstats.cpp @@ -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) { diff --git a/indra/newview/skins/default/xui/en/widgets/wearable_outfit_list_item.xml b/indra/newview/skins/default/xui/en/widgets/wearable_outfit_list_item.xml index 830eef0abb..28e38b9cbf 100644 --- a/indra/newview/skins/default/xui/en/widgets/wearable_outfit_list_item.xml +++ b/indra/newview/skins/default/xui/en/widgets/wearable_outfit_list_item.xml @@ -47,6 +47,7 @@ width="359" />