From 993c37f56d579adab13a49bfb4b8828a570245e0 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Wed, 28 Oct 2020 08:24:48 +0800 Subject: [PATCH] Prefer UTF-8, cleanup, ryzom/ryzomcore#335 --- nel/include/nel/gui/group_editbox.h | 10 ++-- nel/src/gui/CMakeLists.txt | 3 +- nel/src/gui/group_editbox.cpp | 52 +++++++++---------- nel/src/gui/group_html.cpp | 2 +- ryzom/client/src/connection.cpp | 2 +- .../src/interface_v3/action_handler_edit.cpp | 3 +- .../src/interface_v3/action_handler_item.cpp | 8 +-- .../src/interface_v3/action_phrase_faber.cpp | 2 +- .../src/interface_v3/bot_chat_page_trade.cpp | 14 ++--- ryzom/client/src/interface_v3/chat_window.cpp | 4 +- .../src/interface_v3/dbgroup_build_phrase.cpp | 2 +- ryzom/client/src/interface_v3/group_map.cpp | 2 +- .../client/src/interface_v3/macrocmd_key.cpp | 6 +-- .../src/interface_v3/macrocmd_manager.cpp | 12 ++--- .../src/interface_v3/people_interraction.cpp | 8 +-- ryzom/client/src/interface_v3/people_list.cpp | 6 +-- ryzom/client/src/login.cpp | 18 +++---- ryzom/client/src/r2/editor.cpp | 4 +- 18 files changed, 77 insertions(+), 81 deletions(-) diff --git a/nel/include/nel/gui/group_editbox.h b/nel/include/nel/gui/group_editbox.h index 62b78584c..355c01d3c 100644 --- a/nel/include/nel/gui/group_editbox.h +++ b/nel/include/nel/gui/group_editbox.h @@ -63,7 +63,7 @@ namespace NLGUI virtual bool handleEvent (const NLGUI::CEventDescriptor& eventDesc); /// Accessors - u32string getInputString() const { return _InputString; } + std::string getInputString() const; const u32string &getInputStringRef() const { return _InputString; } const ucstring &getPrompt() const { return _Prompt; } @@ -71,7 +71,7 @@ namespace NLGUI * NB : line returns are encoded as '\n', not '\r\n' */ void setPrompt(const ucstring &s) { _Prompt = s; } - void setInputString(const u32string &str); + void setInputString(const std::string &str); void setInputStringRef(const u32string &str) {_InputString = str; }; void setInputStringAsInt(sint32 val); sint32 getInputStringAsInt() const; @@ -79,10 +79,10 @@ namespace NLGUI sint64 getInputStringAsInt64() const; void setInputStringAsFloat(float val); float getInputStringAsFloat() const; - void setInputStringAsUtf8(const std::string &str); - std::string getInputStringAsUtf8() const; void setInputStringAsUtf16(const ucstring &str); ucstring getInputStringAsUtf16() const; + void setInputStringAsUtf32(const u32string &str); + u32string getInputStringAsUtf32() const { return _InputString; } void setColor(NLMISC::CRGBA col); @@ -189,7 +189,7 @@ namespace NLGUI REFLECT_LUA_METHOD("setSelectionAll", luaSetSelectionAll); REFLECT_LUA_METHOD("setFocusOnText", luaSetFocusOnText); REFLECT_LUA_METHOD("cancelFocusOnText", luaCancelFocusOnText); - REFLECT_STRING("input_string", getInputStringAsUtf8, setInputStringAsUtf8); + REFLECT_STRING("input_string", getInputString, setInputString); REFLECT_UCSTRING("uc_input_string", getInputStringAsUtf16, setInputStringAsUtf16); REFLECT_EXPORT_END diff --git a/nel/src/gui/CMakeLists.txt b/nel/src/gui/CMakeLists.txt index bb5a0b7f2..4dd53e857 100644 --- a/nel/src/gui/CMakeLists.txt +++ b/nel/src/gui/CMakeLists.txt @@ -1,8 +1,7 @@ FILE(GLOB SRC *.cpp *.h) FILE(GLOB HEADERS ../../include/nel/gui/*.h) -SOURCE_GROUP("include" FILES ${HEADERS}) -SOURCE_GROUP("src" FILES ${SRC}) +SOURCE_GROUP("" FILES ${HEADERS} ${SRC}) NL_TARGET_LIB(nelgui ${SRC} ${HEADERS}) diff --git a/nel/src/gui/group_editbox.cpp b/nel/src/gui/group_editbox.cpp index b9dc44895..037ae4656 100644 --- a/nel/src/gui/group_editbox.cpp +++ b/nel/src/gui/group_editbox.cpp @@ -1015,7 +1015,7 @@ namespace NLGUI _CursorAtPreviousLineEnd = false; if (_ClearOnEscape) { - setInputString(u32string()); + setInputStringAsUtf32(u32string()); triggerOnChangeAH(); } CWidgetManager::getInstance()->setCaptureKeyboard(NULL); @@ -1179,7 +1179,7 @@ namespace NLGUI if (CWidgetManager::getInstance()->getCaptureKeyboard() != this) return false; if (!_CanUndo) return false; _ModifiedInputString = _InputString; - setInputString(_StartInputString); + setInputStringAsUtf32(_StartInputString); _CanUndo = false; _CanRedo = true; setCursorPos((sint32)_InputString.length()); @@ -1192,7 +1192,7 @@ namespace NLGUI { if (CWidgetManager::getInstance()->getCaptureKeyboard() != this) return false; if (!_CanRedo) return false; - setInputString(_ModifiedInputString); + setInputStringAsUtf32(_ModifiedInputString); _CanUndo = true; _CanRedo = false; setCursorPos((sint32)_InputString.length()); @@ -1303,7 +1303,7 @@ namespace NLGUI default: break; } // update the text - setInputString(_InputString); + setInputStringAsUtf32(_InputString); // if event of type char or string, consider handle all of them if( rEDK.getKeyEventType()==NLGUI::CEventDescriptorKey::keychar || rEDK.getKeyEventType()==NLGUI::CEventDescriptorKey::keystring ) @@ -1624,8 +1624,13 @@ namespace NLGUI } + // ---------------------------------------------------------------------------- - void CGroupEditBox::setInputString(const u32string &str) + void CGroupEditBox::setInputString(const std::string &str) + { + setInputStringAsUtf32(CUtfStringView(str).toUtf32()); + } + void CGroupEditBox::setInputStringAsUtf32(const u32string &str) { _InputString = str; if (_CursorPos > (sint32) str.length()) @@ -1644,43 +1649,42 @@ namespace NLGUI void CGroupEditBox::setDefaultInputString(const ucstring &str) { _DefaultInputString= true; - setInputString(CUtfStringView(str).toUtf32()); + setInputStringAsUtf32(CUtfStringView(str).toUtf32()); } - // *************************************************************************** sint32 CGroupEditBox::getInputStringAsInt() const { sint32 value; - fromString(getInputStringAsUtf8(), value); + fromString(getInputString(), value); return value; } // *************************************************************************** void CGroupEditBox::setInputStringAsInt(sint32 val) { - setInputStringAsUtf8(NLMISC::toString(val)); + setInputString(NLMISC::toString(val)); } // *************************************************************************** sint64 CGroupEditBox::getInputStringAsInt64() const { sint64 value; - fromString(getInputStringAsUtf8(), value); + fromString(getInputString(), value); return value; } // *************************************************************************** void CGroupEditBox::setInputStringAsInt64(sint64 val) { - setInputStringAsUtf8(NLMISC::toString(val)); + setInputString(NLMISC::toString(val)); } // *************************************************************************** float CGroupEditBox::getInputStringAsFloat() const { float value; - fromString(getInputStringAsUtf8(), value); + fromString(getInputString(), value); return value; } @@ -1688,7 +1692,7 @@ namespace NLGUI void CGroupEditBox::setInputStringAsFloat(float val) { string fmt= "%." + NLMISC::toString(_MaxFloatPrec) + "f"; - setInputStringAsUtf8(NLMISC::toString(fmt.c_str(), val)); + setInputString(NLMISC::toString(fmt.c_str(), val)); } // *************************************************************************** @@ -1739,21 +1743,15 @@ namespace NLGUI } // *************************************************************************** - void CGroupEditBox::setInputStringAsUtf8(const std::string &str) - { - setInputString(CUtfStringView(str).toUtf32()); - } - - // *************************************************************************** - std::string CGroupEditBox::getInputStringAsUtf8() const + std::string CGroupEditBox::getInputString() const { - return CUtfStringView(_InputString).toUtf8(); + return NLMISC::CUtfStringView(_InputString).toUtf8(); } // *************************************************************************** void CGroupEditBox::setInputStringAsUtf16(const ucstring &str) { - setInputString(CUtfStringView(str).toUtf32()); + setInputStringAsUtf32(CUtfStringView(str).toUtf32()); } // *************************************************************************** @@ -1770,7 +1768,7 @@ namespace NLGUI return; // set the string and maybe execute - setInputString(CUtfStringView((ucchar) '/' + command).toUtf32()); + setInputStringAsUtf16((ucchar) '/' + command); if (execute) { // stop selection @@ -1853,7 +1851,7 @@ namespace NLGUI f.serial(_PrevNumLine); if (f.isReading()) { - setInputString(_InputString); + setInputStringAsUtf32(_InputString); } // serial selection @@ -1870,7 +1868,7 @@ namespace NLGUI void CGroupEditBox::onQuit() { // clear the text and restore backup pos before final save - setInputString(u32string()); + setInputStringAsUtf32(u32string()); _CurrSelection = NULL; } @@ -1878,7 +1876,7 @@ namespace NLGUI void CGroupEditBox::onLoadConfig() { // config is not saved when there's an empty string, so restore that default state. - setInputString(u32string()); + setInputStringAsUtf32(u32string()); _CurrSelection = NULL; _PrevNumLine = 1; } @@ -1893,7 +1891,7 @@ namespace NLGUI if (_DefaultInputString) { _DefaultInputString= false; - setInputString(u32string()); + setInputStringAsUtf32(u32string()); } _CanRedo = false; _CanUndo = false; diff --git a/nel/src/gui/group_html.cpp b/nel/src/gui/group_html.cpp index 7f80405ce..4fab8c4bb 100644 --- a/nel/src/gui/group_html.cpp +++ b/nel/src/gui/group_html.cpp @@ -3024,7 +3024,7 @@ namespace NLGUI CGroupEditBox *eb = dynamic_cast(textArea->getGroup("eb")); if (eb) { - eb->setInputString(CUtfStringView(decodeHTMLEntities(content)).toUtf32()); + eb->setInputString(CUtfStringView(decodeHTMLEntities(content)).toUtf8()); if (style.hasStyle("background-color")) { CViewBitmap *bg = dynamic_cast(eb->getView("bg")); diff --git a/ryzom/client/src/connection.cpp b/ryzom/client/src/connection.cpp index 5aad200ae..00c663e5e 100644 --- a/ryzom/client/src/connection.cpp +++ b/ryzom/client/src/connection.cpp @@ -2977,7 +2977,7 @@ class CAHLoadScenario : public IActionHandler { CGroupEditBox* editBox = dynamic_cast(result); if(editBox) - description = editBox->getInputStringAsUtf8(); + description = editBox->getInputString(); } // races diff --git a/ryzom/client/src/interface_v3/action_handler_edit.cpp b/ryzom/client/src/interface_v3/action_handler_edit.cpp index 81837bf4a..055a77422 100644 --- a/ryzom/client/src/interface_v3/action_handler_edit.cpp +++ b/ryzom/client/src/interface_v3/action_handler_edit.cpp @@ -639,8 +639,7 @@ class CAHEditExpandOrCycleTell : public CAHEdit void actionPart () { // If the line starts with '/tell ', do not try to expand - static const u32string TELL_STR(CUtfStringView("/tell ").toUtf32()); - if (_GroupEdit->getInputString().substr(0, TELL_STR.length()) != TELL_STR) + if (!NLMISC::startsWith(_GroupEdit->getInputString(), "/tell ")) { if (_GroupEdit->expand()) return; } diff --git a/ryzom/client/src/interface_v3/action_handler_item.cpp b/ryzom/client/src/interface_v3/action_handler_item.cpp index 998bfcd77..655ea084f 100644 --- a/ryzom/client/src/interface_v3/action_handler_item.cpp +++ b/ryzom/client/src/interface_v3/action_handler_item.cpp @@ -239,8 +239,8 @@ void CInterfaceItemEdition::CItemEditionWindow::begin() closeButton->setActive(false); group->setActive(true); - editBoxShort->setInputString(u32string()); - editBoxLarge->setInputString(u32string()); + editBoxShort->setInputString(std::string()); + editBoxLarge->setInputString(std::string()); display->setTextFormatTaged(ucstring()); @@ -297,8 +297,8 @@ void CInterfaceItemEdition::CItemEditionWindow::begin() closeButton->setActive(true); group->setActive(false); - editBoxShort->setInputString(u32string()); - editBoxLarge->setInputString(u32string()); + editBoxShort->setInputString(std::string()); + editBoxLarge->setInputString(std::string()); display->setTextFormatTaged(ucstring()); // Finish the display or add the waiter diff --git a/ryzom/client/src/interface_v3/action_phrase_faber.cpp b/ryzom/client/src/interface_v3/action_phrase_faber.cpp index d039444f9..40efedac0 100644 --- a/ryzom/client/src/interface_v3/action_phrase_faber.cpp +++ b/ryzom/client/src/interface_v3/action_phrase_faber.cpp @@ -718,7 +718,7 @@ void CActionPhraseFaber::startMpSelection(uint itemReqLine, uint mpSlot) if (eb) { CWidgetManager::getInstance()->setCaptureKeyboard(eb); - eb->setInputStringAsUtf8(toString(maxQuantity)); + eb->setInputString(toString(maxQuantity)); eb->setSelectionAll(); } } diff --git a/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp b/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp index 64f19214f..dc2c88789 100644 --- a/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp +++ b/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp @@ -333,7 +333,7 @@ uint32 CBotChatPageTrade::getCurrItemQuantity() const CGroupEditBox *ed = dynamic_cast(ig->getGroup("header_opened:standard_price:quantity:edit:eb")); if (!ed) return std::numeric_limits::max(); uint32 intQuantity; - if (fromString(ed->getInputStringAsUtf8(), intQuantity)) + if (fromString(ed->getInputString(), intQuantity)) { return intQuantity; } @@ -1465,7 +1465,7 @@ void CBotChatPageTrade::setupPriceGroupQuantity(CInterfaceGroup *priceGroup, sin CGroupEditBox *eb = dynamic_cast(quantityGroup->getGroup("edit:eb")); if (eb) { - eb->setInputStringAsUtf8(toString(defaultQuantity)); + eb->setInputString(toString(defaultQuantity)); } } } @@ -1569,7 +1569,7 @@ void CBotChatPageTrade::setupResellGroup(bool sellMode, uint defaultQuantity, CI { sint32 resaleMargin= NLGUI::CDBManager::getInstance()->getDbProp( "UI:SAVE:TRADE_ITEM:RESALE_MARGIN" )->getValue32(); clamp(resaleMargin, 0, (sint32)MaxResaleMargin); - eb->setInputStringAsUtf8( toString( resaleMargin ) ); + eb->setInputString( toString( resaleMargin ) ); eb->setPositiveIntegerMaxValue(MaxResaleMargin); } } @@ -1725,8 +1725,8 @@ void CBotChatPageTrade::startChangeBuyFilterDialog(const std::string &dbext, con sint rangeMax= 0; if(dbRangeMin) rangeMin= dbRangeMin->getValue32(); if(dbRangeMax) rangeMax= dbRangeMax->getValue32(); - if(edMin) edMin->setInputStringAsUtf8(toString(rangeMin)); - if(edMax) edMax->setInputStringAsUtf8(toString(rangeMax)); + if(edMin) edMin->setInputString(toString(rangeMin)); + if(edMax) edMax->setInputString(toString(rangeMax)); if(edMin) edMin->setPositiveIntegerMaxValue(maxValue); if(edMax) edMax->setPositiveIntegerMaxValue(maxValue); @@ -1754,8 +1754,8 @@ void CBotChatPageTrade::resetBuyFilterDialog() sint rangeMin= 0; sint rangeMax= _FilterBuyDlgMaxValue; // write result in EditBox, and in db - if(edMin) edMin->setInputStringAsUtf8(toString(rangeMin)); - if(edMax) edMax->setInputStringAsUtf8(toString(rangeMax)); + if(edMin) edMin->setInputString(toString(rangeMin)); + if(edMax) edMax->setInputString(toString(rangeMax)); if(dbRangeMin) dbRangeMin->setValue32(rangeMin); if(dbRangeMax) dbRangeMax->setValue32(rangeMax); diff --git a/ryzom/client/src/interface_v3/chat_window.cpp b/ryzom/client/src/interface_v3/chat_window.cpp index bfac81212..ed1a220ca 100644 --- a/ryzom/client/src/interface_v3/chat_window.cpp +++ b/ryzom/client/src/interface_v3/chat_window.cpp @@ -1289,7 +1289,7 @@ public: // Parse any tokens in the text if ( ! CInterfaceManager::parseTokens(text)) { - pEB->setInputString (u32string()); + pEB->setInputString(std::string()); return; } @@ -1329,7 +1329,7 @@ public: } } // Clear input string - pEB->setInputString (u32string()); + pEB->setInputString (std::string()); CGroupContainer *gc = static_cast< CGroupContainer* >( pEB->getEnclosingContainer() ); if (gc) diff --git a/ryzom/client/src/interface_v3/dbgroup_build_phrase.cpp b/ryzom/client/src/interface_v3/dbgroup_build_phrase.cpp index 8ffa62530..561d48235 100644 --- a/ryzom/client/src/interface_v3/dbgroup_build_phrase.cpp +++ b/ryzom/client/src/interface_v3/dbgroup_build_phrase.cpp @@ -279,7 +279,7 @@ void CDBGroupBuildPhrase::clearBuildingPhrase() // Empty the name if(_UserSentenceName) { - _UserSentenceName->setInputString(u32string()); + _UserSentenceName->setInputString(std::string()); } // update Display diff --git a/ryzom/client/src/interface_v3/group_map.cpp b/ryzom/client/src/interface_v3/group_map.cpp index b696ae40d..41b6f021e 100644 --- a/ryzom/client/src/interface_v3/group_map.cpp +++ b/ryzom/client/src/interface_v3/group_map.cpp @@ -3882,7 +3882,7 @@ class CAHLandMarkFilter : public IActionHandler CGroupEditBox* eb = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(group)); if (!eb) return; - text = eb->getInputStringAsUtf8(); + text = eb->getInputString(); } map->setLandmarkFilter(text); diff --git a/ryzom/client/src/interface_v3/macrocmd_key.cpp b/ryzom/client/src/interface_v3/macrocmd_key.cpp index 241862ff1..f97e90723 100644 --- a/ryzom/client/src/interface_v3/macrocmd_key.cpp +++ b/ryzom/client/src/interface_v3/macrocmd_key.cpp @@ -679,7 +679,7 @@ void CModalContainerEditCmd::activateFrom (const std::string &cmdName, const std else sEditBox = WinName+WIN_EDITCMD_COMBO_SECOND_PARAM_EDITBOX; CGroupEditBox *pEB = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(sEditBox)); // sTmp is utf8 - pEB->setInputStringAsUtf8(sTmp); + pEB->setInputString(sTmp); } // Setup the param name if any @@ -863,7 +863,7 @@ void CModalContainerEditCmd::validCurrentCommand() CGroupEditBox *pEB= dynamic_cast(CWidgetManager::getInstance()->getElementFromId( sWin )); // convert to utf8 if (pEB != NULL) - CurrentEditCmdLine.ActionName.Argu += pEB->getInputStringAsUtf8(); + CurrentEditCmdLine.ActionName.Argu += pEB->getInputString(); noParam++; } } @@ -1148,7 +1148,7 @@ void CModalContainerEditCmd::onChangeAction() CGroupEditBox *pEB= dynamic_cast(CWidgetManager::getInstance()->getElementFromId( sWin )); if( pEB ) { - pEB->setInputString(u32string()); + pEB->setInputString(std::string()); } NLGUI::CDBManager::getInstance()->getDbProp( sDB )->setValue32(1); } diff --git a/ryzom/client/src/interface_v3/macrocmd_manager.cpp b/ryzom/client/src/interface_v3/macrocmd_manager.cpp index 39b2aedde..bf2197e45 100644 --- a/ryzom/client/src/interface_v3/macrocmd_manager.cpp +++ b/ryzom/client/src/interface_v3/macrocmd_manager.cpp @@ -636,7 +636,7 @@ public: CDBCtrlSheet *pCS = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(Params)); if (pCS == NULL) return; - pCS->setMacroText(pEB->getInputStringAsUtf8()); + pCS->setMacroText(pEB->getInputString()); } }; REGISTER_ACTION_HANDLER( CHandlerEBUpdateMacroText, "eb_update_macro_text"); @@ -703,10 +703,10 @@ public: CGroupEditBox *pEB = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_MACROICONCREATION_EDITTEXT)); if (pEB != NULL) { - pEB->setInputStringAsUtf8(pMCM->CurrentEditMacro.DispText); + pEB->setInputString(pMCM->CurrentEditMacro.DispText); CDBCtrlSheet *pCS = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_MACROICONCREATION_ICON)); if (pCS != NULL) - pCS->setMacroText(pEB->getInputStringAsUtf8()); + pCS->setMacroText(pEB->getInputString()); } CAHManager::getInstance()->runActionHandler("set_macro_back", NULL, string("target=")+CTRL_MACROICONCREATION_ICON+"|value="+toString(back)); @@ -862,11 +862,11 @@ public: if (pEB == NULL) return; CMacroCmdManager *pMCM = CMacroCmdManager::getInstance(); - pMCM->CurrentEditMacro.Name = pEB->getInputStringAsUtf8(); + pMCM->CurrentEditMacro.Name = pEB->getInputString(); if ((pMCM->CurrentEditMacro.Name.size() >= 2) && (pMCM->CurrentEditMacro.Name[0] == 'u') && (pMCM->CurrentEditMacro.Name[1] == 'i')) pMCM->CurrentEditMacro.Name[0] = 'U'; - pEB->setInputStringAsUtf8(pMCM->CurrentEditMacro.Name); + pEB->setInputString(pMCM->CurrentEditMacro.Name); } }; REGISTER_ACTION_HANDLER( CHandlerNewMacroEnterName, "new_macro_enter_name"); @@ -886,7 +886,7 @@ public: if (pCS != NULL) pCS->readFromMacro(pMCM->CurrentEditMacro); // Name CGroupEditBox *pEB = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(GROUP_NEWMACRO_EDIT_NAME)); - if (pEB != NULL) pEB->setInputStringAsUtf8(pMCM->CurrentEditMacro.Name); + if (pEB != NULL) pEB->setInputString(pMCM->CurrentEditMacro.Name); // Commands CGroupList *pList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(GROUP_NEWMACRO_COMMANDS)); if (pList == NULL) return; diff --git a/ryzom/client/src/interface_v3/people_interraction.cpp b/ryzom/client/src/interface_v3/people_interraction.cpp index 21cfb63cf..7bde7d0fc 100644 --- a/ryzom/client/src/interface_v3/people_interraction.cpp +++ b/ryzom/client/src/interface_v3/people_interraction.cpp @@ -2199,7 +2199,7 @@ public: if (gc) { CGroupEditBox *geb = dynamic_cast(gc->getGroup("add_contact_eb:eb")); - geb->setInputString(u32string()); + geb->setInputString(std::string()); } CAHManager::getInstance()->runActionHandler("enter_modal", pCaller, sParams); } @@ -2257,11 +2257,11 @@ public: else { PeopleInterraction.askAddContact(geb->getInputStringAsUtf16(), peopleList); - geb->setInputString(u32string()); + geb->setInputString(std::string()); } } } - geb->setInputString(u32string()); + geb->setInputString(std::string()); } } } @@ -2389,7 +2389,7 @@ public: if (eb) { CWidgetManager::getInstance()->setCaptureKeyboard(eb); - eb->setInputString(u32string()); + eb->setInputString(std::string()); } // if (gc->getActive()) diff --git a/ryzom/client/src/interface_v3/people_list.cpp b/ryzom/client/src/interface_v3/people_list.cpp index 43ee1543c..1b4c7ea5e 100644 --- a/ryzom/client/src/interface_v3/people_list.cpp +++ b/ryzom/client/src/interface_v3/people_list.cpp @@ -884,7 +884,7 @@ class CHandlerContactEntry : public IActionHandler // Parse any tokens in the text if ( ! CInterfaceManager::parseTokens(text)) { - pEB->setInputString (u32string()); + pEB->setInputString (std::string()); return; } @@ -895,7 +895,7 @@ class CHandlerContactEntry : public IActionHandler // TODO : have NLMISC::ICommand accept unicode strings std::string str = text.toUtf8().substr(1); NLMISC::ICommand::execute( str, g_log ); - pEB->setInputString (u32string()); + pEB->setInputString (std::string()); return; } // Well, we could have used CChatWindow class to handle this, but CPeopleList was written earlier, so for now @@ -908,7 +908,7 @@ class CHandlerContactEntry : public IActionHandler // Simply do a tell on the player ChatMngr.tell(playerName.toString(), text); - pEB->setInputString (u32string()); + pEB->setInputString (std::string()); if (gc) { // Restore position of enclosing container if it hasn't been moved/scaled/poped by the user diff --git a/ryzom/client/src/login.cpp b/ryzom/client/src/login.cpp index 6f3617286..b134a5519 100644 --- a/ryzom/client/src/login.cpp +++ b/ryzom/client/src/login.cpp @@ -808,7 +808,7 @@ void initLoginScreen() CGroupEditBox *pGEB = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_EDITBOX_LOGIN)); if (pGEB != NULL && (pGEB->getInputString().empty())) { - pGEB->setInputStringAsUtf8(l); + pGEB->setInputString(l); } CAHManager::getInstance()->runActionHandler("set_keyboard_focus", NULL, "target=" CTRL_EDITBOX_PASSWORD "|select_all=false"); } @@ -830,8 +830,8 @@ void initAutoLogin() CInterfaceManager *pIM = CInterfaceManager::getInstance(); CGroupEditBox *pGEBLog = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_EDITBOX_LOGIN)); CGroupEditBox *pGEBPwd = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_EDITBOX_PASSWORD)); - pGEBLog->setInputStringAsUtf8(LoginLogin); - pGEBPwd->setInputStringAsUtf8(LoginPassword); + pGEBLog->setInputString(LoginLogin); + pGEBPwd->setInputString(LoginPassword); CAHManager::getInstance()->runActionHandler("on_login", NULL, ""); if (ClientCfg.R2Mode) @@ -1379,8 +1379,8 @@ class CAHOnLogin : public IActionHandler return; } - LoginLogin = pGEBLog->getInputStringAsUtf8(); - LoginPassword = pGEBPwd->getInputStringAsUtf8(); + LoginLogin = pGEBLog->getInputString(); + LoginPassword = pGEBPwd->getInputString(); onlogin(); } @@ -2394,7 +2394,7 @@ bool initCreateAccount() { CGroupEditBox * eb = dynamic_cast(createAccountUI->findFromShortId(editBoxes[i] + ":eb")); if(eb) - eb->setInputString(u32string()); + eb->setInputString(std::string()); } // conditions button @@ -2581,7 +2581,7 @@ class CAHOnCreateAccountSubmit : public IActionHandler { CGroupEditBox * eb = dynamic_cast(createAccountUI->findFromShortId(editBoxes[i] + ":eb")); if(eb) - results[i] = eb->getInputStringAsUtf8(); + results[i] = eb->getInputString(); } // text @@ -2735,11 +2735,11 @@ class CAHCreateAccountLogin : public IActionHandler { CGroupEditBox * eb = dynamic_cast(createAccountUI->findFromShortId("eb_login:eb")); if(eb) - LoginLogin = eb->getInputStringAsUtf8(); + LoginLogin = eb->getInputString(); eb = dynamic_cast(createAccountUI->findFromShortId("eb_password:eb")); if(eb) - LoginPassword = eb->getInputStringAsUtf8(); + LoginPassword = eb->getInputString(); onlogin(false); } diff --git a/ryzom/client/src/r2/editor.cpp b/ryzom/client/src/r2/editor.cpp index e9702af28..ee203d312 100644 --- a/ryzom/client/src/r2/editor.cpp +++ b/ryzom/client/src/r2/editor.cpp @@ -7484,7 +7484,7 @@ class CAHInviteCharacter : public IActionHandler CGroupEditBox *geb = dynamic_cast(fatherGC->getGroup("add_contact_eb:eb")); if (geb && !geb->getInputString().empty()) { - string charName = geb->getInputStringAsUtf8(); + string charName = geb->getInputString(); CSessionBrowserImpl & sessionBrowser = CSessionBrowserImpl::getInstance(); sessionBrowser.inviteCharacterByName(sessionBrowser.getCharId(), charName); @@ -7506,7 +7506,7 @@ class CAHInviteCharacter : public IActionHandler CAHManager::getInstance()->runActionHandler("enter_modal", pCaller, "group=ui:interface:warning_newcomer"); } - geb->setInputString(u32string()); + geb->setInputString(std::string()); } } }