1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-21 08:39:45 +00:00

Use MyGUI::UString's new string_view support

This commit is contained in:
Evil Eye 2023-11-22 22:02:06 +01:00
parent 08538dd137
commit da9b0c5119
38 changed files with 80 additions and 143 deletions

View file

@ -27,7 +27,6 @@
#include "../mwrender/vismask.hpp"
#include "../mwgui/tooltips.hpp"
#include "../mwgui/ustring.hpp"
#include "../mwmechanics/npcstats.hpp"
@ -102,8 +101,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

@ -15,7 +15,6 @@
#include "../mwrender/renderinginterface.hpp"
#include "../mwgui/tooltips.hpp"
#include "../mwgui/ustring.hpp"
#include "classmodel.hpp"
@ -92,8 +91,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

@ -24,7 +24,6 @@
#include "../mwrender/renderinginterface.hpp"
#include "../mwgui/tooltips.hpp"
#include "../mwgui/ustring.hpp"
#include "classmodel.hpp"
@ -217,8 +216,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

@ -19,7 +19,6 @@
#include "../mwrender/renderinginterface.hpp"
#include "../mwgui/tooltips.hpp"
#include "../mwgui/ustring.hpp"
#include "../mwmechanics/npcstats.hpp"
@ -111,8 +110,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

@ -16,7 +16,6 @@
#include "../mwworld/ptr.hpp"
#include "../mwgui/tooltips.hpp"
#include "../mwgui/ustring.hpp"
#include "../mwrender/objects.hpp"
#include "../mwrender/renderinginterface.hpp"
@ -154,8 +153,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

@ -24,7 +24,6 @@
#include "../mwworld/worldmodel.hpp"
#include "../mwgui/tooltips.hpp"
#include "../mwgui/ustring.hpp"
#include "../mwrender/animation.hpp"
#include "../mwrender/objects.hpp"
@ -249,7 +248,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

@ -45,7 +45,6 @@
#include "../mwrender/renderinginterface.hpp"
#include "../mwgui/tooltips.hpp"
#include "../mwgui/ustring.hpp"
#include "classmodel.hpp"
@ -582,7 +581,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

@ -25,7 +25,6 @@
#include "../mwworld/worldmodel.hpp"
#include "../mwgui/tooltips.hpp"
#include "../mwgui/ustring.hpp"
#include "../mwrender/animation.hpp"
#include "../mwrender/objects.hpp"
@ -267,7 +266,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

@ -5,7 +5,6 @@
#include <components/sceneutil/positionattitudetransform.hpp>
#include "../mwgui/tooltips.hpp"
#include "../mwgui/ustring.hpp"
#include "../mwrender/objects.hpp"
#include "../mwrender/renderinginterface.hpp"
@ -35,8 +34,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

@ -16,7 +16,6 @@
#include "../mwworld/ptr.hpp"
#include "../mwgui/tooltips.hpp"
#include "../mwgui/ustring.hpp"
#include "../mwrender/objects.hpp"
#include "../mwrender/renderinginterface.hpp"
@ -107,8 +106,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

@ -21,7 +21,6 @@
#include "../mwworld/ptr.hpp"
#include "../mwgui/tooltips.hpp"
#include "../mwgui/ustring.hpp"
#include "../mwrender/objects.hpp"
#include "../mwrender/renderinginterface.hpp"
@ -159,8 +158,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

@ -15,7 +15,6 @@
#include "../mwworld/ptr.hpp"
#include "../mwgui/tooltips.hpp"
#include "../mwgui/ustring.hpp"
#include "../mwrender/objects.hpp"
#include "../mwrender/renderinginterface.hpp"
@ -104,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

@ -19,7 +19,6 @@
#include "../mwworld/worldmodel.hpp"
#include "../mwgui/tooltips.hpp"
#include "../mwgui/ustring.hpp"
#include "../mwrender/objects.hpp"
#include "../mwrender/renderinginterface.hpp"
@ -151,8 +150,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

@ -57,7 +57,6 @@
#include "../mwrender/renderinginterface.hpp"
#include "../mwgui/tooltips.hpp"
#include "../mwgui/ustring.hpp"
namespace
{
@ -1089,7 +1088,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

@ -13,7 +13,6 @@
#include "../mwworld/ptr.hpp"
#include "../mwgui/tooltips.hpp"
#include "../mwgui/ustring.hpp"
#include "../mwrender/objects.hpp"
#include "../mwrender/renderinginterface.hpp"
@ -95,8 +94,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

@ -15,7 +15,6 @@
#include "../mwworld/ptr.hpp"
#include "../mwgui/tooltips.hpp"
#include "../mwgui/ustring.hpp"
#include "../mwrender/objects.hpp"
#include "../mwrender/renderinginterface.hpp"
@ -103,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);
info.icon = ref->mBase->mIcon;
std::string text;

View file

@ -13,7 +13,6 @@
#include "../mwworld/ptr.hpp"
#include "../mwgui/tooltips.hpp"
#include "../mwgui/ustring.hpp"
#include "../mwrender/objects.hpp"
#include "../mwrender/renderinginterface.hpp"
@ -105,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

@ -20,7 +20,6 @@
#include "../mwmechanics/weapontype.hpp"
#include "../mwgui/tooltips.hpp"
#include "../mwgui/ustring.hpp"
#include "../mwrender/objects.hpp"
#include "../mwrender/renderinginterface.hpp"
@ -150,8 +149,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

@ -28,7 +28,6 @@
#include "itemview.hpp"
#include "itemwidget.hpp"
#include "sortfilteritemmodel.hpp"
#include "ustring.hpp"
#include "widgets.hpp"
namespace MWGui
@ -164,7 +163,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 +175,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

@ -18,7 +18,6 @@
#include "../mwworld/esmstore.hpp"
#include "../mwworld/player.hpp"
#include "ustring.hpp"
#include "widgets.hpp"
namespace
@ -56,7 +55,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 +70,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 +235,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

@ -20,7 +20,6 @@
#include <components/vfs/manager.hpp>
#include "tooltips.hpp"
#include "ustring.hpp"
namespace
{
@ -129,10 +128,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 +545,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 +868,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

@ -337,7 +337,7 @@ namespace MWGui
void DialogueWindow::onTradeComplete()
{
MyGUI::UString message = MyGUI::LanguageManager::getInstance().replaceTags("#{sBarterDialog5}");
addResponse({}, message.asUTF8());
addResponse({}, message);
}
bool DialogueWindow::exit()

View file

@ -26,7 +26,6 @@
#include "itemwidget.hpp"
#include "sortfilteritemmodel.hpp"
#include "ustring.hpp"
namespace MWGui
{
@ -95,7 +94,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 +114,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

@ -18,7 +18,6 @@
#include "itemmodel.hpp"
#include "itemwidget.hpp"
#include "ustring.hpp"
namespace MWGui
{
@ -130,7 +129,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 +181,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

@ -6,8 +6,6 @@
#include <MyGUI_Widget.h>
#include <MyGUI_Window.h>
#include "ustring.hpp"
namespace MWGui
{
void Layout::initialise(std::string_view _layout)
@ -52,16 +50,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

@ -22,7 +22,6 @@
#include "../mwmechanics/npcstats.hpp"
#include "class.hpp"
#include "ustring.hpp"
namespace
{
@ -176,7 +175,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

@ -191,7 +191,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

@ -379,17 +379,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

@ -19,7 +19,6 @@
#include "../mwworld/esmstore.hpp"
#include "tooltips.hpp"
#include "ustring.hpp"
namespace
{
@ -114,7 +113,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 +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 RaceDialog::onOpen()

View file

@ -19,7 +19,6 @@
#include "../mwworld/esmstore.hpp"
#include "tooltips.hpp"
#include "ustring.hpp"
namespace
{
@ -272,7 +271,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 +286,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

@ -35,7 +35,6 @@
#include "../mwstate/character.hpp"
#include "confirmationdialog.hpp"
#include "ustring.hpp"
namespace MWGui
{
@ -198,7 +197,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 +301,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

@ -38,7 +38,6 @@
#include "../mwbase/world.hpp"
#include "confirmationdialog.hpp"
#include "ustring.hpp"
namespace
{
@ -659,18 +658,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

@ -6,8 +6,6 @@
#include <MyGUI_Button.h>
#include <MyGUI_EditBox.h>
#include "ustring.hpp"
namespace MWGui
{
@ -35,10 +33,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

@ -953,8 +953,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

@ -20,8 +20,6 @@
#include "../mwworld/esmstore.hpp"
#include "ustring.hpp"
namespace MWGui::Widgets
{
/* MWSkill */
@ -135,8 +133,7 @@ namespace MWGui::Widgets
}
else
{
MyGUI::UString name = toUString(attribute->mName);
mAttributeNameWidget->setCaption(name);
mAttributeNameWidget->setCaption(MyGUI::UString(attribute->mName));
}
}
if (mAttributeValueWidget)
@ -497,13 +494,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=";