Try fix build in GitHub Actions.

This commit is contained in:
Martín Lucas Golini
2022-09-04 13:12:00 -03:00
parent 0a70817ed1
commit fc2bb97365
4 changed files with 32 additions and 13 deletions

View File

@@ -63,7 +63,7 @@ class EE_API UIDocFindReplace : public UILinearLayout, public WidgetCommandExecu
UIWidget* mToggle{ nullptr };
UIWidget* mReplaceBox{ nullptr };
std::shared_ptr<Doc::TextDocument> mDoc;
std::vector<std::unique_ptr<UIDataBind<bool>>> mDataBinds;
std::vector<std::unique_ptr<UIDataBindBool>> mDataBinds;
std::unique_ptr<UIDataBind<TextDocument::FindReplaceType>> mPatternBind;
UIDocFindReplace(

View File

@@ -12,8 +12,7 @@ template <typename T> class UIDataBind {
Converter(
std::function<bool( const UIDataBind<T>*, T&, const std::string& )> toVal =
[]( const UIDataBind<T>*, T& val, const std::string& str ) {
auto base = std::is_same<T, bool>::value ? std::boolalpha : std::dec;
return String::fromString( val, str, base );
return String::fromString( val, str );
},
std::function<bool( const UIDataBind<T>*, std::string&, const T& )> fromVal =
[]( const UIDataBind<T>*, std::string& str, const T& val ) {
@@ -25,7 +24,19 @@ template <typename T> class UIDataBind {
std::function<bool( const UIDataBind<T>*, std::string&, const T& )> fromVal;
};
UIDataBind( T* t, std::set<UIWidget*> widgets, const Converter& converter = {},
static Converter converterBool() {
return Converter(
[]( const UIDataBind<T>* databind, T& val, const std::string& str ) -> bool {
val = StyleSheetProperty( databind->getPropertyDefinition(), str ).asBool();
return true;
},
[]( const UIDataBind<T>*, std::string& str, const T& val ) -> bool {
str = val ? "true" : "false";
return true;
} );
}
UIDataBind( T* t, const std::set<UIWidget*>& widgets, const Converter& converter = {},
const std::string& valueKey = "value" ) :
data( t ),
widgets( widgets ),
@@ -138,6 +149,16 @@ template <typename T> class UIDataBind {
}
};
class UIDataBindBool : public UIDataBind<bool> {
public:
UIDataBindBool( bool* t, const std::set<UIWidget*>& widgets,
const std::string& valueKey = "value" ) :
UIDataBind<bool>( t, widgets, UIDataBind<bool>::converterBool(), valueKey ) {}
UIDataBindBool( bool* t, UIWidget* widget, const std::string& valueKey = "value" ) :
UIDataBind<bool>( t, widget, UIDataBind<bool>::converterBool(), valueKey ) {}
};
}} // namespace EE::UI
#endif // EE_UI_UIDATABIND_HPP

View File

@@ -1177,15 +1177,13 @@ solution "eepp"
set_kind()
language "C++"
includedirs { "src/thirdparty/efsw/include", "src/thirdparty" }
links { "efsw-static", "pugixml-static" }
if not os.is_real("windows") and not os.is_real("haiku") then
links { "pthread" }
end
if os.is_real("macosx") then
links { "CoreFoundation.framework", "CoreServices.framework" }
end
links { "efsw-static", "pugixml-static" }
files { "src/tools/uieditor/*.cpp" }
build_link_configuration( "eepp-UIEditor", true )

View File

@@ -296,12 +296,12 @@ UIDocFindReplace::UIDocFindReplace( UIWidget* parent, const std::shared_ptr<Doc:
mReplaceInput->addEventListener( Event::OnTabNavigate,
[&]( const Event* ) { mFindInput->setFocus(); } );
mDataBinds.emplace_back( std::unique_ptr<UIDataBind<bool>>(
new UIDataBind<bool>( &mSearchState.caseSensitive, mCaseSensitive ) ) );
mDataBinds.emplace_back( std::unique_ptr<UIDataBind<bool>>(
new UIDataBind<bool>( &mSearchState.wholeWord, mWholeWord ) ) );
mDataBinds.emplace_back( std::unique_ptr<UIDataBind<bool>>(
new UIDataBind<bool>( &mSearchState.escapeSequences, mEscapeSequences ) ) );
mDataBinds.emplace_back( std::unique_ptr<UIDataBindBool>(
new UIDataBindBool( &mSearchState.caseSensitive, mCaseSensitive ) ) );
mDataBinds.emplace_back( std::unique_ptr<UIDataBindBool>(
new UIDataBindBool( &mSearchState.wholeWord, mWholeWord ) ) );
mDataBinds.emplace_back( std::unique_ptr<UIDataBindBool>(
new UIDataBindBool( &mSearchState.escapeSequences, mEscapeSequences ) ) );
UIDataBind<TextDocument::FindReplaceType>::Converter luaPatternConverter(
[]( const UIDataBind<TextDocument::FindReplaceType>* databind,
TextDocument::FindReplaceType& val, const std::string& str ) -> bool {