1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 09:35:28 +00:00

Merge branch 'ustringmestring' into 'master'

Use MyGUI::UString's new string_view support

See merge request OpenMW/openmw!3610
This commit is contained in:
uramer 2023-11-25 14:23:59 +00:00
commit 22dbb3e09a
38 changed files with 115 additions and 143 deletions

View File

@ -1,6 +1,7 @@
#include "activator.hpp"
#include <MyGUI_TextIterator.h>
#include <MyGUI_UString.h>
#include <components/esm3/loadacti.hpp>
#include <components/esm3/loadcrea.hpp>
@ -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())

View File

@ -1,6 +1,7 @@
#include "apparatus.hpp"
#include <MyGUI_TextIterator.h>
#include <MyGUI_UString.h>
#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;

View File

@ -1,6 +1,7 @@
#include "armor.hpp"
#include <MyGUI_TextIterator.h>
#include <MyGUI_UString.h>
#include <components/esm3/loadarmo.hpp>
#include <components/esm3/loadgmst.hpp>
@ -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;

View File

@ -1,6 +1,7 @@
#include "book.hpp"
#include <MyGUI_TextIterator.h>
#include <MyGUI_UString.h>
#include <components/esm3/loadbook.hpp>
#include <components/esm3/loadsoun.hpp>
@ -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;

View File

@ -1,6 +1,7 @@
#include "clothing.hpp"
#include <MyGUI_TextIterator.h>
#include <MyGUI_UString.h>
#include <components/esm3/loadclot.hpp>
#include <components/esm3/loadnpc.hpp>
@ -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;

View File

@ -1,6 +1,7 @@
#include "container.hpp"
#include <MyGUI_TextIterator.h>
#include <MyGUI_UString.h>
#include <components/esm3/containerstate.hpp>
#include <components/esm3/loadcont.hpp>
@ -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();

View File

@ -1,6 +1,7 @@
#include "creature.hpp"
#include <MyGUI_TextIterator.h>
#include <MyGUI_UString.h>
#include <components/esm3/creaturestate.hpp>
#include <components/esm3/loadclas.hpp>
@ -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())

View File

@ -1,6 +1,7 @@
#include "door.hpp"
#include <MyGUI_TextIterator.h>
#include <MyGUI_UString.h>
#include <components/esm3/doorstate.hpp>
#include <components/esm3/loaddoor.hpp>
@ -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;

View File

@ -1,11 +1,11 @@
#include "esm4base.hpp"
#include <MyGUI_TextIterator.h>
#include <MyGUI_UString.h>
#include <components/sceneutil/positionattitudetransform.hpp>
#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;
}
}

View File

@ -1,6 +1,7 @@
#include "ingredient.hpp"
#include <MyGUI_TextIterator.h>
#include <MyGUI_UString.h>
#include <components/esm3/loadingr.hpp>
#include <components/esm3/loadnpc.hpp>
@ -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;

View File

@ -1,6 +1,7 @@
#include "light.hpp"
#include <MyGUI_TextIterator.h>
#include <MyGUI_UString.h>
#include <components/esm3/loadligh.hpp>
#include <components/esm3/loadnpc.hpp>
@ -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;

View File

@ -1,6 +1,7 @@
#include "lockpick.hpp"
#include <MyGUI_TextIterator.h>
#include <MyGUI_UString.h>
#include <components/esm3/loadlock.hpp>
#include <components/esm3/loadnpc.hpp>
@ -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;

View File

@ -1,6 +1,7 @@
#include "misc.hpp"
#include <MyGUI_TextIterator.h>
#include <MyGUI_UString.h>
#include <components/esm3/loadcrea.hpp>
#include <components/esm3/loadmisc.hpp>
@ -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;

View File

@ -1,6 +1,7 @@
#include "npc.hpp"
#include <MyGUI_TextIterator.h>
#include <MyGUI_UString.h>
#include <cassert>
#include <memory>
@ -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())
{

View File

@ -1,6 +1,7 @@
#include "potion.hpp"
#include <MyGUI_TextIterator.h>
#include <MyGUI_UString.h>
#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;

View File

@ -1,6 +1,7 @@
#include "probe.hpp"
#include <MyGUI_TextIterator.h>
#include <MyGUI_UString.h>
#include <components/esm3/loadnpc.hpp>
#include <components/esm3/loadprob.hpp>
@ -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;

View File

@ -1,6 +1,7 @@
#include "repair.hpp"
#include <MyGUI_TextIterator.h>
#include <MyGUI_UString.h>
#include <components/esm3/loadnpc.hpp>
#include <components/esm3/loadrepa.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"
@ -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;

View File

@ -1,6 +1,7 @@
#include "weapon.hpp"
#include <MyGUI_TextIterator.h>
#include <MyGUI_UString.h>
#include <components/esm3/loadnpc.hpp>
#include <components/esm3/loadweap.hpp>
@ -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();

View File

@ -6,6 +6,7 @@
#include <MyGUI_ControllerRepeatClick.h>
#include <MyGUI_EditBox.h>
#include <MyGUI_Gui.h>
#include <MyGUI_UString.h>
#include <components/esm3/loadappa.hpp>
#include <components/esm3/loadingr.hpp>
@ -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<MyGUI::Button>();
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({});

View File

@ -4,6 +4,7 @@
#include <MyGUI_ImageBox.h>
#include <MyGUI_ListBox.h>
#include <MyGUI_ScrollView.h>
#include <MyGUI_UString.h>
#include <components/esm3/loadbsgn.hpp>
#include <components/esm3/loadspel.hpp>
@ -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<MyGUI::TextBox>("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;

View File

@ -4,6 +4,7 @@
#include <MyGUI_ImageBox.h>
#include <MyGUI_ListBox.h>
#include <MyGUI_ScrollView.h>
#include <MyGUI_UString.h>
#include "../mwbase/environment.hpp"
#include "../mwbase/windowmanager.hpp"
@ -20,7 +21,6 @@
#include <components/vfs/manager.hpp>
#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);

View File

@ -4,6 +4,7 @@
#include <MyGUI_LanguageManager.h>
#include <MyGUI_ProgressBar.h>
#include <MyGUI_ScrollBar.h>
#include <MyGUI_UString.h>
#include <MyGUI_Window.h>
#include <components/debug/debuglog.hpp>
@ -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()

View File

@ -5,6 +5,7 @@
#include <MyGUI_Button.h>
#include <MyGUI_EditBox.h>
#include <MyGUI_ScrollView.h>
#include <MyGUI_UString.h>
#include <components/misc/strings/format.hpp>
#include <components/settings/values.hpp>
@ -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;
}

View File

@ -6,6 +6,7 @@
#include <MyGUI_Gui.h>
#include <MyGUI_ScrollView.h>
#include <MyGUI_TextBox.h>
#include <MyGUI_UString.h>
#include <components/esm3/loadench.hpp>
@ -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)

View File

@ -3,11 +3,10 @@
#include <MyGUI_Gui.h>
#include <MyGUI_LayoutManager.h>
#include <MyGUI_TextBox.h>
#include <MyGUI_UString.h>
#include <MyGUI_Widget.h>
#include <MyGUI_Window.h>
#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<MyGUI::TextBox*>(pt)->setCaption(toUString(caption));
static_cast<MyGUI::TextBox*>(pt)->setCaption(MyGUI::UString(caption));
}
void Layout::setTitle(std::string_view title)
{
MyGUI::Window* window = static_cast<MyGUI::Window*>(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)

View File

@ -5,6 +5,7 @@
#include <MyGUI_ImageBox.h>
#include <MyGUI_ScrollView.h>
#include <MyGUI_TextBox.h>
#include <MyGUI_UString.h>
#include <components/fallback/fallback.hpp>
#include <components/widgets/box.hpp>
@ -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<ESM::Attribute>())

View File

@ -9,6 +9,7 @@
#include <MyGUI_Gui.h>
#include <MyGUI_ScrollBar.h>
#include <MyGUI_TextBox.h>
#include <MyGUI_UString.h>
#include <components/debug/debuglog.hpp>
#include <components/misc/pathhelpers.hpp>
@ -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;
}
}

View File

@ -4,6 +4,7 @@
#include <MyGUI_EditBox.h>
#include <MyGUI_LanguageManager.h>
#include <MyGUI_RenderManager.h>
#include <MyGUI_UString.h>
#include <components/debug/debuglog.hpp>
#include <components/misc/strings/algorithm.hpp>
@ -379,17 +380,17 @@ namespace MWGui
MyGUI::Widget* InteractiveMessageBox::getDefaultKeyFocus()
{
std::vector<std::string> keywords{ "sOk", "sYes" };
if (mDefaultFocus >= 0 && mDefaultFocus < static_cast<int>(mButtons.size()))
return mButtons[mDefaultFocus];
auto& languageManager = MyGUI::LanguageManager::getInstance();
std::vector<MyGUI::UString> 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;
}

View File

@ -4,6 +4,7 @@
#include <MyGUI_ImageBox.h>
#include <MyGUI_ListBox.h>
#include <MyGUI_ScrollBar.h>
#include <MyGUI_UString.h>
#include <osg/Texture2D>
@ -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()

View File

@ -6,6 +6,7 @@
#include <MyGUI_Gui.h>
#include <MyGUI_ImageBox.h>
#include <MyGUI_ScrollView.h>
#include <MyGUI_UString.h>
#include <components/esm3/loadbsgn.hpp>
#include <components/esm3/loadrace.hpp>
@ -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<MyGUI::TextBox>("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<MyGUI::TextBox>("SandText", coord1, MyGUI::Align::Default);
skillNameWidget->setCaption(toUString(text));
skillNameWidget->setCaption(MyGUI::UString(text));
skillNameWidget->eventMouseWheel += MyGUI::newDelegate(this, &ReviewDialog::onMouseWheel);
skillValueWidget = mSkillView->createWidget<MyGUI::TextBox>("SandTextRight", coord2, MyGUI::Align::Default);

View File

@ -7,6 +7,7 @@
#include <MyGUI_ImageBox.h>
#include <MyGUI_InputManager.h>
#include <MyGUI_LanguageManager.h>
#include <MyGUI_UString.h>
#include <osg/Texture2D>
#include <osgDB/ReadFile>
@ -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
{

View File

@ -13,6 +13,7 @@
#include <MyGUI_ScrollBar.h>
#include <MyGUI_ScrollView.h>
#include <MyGUI_TabControl.h>
#include <MyGUI_UString.h>
#include <MyGUI_Window.h>
#include <SDL_video.h>
@ -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<MyGUI::Button>()->getCaption() == on)
{
MyGUI::UString off
= toUString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sOff", "Off"));
_sender->castType<MyGUI::Button>()->setCaption(off);
_sender->castType<MyGUI::Button>()->setCaption(
MyGUI::UString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sOff", "Off")));
newState = false;
}
else
{
_sender->castType<MyGUI::Button>()->setCaption(on);
_sender->castType<MyGUI::Button>()->setCaption(MyGUI::UString(on));
newState = true;
}

View File

@ -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<MyGUI::TextBox>("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<MyGUI::TextBox>(
"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<MyGUI::TextBox>(

View File

@ -5,8 +5,7 @@
#include <MyGUI_Button.h>
#include <MyGUI_EditBox.h>
#include "ustring.hpp"
#include <MyGUI_UString.h>
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)

View File

@ -7,6 +7,7 @@
#include <MyGUI_InputManager.h>
#include <MyGUI_RenderManager.h>
#include <MyGUI_TextIterator.h>
#include <MyGUI_UString.h>
#include <components/esm/records.hpp>
#include <components/l10n/manager.hpp>
@ -953,8 +954,7 @@ namespace MWGui
widget->setUserString("Caption_MagicEffectSchool",
"#{sSchool}: "
+ MyGUI::TextIterator::toTagsString(
store->get<ESM::Skill>().find(effect->mData.mSchool)->mSchool->mName)
.asUTF8());
store->get<ESM::Skill>().find(effect->mData.mSchool)->mSchool->mName));
widget->setUserString("ImageTexture_MagicEffectImage", icon);
}
}

View File

@ -1,15 +0,0 @@
#ifndef MWGUI_USTRING_H
#define MWGUI_USTRING_H
#include <MyGUI_UString.h>
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

View File

@ -6,6 +6,7 @@
#include <MyGUI_ControllerManager.h>
#include <MyGUI_ImageBox.h>
#include <MyGUI_ProgressBar.h>
#include <MyGUI_UString.h>
#include <components/esm/attr.hpp>
#include <components/esm3/loadmgef.hpp>
@ -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() {}

View File

@ -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=";