Added UIApplication class to easily initialize GUI Applications.

Addind 7GUIs examples (https://eugenkiss.github.io/7guis/). Currently implemented the first three: Counter, Temperature Converter and Flight Booker.
Fixes in IgnoreMatcher and ProjectDirectoryTree.
Window::runMainLoop now accepts an std::function<void()>, this allows to use lambdas with captures.
UITextInput when using only numbers allow to insert + and - at the beggining of the number.
Return Node* on Node::setFocus().
String::fromFloat and String::fromDouble will shrink the number as much as possible (delete extra 0 and .).
This commit is contained in:
Martín Lucas Golini
2024-02-04 22:01:32 -03:00
parent 9797d49723
commit bb26ac4706
24 changed files with 361 additions and 29 deletions
+18 -3
View File
@@ -171,6 +171,8 @@ const std::string& GitIgnoreMatcher::getIgnoreFilePath() const {
bool GitIgnoreMatcher::parse() {
std::string patternFile;
FileSystem::fileGet( mPath + mIgnoreFileName, patternFile );
if ( FileSystem::fileExists( mPath + ".git" ) ) // Also ignore the .git folder
mPatterns.emplace_back( std::make_pair( "**/.git/**", false ) );
std::vector<std::string> patterns = String::split( patternFile );
for ( auto& pattern : patterns ) {
bool negates = false;
@@ -187,8 +189,6 @@ bool GitIgnoreMatcher::parse() {
pattern = String::rTrim( pattern, '/' );
mPatterns.emplace_back( std::make_pair( pattern, negates ) );
}
if ( FileSystem::fileExists( mPath + ".git" ) )
mPatterns.emplace_back( std::make_pair( "/.git", false ) ); // Also ignore the .git folder
return !mPatterns.empty();
}
@@ -258,10 +258,25 @@ bool IgnoreMatcherManager::foundMatch() const {
return !mMatchers.empty();
}
bool IgnoreMatcherManager::match( const FileInfo& file ) const {
eeASSERT( foundMatch() );
auto dirPath( file.getDirectoryPath() );
std::string localPath;
for ( const auto& matcher : mMatchers ) {
localPath.clear();
if ( String::startsWith( dirPath, matcher->getPath() ) )
localPath = dirPath.substr( matcher->getPath().size() );
if ( matcher->match( localPath + file.getFileName() ) )
return true;
}
return false;
}
bool IgnoreMatcherManager::match( const std::string& dir, const std::string& value ) const {
eeASSERT( foundMatch() );
std::string localPath;
for ( const auto& matcher : mMatchers ) {
std::string localPath;
localPath.clear();
if ( String::startsWith( dir, matcher->getPath() ) )
localPath = dir.substr( matcher->getPath().size() );
if ( matcher->match( localPath + value ) )