Merge Assumeru/mystringvui

macos_ci_fix
Evil Eye 1 year ago committed by Bret Curtis
parent 589a27d09c
commit 97009f1e23

@ -9,15 +9,14 @@ namespace MWGui
void resizeSkin(MyGUI::xml::ElementPtr _node)
{
_node->setAttribute("type", "ResourceSkin");
auto size = _node->findAttribute("size");
if (!size.empty())
if (!_node->findAttribute("size").empty())
return;
auto textureName = _node->findAttribute("texture");
if (textureName.empty())
return;
MyGUI::ITexture* texture = MyGUI::RenderManager::getInstance().getTexture(std::string(textureName));
MyGUI::ITexture* texture = MyGUI::RenderManager::getInstance().getTexture(std::string{ textureName });
if (!texture)
return;

@ -168,7 +168,7 @@ namespace MWGui
std::string_view type = getSettingType(current);
if (type == checkButtonType)
{
const std::string initialValue
std::string_view initialValue
= Settings::get<bool>(getSettingCategory(current), getSettingName(current)) ? "#{Interface:On}"
: "#{Interface:Off}";
current->castType<MyGUI::Button>()->setCaptionWithReplacing(initialValue);
@ -247,8 +247,8 @@ namespace MWGui
{
MyGUI::TextBox* textBox;
getWidget(textBox, labelWidgetName);
auto labelCaption = scroller->getUserString("SettingLabelCaption");
labelCaption = Misc::StringUtils::format(std::string(labelCaption), value);
std::string labelCaption{ scroller->getUserString("SettingLabelCaption") };
labelCaption = Misc::StringUtils::format(labelCaption, value);
textBox->setCaptionWithReplacing(labelCaption);
}
}

@ -1227,7 +1227,7 @@ namespace MWGui
MWBase::Environment::get().getStateManager()->requestQuit();
}
void WindowManager::onCursorChange(const std::string& name)
void WindowManager::onCursorChange(std::string_view name)
{
mCursorManager->cursorChanged(name);
}
@ -2071,13 +2071,13 @@ namespace MWGui
mWerewolfFader->notifyAlphaChanged(set ? 1.0f : 0.0f);
}
void WindowManager::onClipboardChanged(const std::string& _type, const std::string& _data)
void WindowManager::onClipboardChanged(std::string_view _type, std::string_view _data)
{
if (_type == "Text")
SDL_SetClipboardText(MyGUI::TextIterator::getOnlyText(MyGUI::UString(_data)).asUTF8().c_str());
}
void WindowManager::onClipboardRequested(const std::string& _type, std::string& _data)
void WindowManager::onClipboardRequested(std::string_view _type, std::string& _data)
{
if (_type != "Text")
return;

@ -560,7 +560,7 @@ namespace MWGui
*/
void onRetrieveTag(const MyGUI::UString& _tag, MyGUI::UString& _result);
void onCursorChange(const std::string& name);
void onCursorChange(std::string_view name);
void onKeyFocusChanged(MyGUI::Widget* widget);
// Key pressed while playing a video
@ -568,8 +568,8 @@ namespace MWGui
void sizeVideo(int screenWidth, int screenHeight);
void onClipboardChanged(const std::string& _type, const std::string& _data);
void onClipboardRequested(const std::string& _type, std::string& _data);
void onClipboardChanged(std::string_view _type, std::string_view _data);
void onClipboardRequested(std::string_view _type, std::string& _data);
void createTextures();
void createCursors();

@ -608,7 +608,7 @@ namespace Gui
MyGUI::ResourceManager::getInstance().addResource(bookFont);
}
void FontLoader::overrideLineHeight(MyGUI::xml::ElementPtr _node, const std::string& _file, MyGUI::Version _version)
void FontLoader::overrideLineHeight(MyGUI::xml::ElementPtr _node, std::string_view _file, MyGUI::Version _version)
{
// We should adjust line height for MyGUI widgets depending on font size
MyGUI::xml::ElementEnumerator resourceNode = _node->getElementEnumerator();

@ -27,7 +27,7 @@ namespace Gui
public:
FontLoader(ToUTF8::FromType encoding, const VFS::Manager* vfs, float scalingFactor);
void overrideLineHeight(MyGUI::xml::ElementPtr _node, const std::string& _file, MyGUI::Version _version);
void overrideLineHeight(MyGUI::xml::ElementPtr _node, std::string_view _file, MyGUI::Version _version);
static std::string_view getFontForFace(std::string_view face);

@ -60,20 +60,15 @@ namespace osgMyGUI
std::string DataManager::getDataPath(const std::string& name) const
{
static std::string result;
result.clear();
if (name.empty())
{
result = Files::pathToUnicodeString(mResourcePath);
return result;
return Files::pathToUnicodeString(mResourcePath);
}
if (!isDataExist(name))
return result;
return {};
result = Files::pathToUnicodeString(mResourcePath / name);
return result;
return Files::pathToUnicodeString(mResourcePath / name);
}
}

@ -25,12 +25,12 @@ namespace osgMyGUI
mStream.flush();
}
void CustomLogListener::log(const std::string& _section, MyGUI::LogLevel _level, const struct tm* _time,
const std::string& _message, const char* _file, int _line)
void CustomLogListener::log(std::string_view _section, MyGUI::LogLevel _level, const struct tm* _time,
std::string_view _message, std::string_view _file, int _line)
{
if (mStream.is_open())
{
const char* separator = " | ";
std::string_view separator = " | ";
mStream << std::setw(2) << std::setfill('0') << _time->tm_hour << ":" << std::setw(2) << std::setfill('0')
<< _time->tm_min << ":" << std::setw(2) << std::setfill('0') << _time->tm_sec << separator
<< _section << separator << _level.print() << separator << _message << separator << _file

@ -30,8 +30,8 @@ namespace osgMyGUI
void close() override;
void flush() override;
void log(const std::string& _section, MyGUI::LogLevel _level, const struct tm* _time,
const std::string& _message, const char* _file, int _line);
void log(std::string_view _section, MyGUI::LogLevel _level, const struct tm* _time, std::string_view _message,
std::string_view _file, int _line) override;
private:
std::ofstream mStream;

@ -40,7 +40,7 @@ namespace Gui
notifySizeChange(this);
}
void AutoSizedTextBox::setPropertyOverride(std::string_view _key, const std::string_view _value)
void AutoSizedTextBox::setPropertyOverride(std::string_view _key, std::string_view _value)
{
if (_key == "ExpandDirection")
{
@ -103,7 +103,7 @@ namespace Gui
setEditStatic(true);
}
void AutoSizedEditBox::setPropertyOverride(std::string_view _key, const std::string_view _value)
void AutoSizedEditBox::setPropertyOverride(std::string_view _key, std::string_view _value)
{
if (_key == "ExpandDirection")
{
@ -136,7 +136,7 @@ namespace Gui
notifySizeChange(this);
}
void AutoSizedButton::setPropertyOverride(std::string_view _key, const std::string_view _value)
void AutoSizedButton::setPropertyOverride(std::string_view _key, std::string_view _value)
{
if (_key == "ExpandDirection")
{
@ -160,7 +160,7 @@ namespace Gui
align();
}
bool Box::_setPropertyImpl(std::string_view _key, const std::string_view _value)
bool Box::_setPropertyImpl(std::string_view _key, std::string_view _value)
{
if (_key == "Spacing")
mSpacing = MyGUI::utility::parseValue<int>(_value);
@ -261,7 +261,7 @@ namespace Gui
}
}
void HBox::setPropertyOverride(std::string_view _key, const std::string_view _value)
void HBox::setPropertyOverride(std::string_view _key, std::string_view _value)
{
if (!Box::_setPropertyImpl(_key, _value))
MyGUI::Widget::setPropertyOverride(_key, _value);
@ -416,7 +416,7 @@ namespace Gui
}
}
void VBox::setPropertyOverride(std::string_view _key, const std::string_view _value)
void VBox::setPropertyOverride(std::string_view _key, std::string_view _value)
{
if (!Box::_setPropertyImpl(_key, _value))
MyGUI::Widget::setPropertyOverride(_key, _value);

@ -51,7 +51,7 @@ namespace Gui
void initialiseOverride() override;
protected:
void setPropertyOverride(std::string_view _key, const std::string_view _value) override;
void setPropertyOverride(std::string_view _key, std::string_view _value) override;
int getWidth();
std::string mFontSize;
bool mShrink = false;
@ -68,7 +68,7 @@ namespace Gui
void setCaption(const MyGUI::UString& _value) override;
protected:
void setPropertyOverride(std::string_view _key, const std::string_view _value) override;
void setPropertyOverride(std::string_view _key, std::string_view _value) override;
std::string mFontSize;
};

@ -34,7 +34,7 @@ namespace Gui
updateImage();
}
void ImageButton::setPropertyOverride(std::string_view _key, const std::string_view _value)
void ImageButton::setPropertyOverride(std::string_view _key, std::string_view _value)
{
if (_key == "ImageHighlighted")
mImageHighlighted = _value;

@ -107,7 +107,7 @@ namespace Gui
mScrollView->setViewOffset(MyGUI::IntPoint(0, -viewPosition));
}
void MWList::setPropertyOverride(std::string_view _key, const std::string_view _value)
void MWList::setPropertyOverride(std::string_view _key, std::string_view _value)
{
if (_key == "ListItemSkin")
mListItemSkin = _value;

Loading…
Cancel
Save