X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=base%2Fdali-toolkit%2Finternal%2Fstyling%2Fstyle-manager-impl.cpp;h=0e43c192ce4a182111a3ef6b2cc91c4926b8937a;hp=57be231c242189fac6f7fdf3cafd7541ec868eba;hb=467273430b68ef02ca30677af8dbb64277e5a668;hpb=d9b7907a944d4ca0568b34361f334026999312bc diff --git a/base/dali-toolkit/internal/styling/style-manager-impl.cpp b/base/dali-toolkit/internal/styling/style-manager-impl.cpp index 57be231..0e43c19 100644 --- a/base/dali-toolkit/internal/styling/style-manager-impl.cpp +++ b/base/dali-toolkit/internal/styling/style-manager-impl.cpp @@ -21,7 +21,6 @@ #include #include #include -#include #include // EXTERNAL INCLUDES @@ -108,32 +107,33 @@ Toolkit::StyleManager StyleManager::Get() } StyleManager::StyleManager() - : mOrientationDegrees( 0 ), // Portrait - mSetThemeConnection( false ) + : mOrientationDegrees( 0 ) // Portrait { // Add theme builder constants mThemeBuilderConstants[ PACKAGE_PATH_KEY ] = DEFAULT_PACKAGE_PATH; RequestDefaultTheme(); - if( Adaptor::IsAvailable() ) + StyleMonitor styleMonitor( StyleMonitor::Get() ); + if( styleMonitor ) { - StyleMonitor::Get().StyleChangeSignal().Connect( this, &StyleManager::StyleMonitorChange ); + styleMonitor.StyleChangeSignal().Connect( this, &StyleManager::StyleMonitorChange ); } } StyleManager::~StyleManager() { - // Disconnect from signal - SetOrientation( Orientation() ); } void StyleManager::SetOrientationValue( int orientation ) { - mOrientationDegrees = orientation; - - Util::ConnectEventProcessingFinishedSignal(); - mSetThemeConnection = true; + if( orientation != mOrientationDegrees ) + { + mOrientationDegrees = orientation; + // TODO: if orientation changed, apply the new style to all controls + // dont want to really do the whole load from file again if the bundle contains both portrait & landscape + SetTheme(); + } } int StyleManager::GetOrientationValue() @@ -181,12 +181,9 @@ bool StyleManager::GetStyleConstant( const std::string& key, Property::Value& va void StyleManager::OnOrientationChanged( Orientation orientation ) { mOrientation = orientation; - - if( mOrientation ) - { - Util::ConnectEventProcessingFinishedSignal(); - mSetThemeConnection = true; - } + // TODO: if orientation changed, apply the new style to all controls + // dont want to really do the whole load from file again if the bundle contains both portrait & landscape + SetTheme(); } Toolkit::Builder StyleManager::CreateBuilder( const PropertyValueMap& constants ) @@ -349,8 +346,8 @@ void StyleManager::RequestThemeChange( const std::string& themeFile ) { mThemeFile = themeFile; - Util::ConnectEventProcessingFinishedSignal(); - mSetThemeConnection = true; + // need to do style change synchronously as app might create a UI control on the next line + SetTheme(); } void StyleManager::RequestDefaultTheme() @@ -358,18 +355,11 @@ void StyleManager::RequestDefaultTheme() RequestThemeChange( DEFAULT_THEME ); } -bool StyleManager::IsThemeRequestPending() -{ - return mSetThemeConnection; -} - void StyleManager::SetTheme() { mThemeBuilder = CreateBuilder( mThemeBuilderConstants ); LoadJSON( mThemeBuilder, mThemeFile ); - mSetThemeConnection = false; - StyleChange change; change.themeChange = true; mStyleChangeSignal.Emit( Toolkit::StyleManager::Get(), change );