Merge branch 'ryzom/ui/improvements' into yubo

merge-requests/7/merge
Ulukyn 4 years ago
commit eab140850e

@ -422,6 +422,29 @@ CViewBase *CChatTextManager::createMsgTextComplex(const ucstring &msg, NLMISC::C
return para;
}
ucstring::size_type pos = 0;
// Manage Translations
string::size_type startTr = msg.find(ucstring("{:"));
string::size_type endOfOriginal = msg.find(ucstring("}@{"));
// Original/Translated case, example: {:enHello the world!}@{ Bonjour le monde !
if (startTr != string::npos && endOfOriginal != string::npos)
{
CViewBase *vt = createMsgTextSimple(msg.substr(0, startTr), col, justified, NULL);
para->addChild(vt);
string texture = "flag-"+toLower(msg.substr(startTr+2, 2)).toString()+".tga";
ucstring original = msg.substr(startTr+5, endOfOriginal-startTr-5);
pos = endOfOriginal+3;
CCtrlButton *ctrlButton = new CCtrlButton(CViewBase::TCtorParam());
ctrlButton->setTexture(texture);
ctrlButton->setTextureOver(texture);
ctrlButton->setTexturePushed(texture);
ctrlButton->setDefaultContextHelp(original);
ctrlButton->setId("tr");
para->addChild(ctrlButton);
}
// quickly check if text has links or not
bool hasUrl;
@ -430,8 +453,7 @@ CViewBase *CChatTextManager::createMsgTextComplex(const ucstring &msg, NLMISC::C
hasUrl = (s.find(ucstring("http://")) || s.find(ucstring("https://")));
}
ucstring::size_type pos = 0;
for (ucstring::size_type i = 0; i< textSize;)
for (ucstring::size_type i = pos; i< textSize;)
{
if (hasUrl && isUrlTag(msg, i, textSize))
{

@ -843,6 +843,14 @@ void CGroupInSceneBubbleManager::chatOpen (uint32 nUID, const ucstring &ucsText,
if (pChar == NULL || nUID==CLFECOMMON::INVALID_CLIENT_DATASET_INDEX) return;
if (bubbleTimer == 0) bubbleTimer = CWidgetManager::getInstance()->getSystemOption(CWidgetManager::OptionTimeoutBubbles).getValSInt32();
// Clean bubble from translation system
ucstring::size_type pos = 0;
string::size_type endOfOriginal = ucsText.find(ucstring("}@{"));
if (endOfOriginal != string::npos)
pos = endOfOriginal+4;
// Output the message in a bubble
bool show = false;
@ -862,7 +870,7 @@ void CGroupInSceneBubbleManager::chatOpen (uint32 nUID, const ucstring &ucsText,
return;
// Get a bubble
CGroupInSceneBubble *bubble = newBubble (ucsText);
CGroupInSceneBubble *bubble = newBubble (ucsText.substr(pos));
if (bubble)
{
// Link the bubble

@ -147,6 +147,7 @@ extern bool CharNameValidArrived;
extern bool CharNameValid;
bool IsInRingSession = false;
TSessionId HighestMainlandSessionId; // highest in the position stack
ucstring lastUniversMessage;
extern const char *CDBBankNames[INVALID_CDB_BANK+1];
@ -770,7 +771,11 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c
}
else if (mode == CChatGroup::universe)
{
PeopleInterraction.ChatInput.Universe.displayMessage(finalString, col, 2, &windowVisible);
if (lastUniversMessage != finalString)
{
PeopleInterraction.ChatInput.Universe.displayMessage(finalString, col, 2, &windowVisible);
lastUniversMessage = finalString;
}
}
else if (mode == CChatGroup::dyn_chat)
{

@ -750,7 +750,7 @@ restartLoop:
// if the string contains a special rename of creature, remove it
if (str.size() > 2 && str[0] == '<' && str[1] == '#')
{
str = str.substr(2);
str = toUpper(str[2])+str.substr(3);
}
// append this string

Loading…
Cancel
Save