X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fstyling%2Fstyle-manager-impl.cpp;h=df885d9fc1174a2e261811c4eb4fef16a3df5b6c;hb=7cca1061ed3db08d2e7f511a8f6ef707e688703d;hp=98596eb318e23fc8ed9ece30720d8661cbbcec14;hpb=24ea337df1049251ab2e47c556edc6e8458f9c93;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/styling/style-manager-impl.cpp b/dali-toolkit/internal/styling/style-manager-impl.cpp index 98596eb..df885d9 100644 --- a/dali-toolkit/internal/styling/style-manager-impl.cpp +++ b/dali-toolkit/internal/styling/style-manager-impl.cpp @@ -133,8 +133,7 @@ void StyleManager::ApplyTheme( const std::string& themeFile ) void StyleManager::ApplyDefaultTheme() { - std::string empty; - SetTheme( empty ); + SetTheme( DEFAULT_THEME ); } const std::string& StyleManager::GetDefaultFontFamily() const @@ -229,15 +228,22 @@ void StyleManager::SetTheme( const std::string& themeFile ) { bool themeLoaded = false; - mThemeBuilder = CreateBuilder( mThemeBuilderConstants ); - - // Always load the default theme first, then merge in the custom theme if present - themeLoaded = LoadJSON( mThemeBuilder, DEFAULT_THEME ); + if( mThemeFile.compare(DEFAULT_THEME) == 0 && mThemeBuilder ) + { + // We have already loaded the default theme into mThemeBuilder + } + else + { + // Reload the default theme + mThemeBuilder = CreateBuilder( mThemeBuilderConstants ); + themeLoaded = LoadJSON( mThemeBuilder, DEFAULT_THEME ); + } - if( ! themeFile.empty() ) + if( themeFile.compare(DEFAULT_THEME) != 0 ) { + // The theme is different to the default: Merge it + themeLoaded = LoadJSON( mThemeBuilder, themeFile ); mThemeFile = themeFile; - themeLoaded = LoadJSON( mThemeBuilder, mThemeFile ); } if( themeLoaded ) @@ -255,6 +261,32 @@ void StyleManager::SetTheme( const std::string& themeFile ) } } +const Property::Map StyleManager::GetConfigurations() +{ + Property::Map result; + if( mThemeBuilder ) + { + result = mThemeBuilder.GetConfigurations(); + } + else + { + bool themeLoaded = false; + + mThemeBuilder = CreateBuilder( mThemeBuilderConstants ); + + // Load default theme because this is first try to load stylesheet. + themeLoaded = LoadJSON( mThemeBuilder, DEFAULT_THEME ); + mThemeFile = DEFAULT_THEME; + + if( themeLoaded ) + { + result = mThemeBuilder.GetConfigurations(); + } + } + + return result; +} + bool StyleManager::LoadFile( const std::string& filename, std::string& stringOut ) { DALI_ASSERT_DEBUG( 0 != filename.length());