diff --git a/apps/openmw/mwclass/activator.cpp b/apps/openmw/mwclass/activator.cpp index 9e99b4cacb..fc6cfadb55 100644 --- a/apps/openmw/mwclass/activator.cpp +++ b/apps/openmw/mwclass/activator.cpp @@ -1,6 +1,7 @@ #include "activator.hpp" #include +#include #include #include @@ -27,7 +28,6 @@ #include "../mwrender/vismask.hpp" #include "../mwgui/tooltips.hpp" -#include "../mwgui/ustring.hpp" #include "../mwmechanics/npcstats.hpp" @@ -102,8 +102,7 @@ namespace MWClass MWGui::ToolTipInfo info; std::string_view name = getName(ptr); - info.caption - = MyGUI::TextIterator::toTagsString(MWGui::toUString(name)) + MWGui::ToolTips::getCountString(count); + info.caption = MyGUI::TextIterator::toTagsString(MyGUI::UString(name)) + MWGui::ToolTips::getCountString(count); std::string text; if (MWBase::Environment::get().getWindowManager()->getFullHelp()) diff --git a/apps/openmw/mwclass/apparatus.cpp b/apps/openmw/mwclass/apparatus.cpp index 2fbe2f9f87..10687171a0 100644 --- a/apps/openmw/mwclass/apparatus.cpp +++ b/apps/openmw/mwclass/apparatus.cpp @@ -1,6 +1,7 @@ #include "apparatus.hpp" #include +#include #include "../mwbase/environment.hpp" #include "../mwbase/windowmanager.hpp" @@ -15,7 +16,6 @@ #include "../mwrender/renderinginterface.hpp" #include "../mwgui/tooltips.hpp" -#include "../mwgui/ustring.hpp" #include "classmodel.hpp" @@ -92,8 +92,7 @@ namespace MWClass MWGui::ToolTipInfo info; std::string_view name = getName(ptr); - info.caption - = MyGUI::TextIterator::toTagsString(MWGui::toUString(name)) + MWGui::ToolTips::getCountString(count); + info.caption = MyGUI::TextIterator::toTagsString(MyGUI::UString(name)) + MWGui::ToolTips::getCountString(count); info.icon = ref->mBase->mIcon; std::string text; diff --git a/apps/openmw/mwclass/armor.cpp b/apps/openmw/mwclass/armor.cpp index 54561e3b0f..4006f21ce7 100644 --- a/apps/openmw/mwclass/armor.cpp +++ b/apps/openmw/mwclass/armor.cpp @@ -1,6 +1,7 @@ #include "armor.hpp" #include +#include #include #include @@ -24,7 +25,6 @@ #include "../mwrender/renderinginterface.hpp" #include "../mwgui/tooltips.hpp" -#include "../mwgui/ustring.hpp" #include "classmodel.hpp" @@ -217,8 +217,7 @@ namespace MWClass MWGui::ToolTipInfo info; std::string_view name = getName(ptr); - info.caption - = MyGUI::TextIterator::toTagsString(MWGui::toUString(name)) + MWGui::ToolTips::getCountString(count); + info.caption = MyGUI::TextIterator::toTagsString(MyGUI::UString(name)) + MWGui::ToolTips::getCountString(count); info.icon = ref->mBase->mIcon; std::string text; diff --git a/apps/openmw/mwclass/book.cpp b/apps/openmw/mwclass/book.cpp index b2b65e01b2..55de7a64ab 100644 --- a/apps/openmw/mwclass/book.cpp +++ b/apps/openmw/mwclass/book.cpp @@ -1,6 +1,7 @@ #include "book.hpp" #include +#include #include #include @@ -19,7 +20,6 @@ #include "../mwrender/renderinginterface.hpp" #include "../mwgui/tooltips.hpp" -#include "../mwgui/ustring.hpp" #include "../mwmechanics/npcstats.hpp" @@ -111,8 +111,7 @@ namespace MWClass MWGui::ToolTipInfo info; std::string_view name = getName(ptr); - info.caption - = MyGUI::TextIterator::toTagsString(MWGui::toUString(name)) + MWGui::ToolTips::getCountString(count); + info.caption = MyGUI::TextIterator::toTagsString(MyGUI::UString(name)) + MWGui::ToolTips::getCountString(count); info.icon = ref->mBase->mIcon; std::string text; diff --git a/apps/openmw/mwclass/clothing.cpp b/apps/openmw/mwclass/clothing.cpp index cbc5cecb70..0614c92eb9 100644 --- a/apps/openmw/mwclass/clothing.cpp +++ b/apps/openmw/mwclass/clothing.cpp @@ -1,6 +1,7 @@ #include "clothing.hpp" #include +#include #include #include @@ -16,7 +17,6 @@ #include "../mwworld/ptr.hpp" #include "../mwgui/tooltips.hpp" -#include "../mwgui/ustring.hpp" #include "../mwrender/objects.hpp" #include "../mwrender/renderinginterface.hpp" @@ -154,8 +154,7 @@ namespace MWClass MWGui::ToolTipInfo info; std::string_view name = getName(ptr); - info.caption - = MyGUI::TextIterator::toTagsString(MWGui::toUString(name)) + MWGui::ToolTips::getCountString(count); + info.caption = MyGUI::TextIterator::toTagsString(MyGUI::UString(name)) + MWGui::ToolTips::getCountString(count); info.icon = ref->mBase->mIcon; std::string text; diff --git a/apps/openmw/mwclass/container.cpp b/apps/openmw/mwclass/container.cpp index db9e2fc08d..0efbbc84fd 100644 --- a/apps/openmw/mwclass/container.cpp +++ b/apps/openmw/mwclass/container.cpp @@ -1,6 +1,7 @@ #include "container.hpp" #include +#include #include #include @@ -24,7 +25,6 @@ #include "../mwworld/worldmodel.hpp" #include "../mwgui/tooltips.hpp" -#include "../mwgui/ustring.hpp" #include "../mwrender/animation.hpp" #include "../mwrender/objects.hpp" @@ -249,7 +249,7 @@ namespace MWClass MWGui::ToolTipInfo info; std::string_view name = getName(ptr); - info.caption = MyGUI::TextIterator::toTagsString(MWGui::toUString(name)); + info.caption = MyGUI::TextIterator::toTagsString(MyGUI::UString(name)); std::string text; int lockLevel = ptr.getCellRef().getLockLevel(); diff --git a/apps/openmw/mwclass/creature.cpp b/apps/openmw/mwclass/creature.cpp index eebcb99512..2628cd3905 100644 --- a/apps/openmw/mwclass/creature.cpp +++ b/apps/openmw/mwclass/creature.cpp @@ -1,6 +1,7 @@ #include "creature.hpp" #include +#include #include #include @@ -45,7 +46,6 @@ #include "../mwrender/renderinginterface.hpp" #include "../mwgui/tooltips.hpp" -#include "../mwgui/ustring.hpp" #include "classmodel.hpp" @@ -582,7 +582,7 @@ namespace MWClass MWGui::ToolTipInfo info; std::string_view name = getName(ptr); - info.caption = MyGUI::TextIterator::toTagsString(MWGui::toUString(name)); + info.caption = MyGUI::TextIterator::toTagsString(MyGUI::UString(name)); std::string text; if (MWBase::Environment::get().getWindowManager()->getFullHelp()) diff --git a/apps/openmw/mwclass/door.cpp b/apps/openmw/mwclass/door.cpp index ecd6cb59aa..695bea5f10 100644 --- a/apps/openmw/mwclass/door.cpp +++ b/apps/openmw/mwclass/door.cpp @@ -1,6 +1,7 @@ #include "door.hpp" #include +#include #include #include @@ -25,7 +26,6 @@ #include "../mwworld/worldmodel.hpp" #include "../mwgui/tooltips.hpp" -#include "../mwgui/ustring.hpp" #include "../mwrender/animation.hpp" #include "../mwrender/objects.hpp" @@ -267,7 +267,7 @@ namespace MWClass MWGui::ToolTipInfo info; std::string_view name = getName(ptr); - info.caption = MyGUI::TextIterator::toTagsString(MWGui::toUString(name)); + info.caption = MyGUI::TextIterator::toTagsString(MyGUI::UString(name)); std::string text; diff --git a/apps/openmw/mwclass/esm4base.cpp b/apps/openmw/mwclass/esm4base.cpp index 956fc210ee..77a5ad94a6 100644 --- a/apps/openmw/mwclass/esm4base.cpp +++ b/apps/openmw/mwclass/esm4base.cpp @@ -1,11 +1,11 @@ #include "esm4base.hpp" #include +#include #include #include "../mwgui/tooltips.hpp" -#include "../mwgui/ustring.hpp" #include "../mwrender/objects.hpp" #include "../mwrender/renderinginterface.hpp" @@ -35,8 +35,7 @@ namespace MWClass MWGui::ToolTipInfo ESM4Impl::getToolTipInfo(std::string_view name, int count) { MWGui::ToolTipInfo info; - info.caption - = MyGUI::TextIterator::toTagsString(MWGui::toUString(name)) + MWGui::ToolTips::getCountString(count); + info.caption = MyGUI::TextIterator::toTagsString(MyGUI::UString(name)) + MWGui::ToolTips::getCountString(count); return info; } } diff --git a/apps/openmw/mwclass/ingredient.cpp b/apps/openmw/mwclass/ingredient.cpp index e87f74218b..3e07a24610 100644 --- a/apps/openmw/mwclass/ingredient.cpp +++ b/apps/openmw/mwclass/ingredient.cpp @@ -1,6 +1,7 @@ #include "ingredient.hpp" #include +#include #include #include @@ -16,7 +17,6 @@ #include "../mwworld/ptr.hpp" #include "../mwgui/tooltips.hpp" -#include "../mwgui/ustring.hpp" #include "../mwrender/objects.hpp" #include "../mwrender/renderinginterface.hpp" @@ -107,8 +107,7 @@ namespace MWClass MWGui::ToolTipInfo info; std::string_view name = getName(ptr); - info.caption - = MyGUI::TextIterator::toTagsString(MWGui::toUString(name)) + MWGui::ToolTips::getCountString(count); + info.caption = MyGUI::TextIterator::toTagsString(MyGUI::UString(name)) + MWGui::ToolTips::getCountString(count); info.icon = ref->mBase->mIcon; std::string text; diff --git a/apps/openmw/mwclass/light.cpp b/apps/openmw/mwclass/light.cpp index 931ed73dfe..92ba8e1512 100644 --- a/apps/openmw/mwclass/light.cpp +++ b/apps/openmw/mwclass/light.cpp @@ -1,6 +1,7 @@ #include "light.hpp" #include +#include #include #include @@ -21,7 +22,6 @@ #include "../mwworld/ptr.hpp" #include "../mwgui/tooltips.hpp" -#include "../mwgui/ustring.hpp" #include "../mwrender/objects.hpp" #include "../mwrender/renderinginterface.hpp" @@ -159,8 +159,7 @@ namespace MWClass MWGui::ToolTipInfo info; std::string_view name = getName(ptr); - info.caption - = MyGUI::TextIterator::toTagsString(MWGui::toUString(name)) + MWGui::ToolTips::getCountString(count); + info.caption = MyGUI::TextIterator::toTagsString(MyGUI::UString(name)) + MWGui::ToolTips::getCountString(count); info.icon = ref->mBase->mIcon; std::string text; diff --git a/apps/openmw/mwclass/lockpick.cpp b/apps/openmw/mwclass/lockpick.cpp index 1fc65c8f79..6c46f2e66f 100644 --- a/apps/openmw/mwclass/lockpick.cpp +++ b/apps/openmw/mwclass/lockpick.cpp @@ -1,6 +1,7 @@ #include "lockpick.hpp" #include +#include #include #include @@ -15,7 +16,6 @@ #include "../mwworld/ptr.hpp" #include "../mwgui/tooltips.hpp" -#include "../mwgui/ustring.hpp" #include "../mwrender/objects.hpp" #include "../mwrender/renderinginterface.hpp" @@ -104,8 +104,7 @@ namespace MWClass MWGui::ToolTipInfo info; std::string_view name = getName(ptr); - info.caption - = MyGUI::TextIterator::toTagsString(MWGui::toUString(name)) + MWGui::ToolTips::getCountString(count); + info.caption = MyGUI::TextIterator::toTagsString(MyGUI::UString(name)) + MWGui::ToolTips::getCountString(count); info.icon = ref->mBase->mIcon; std::string text; diff --git a/apps/openmw/mwclass/misc.cpp b/apps/openmw/mwclass/misc.cpp index 6c517e3dde..ae78773fa1 100644 --- a/apps/openmw/mwclass/misc.cpp +++ b/apps/openmw/mwclass/misc.cpp @@ -1,6 +1,7 @@ #include "misc.hpp" #include +#include #include #include @@ -19,7 +20,6 @@ #include "../mwworld/worldmodel.hpp" #include "../mwgui/tooltips.hpp" -#include "../mwgui/ustring.hpp" #include "../mwrender/objects.hpp" #include "../mwrender/renderinginterface.hpp" @@ -151,8 +151,8 @@ namespace MWClass countString = " (" + std::to_string(count) + ")"; std::string_view name = getName(ptr); - info.caption = MyGUI::TextIterator::toTagsString(MWGui::toUString(name)) - + MWGui::ToolTips::getCountString(count) + MWGui::ToolTips::getSoulString(ptr.getCellRef()); + info.caption = MyGUI::TextIterator::toTagsString(MyGUI::UString(name)) + MWGui::ToolTips::getCountString(count) + + MWGui::ToolTips::getSoulString(ptr.getCellRef()); info.icon = ref->mBase->mIcon; std::string text; diff --git a/apps/openmw/mwclass/npc.cpp b/apps/openmw/mwclass/npc.cpp index dab6dc99ae..b9e8bc8dfb 100644 --- a/apps/openmw/mwclass/npc.cpp +++ b/apps/openmw/mwclass/npc.cpp @@ -1,6 +1,7 @@ #include "npc.hpp" #include +#include #include #include @@ -57,7 +58,6 @@ #include "../mwrender/renderinginterface.hpp" #include "../mwgui/tooltips.hpp" -#include "../mwgui/ustring.hpp" namespace { @@ -1089,7 +1089,7 @@ namespace MWClass MWGui::ToolTipInfo info; std::string_view name = getName(ptr); - info.caption = MyGUI::TextIterator::toTagsString(MWGui::toUString(name)); + info.caption = MyGUI::TextIterator::toTagsString(MyGUI::UString(name)); if (fullHelp && !ref->mBase->mName.empty() && ptr.getRefData().getCustomData() && ptr.getRefData().getCustomData()->asNpcCustomData().mNpcStats.isWerewolf()) { diff --git a/apps/openmw/mwclass/potion.cpp b/apps/openmw/mwclass/potion.cpp index 9bab0345cb..5811ec10db 100644 --- a/apps/openmw/mwclass/potion.cpp +++ b/apps/openmw/mwclass/potion.cpp @@ -1,6 +1,7 @@ #include "potion.hpp" #include +#include #include "../mwbase/environment.hpp" #include "../mwbase/windowmanager.hpp" @@ -13,7 +14,6 @@ #include "../mwworld/ptr.hpp" #include "../mwgui/tooltips.hpp" -#include "../mwgui/ustring.hpp" #include "../mwrender/objects.hpp" #include "../mwrender/renderinginterface.hpp" @@ -95,8 +95,7 @@ namespace MWClass MWGui::ToolTipInfo info; std::string_view name = getName(ptr); - info.caption - = MyGUI::TextIterator::toTagsString(MWGui::toUString(name)) + MWGui::ToolTips::getCountString(count); + info.caption = MyGUI::TextIterator::toTagsString(MyGUI::UString(name)) + MWGui::ToolTips::getCountString(count); info.icon = ref->mBase->mIcon; std::string text; diff --git a/apps/openmw/mwclass/probe.cpp b/apps/openmw/mwclass/probe.cpp index e020c89443..7a6c00824d 100644 --- a/apps/openmw/mwclass/probe.cpp +++ b/apps/openmw/mwclass/probe.cpp @@ -1,6 +1,7 @@ #include "probe.hpp" #include +#include #include #include @@ -15,7 +16,6 @@ #include "../mwworld/ptr.hpp" #include "../mwgui/tooltips.hpp" -#include "../mwgui/ustring.hpp" #include "../mwrender/objects.hpp" #include "../mwrender/renderinginterface.hpp" @@ -103,8 +103,7 @@ namespace MWClass MWGui::ToolTipInfo info; std::string_view name = getName(ptr); - info.caption - = MyGUI::TextIterator::toTagsString(MWGui::toUString(name)) + MWGui::ToolTips::getCountString(count); + info.caption = MyGUI::TextIterator::toTagsString(MyGUI::UString(name)) + MWGui::ToolTips::getCountString(count); info.icon = ref->mBase->mIcon; std::string text; diff --git a/apps/openmw/mwclass/repair.cpp b/apps/openmw/mwclass/repair.cpp index 68fc2f60da..0d38271aab 100644 --- a/apps/openmw/mwclass/repair.cpp +++ b/apps/openmw/mwclass/repair.cpp @@ -1,6 +1,7 @@ #include "repair.hpp" #include +#include #include #include @@ -13,7 +14,6 @@ #include "../mwworld/ptr.hpp" #include "../mwgui/tooltips.hpp" -#include "../mwgui/ustring.hpp" #include "../mwrender/objects.hpp" #include "../mwrender/renderinginterface.hpp" @@ -105,8 +105,7 @@ namespace MWClass MWGui::ToolTipInfo info; std::string_view name = getName(ptr); - info.caption - = MyGUI::TextIterator::toTagsString(MWGui::toUString(name)) + MWGui::ToolTips::getCountString(count); + info.caption = MyGUI::TextIterator::toTagsString(MyGUI::UString(name)) + MWGui::ToolTips::getCountString(count); info.icon = ref->mBase->mIcon; std::string text; diff --git a/apps/openmw/mwclass/weapon.cpp b/apps/openmw/mwclass/weapon.cpp index 68a66b69d9..1cc2c86761 100644 --- a/apps/openmw/mwclass/weapon.cpp +++ b/apps/openmw/mwclass/weapon.cpp @@ -1,6 +1,7 @@ #include "weapon.hpp" #include +#include #include #include @@ -20,7 +21,6 @@ #include "../mwmechanics/weapontype.hpp" #include "../mwgui/tooltips.hpp" -#include "../mwgui/ustring.hpp" #include "../mwrender/objects.hpp" #include "../mwrender/renderinginterface.hpp" @@ -150,8 +150,7 @@ namespace MWClass MWGui::ToolTipInfo info; std::string_view name = getName(ptr); - info.caption - = MyGUI::TextIterator::toTagsString(MWGui::toUString(name)) + MWGui::ToolTips::getCountString(count); + info.caption = MyGUI::TextIterator::toTagsString(MyGUI::UString(name)) + MWGui::ToolTips::getCountString(count); info.icon = ref->mBase->mIcon; const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore(); diff --git a/apps/openmw/mwgui/alchemywindow.cpp b/apps/openmw/mwgui/alchemywindow.cpp index 7208fce5f6..333722a149 100644 --- a/apps/openmw/mwgui/alchemywindow.cpp +++ b/apps/openmw/mwgui/alchemywindow.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include #include @@ -28,7 +29,6 @@ #include "itemview.hpp" #include "itemwidget.hpp" #include "sortfilteritemmodel.hpp" -#include "ustring.hpp" #include "widgets.hpp" namespace MWGui @@ -164,7 +164,7 @@ namespace MWGui auto const& wm = MWBase::Environment::get().getWindowManager(); std::string_view ingredient = wm->getGameSettingString("sIngredients", "Ingredients"); - if (mFilterType->getCaption() == toUString(ingredient)) + if (mFilterType->getCaption() == ingredient) mCurrentFilter = FilterType::ByName; else mCurrentFilter = FilterType::ByEffect; @@ -176,17 +176,17 @@ namespace MWGui void AlchemyWindow::switchFilterType(MyGUI::Widget* _sender) { auto const& wm = MWBase::Environment::get().getWindowManager(); - MyGUI::UString ingredient = toUString(wm->getGameSettingString("sIngredients", "Ingredients")); + std::string_view ingredient = wm->getGameSettingString("sIngredients", "Ingredients"); auto* button = _sender->castType(); if (button->getCaption() == ingredient) { - button->setCaption(toUString(wm->getGameSettingString("sMagicEffects", "Magic Effects"))); + button->setCaption(MyGUI::UString(wm->getGameSettingString("sMagicEffects", "Magic Effects"))); mCurrentFilter = FilterType::ByEffect; } else { - button->setCaption(ingredient); + button->setCaption(MyGUI::UString(ingredient)); mCurrentFilter = FilterType::ByName; } mSortModel->setNameFilter({}); diff --git a/apps/openmw/mwgui/birth.cpp b/apps/openmw/mwgui/birth.cpp index 617c373b0b..3dfdd17627 100644 --- a/apps/openmw/mwgui/birth.cpp +++ b/apps/openmw/mwgui/birth.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include @@ -18,7 +19,6 @@ #include "../mwworld/esmstore.hpp" #include "../mwworld/player.hpp" -#include "ustring.hpp" #include "widgets.hpp" namespace @@ -56,7 +56,8 @@ namespace MWGui MyGUI::Button* okButton; getWidget(okButton, "OKButton"); - okButton->setCaption(toUString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sOK", {}))); + okButton->setCaption( + MyGUI::UString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sOK", {}))); okButton->eventMouseButtonClick += MyGUI::newDelegate(this, &BirthDialog::onOkClicked); updateBirths(); @@ -70,10 +71,10 @@ namespace MWGui if (shown) okButton->setCaption( - toUString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sNext", {}))); + MyGUI::UString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sNext", {}))); else okButton->setCaption( - toUString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sOK", {}))); + MyGUI::UString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sOK", {}))); } void BirthDialog::onOpen() @@ -235,7 +236,7 @@ namespace MWGui { MyGUI::TextBox* label = mSpellArea->createWidget("SandBrightText", coord, MyGUI::Align::Default, "Label"); - label->setCaption(toUString(MWBase::Environment::get().getWindowManager()->getGameSettingString( + label->setCaption(MyGUI::UString(MWBase::Environment::get().getWindowManager()->getGameSettingString( categories[category].label, {}))); mSpellItems.push_back(label); coord.top += lineHeight; diff --git a/apps/openmw/mwgui/class.cpp b/apps/openmw/mwgui/class.cpp index f71da8bdf5..d6b4e7f635 100644 --- a/apps/openmw/mwgui/class.cpp +++ b/apps/openmw/mwgui/class.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include "../mwbase/environment.hpp" #include "../mwbase/windowmanager.hpp" @@ -20,7 +21,6 @@ #include #include "tooltips.hpp" -#include "ustring.hpp" namespace { @@ -129,10 +129,10 @@ namespace MWGui if (shown) okButton->setCaption( - toUString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sNext", {}))); + MyGUI::UString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sNext", {}))); else okButton->setCaption( - toUString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sOK", {}))); + MyGUI::UString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sOK", {}))); } void PickClassDialog::onOpen() @@ -546,10 +546,10 @@ namespace MWGui if (shown) okButton->setCaption( - toUString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sNext", {}))); + MyGUI::UString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sNext", {}))); else okButton->setCaption( - toUString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sOK", {}))); + MyGUI::UString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sOK", {}))); } // widget controls @@ -869,7 +869,7 @@ namespace MWGui getWidget(okButton, "OKButton"); okButton->eventMouseButtonClick += MyGUI::newDelegate(this, &DescriptionDialog::onOkClicked); okButton->setCaption( - toUString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sInputMenu1", {}))); + MyGUI::UString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sInputMenu1", {}))); // Make sure the edit box has focus MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mTextEdit); diff --git a/apps/openmw/mwgui/dialogue.cpp b/apps/openmw/mwgui/dialogue.cpp index 4ab77c3956..79673463ef 100644 --- a/apps/openmw/mwgui/dialogue.cpp +++ b/apps/openmw/mwgui/dialogue.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include @@ -337,7 +338,7 @@ namespace MWGui void DialogueWindow::onTradeComplete() { MyGUI::UString message = MyGUI::LanguageManager::getInstance().replaceTags("#{sBarterDialog5}"); - addResponse({}, message.asUTF8()); + addResponse({}, message); } bool DialogueWindow::exit() diff --git a/apps/openmw/mwgui/enchantingdialog.cpp b/apps/openmw/mwgui/enchantingdialog.cpp index e70599697a..f5bcb1fb5f 100644 --- a/apps/openmw/mwgui/enchantingdialog.cpp +++ b/apps/openmw/mwgui/enchantingdialog.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include @@ -26,7 +27,6 @@ #include "itemwidget.hpp" #include "sortfilteritemmodel.hpp" -#include "ustring.hpp" namespace MWGui { @@ -95,7 +95,7 @@ namespace MWGui else { std::string_view name = item.getClass().getName(item); - mName->setCaption(toUString(name)); + mName->setCaption(MyGUI::UString(name)); mItemBox->setItem(item); mItemBox->setUserString("ToolTipType", "ItemPtr"); mItemBox->setUserData(MWWorld::Ptr(item)); @@ -115,23 +115,26 @@ namespace MWGui switch (mEnchanting.getCastStyle()) { case ESM::Enchantment::CastOnce: - mTypeButton->setCaption(toUString( + mTypeButton->setCaption(MyGUI::UString( MWBase::Environment::get().getWindowManager()->getGameSettingString("sItemCastOnce", "Cast Once"))); setConstantEffect(false); break; case ESM::Enchantment::WhenStrikes: - mTypeButton->setCaption(toUString(MWBase::Environment::get().getWindowManager()->getGameSettingString( - "sItemCastWhenStrikes", "When Strikes"))); + mTypeButton->setCaption( + MyGUI::UString(MWBase::Environment::get().getWindowManager()->getGameSettingString( + "sItemCastWhenStrikes", "When Strikes"))); setConstantEffect(false); break; case ESM::Enchantment::WhenUsed: - mTypeButton->setCaption(toUString(MWBase::Environment::get().getWindowManager()->getGameSettingString( - "sItemCastWhenUsed", "When Used"))); + mTypeButton->setCaption( + MyGUI::UString(MWBase::Environment::get().getWindowManager()->getGameSettingString( + "sItemCastWhenUsed", "When Used"))); setConstantEffect(false); break; case ESM::Enchantment::ConstantEffect: - mTypeButton->setCaption(toUString(MWBase::Environment::get().getWindowManager()->getGameSettingString( - "sItemCastConstant", "Cast Constant"))); + mTypeButton->setCaption( + MyGUI::UString(MWBase::Environment::get().getWindowManager()->getGameSettingString( + "sItemCastConstant", "Cast Constant"))); setConstantEffect(true); break; } diff --git a/apps/openmw/mwgui/itemchargeview.cpp b/apps/openmw/mwgui/itemchargeview.cpp index ba74eadc7a..02c3cc182c 100644 --- a/apps/openmw/mwgui/itemchargeview.cpp +++ b/apps/openmw/mwgui/itemchargeview.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include @@ -18,7 +19,6 @@ #include "itemmodel.hpp" #include "itemwidget.hpp" -#include "ustring.hpp" namespace MWGui { @@ -130,7 +130,7 @@ namespace MWGui std::stable_sort(mLines.begin(), mLines.end(), [](const MWGui::ItemChargeView::Line& a, const MWGui::ItemChargeView::Line& b) { - return Misc::StringUtils::ciLess(a.mText->getCaption().asUTF8(), b.mText->getCaption().asUTF8()); + return Misc::StringUtils::ciLess(a.mText->getCaption(), b.mText->getCaption()); }); layoutWidgets(); @@ -182,7 +182,7 @@ namespace MWGui void ItemChargeView::updateLine(const ItemChargeView::Line& line) { std::string_view name = line.mItemPtr.getClass().getName(line.mItemPtr); - line.mText->setCaption(toUString(name)); + line.mText->setCaption(MyGUI::UString(name)); line.mCharge->setVisible(false); switch (mDisplayMode) diff --git a/apps/openmw/mwgui/layout.cpp b/apps/openmw/mwgui/layout.cpp index fb0fb5e1c5..8d70bc956b 100644 --- a/apps/openmw/mwgui/layout.cpp +++ b/apps/openmw/mwgui/layout.cpp @@ -3,11 +3,10 @@ #include #include #include +#include #include #include -#include "ustring.hpp" - namespace MWGui { void Layout::initialise(std::string_view _layout) @@ -52,16 +51,15 @@ namespace MWGui { MyGUI::Widget* pt; getWidget(pt, name); - static_cast(pt)->setCaption(toUString(caption)); + static_cast(pt)->setCaption(MyGUI::UString(caption)); } void Layout::setTitle(std::string_view title) { MyGUI::Window* window = static_cast(mMainWidget); - MyGUI::UString uTitle = toUString(title); - if (window->getCaption() != uTitle) - window->setCaptionWithReplacing(uTitle); + if (window->getCaption() != title) + window->setCaptionWithReplacing(MyGUI::UString(title)); } MyGUI::Widget* Layout::getWidget(std::string_view _name) diff --git a/apps/openmw/mwgui/levelupdialog.cpp b/apps/openmw/mwgui/levelupdialog.cpp index 41b2dadeb9..2160a04b1b 100644 --- a/apps/openmw/mwgui/levelupdialog.cpp +++ b/apps/openmw/mwgui/levelupdialog.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include @@ -22,7 +23,6 @@ #include "../mwmechanics/npcstats.hpp" #include "class.hpp" -#include "ustring.hpp" namespace { @@ -176,7 +176,7 @@ namespace MWGui if (levelupdescription.empty()) levelupdescription = Fallback::Map::getString("Level_Up_Default"); - mLevelDescription->setCaption(toUString(levelupdescription)); + mLevelDescription->setCaption(MyGUI::UString(levelupdescription)); unsigned int availableAttributes = 0; for (const ESM::Attribute& attribute : MWBase::Environment::get().getESMStore()->get()) diff --git a/apps/openmw/mwgui/loadingscreen.cpp b/apps/openmw/mwgui/loadingscreen.cpp index fd7afa2d8a..1723841b32 100644 --- a/apps/openmw/mwgui/loadingscreen.cpp +++ b/apps/openmw/mwgui/loadingscreen.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -191,7 +192,7 @@ namespace MWGui // we may still want to show the label if the caller requested it if (mImportantLabel) { - MWBase::Environment::get().getWindowManager()->messageBox(mLoadingText->getCaption().asUTF8()); + MWBase::Environment::get().getWindowManager()->messageBox(mLoadingText->getCaption()); mImportantLabel = false; } } diff --git a/apps/openmw/mwgui/messagebox.cpp b/apps/openmw/mwgui/messagebox.cpp index b22fb873fa..b27adacd0f 100644 --- a/apps/openmw/mwgui/messagebox.cpp +++ b/apps/openmw/mwgui/messagebox.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include @@ -379,17 +380,17 @@ namespace MWGui MyGUI::Widget* InteractiveMessageBox::getDefaultKeyFocus() { - std::vector keywords{ "sOk", "sYes" }; if (mDefaultFocus >= 0 && mDefaultFocus < static_cast(mButtons.size())) return mButtons[mDefaultFocus]; + auto& languageManager = MyGUI::LanguageManager::getInstance(); + std::vector keywords{ languageManager.replaceTags("#{sOk}"), + languageManager.replaceTags("#{sYes}") }; for (MyGUI::Button* button : mButtons) { - for (const std::string& keyword : keywords) + for (const MyGUI::UString& keyword : keywords) { - if (Misc::StringUtils::ciEqual( - MyGUI::LanguageManager::getInstance().replaceTags("#{" + keyword + "}").asUTF8(), - button->getCaption().asUTF8())) + if (Misc::StringUtils::ciEqual(keyword, button->getCaption())) { return button; } diff --git a/apps/openmw/mwgui/race.cpp b/apps/openmw/mwgui/race.cpp index da5c0c9ca8..7b445d419f 100644 --- a/apps/openmw/mwgui/race.cpp +++ b/apps/openmw/mwgui/race.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include @@ -19,7 +20,6 @@ #include "../mwworld/esmstore.hpp" #include "tooltips.hpp" -#include "ustring.hpp" namespace { @@ -114,7 +114,8 @@ namespace MWGui MyGUI::Button* okButton; getWidget(okButton, "OKButton"); - okButton->setCaption(toUString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sOK", {}))); + okButton->setCaption( + MyGUI::UString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sOK", {}))); okButton->eventMouseButtonClick += MyGUI::newDelegate(this, &RaceDialog::onOkClicked); updateRaces(); @@ -129,10 +130,10 @@ namespace MWGui if (shown) okButton->setCaption( - toUString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sNext", {}))); + MyGUI::UString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sNext", {}))); else okButton->setCaption( - toUString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sOK", {}))); + MyGUI::UString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sOK", {}))); } void RaceDialog::onOpen() diff --git a/apps/openmw/mwgui/review.cpp b/apps/openmw/mwgui/review.cpp index 04c3806c0e..4ea21df00c 100644 --- a/apps/openmw/mwgui/review.cpp +++ b/apps/openmw/mwgui/review.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include #include @@ -19,7 +20,6 @@ #include "../mwworld/esmstore.hpp" #include "tooltips.hpp" -#include "ustring.hpp" namespace { @@ -272,7 +272,7 @@ namespace MWGui MyGUI::TextBox* groupWidget = mSkillView->createWidget("SandBrightText", MyGUI::IntCoord(0, coord1.top, coord1.width + coord2.width, coord1.height), MyGUI::Align::Default); groupWidget->eventMouseWheel += MyGUI::newDelegate(this, &ReviewDialog::onMouseWheel); - groupWidget->setCaption(toUString(label)); + groupWidget->setCaption(MyGUI::UString(label)); mSkillWidgets.push_back(groupWidget); const int lineHeight = Settings::gui().mFontSize + 2; @@ -287,7 +287,7 @@ namespace MWGui MyGUI::TextBox* skillValueWidget; skillNameWidget = mSkillView->createWidget("SandText", coord1, MyGUI::Align::Default); - skillNameWidget->setCaption(toUString(text)); + skillNameWidget->setCaption(MyGUI::UString(text)); skillNameWidget->eventMouseWheel += MyGUI::newDelegate(this, &ReviewDialog::onMouseWheel); skillValueWidget = mSkillView->createWidget("SandTextRight", coord2, MyGUI::Align::Default); diff --git a/apps/openmw/mwgui/savegamedialog.cpp b/apps/openmw/mwgui/savegamedialog.cpp index 4f78c27f05..8330c23f2f 100644 --- a/apps/openmw/mwgui/savegamedialog.cpp +++ b/apps/openmw/mwgui/savegamedialog.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -35,7 +36,6 @@ #include "../mwstate/character.hpp" #include "confirmationdialog.hpp" -#include "ustring.hpp" namespace MWGui { @@ -198,7 +198,7 @@ namespace MWGui } title << " (#{sLevel} " << signature.mPlayerLevel << " " - << MyGUI::TextIterator::toTagsString(toUString(className)) << ")"; + << MyGUI::TextIterator::toTagsString(MyGUI::UString(className)) << ")"; mCharacterSelection->addItem(MyGUI::LanguageManager::getInstance().replaceTags(title.str())); @@ -302,7 +302,7 @@ namespace MWGui if (mSaving) { - MWBase::Environment::get().getStateManager()->saveGame(mSaveNameEdit->getCaption().asUTF8(), mCurrentSlot); + MWBase::Environment::get().getStateManager()->saveGame(mSaveNameEdit->getCaption(), mCurrentSlot); } else { diff --git a/apps/openmw/mwgui/settingswindow.cpp b/apps/openmw/mwgui/settingswindow.cpp index 7cefa7bda8..696596a46f 100644 --- a/apps/openmw/mwgui/settingswindow.cpp +++ b/apps/openmw/mwgui/settingswindow.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #include @@ -38,7 +39,6 @@ #include "../mwbase/world.hpp" #include "confirmationdialog.hpp" -#include "ustring.hpp" namespace { @@ -659,18 +659,17 @@ namespace MWGui void SettingsWindow::onButtonToggled(MyGUI::Widget* _sender) { - MyGUI::UString on = toUString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sOn", "On")); + std::string_view on = MWBase::Environment::get().getWindowManager()->getGameSettingString("sOn", "On"); bool newState; if (_sender->castType()->getCaption() == on) { - MyGUI::UString off - = toUString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sOff", "Off")); - _sender->castType()->setCaption(off); + _sender->castType()->setCaption( + MyGUI::UString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sOff", "Off"))); newState = false; } else { - _sender->castType()->setCaption(on); + _sender->castType()->setCaption(MyGUI::UString(on)); newState = true; } diff --git a/apps/openmw/mwgui/statswindow.cpp b/apps/openmw/mwgui/statswindow.cpp index cb16ab6d15..6e7d2c2ba2 100644 --- a/apps/openmw/mwgui/statswindow.cpp +++ b/apps/openmw/mwgui/statswindow.cpp @@ -32,7 +32,6 @@ #include "../mwmechanics/npcstats.hpp" #include "tooltips.hpp" -#include "ustring.hpp" namespace MWGui { @@ -417,7 +416,7 @@ namespace MWGui MyGUI::TextBox* groupWidget = mSkillView->createWidget("SandBrightText", MyGUI::IntCoord(0, coord1.top, coord1.width + coord2.width, coord1.height), MyGUI::Align::Left | MyGUI::Align::Top | MyGUI::Align::HStretch); - groupWidget->setCaption(toUString(label)); + groupWidget->setCaption(MyGUI::UString(label)); groupWidget->eventMouseWheel += MyGUI::newDelegate(this, &StatsWindow::onMouseWheel); mSkillWidgets.push_back(groupWidget); @@ -433,7 +432,7 @@ namespace MWGui skillNameWidget = mSkillView->createWidget( "SandText", coord1, MyGUI::Align::Left | MyGUI::Align::Top | MyGUI::Align::HStretch); - skillNameWidget->setCaption(toUString(text)); + skillNameWidget->setCaption(MyGUI::UString(text)); skillNameWidget->eventMouseWheel += MyGUI::newDelegate(this, &StatsWindow::onMouseWheel); skillValueWidget = mSkillView->createWidget( diff --git a/apps/openmw/mwgui/textinput.cpp b/apps/openmw/mwgui/textinput.cpp index 18a56e7284..5f47b96f03 100644 --- a/apps/openmw/mwgui/textinput.cpp +++ b/apps/openmw/mwgui/textinput.cpp @@ -5,8 +5,7 @@ #include #include - -#include "ustring.hpp" +#include namespace MWGui { @@ -35,10 +34,10 @@ namespace MWGui if (shown) okButton->setCaption( - toUString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sNext", {}))); + MyGUI::UString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sNext", {}))); else okButton->setCaption( - toUString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sOK", {}))); + MyGUI::UString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sOK", {}))); } void TextInputDialog::setTextLabel(std::string_view label) diff --git a/apps/openmw/mwgui/tooltips.cpp b/apps/openmw/mwgui/tooltips.cpp index 323579317a..bdcc4e76d7 100644 --- a/apps/openmw/mwgui/tooltips.cpp +++ b/apps/openmw/mwgui/tooltips.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -953,8 +954,7 @@ namespace MWGui widget->setUserString("Caption_MagicEffectSchool", "#{sSchool}: " + MyGUI::TextIterator::toTagsString( - store->get().find(effect->mData.mSchool)->mSchool->mName) - .asUTF8()); + store->get().find(effect->mData.mSchool)->mSchool->mName)); widget->setUserString("ImageTexture_MagicEffectImage", icon); } } diff --git a/apps/openmw/mwgui/ustring.hpp b/apps/openmw/mwgui/ustring.hpp deleted file mode 100644 index 5a6c30312a..0000000000 --- a/apps/openmw/mwgui/ustring.hpp +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef MWGUI_USTRING_H -#define MWGUI_USTRING_H - -#include - -namespace MWGui -{ - // FIXME: Remove once we get a version of MyGUI that supports string_view - inline MyGUI::UString toUString(std::string_view string) - { - return { string.data(), string.size() }; - } -} - -#endif \ No newline at end of file diff --git a/apps/openmw/mwgui/widgets.cpp b/apps/openmw/mwgui/widgets.cpp index 31e2689485..d824682308 100644 --- a/apps/openmw/mwgui/widgets.cpp +++ b/apps/openmw/mwgui/widgets.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include #include @@ -20,8 +21,6 @@ #include "../mwworld/esmstore.hpp" -#include "ustring.hpp" - namespace MWGui::Widgets { /* MWSkill */ @@ -135,8 +134,7 @@ namespace MWGui::Widgets } else { - MyGUI::UString name = toUString(attribute->mName); - mAttributeNameWidget->setCaption(name); + mAttributeNameWidget->setCaption(MyGUI::UString(attribute->mName)); } } if (mAttributeValueWidget) @@ -497,13 +495,13 @@ namespace MWGui::Widgets { std::stringstream out; out << mValue << "/" << mMax; - mBarTextWidget->setCaption(out.str().c_str()); + mBarTextWidget->setCaption(out.str()); } } void MWDynamicStat::setTitle(std::string_view text) { if (mTextWidget) - mTextWidget->setCaption(toUString(text)); + mTextWidget->setCaption(MyGUI::UString(text)); } MWDynamicStat::~MWDynamicStat() {} diff --git a/apps/openmw/mwgui/windowmanagerimp.cpp b/apps/openmw/mwgui/windowmanagerimp.cpp index 7b3d35e011..3bd779a186 100644 --- a/apps/openmw/mwgui/windowmanagerimp.cpp +++ b/apps/openmw/mwgui/windowmanagerimp.cpp @@ -117,7 +117,6 @@ #include "tradewindow.hpp" #include "trainingwindow.hpp" #include "travelwindow.hpp" -#include "ustring.hpp" #include "videowidget.hpp" #include "waitdialog.hpp" @@ -788,8 +787,8 @@ namespace MWGui { if (getMode() == GM_Dialogue && showInDialogueMode != MWGui::ShowInDialogueMode_Never) { - MyGUI::UString text = MyGUI::LanguageManager::getInstance().replaceTags(toUString(message)); - mDialogueWindow->addMessageBox(text.asUTF8()); + MyGUI::UString text = MyGUI::LanguageManager::getInstance().replaceTags(MyGUI::UString(message)); + mDialogueWindow->addMessageBox(text); } else if (showInDialogueMode != MWGui::ShowInDialogueMode_Only) { @@ -1089,7 +1088,7 @@ namespace MWGui void WindowManager::onRetrieveTag(const MyGUI::UString& _tag, MyGUI::UString& _result) { - std::string_view tag = _tag.asUTF8(); + std::string_view tag = _tag; std::string_view MyGuiPrefix = "setting=";