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) void resizeSkin(MyGUI::xml::ElementPtr _node)
{ {
_node->setAttribute("type", "ResourceSkin"); _node->setAttribute("type", "ResourceSkin");
auto size = _node->findAttribute("size"); if (!_node->findAttribute("size").empty())
if (!size.empty())
return; return;
auto textureName = _node->findAttribute("texture"); auto textureName = _node->findAttribute("texture");
if (textureName.empty()) if (textureName.empty())
return; return;
MyGUI::ITexture* texture = MyGUI::RenderManager::getInstance().getTexture(std::string(textureName)); MyGUI::ITexture* texture = MyGUI::RenderManager::getInstance().getTexture(std::string{ textureName });
if (!texture) if (!texture)
return; return;

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

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

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

@ -608,7 +608,7 @@ namespace Gui
MyGUI::ResourceManager::getInstance().addResource(bookFont); 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 // We should adjust line height for MyGUI widgets depending on font size
MyGUI::xml::ElementEnumerator resourceNode = _node->getElementEnumerator(); MyGUI::xml::ElementEnumerator resourceNode = _node->getElementEnumerator();

@ -27,7 +27,7 @@ namespace Gui
public: public:
FontLoader(ToUTF8::FromType encoding, const VFS::Manager* vfs, float scalingFactor); 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); static std::string_view getFontForFace(std::string_view face);

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

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

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

@ -40,7 +40,7 @@ namespace Gui
notifySizeChange(this); 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") if (_key == "ExpandDirection")
{ {
@ -103,7 +103,7 @@ namespace Gui
setEditStatic(true); 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") if (_key == "ExpandDirection")
{ {
@ -136,7 +136,7 @@ namespace Gui
notifySizeChange(this); 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") if (_key == "ExpandDirection")
{ {
@ -160,7 +160,7 @@ namespace Gui
align(); 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") if (_key == "Spacing")
mSpacing = MyGUI::utility::parseValue<int>(_value); 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)) if (!Box::_setPropertyImpl(_key, _value))
MyGUI::Widget::setPropertyOverride(_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)) if (!Box::_setPropertyImpl(_key, _value))
MyGUI::Widget::setPropertyOverride(_key, _value); MyGUI::Widget::setPropertyOverride(_key, _value);

@ -51,7 +51,7 @@ namespace Gui
void initialiseOverride() override; void initialiseOverride() override;
protected: 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(); int getWidth();
std::string mFontSize; std::string mFontSize;
bool mShrink = false; bool mShrink = false;
@ -68,7 +68,7 @@ namespace Gui
void setCaption(const MyGUI::UString& _value) override; void setCaption(const MyGUI::UString& _value) override;
protected: 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; std::string mFontSize;
}; };

@ -34,7 +34,7 @@ namespace Gui
updateImage(); 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") if (_key == "ImageHighlighted")
mImageHighlighted = _value; mImageHighlighted = _value;

@ -107,7 +107,7 @@ namespace Gui
mScrollView->setViewOffset(MyGUI::IntPoint(0, -viewPosition)); 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") if (_key == "ListItemSkin")
mListItemSkin = _value; mListItemSkin = _value;

Loading…
Cancel
Save