Merged in lindenlab/viewer-lynx

meow-7.2.2
AndreyL ProductEngine 2016-06-16 00:01:59 +03:00
commit a199cd76a1
9 changed files with 599 additions and 465 deletions

View File

@ -576,6 +576,33 @@ std::string utf8str_truncate(const std::string& utf8str, const S32 max_len)
}
}
std::string utf8str_symbol_truncate(const std::string& utf8str, const S32 symbol_len)
{
if (0 == symbol_len)
{
return std::string();
}
if ((S32)utf8str.length() <= symbol_len)
{
return utf8str;
}
else
{
int len = 0, byteIndex = 0;
const char* aStr = utf8str.c_str();
size_t origSize = utf8str.size();
for (byteIndex = 0; len < symbol_len && byteIndex < origSize; byteIndex++)
{
if ((aStr[byteIndex] & 0xc0) != 0x80)
{
len += 1;
}
}
return utf8str.substr(0, byteIndex);
}
}
std::string utf8str_substChar(
const std::string& utf8str,
const llwchar target_char,

View File

@ -563,6 +563,17 @@ LL_COMMON_API S32 utf8str_compare_insensitive(
const std::string& lhs,
const std::string& rhs);
/**
* @brief Properly truncate a utf8 string to a maximum character count.
*
* If symbol_len is longer than the string passed in, the return
* value == utf8str.
* @param utf8str A valid utf8 string to truncate.
* @param symbol_len The maximum number of symbols in the return value.
* @return Returns a valid utf8 string with symbol count <= max_len.
*/
LL_COMMON_API std::string utf8str_symbol_truncate(const std::string& utf8str, const S32 symbol_len);
/**
* @brief Replace all occurences of target_char with replace_char
*

View File

@ -181,6 +181,10 @@ protected:
// Map of known bad assets
typedef std::map<LLUUID,U64,lluuid_less> toxic_asset_map_t;
// *TODO: these typedefs are passed into the VFS via a legacy C function pointer
// future project would be to convert these to C++ callables (std::function<>) so that
// we can use bind and remove the userData parameter.
//
typedef void (*LLGetAssetCallback)(LLVFS *vfs, const LLUUID &asset_id,
LLAssetType::EType asset_type, void *user_data, S32 status, LLExtStat ext_status);

View File

@ -400,12 +400,7 @@ void LLLineEditor::setText(const LLStringExplicit &new_text)
if (mMaxLengthChars)
{
LLWString truncated_wstring = utf8str_to_wstring(truncated_utf8);
if (truncated_wstring.size() > (U32)mMaxLengthChars)
{
truncated_wstring = truncated_wstring.substr(0, mMaxLengthChars);
}
mText.assign(wstring_to_utf8str(truncated_wstring));
mText.assign(utf8str_symbol_truncate(truncated_utf8, mMaxLengthChars));
}
if (all_selected)

File diff suppressed because it is too large Load Diff

View File

@ -37,6 +37,8 @@
#include "llviewerinventory.h"
#include "llevents.h"
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Class LLFloaterScriptQueue
//
@ -48,7 +50,7 @@
// scripts manipulated.
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLFloaterScriptQueue : public LLFloater, public LLVOInventoryListener
class LLFloaterScriptQueue : public LLFloater/*, public LLVOInventoryListener*/
{
public:
LLFloaterScriptQueue(const LLSD& key);
@ -64,29 +66,18 @@ public:
// start() returns TRUE if the queue has started, otherwise FALSE.
BOOL start();
protected:
// This is the callback method for the viewer object currently
// being worked on.
/*virtual*/ void inventoryChanged(LLViewerObject* obj,
LLInventoryObject::object_list_t* inv,
S32 serial_num,
void* queue);
// This is called by inventoryChanged
virtual void handleInventory(LLViewerObject* viewer_obj,
LLInventoryObject::object_list_t* inv) = 0;
void addProcessingMessage(const std::string &message, const LLSD &args);
void addStringMessage(const std::string &message);
std::string getStartString() const { return mStartString; }
protected:
static void onCloseBtn(void* user_data);
// returns true if this is done
BOOL isDone() const;
virtual BOOL startQueue();
// go to the next object. If no objects left, it falls out
// silently and waits to be killed by the deleteIfDone() callback.
BOOL nextObject();
BOOL popNext();
virtual bool startQueue() = 0;
void setStartString(const std::string& s) { mStartString = s; }
@ -96,12 +87,16 @@ protected:
LLButton* mCloseBtn;
// Object Queue
std::vector<LLUUID> mObjectIDs;
uuid_list_t mObjectIDs;
LLUUID mCurrentObjectID;
bool mDone;
std::string mStartString;
bool mMono;
typedef boost::function<bool(const LLPointer<LLViewerObject> &, LLInventoryObject*, LLEventPump &)> fnQueueAction_t;
static void objectScriptProcessingQueueCoro(std::string action, LLHandle<LLFloaterScriptQueue> hfloater, uuid_list_t objectList, fnQueueAction_t func);
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -122,8 +117,6 @@ class LLFloaterCompileQueue : public LLFloaterScriptQueue
{
friend class LLFloaterReg;
public:
// remove any object in mScriptScripts with the matching uuid.
void removeItemByItemID(const LLUUID& item_id);
void experienceIdsReceived( const LLSD& content );
BOOL hasExperience(const LLUUID& id)const;
@ -132,27 +125,17 @@ protected:
LLFloaterCompileQueue(const LLSD& key);
virtual ~LLFloaterCompileQueue();
// This is called by inventoryChanged
virtual void handleInventory(LLViewerObject* viewer_obj,
LLInventoryObject::object_list_t* inv);
virtual bool startQueue();
static void requestAsset(struct LLScriptQueueData* datap, const LLSD& experience);
static bool processScript(LLHandle<LLFloaterCompileQueue> hfloater, const LLPointer<LLViewerObject> &object, LLInventoryObject* inventory, LLEventPump &pump);
static void finishLSLUpload(LLUUID itemId, LLUUID taskId, LLUUID newAssetId, LLSD response, std::string scriptName, LLUUID queueId);
// This is the callback for when each script arrives
static void scriptArrived(LLVFS *vfs, const LLUUID& asset_id,
LLAssetType::EType type,
void* user_data, S32 status, LLExtStat ext_status);
virtual BOOL startQueue();
protected:
LLViewerInventoryItem::item_array_t mCurrentScripts;
//bool checkAssetId(const LLUUID &assetId);
static void handleHTTPResponse(std::string pumpName, const LLSD &expresult);
static void handleScriptRetrieval(LLVFS *vfs, const LLUUID& assetId, LLAssetType::EType type, void* userData, S32 status, LLExtStat extStatus);
private:
static void processExperienceIdResults(LLSD result, LLUUID parent);
//uuid_list_t mAssetIds; // list of asset IDs processed.
uuid_list_t mExperienceIds;
};
@ -169,9 +152,9 @@ protected:
LLFloaterResetQueue(const LLSD& key);
virtual ~LLFloaterResetQueue();
// This is called by inventoryChanged
virtual void handleInventory(LLViewerObject* viewer_obj,
LLInventoryObject::object_list_t* inv);
static bool resetObjectScripts(LLHandle<LLFloaterScriptQueue> hfloater, const LLPointer<LLViewerObject> &object, LLInventoryObject* inventory, LLEventPump &pump);
virtual bool startQueue();
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -186,10 +169,10 @@ class LLFloaterRunQueue : public LLFloaterScriptQueue
protected:
LLFloaterRunQueue(const LLSD& key);
virtual ~LLFloaterRunQueue();
// This is called by inventoryChanged
virtual void handleInventory(LLViewerObject* viewer_obj,
LLInventoryObject::object_list_t* inv);
static bool runObjectScripts(LLHandle<LLFloaterScriptQueue> hfloater, const LLPointer<LLViewerObject> &object, LLInventoryObject* inventory, LLEventPump &pump);
virtual bool startQueue();
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -205,9 +188,9 @@ protected:
LLFloaterNotRunQueue(const LLSD& key);
virtual ~LLFloaterNotRunQueue();
// This is called by inventoryChanged
virtual void handleInventory(LLViewerObject* viewer_obj,
LLInventoryObject::object_list_t* inv);
static bool stopObjectScripts(LLHandle<LLFloaterScriptQueue> hfloater, const LLPointer<LLViewerObject> &object, LLInventoryObject* inventory, LLEventPump &pump);
virtual bool startQueue();
};
#endif // LL_LLCOMPILEQUEUE_H

View File

@ -4034,7 +4034,7 @@ void LLMeshRepository::uploadError(LLSD& args)
//static
F32 LLMeshRepository::getStreamingCost(LLSD& header, F32 radius, S32* bytes, S32* bytes_visible, S32 lod, F32 *unscaled_value)
{
if (header.size() == 0)
if (header.size() == 0 || header.has("404") || header["version"].asInteger() > MAX_MESH_VERSION)
{
return 0.f;
}

View File

@ -67,7 +67,7 @@
follows="left|top"
height="32"
left_pad="-11"
max_length_bytes="64"
max_length_chars="16"
text_pad_left="8"
name="password_edit"
label="Password"

View File

@ -124,7 +124,7 @@
width="200"
height="32"
left="220"
max_length_bytes="64"
max_length_chars="16"
name="password_edit"
label="Password"
text_pad_left="8"