V3 merge pt 2 / 2

This commit is contained in:
Shyotl
2012-04-13 23:24:39 -05:00
parent e1d243272f
commit 59fdf3b6e1
6 changed files with 169 additions and 39 deletions

View File

@@ -44,6 +44,7 @@ const S32 GESTURE_VERSION = 2;
LLMultiGesture::LLMultiGesture()
: mKey(),
mMask(),
mName(),
mTrigger(),
mReplaceText(),
mSteps(),
@@ -286,20 +287,27 @@ BOOL LLGestureStepAnimation::deserialize(LLDataPacker& dp)
dp.unpackU32(mFlags, "flags");
return TRUE;
}
std::string LLGestureStepAnimation::getLabel() const
// *NOTE: result is translated in LLPreviewGesture::getLabel()
std::vector<std::string> LLGestureStepAnimation::getLabel() const
{
std::string label;
std::vector<std::string> strings;
// std::string label;
if (mFlags & ANIM_FLAG_STOP)
{
label = "Stop Animation: ";
strings.push_back( "AnimFlagStop");
// label = "Stop Animation: ";
}
else
{
label = "Start Animation: ";
strings.push_back( "AnimFlagStart");
// label = "Start Animation: ";
}
label += mAnimName;
return label;
strings.push_back( mAnimName);
// label += mAnimName;
return strings;
}
void LLGestureStepAnimation::dump()
@@ -353,12 +361,15 @@ BOOL LLGestureStepSound::deserialize(LLDataPacker& dp)
dp.unpackU32(mFlags, "flags");
return TRUE;
}
std::string LLGestureStepSound::getLabel() const
// *NOTE: result is translated in LLPreviewGesture::getLabel()
std::vector<std::string> LLGestureStepSound::getLabel() const
{
std::string label("Sound: ");
label += mSoundName;
return label;
std::vector<std::string> strings;
strings.push_back( "Sound");
strings.push_back( mSoundName);
// std::string label("Sound: ");
// label += mSoundName;
return strings;
}
void LLGestureStepSound::dump()
@@ -408,12 +419,13 @@ BOOL LLGestureStepChat::deserialize(LLDataPacker& dp)
dp.unpackU32(mFlags, "flags");
return TRUE;
}
std::string LLGestureStepChat::getLabel() const
// *NOTE: result is translated in LLPreviewGesture::getLabel()
std::vector<std::string> LLGestureStepChat::getLabel() const
{
std::string label("Chat: ");
label += mChatText;
return label;
std::vector<std::string> strings;
strings.push_back("Chat");
strings.push_back(mChatText);
return strings;
}
void LLGestureStepChat::dump()
@@ -461,22 +473,31 @@ BOOL LLGestureStepWait::deserialize(LLDataPacker& dp)
dp.unpackU32(mFlags, "flags");
return TRUE;
}
std::string LLGestureStepWait::getLabel() const
// *NOTE: result is translated in LLPreviewGesture::getLabel()
std::vector<std::string> LLGestureStepWait::getLabel() const
{
std::string label("--- Wait: ");
std::vector<std::string> strings;
strings.push_back( "Wait" );
// std::string label("--- Wait: ");
if (mFlags & WAIT_FLAG_TIME)
{
char buffer[64]; /* Flawfinder: ignore */
snprintf(buffer, sizeof(buffer), "%.1f seconds", (double)mWaitSeconds); /* Flawfinder: ignore */
label += buffer;
strings.push_back(buffer);
// label += buffer;
}
else if (mFlags & WAIT_FLAG_ALL_ANIM)
{
label += "until animations are done";
strings.push_back("until animations are done");
// label += "until animations are done";
}
else
{
strings.push_back("");
}
return label;
return strings;
}

View File

@@ -134,7 +134,7 @@ public:
virtual EStepType getType() = 0;
// Return a user-readable label for this step
virtual std::string getLabel() const = 0;
virtual std::vector<std::string> getLabel() const = 0;
virtual S32 getMaxSerialSize() const = 0;
virtual BOOL serialize(LLDataPacker& dp) const = 0;
@@ -156,7 +156,7 @@ public:
virtual EStepType getType() { return STEP_ANIMATION; }
virtual std::string getLabel() const;
virtual std::vector<std::string> getLabel() const;
virtual S32 getMaxSerialSize() const;
virtual BOOL serialize(LLDataPacker& dp) const;
@@ -179,7 +179,7 @@ public:
virtual EStepType getType() { return STEP_SOUND; }
virtual std::string getLabel() const;
virtual std::vector<std::string> getLabel() const;
virtual S32 getMaxSerialSize() const;
virtual BOOL serialize(LLDataPacker& dp) const;
@@ -202,7 +202,7 @@ public:
virtual EStepType getType() { return STEP_CHAT; }
virtual std::string getLabel() const;
virtual std::vector<std::string> getLabel() const;
virtual S32 getMaxSerialSize() const;
virtual BOOL serialize(LLDataPacker& dp) const;
@@ -227,7 +227,7 @@ public:
virtual EStepType getType() { return STEP_WAIT; }
virtual std::string getLabel() const;
virtual std::vector<std::string> getLabel() const;
virtual S32 getMaxSerialSize() const;
virtual BOOL serialize(LLDataPacker& dp) const;

View File

@@ -911,6 +911,21 @@ LLGroupMgrGroupData* LLGroupMgr::getGroupData(const LLUUID& id)
return NULL;
}
// Helper function for LLGroupMgr::processGroupMembersReply
// This reformats date strings from MM/DD/YYYY to YYYY/MM/DD ( e.g. 1/27/2008 -> 2008/1/27 )
// so that the sorter can sort by year before month before day.
static void formatDateString(std::string &date_string)
{
tm t;
if (sscanf(date_string.c_str(), "%u/%u/%u", &t.tm_mon, &t.tm_mday, &t.tm_year) == 3 && t.tm_year > 1900)
{
t.tm_year -= 1900;
t.tm_mon--;
t.tm_hour = t.tm_min = t.tm_sec = 0;
timeStructToFormattedString(&t, gSavedSettings.getString("ShortDateFormat"), date_string);
}
}
// static
void LLGroupMgr::processGroupMembersReply(LLMessageSystem* msg, void** data)
{
@@ -960,13 +975,14 @@ void LLGroupMgr::processGroupMembersReply(LLMessageSystem* msg, void** data)
if (member_id.notNull())
{
tm t;
if (sscanf(online_status.c_str(), "%u/%u/%u", &t.tm_mon, &t.tm_mday, &t.tm_year) == 3 && t.tm_year > 1900)
if (online_status == "Online")
{
t.tm_year -= 1900;
t.tm_mon--;
t.tm_hour = t.tm_min = t.tm_sec = 0;
timeStructToFormattedString(&t, gSavedSettings.getString("ShortDateFormat"), online_status);
static std::string localized_online(LLTrans::getString("group_member_status_online"));
online_status = localized_online;
}
else
{
formatDateString(online_status); // reformat for sorting, e.g. 12/25/2008 -> 2008/12/25
}
//llinfos << "Member " << member_id << " has powers " << std::hex << agent_powers << std::dec << llendl;
@@ -1127,6 +1143,22 @@ void LLGroupMgr::processGroupRoleDataReply(LLMessageSystem* msg, void** data)
msg->getU64("RoleData","Powers",powers,i);
msg->getU32("RoleData","Members",member_count,i);
//there are 3 predifined roles - Owners, Officers, Everyone
//there names are defined in lldatagroups.cpp
//lets change names from server to localized strings
if(name == "Everyone")
{
name = LLTrans::getString("group_role_everyone");
}
else if(name == "Officers")
{
name = LLTrans::getString("group_role_officers");
}
else if(name == "Owners")
{
name = LLTrans::getString("group_role_owners");
}
lldebugs << "Adding role data: " << name << " {" << role_id << "}" << llendl;
LLGroupRoleData* rd = new LLGroupRoleData(role_id,name,title,desc,powers,member_count);
group_datap->mRoles[role_id] = rd;

View File

@@ -44,6 +44,7 @@
#include "lldir.h"
#include "llmultigesture.h"
#include "llvfile.h"
#include "lltrans.h"
// newview
#include "llagent.h" // todo: remove
@@ -862,7 +863,7 @@ void LLPreviewGesture::initDefaultGesture()
item = addStep( STEP_ANIMATION );
LLGestureStepAnimation* anim = (LLGestureStepAnimation*)item->getUserdata();
anim->mAnimAssetID = ANIM_AGENT_HELLO;
anim->mAnimName = "Wave";
anim->mAnimName = LLTrans::getString("Wave");
updateLabel(item);
item = addStep( STEP_WAIT );
@@ -872,7 +873,7 @@ void LLPreviewGesture::initDefaultGesture()
item = addStep( STEP_CHAT );
LLGestureStepChat* chat_step = (LLGestureStepChat*)item->getUserdata();
chat_step->mChatText = "Hello, avatar!";
chat_step->mChatText = LLTrans::getString("HelloAvatar");
updateLabel(item);
// Start with item list selected
@@ -1084,7 +1085,7 @@ void LLPreviewGesture::loadUIFromGesture(LLMultiGesture* gesture)
// Create an enabled item with this step
LLSD row;
row["columns"][0]["value"] = new_step->getLabel();
row["columns"][0]["value"] = getLabel( new_step->getLabel());
row["columns"][0]["font"] = "SANSSERIF_SMALL";
LLScrollListItem* item = mStepList->addElement(row);
item->setUserdata(new_step);
@@ -1400,7 +1401,7 @@ void LLPreviewGesture::updateLabel(LLScrollListItem* item)
LLScrollListCell* cell = item->getColumn(0);
LLScrollListText* text_cell = (LLScrollListText*)cell;
std::string label = step->getLabel();
std::string label = getLabel( step->getLabel());
text_cell->setText(label);
}
@@ -1662,7 +1663,7 @@ LLScrollListItem* LLPreviewGesture::addStep( const EStepType step_type )
// Create an enabled item with this step
LLSD row;
row["columns"][0]["value"] = step->getLabel();
row["columns"][0]["value"] = getLabel(step->getLabel());
row["columns"][0]["font"] = "SANSSERIF_SMALL";
LLScrollListItem* step_item = mStepList->addElement(row);
step_item->setUserdata(step);
@@ -1676,6 +1677,63 @@ LLScrollListItem* LLPreviewGesture::addStep( const EStepType step_type )
return step_item;
}
// static
std::string LLPreviewGesture::getLabel(std::vector<std::string> labels)
{
std::vector<std::string> v_labels = labels ;
std::string result("");
if( v_labels.size() != 2)
{
return result;
}
if(v_labels[0]=="Chat")
{
result=LLTrans::getString("Chat Message");
}
else if(v_labels[0]=="Sound")
{
result=LLTrans::getString("Sound");
}
else if(v_labels[0]=="Wait")
{
result=LLTrans::getString("Wait");
}
else if(v_labels[0]=="AnimFlagStop")
{
result=LLTrans::getString("AnimFlagStop");
}
else if(v_labels[0]=="AnimFlagStart")
{
result=LLTrans::getString("AnimFlagStart");
}
// lets localize action value
std::string action = v_labels[1];
if ("None" == action)
{
action = LLTrans::getString("GestureActionNone");
}
else if ("until animations are done" == action)
{
//action = LLFloaterReg::getInstance("preview_gesture")->getChild<LLCheckBoxCtrl>("wait_anim_check")->getLabel();
//Worst. Thing. Ever. We are in a static function. Find any existing gesture preview and grab the label from its 'wait_anim_check' element.
for(preview_map_t::iterator it = LLPreview::sInstances.begin(); it != LLPreview::sInstances.end();++it)
{
LLPreviewGesture* pPreview = dynamic_cast<LLPreviewGesture*>(it->second);
if(pPreview)
{
pPreview->getChild<LLCheckBoxCtrl>("wait_anim_check")->getLabel();
break;
}
}
}
result.append(action);
return result;
}
// static
void LLPreviewGesture::onClickUp(void* data)
{

View File

@@ -113,6 +113,7 @@ protected:
// "Sound", "Chat", or "Wait"
LLScrollListItem* addStep(const enum EStepType step_type);
static std::string getLabel(std::vector<std::string> labels);
static void updateLabel(LLScrollListItem* item);
static void onCommitSetDirty(LLUICtrl* ctrl, void* data);

View File

@@ -1835,6 +1835,18 @@ Returns a key that is the UUID of the user seated on the prim.
<string name="WornOnAttachmentPoint" value=" (worn on [ATTACHMENT_POINT])" />
<string name="LockedOnAttachmentPoint" value=" (locked to [ATTACHMENT_POINT])" />
<string name="ActiveGesture" value="[GESLABEL] (active)"/>
<!-- Gestures labels -->
<!-- use value="" because they have preceding spaces -->
<string name="Chat Message" value=" Chat : " />
<string name="Sound" value=" Sound : " />
<string name="Wait" value=" --- Wait : " />
<string name="AnimFlagStop" value=" Stop Animation : " />
<string name="AnimFlagStart" value=" Start Animation : " />
<string name="Wave" value=" Wave " />
<string name="GestureActionNone" value="None" />
<string name="HelloAvatar" value=" Hello, avatar! " />
<string name="ViewAllGestures" value=" View All &gt;&gt;" />
<string name="GetMoreGestures" value=" Get More &gt;&gt;" />
<string name="Stone">Stone</string>
<string name="Metal">Metal</string>
<string name="Glass">Glass</string>
@@ -1912,6 +1924,12 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
If you continue to receive this message, contact the [SUPPORT_SITE].
</string>
<string name="group_role_everyone">Everyone</string>
<string name="group_role_officers">Officers</string>
<string name="group_role_owners">Owners</string>
<string name="group_member_status_online">Online</string>
<!-- Addition of OSSL commands for use in OpenSimulator based regions, including Aurora -->
<string name="LSLTipText_osSetRegionWaterHeight">
osSetRegionWaterHeight(float height)