X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fstyling%2Fstyle-manager-impl.cpp;h=d1fa38837dcdd3a37e42a68d81d388906cf3ba42;hb=49557ae728fe830bf27a23ab230d72294b3a1a39;hp=f9569b99174791b734b896bfc986dbdf0f64cbf4;hpb=0297bd30ec1f17d6087f9b876e58ef0c510e9585;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 f9569b9..d1fa388 100644 --- a/dali-toolkit/internal/styling/style-manager-impl.cpp +++ b/dali-toolkit/internal/styling/style-manager-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,13 +20,14 @@ // EXTERNAL INCLUDES #include #include -#include +#include #include +#include // INTERNAL INCLUDES #include #include -#include +#include #include namespace @@ -34,11 +35,13 @@ namespace const char* LANDSCAPE_QUALIFIER = "landscape"; const char* PORTRAIT_QUALIFIER = "portrait"; -const char* FONT_SIZE_QUALIFIER = "FontSize"; +const char* FONT_SIZE_QUALIFIER = "fontsize"; const char* DEFAULT_THEME = DALI_STYLE_DIR "dali-toolkit-default-theme.json"; const char* PACKAGE_PATH_KEY = "PACKAGE_PATH"; +const char* APPLICATION_RESOURCE_PATH_KEY = "APPLICATION_RESOURCE_PATH"; + const char* DEFAULT_PACKAGE_PATH = DALI_DATA_READ_ONLY_DIR "/toolkit/"; } // namespace @@ -98,19 +101,18 @@ Toolkit::StyleManager StyleManager::Get() } StyleManager::StyleManager() -: mOrientationDegrees( 0 ), // Portrait - mDefaultFontSize( -1 ), +: mDefaultFontSize( -1 ), mDefaultFontFamily(""), mFeedbackStyle( NULL ) { // Add theme builder constants mThemeBuilderConstants[ PACKAGE_PATH_KEY ] = DEFAULT_PACKAGE_PATH; + mThemeBuilderConstants[ APPLICATION_RESOURCE_PATH_KEY ] = Application::GetResourcePath(); mStyleMonitor = StyleMonitor::Get(); if( mStyleMonitor ) { mStyleMonitor.StyleChangeSignal().Connect( this, &StyleManager::StyleMonitorChange ); - mDefaultFontSize = mStyleMonitor.GetDefaultFontSize(); } @@ -123,43 +125,18 @@ StyleManager::~StyleManager() delete mFeedbackStyle; } -void StyleManager::SetOrientationValue( int orientation ) -{ - 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( mThemeFile ); - } -} - -int StyleManager::GetOrientationValue() -{ - return mOrientationDegrees; -} - -void StyleManager::SetOrientation( Orientation orientation ) +void StyleManager::ApplyTheme( const std::string& themeFile ) { - if( mOrientation ) - { - mOrientation.ChangedSignal().Disconnect( this, &StyleManager::OnOrientationChanged ); - } - - OnOrientationChanged( orientation ); - - if( mOrientation ) - { - mOrientation.ChangedSignal().Connect( this, &StyleManager::OnOrientationChanged ); - } + SetTheme( themeFile ); } -Orientation StyleManager::GetOrientation() +void StyleManager::ApplyDefaultTheme() { - return mOrientation; + std::string empty; + SetTheme( empty ); } -std::string StyleManager::GetDefaultFontFamily() const +const std::string& StyleManager::GetDefaultFontFamily() const { return mDefaultFontFamily; } @@ -181,22 +158,11 @@ bool StyleManager::GetStyleConstant( const std::string& key, Property::Value& va return false; } -void StyleManager::RequestThemeChange( const std::string& themeFile ) -{ - SetTheme( themeFile ); -} - -void StyleManager::RequestDefaultTheme() -{ - std::string empty; - SetTheme( empty ); -} - void StyleManager::ApplyThemeStyle( Toolkit::Control control ) { if( !mThemeBuilder ) { - RequestDefaultTheme(); + ApplyDefaultTheme(); } if( mThemeBuilder ) @@ -328,13 +294,7 @@ bool StyleManager::LoadJSON( Toolkit::Builder builder, const std::string& jsonFi void StyleManager::CollectQualifiers( StringList& qualifiersOut ) { // Append the relevant qualifier for orientation - int orientation = mOrientationDegrees; - - if( mOrientation ) - { - orientation = mOrientation.GetDegrees(); - } - + int orientation = 0; // Get the orientation from the system switch( orientation ) { case 90: @@ -372,9 +332,7 @@ void StyleManager::ApplyStyle( Toolkit::Builder builder, Toolkit::Control contro if( styleName.empty() ) { - // Convert control name to lower case styleName = control.GetTypeName(); - std::transform( styleName.begin(), styleName.end(), styleName.begin(), ::tolower ); } // Apply the style after choosing the correct actual style (e.g. landscape or portrait) @@ -405,15 +363,6 @@ void StyleManager::ApplyStyle( Toolkit::Builder builder, Toolkit::Control contro } } -void StyleManager::OnOrientationChanged( Orientation orientation ) -{ - mOrientation = 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( mThemeFile ); -} - - Toolkit::Builder StyleManager::FindCachedBuilder( const std::string& key ) { BuilderMap::iterator builderIt = mBuilderCache.find( key );