From: Agnelo Vaz Date: Fri, 5 Aug 2016 15:43:10 +0000 (+0100) Subject: Resource folder retreived from Framework API X-Git-Tag: dali_1.2.2~1 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=266f5b8959b7e9e1215be278dac13347c358af47 Resource folder retreived from Framework API Change-Id: I70e63f2f9adb250d21535d7e64b0b1abdb49b242 --- diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-application.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-application.cpp index 97c0df1..034e416 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-application.cpp +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-application.cpp @@ -41,6 +41,8 @@ public: public: + static std::string GetResourcePath(); + //Orientation& GetOrientation(); public: // static methods @@ -74,6 +76,10 @@ Application::~Application() //delete mOrientation; } +std::string Application::GetResourcePath() +{ + return ""; +} //Orientation& Application::GetOrientation() //{ // return *mOrientation; diff --git a/dali-toolkit/internal/builder/builder-impl.cpp b/dali-toolkit/internal/builder/builder-impl.cpp index 1d648c3..8203437 100644 --- a/dali-toolkit/internal/builder/builder-impl.cpp +++ b/dali-toolkit/internal/builder/builder-impl.cpp @@ -102,7 +102,7 @@ bool GetMappingKey( const std::string& str, std::string& key ) } /* - * Recursively collects all stylesin a node (An array of style names). + * Recursively collects all styles in a node (An array of style names). * * stylesCollection The set of styles from the json file (a json object of named styles) * style The style array to begin the collection from diff --git a/dali-toolkit/internal/styling/style-manager-impl.cpp b/dali-toolkit/internal/styling/style-manager-impl.cpp index 71baa96..7e08cf4 100644 --- a/dali-toolkit/internal/styling/style-manager-impl.cpp +++ b/dali-toolkit/internal/styling/style-manager-impl.cpp @@ -22,6 +22,7 @@ #include #include #include +#include // INTERNAL INCLUDES #include @@ -39,6 +40,8 @@ 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 @@ -104,12 +107,12 @@ StyleManager::StyleManager() { // 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(); } diff --git a/dali-toolkit/public-api/styling/style-manager.h b/dali-toolkit/public-api/styling/style-manager.h index 7b8efbb..bb84ea5 100644 --- a/dali-toolkit/public-api/styling/style-manager.h +++ b/dali-toolkit/public-api/styling/style-manager.h @@ -54,6 +54,11 @@ class StyleManager; * If the application wants to customize the theme, RequestThemeChange * needs to be called. * + * To supply resource paths ( in json ) the following constant is available: APPLICATION_RESOURCE_PATH. + * It provides the path to the application resource root folder, from there the filename can an be specified along with + * any sub folders, e.g Images, Models etc. + * The APPLICATION_RESOURCE_PATH can be retrieved using Application::GetResourcePath() + * * Signals * | %Signal Name | Method | * |------------------------------------------------------------| @@ -106,7 +111,7 @@ public: * * @SINCE_1_1.32 * @param[in] themeFile If a relative path is specified, then this is relative - * to the directory returned by app_get_resource_path(). + * to the directory returned by Application::GetResourcePath(). */ void ApplyTheme( const std::string& themeFile ); @@ -150,7 +155,7 @@ public: * @param[in] control The control to which to apply the style. * @param[in] jsonFileName The name of the JSON style file to apply. If a * relative path is specified, then this is relative to the directory - * returned by app_get_resource_path(). + * returned by Application::GetResourcePath(). * @param[in] styleName The name of the style within the JSON file to apply. */ void ApplyStyle( Toolkit::Control control, const std::string& jsonFileName, const std::string& styleName ); diff --git a/docs/content/programming-guide/styling.h b/docs/content/programming-guide/styling.h index d6c197f..f28eb47 100644 --- a/docs/content/programming-guide/styling.h +++ b/docs/content/programming-guide/styling.h @@ -58,5 +58,15 @@ Each style selector can have resource folders associated with it. Images for that style should be in their own folder named images. Common images not specific for a particular style will be in the images-common folder located in the style folder. + +All application resources are stored in a defined path (application resource path), from this path sub directories can be specified. + +The application resource path can be retrieved using Application::GetResourcePath() + +Alternatively to supply resource paths in json the following constant is available: APPLICATION_RESOURCE_PATH. + +It provides the path to the application resource root folder, from there the filename can an be specified along with any sub folders, e.g Images, Models etc. + + * */