From: Adeel Kazmi Date: Thu, 2 Apr 2020 14:46:48 +0000 (+0000) Subject: Merge "CMake - Option added to define the default toolkit resource path." into devel... X-Git-Tag: dali_1.9.6~2 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=d82f43904668532387d5c796aad7aa265d5536d6;hp=2564b59549aa2619a78059c9e16bd9e6556589e9 Merge "CMake - Option added to define the default toolkit resource path." into devel/master --- diff --git a/automated-tests/src/dali-toolkit-internal/CMakeLists.txt b/automated-tests/src/dali-toolkit-internal/CMakeLists.txt index 22c9a90..98172fb 100755 --- a/automated-tests/src/dali-toolkit-internal/CMakeLists.txt +++ b/automated-tests/src/dali-toolkit-internal/CMakeLists.txt @@ -11,6 +11,7 @@ SET(TC_SOURCES utc-Dali-ColorConversion.cpp utc-Dali-Control-internal.cpp utc-Dali-DebugRendering.cpp + utc-Dali-FeedbackStyle.cpp utc-Dali-ItemView-internal.cpp utc-Dali-LogicalModel.cpp utc-Dali-PropertyHelper.cpp @@ -41,6 +42,7 @@ LIST(APPEND TC_SOURCES ../dali-toolkit/dali-toolkit-test-utils/toolkit-clipboard-event-notifier.cpp ../dali-toolkit/dali-toolkit-test-utils/toolkit-event-thread-callback.cpp ../dali-toolkit/dali-toolkit-test-utils/toolkit-environment-variable.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-feedback-player.cpp ../dali-toolkit/dali-toolkit-test-utils/toolkit-input-method-context.cpp ../dali-toolkit/dali-toolkit-test-utils/toolkit-input-method-options.cpp ../dali-toolkit/dali-toolkit-test-utils/toolkit-lifecycle-controller.cpp diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-FeedbackStyle.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-FeedbackStyle.cpp new file mode 100644 index 0000000..202c87f --- /dev/null +++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-FeedbackStyle.cpp @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2020 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include +#include + +#include +#include +#include +#include + +using namespace Dali; +using namespace Toolkit; + +namespace Dali +{ + +namespace Internal +{ + +namespace Adaptor +{ + +/** + * @brief Sets the return value of the FeedbackPlayer::LoadFile() method of the stub implementation. + * + * Used to improve the line coverage. + * + * @param[in] feedbackPlayer The FeedbackPlayer singleton. + * @param[in] returnValue The desired return value for the FeedbackPlayer::LoadFile() method. Either true or false. + */ +void SetLoadFileReturnValue( Dali::FeedbackPlayer feedbackPlayer, bool returnValue ); + +} + +} + +} + +int UtcDaliFeedbackStyle(void) +{ + // Not too much to test. Just to improve coverage. + + ToolkitTestApplication application; + tet_infoline(" UtcDaliFeedbackStyle"); + + try + { + Toolkit::Internal::FeedbackStyle feedbackStyle; + + Dali::FeedbackPlayer feedbackPlayer = Dali::FeedbackPlayer::Get(); + Dali::Internal::Adaptor::SetLoadFileReturnValue(feedbackPlayer, false); + + Toolkit::Internal::FeedbackStyle feedbackStyle2; + + Dali::Internal::Adaptor::SetLoadFileReturnValue(feedbackPlayer, true); + } + catch(...) + { + tet_result(TET_FAIL); + } + + tet_result(TET_PASS); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-feedback-player.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-feedback-player.cpp index 9111d8d..946880e 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-feedback-player.cpp +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-feedback-player.cpp @@ -85,11 +85,17 @@ public: bool LoadFile(const std::string& filename, std::string& data) { - return true; + return mLoadFileReturn; + } + + void SetLoadFileReturnValue(bool value) + { + mLoadFileReturn = value; } private: FeedbackPlayer() + : mLoadFileReturn{true} { } @@ -105,6 +111,8 @@ private: { return *this; } + + bool mLoadFileReturn; }; } // Adaptor @@ -177,4 +185,17 @@ FeedbackPlayer::FeedbackPlayer( Internal::Adaptor::FeedbackPlayer* player ) { } +namespace Internal +{ +namespace Adaptor +{ + +void SetLoadFileReturnValue(Dali::FeedbackPlayer feedbackPlayer, bool returnValue) +{ + GetImplementation(feedbackPlayer).SetLoadFileReturnValue( returnValue ); +} + +} // Adaptor +} // Internal + } // Dali diff --git a/automated-tests/src/dali-toolkit/utc-Dali-AccessibilityManager.cpp b/automated-tests/src/dali-toolkit/utc-Dali-AccessibilityManager.cpp index ee6f133..dbbbd84 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-AccessibilityManager.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-AccessibilityManager.cpp @@ -550,6 +550,7 @@ int UtcDaliAccessibilityManagerMoveFocusForward(void) Dali::AccessibilityAdaptor accAdaptor = Dali::AccessibilityAdaptor::Get(); Test::AccessibilityAdaptor::SetEnabled( accAdaptor, true ); accAdaptor.HandleActionEnableEvent(); + accAdaptor.HandleActionNextEvent(true); Actor first = Actor::New(); Stage::GetCurrent().Add(first); diff --git a/build/tizen/CMakeLists.txt b/build/tizen/CMakeLists.txt index 1b1d202..cbd6c98 100644 --- a/build/tizen/CMakeLists.txt +++ b/build/tizen/CMakeLists.txt @@ -31,6 +31,7 @@ OPTION(ENABLE_PKG_CONFIGURE "Use pkgconfig" ON) OPTION(ENABLE_LINK_TEST "Enable the link test" ON) OPTION(INSTALL_DOXYGEN_DOC "Install doxygen doc" ON) OPTION(CONFIGURE_AUTOMATED_TESTS "Configure automated tests" ON) +OPTION(USE_DEFAULT_RESOURCE_DIR "Whether to use the default resource folders. Otherwise set environment variables for DALI_IMAGE_DIR, DALI_SOUND_DIR, DALI_STYLE_DIR, DALI_STYLE_IMAGE_DIR and DALI_DATA_READ_ONLY_DIR" ON) IF( ENABLE_PKG_CONFIGURE ) FIND_PACKAGE( PkgConfig REQUIRED ) @@ -101,18 +102,22 @@ ENDIF( ENABLE_I18N ) IF( SET_VCPKG_INSTALL_PREFIX ) ADD_DEFINITIONS( "-DBUILDING_DALI_TOOLKIT" ) - ADD_DEFINITIONS( -DDALI_IMAGE_DIR=\"${VCPKG_INSTALLED_DIR}/share/dali/toolkit/images/\" - -DDALI_SOUND_DIR=\"${VCPKG_INSTALLED_DIR}/share/dali/toolkit/sounds/\" - -DDALI_STYLE_DIR=\"${VCPKG_INSTALLED_DIR}/share/dali/toolkit/styles/\" - -DDALI_STYLE_IMAGE_DIR=\"${VCPKG_INSTALLED_DIR}/share/dali/toolkit/styles/images/\" - -DDALI_DATA_READ_ONLY_DIR=\"${VCPKG_INSTALLED_DIR}/share/\" ) + IF( USE_DEFAULT_RESOURCE_DIR ) + ADD_DEFINITIONS( -DDALI_IMAGE_DIR=\"${VCPKG_INSTALLED_DIR}/share/dali/toolkit/images/\" + -DDALI_SOUND_DIR=\"${VCPKG_INSTALLED_DIR}/share/dali/toolkit/sounds/\" + -DDALI_STYLE_DIR=\"${VCPKG_INSTALLED_DIR}/share/dali/toolkit/styles/\" + -DDALI_STYLE_IMAGE_DIR=\"${VCPKG_INSTALLED_DIR}/share/dali/toolkit/styles/images/\" + -DDALI_DATA_READ_ONLY_DIR=\"${VCPKG_INSTALLED_DIR}/share/\" ) + ENDIF() ELSE() ADD_DEFINITIONS(-DPIC -DSTDC_HEADERS) - ADD_DEFINITIONS(-DDALI_IMAGE_DIR=\"${dataReadOnlyDir}/toolkit/images/\" - -DDALI_SOUND_DIR=\"${dataReadOnlyDir}/toolkit/sounds/\" - -DDALI_STYLE_DIR=\"${dataReadOnlyDir}/toolkit/styles/\" - -DDALI_STYLE_IMAGE_DIR=\"${dataReadOnlyDir}/toolkit/styles/images/\" - -DDALI_DATA_READ_ONLY_DIR=\"${dataReadOnlyDir}\" ) + IF( USE_DEFAULT_RESOURCE_DIR ) + ADD_DEFINITIONS( -DDALI_IMAGE_DIR=\"${dataReadOnlyDir}/toolkit/images/\" + -DDALI_SOUND_DIR=\"${dataReadOnlyDir}/toolkit/sounds/\" + -DDALI_STYLE_DIR=\"${dataReadOnlyDir}/toolkit/styles/\" + -DDALI_STYLE_IMAGE_DIR=\"${dataReadOnlyDir}/toolkit/styles/images/\" + -DDALI_DATA_READ_ONLY_DIR=\"${dataReadOnlyDir}\" ) + ENDIF() IF("${ARCH}" STREQUAL "arm") ADD_DEFINITIONS("-DTARGET") @@ -123,6 +128,14 @@ ELSE() ENDIF( NOT ${ENABLE_EXPORTALL} ) ENDIF() +IF( NOT USE_DEFAULT_RESOURCE_DIR ) + ADD_DEFINITIONS( -DDALI_IMAGE_DIR=0 + -DDALI_SOUND_DIR=0 + -DDALI_STYLE_DIR=0 + -DDALI_STYLE_IMAGE_DIR=0 + -DDALI_DATA_READ_ONLY_DIR=0 ) +ENDIF() + IF( ENABLE_TRACE ) ADD_DEFINITIONS("-DTRACE_ENABLED") ENDIF() diff --git a/dali-toolkit/devel-api/asset-manager/asset-manager.cpp b/dali-toolkit/devel-api/asset-manager/asset-manager.cpp new file mode 100644 index 0000000..b5c8662 --- /dev/null +++ b/dali-toolkit/devel-api/asset-manager/asset-manager.cpp @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2020 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// CLASS HEADER +#include + +// EXTERNAL INCLUDES +#include + +namespace +{ + +#define TOKEN_STRING(x) #x + +} // unnamed namespace + +namespace Dali +{ + +namespace Toolkit +{ + +const std::string AssetManager::GetDaliImagePath() +{ + return (nullptr == DALI_IMAGE_DIR) ? EnvironmentVariable::GetEnvironmentVariable(TOKEN_STRING(DALI_IMAGE_DIR)) : DALI_IMAGE_DIR; +} + +const std::string AssetManager::GetDaliSoundPath() +{ + return (nullptr == DALI_SOUND_DIR) ? EnvironmentVariable::GetEnvironmentVariable(TOKEN_STRING(DALI_SOUND_DIR)) : DALI_SOUND_DIR; +} + +const std::string AssetManager::GetDaliStylePath() +{ + return (nullptr == DALI_STYLE_DIR) ? EnvironmentVariable::GetEnvironmentVariable(TOKEN_STRING(DALI_STYLE_DIR)) : DALI_STYLE_DIR; +} + +const std::string AssetManager::GetDaliStyleImagePath() +{ + return (nullptr == DALI_STYLE_IMAGE_DIR) ? EnvironmentVariable::GetEnvironmentVariable(TOKEN_STRING(DALI_STYLE_IMAGE_DIR)) : DALI_STYLE_IMAGE_DIR; +} + +const std::string AssetManager::GetDaliDataReadOnlyPath() +{ + return (nullptr == DALI_DATA_READ_ONLY_DIR) ? EnvironmentVariable::GetEnvironmentVariable(TOKEN_STRING(DALI_DATA_READ_ONLY_DIR)) : DALI_DATA_READ_ONLY_DIR; +} + +} // Toolkit + +} // Dali diff --git a/dali-toolkit/devel-api/asset-manager/asset-manager.h b/dali-toolkit/devel-api/asset-manager/asset-manager.h new file mode 100644 index 0000000..aa6f2d6 --- /dev/null +++ b/dali-toolkit/devel-api/asset-manager/asset-manager.h @@ -0,0 +1,48 @@ +#ifndef DALI_TOOLKIT_ASSET_MANAGER_DEVEL_H +#define DALI_TOOLKIT_ASSET_MANAGER_DEVEL_H + +/* + * Copyright (c) 2020 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES + +namespace Dali +{ + +namespace Toolkit +{ + +class AssetManager +{ +public: + static const std::string GetDaliImagePath(); + static const std::string GetDaliSoundPath(); + static const std::string GetDaliStylePath(); + static const std::string GetDaliStyleImagePath(); + static const std::string GetDaliDataReadOnlyPath(); +}; + +} // Toolkit + +} // Dali + + +#endif // DALI_TOOLKIT_ASSET_MANAGER_DEVEL_H + diff --git a/dali-toolkit/devel-api/file.list b/dali-toolkit/devel-api/file.list index 77d3d5e..219fb28 100755 --- a/dali-toolkit/devel-api/file.list +++ b/dali-toolkit/devel-api/file.list @@ -3,6 +3,7 @@ SET( devel_api_src_dir ${ROOT_SRC_DIR}/dali-toolkit/devel-api ) # Add local source files here SET( devel_api_src_files + ${devel_api_src_dir}/asset-manager/asset-manager.cpp ${devel_api_src_dir}/builder/base64-encoding.cpp ${devel_api_src_dir}/builder/builder.cpp ${devel_api_src_dir}/builder/json-parser.cpp diff --git a/dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.cpp b/dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.cpp index 9eeab0e..7f69861 100644 --- a/dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.cpp +++ b/dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.cpp @@ -29,6 +29,7 @@ #include // INTERNAL INCLUDES +#include #include #include #include @@ -58,10 +59,10 @@ Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_FOC const char* const ACTOR_FOCUSABLE("focusable"); const char* const IS_FOCUS_GROUP("isFocusGroup"); -const char* FOCUS_BORDER_IMAGE_PATH = DALI_IMAGE_DIR "B16-8_TTS_focus.9.png"; +const char* FOCUS_BORDER_IMAGE_FILE_NAME = "B16-8_TTS_focus.9.png"; -const char* FOCUS_SOUND_FILE = DALI_SOUND_DIR "Focus.ogg"; -const char* FOCUS_CHAIN_END_SOUND_FILE = DALI_SOUND_DIR "End_of_List.ogg"; +const char* FOCUS_SOUND_FILE_NAME = "Focus.ogg"; +const char* FOCUS_CHAIN_END_SOUND_FILE_NAME = "End_of_List.ogg"; /** * The function to be used in the hit-test algorithm to check whether the actor is hittable. @@ -112,6 +113,8 @@ AccessibilityManager::AccessibilityManager() mFocusIndicatorActor(), mPreviousPosition( 0.0f, 0.0f ), mRecursiveFocusMoveCounter(0), + mFocusSoundFilePath(), + mFocusChainEndSoundFilePath(), mIsWrapped(false), mIsFocusWithinGroup(false), mIsEndcapFeedbackEnabled(false), @@ -119,7 +122,9 @@ AccessibilityManager::AccessibilityManager() mIsAccessibilityTtsEnabled(false), mTtsCreated(false), mIsFocusIndicatorEnabled(false), - mContinuousPlayMode(false) + mContinuousPlayMode(false), + mIsFocusSoundFilePathSet(false), + mIsFocusChainEndSoundFilePathSet(false) { } @@ -357,7 +362,13 @@ bool AccessibilityManager::DoSetCurrentFocusActor(const unsigned int actorID) Dali::SoundPlayer soundPlayer = Dali::SoundPlayer::Get(); if(soundPlayer) { - soundPlayer.PlaySound(FOCUS_SOUND_FILE); + if (!mIsFocusSoundFilePathSet) + { + const std::string soundDirPath = AssetManager::GetDaliSoundPath(); + mFocusSoundFilePath = soundDirPath + FOCUS_SOUND_FILE_NAME; + mIsFocusSoundFilePathSet = true; + } + soundPlayer.PlaySound(mFocusSoundFilePath); } // Play the accessibility attributes with the TTS player. @@ -595,7 +606,10 @@ Actor AccessibilityManager::GetFocusIndicatorActor() if( ! mFocusIndicatorActor ) { // Create the default if it hasn't been set and one that's shared by all the keyboard focusable actors - mFocusIndicatorActor = Toolkit::ImageView::New( FOCUS_BORDER_IMAGE_PATH ); + const std::string imageDirPath = AssetManager::GetDaliImagePath(); + const std::string focusBorderImagePath = imageDirPath + FOCUS_BORDER_IMAGE_FILE_NAME; + + mFocusIndicatorActor = Toolkit::ImageView::New(focusBorderImagePath); mFocusIndicatorActor.SetParentOrigin( ParentOrigin::CENTER ); mFocusIndicatorActor.SetZ( 1.0f ); @@ -622,7 +636,13 @@ bool AccessibilityManager::DoMoveFocus(FocusIDIter focusIDIter, bool forward, bo Dali::SoundPlayer soundPlayer = Dali::SoundPlayer::Get(); if(soundPlayer) { - soundPlayer.PlaySound(FOCUS_CHAIN_END_SOUND_FILE); + if (!mIsFocusChainEndSoundFilePathSet) + { + const std::string soundDirPath = AssetManager::GetDaliSoundPath(); + mFocusChainEndSoundFilePath = soundDirPath + FOCUS_CHAIN_END_SOUND_FILE_NAME; + mIsFocusChainEndSoundFilePathSet = true; + } + soundPlayer.PlaySound(mFocusChainEndSoundFilePath); } mIsEndcapFeedbackPlayed = true; diff --git a/dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.h b/dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.h index d51d753..5c518fd 100644 --- a/dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.h +++ b/dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.h @@ -729,6 +729,8 @@ private: Actor mFocusIndicatorActor; ///< The focus indicator actor shared by all the focusable actors for highlight Vector2 mPreviousPosition; ///< The previous pan position; useful for calculating velocity for Gesture::Finished events unsigned int mRecursiveFocusMoveCounter; ///< The counter to count the number of recursive focus movement attempted before the focus movement is successful. + std::string mFocusSoundFilePath; ///< The path of the focus sound file + std::string mFocusChainEndSoundFilePath; ///< The path of the focus chain end sound file bool mIsWrapped:1; ///< Whether the focus movement is wrapped around or not bool mIsFocusWithinGroup:1; ///< Whether the focus movement is limited to the current focus group or not @@ -738,6 +740,8 @@ private: bool mTtsCreated:1; ///< Whether the TTS Player has been accessed bool mIsFocusIndicatorEnabled:1; ///< Whether indicator should be shown / hidden. It could be enabled when TTS enabled or 'Tab' key operated. bool mContinuousPlayMode:1; ///< Keeps track of whether or not we are in continuous play mode + bool mIsFocusSoundFilePathSet:1; ///< Whether the path of the focus sound file has been set + bool mIsFocusChainEndSoundFilePathSet:1; ///< Whether the path of the focus chain end sound file has been set }; diff --git a/dali-toolkit/internal/builder/builder-impl.cpp b/dali-toolkit/internal/builder/builder-impl.cpp index 78000be..5165a09 100644 --- a/dali-toolkit/internal/builder/builder-impl.cpp +++ b/dali-toolkit/internal/builder/builder-impl.cpp @@ -35,6 +35,7 @@ // INTERNAL INCLUDES #include +#include #include #include @@ -155,10 +156,10 @@ Builder::Builder() mParser = Dali::Toolkit::JsonParser::New(); Property::Map defaultDirs; - defaultDirs[ TOKEN_STRING(DALI_IMAGE_DIR) ] = DALI_IMAGE_DIR; - defaultDirs[ TOKEN_STRING(DALI_SOUND_DIR) ] = DALI_SOUND_DIR; - defaultDirs[ TOKEN_STRING(DALI_STYLE_DIR) ] = DALI_STYLE_DIR; - defaultDirs[ TOKEN_STRING(DALI_STYLE_IMAGE_DIR) ] = DALI_STYLE_IMAGE_DIR; + defaultDirs[TOKEN_STRING(DALI_IMAGE_DIR)] = AssetManager::GetDaliImagePath(); + defaultDirs[TOKEN_STRING(DALI_SOUND_DIR)] = AssetManager::GetDaliSoundPath(); + defaultDirs[TOKEN_STRING(DALI_STYLE_DIR)] = AssetManager::GetDaliStylePath(); + defaultDirs[TOKEN_STRING(DALI_STYLE_IMAGE_DIR)] = AssetManager::GetDaliStyleImagePath(); AddConstants( defaultDirs ); } diff --git a/dali-toolkit/internal/controls/popup/popup-impl.cpp b/dali-toolkit/internal/controls/popup/popup-impl.cpp index cde648a..e11c89f 100644 --- a/dali-toolkit/internal/controls/popup/popup-impl.cpp +++ b/dali-toolkit/internal/controls/popup/popup-impl.cpp @@ -34,6 +34,7 @@ #include // INTERNAL INCLUDES +#include #include #include #include @@ -177,29 +178,29 @@ const Scripting::StringEnum ContextualModeTable[] = { }; const unsigned int ContextualModeTableCount = sizeof( ContextualModeTable ) / sizeof( ContextualModeTable[0] ); // Popup defaults. -const Vector3 DEFAULT_POPUP_PARENT_RELATIVE_SIZE( 0.75f, 1.0f, 1.0f ); ///< Default size percentage of parent. -const float DEFAULT_POPUP_ANIMATION_DURATION = 0.6f; ///< Duration of hide/show animations. -const float POPUP_OUT_MARGIN_WIDTH = 16.f; ///< Space between the screen edge and the popup edge in the horizontal dimension. -const float POPUP_OUT_MARGIN_HEIGHT = 36.f; ///< Space between the screen edge and the popup edge in the vertical dimension. -const Vector3 DEFAULT_TAIL_POSITION( 0.5f, 1.0f, 0.0f ); ///< Position the tail will be displayed when enabled without setting the position. +const Vector3 DEFAULT_POPUP_PARENT_RELATIVE_SIZE( 0.75f, 1.0f, 1.0f ); ///< Default size percentage of parent. +const float DEFAULT_POPUP_ANIMATION_DURATION = 0.6f; ///< Duration of hide/show animations. +const float POPUP_OUT_MARGIN_WIDTH = 16.f; ///< Space between the screen edge and the popup edge in the horizontal dimension. +const float POPUP_OUT_MARGIN_HEIGHT = 36.f; ///< Space between the screen edge and the popup edge in the vertical dimension. +const Vector3 DEFAULT_TAIL_POSITION( 0.5f, 1.0f, 0.0f ); ///< Position the tail will be displayed when enabled without setting the position. // Contextual defaults. -const Vector2 DEFAULT_CONTEXTUAL_ADJACENCY_MARGIN( 10.0f, 10.0f ); ///< How close the Popup will be to it's contextual parent. -const Vector2 DEFAULT_CONTEXTUAL_STAGE_BORDER( 15.0f, 15.0f ); ///< How close the Popup can be to the stage edges. +const Vector2 DEFAULT_CONTEXTUAL_ADJACENCY_MARGIN( 10.0f, 10.0f ); ///< How close the Popup will be to it's contextual parent. +const Vector2 DEFAULT_CONTEXTUAL_STAGE_BORDER( 15.0f, 15.0f ); ///< How close the Popup can be to the stage edges. // Popup style defaults. -const char* DEFAULT_BACKGROUND_IMAGE_PATH = DALI_IMAGE_DIR "00_popup_bg.9.png"; ///< Background image. -const char* DEFAULT_TAIL_UP_IMAGE_PATH = DALI_IMAGE_DIR "popup_tail_up.png"; ///< Tail up image. -const char* DEFAULT_TAIL_DOWN_IMAGE_PATH = DALI_IMAGE_DIR "popup_tail_down.png"; ///< Tail down image. -const char* DEFAULT_TAIL_LEFT_IMAGE_PATH = DALI_IMAGE_DIR "popup_tail_left.png"; ///< Tail left image. -const char* DEFAULT_TAIL_RIGHT_IMAGE_PATH = DALI_IMAGE_DIR "popup_tail_right.png"; ///< Tail right image. - -const Vector4 DEFAULT_BACKING_COLOR( 0.0f, 0.0f, 0.0f, 0.5f ); ///< Color of the dimmed backing. -const Rect DEFAULT_BACKGROUND_BORDER( 17, 17, 13, 13 ); ///< Default border of the background. -const Rect DEFAULT_TITLE_PADDING( 20.0f, 20.0f, 20.0f, 20.0f ); ///< Title padding used on popups with content and/or controls (from Tizen GUI UX). -const Rect DEFAULT_TITLE_ONLY_PADDING( 8.0f, 8.0f, 8.0f, 8.0f ); ///< Title padding used on popups with a title only (like toast popups). -const Vector3 FOOTER_SIZE( 620.0f, 96.0f,0.0f ); ///< Default size of the bottom control area. -const float DEFAULT_RELATIVE_PARENT_WIDTH = 0.75f; ///< If width is not fixed, relative size to parent is used by default. +const char* DEFAULT_BACKGROUND_IMAGE_FILE_NAME = "00_popup_bg.9.png"; ///< Background image. +const char* DEFAULT_TAIL_UP_IMAGE_FILE_NAME = "popup_tail_up.png"; ///< Tail up image. +const char* DEFAULT_TAIL_DOWN_IMAGE_FILE_NAME = "popup_tail_down.png"; ///< Tail down image. +const char* DEFAULT_TAIL_LEFT_IMAGE_FILE_NAME = "popup_tail_left.png"; ///< Tail left image. +const char* DEFAULT_TAIL_RIGHT_IMAGE_FILE_NAME = "popup_tail_right.png"; ///< Tail right image. + +const Vector4 DEFAULT_BACKING_COLOR( 0.0f, 0.0f, 0.0f, 0.5f ); ///< Color of the dimmed backing. +const Rect DEFAULT_BACKGROUND_BORDER( 17, 17, 13, 13 ); ///< Default border of the background. +const Rect DEFAULT_TITLE_PADDING( 20.0f, 20.0f, 20.0f, 20.0f ); ///< Title padding used on popups with content and/or controls (from Tizen GUI UX). +const Rect DEFAULT_TITLE_ONLY_PADDING( 8.0f, 8.0f, 8.0f, 8.0f ); ///< Title padding used on popups with a title only (like toast popups). +const Vector3 FOOTER_SIZE( 620.0f, 96.0f,0.0f ); ///< Default size of the bottom control area. +const float DEFAULT_RELATIVE_PARENT_WIDTH = 0.75f; ///< If width is not fixed, relative size to parent is used by default. } // Unnamed namespace @@ -257,12 +258,18 @@ Popup::Popup() mPopupBackgroundImage(), mBackgroundBorder( DEFAULT_BACKGROUND_BORDER ), mMargin(), - mTailUpImage( DEFAULT_TAIL_UP_IMAGE_PATH ), - mTailDownImage( DEFAULT_TAIL_DOWN_IMAGE_PATH ), - mTailLeftImage( DEFAULT_TAIL_LEFT_IMAGE_PATH ), - mTailRightImage( DEFAULT_TAIL_RIGHT_IMAGE_PATH ) + mTailUpImage(), + mTailDownImage(), + mTailLeftImage(), + mTailRightImage() { SetKeyboardNavigationSupport( true ); + + const std::string imageDirPath = AssetManager::GetDaliImagePath(); + mTailUpImage = imageDirPath + DEFAULT_TAIL_UP_IMAGE_FILE_NAME; + mTailDownImage = imageDirPath + DEFAULT_TAIL_DOWN_IMAGE_FILE_NAME; + mTailLeftImage = imageDirPath + DEFAULT_TAIL_LEFT_IMAGE_FILE_NAME; + mTailRightImage = imageDirPath + DEFAULT_TAIL_RIGHT_IMAGE_FILE_NAME; } void Popup::OnInitialize() @@ -308,7 +315,8 @@ void Popup::OnInitialize() mPopupLayout = Toolkit::TableView::New( 3, 1 ); // Adds the default background image. - SetPopupBackgroundImage( Toolkit::ImageView::New( DEFAULT_BACKGROUND_IMAGE_PATH ) ); + const std::string imageDirPath = AssetManager::GetDaliImagePath(); + SetPopupBackgroundImage( Toolkit::ImageView::New( imageDirPath + DEFAULT_BACKGROUND_IMAGE_FILE_NAME ) ); mPopupLayout.SetName( "popupLayoutTable" ); mPopupLayout.SetParentOrigin( ParentOrigin::CENTER ); diff --git a/dali-toolkit/internal/controls/scene3d-view/scene3d-view-impl.cpp b/dali-toolkit/internal/controls/scene3d-view/scene3d-view-impl.cpp index 2f7bd6b..990aedf 100644 --- a/dali-toolkit/internal/controls/scene3d-view/scene3d-view-impl.cpp +++ b/dali-toolkit/internal/controls/scene3d-view/scene3d-view-impl.cpp @@ -21,6 +21,9 @@ // EXTERNAL INCLUDES #include +// INTERNAL INCLUDES +#include + namespace Dali { @@ -33,6 +36,8 @@ namespace Internal namespace { +const char* const IMAGE_BRDF_FILE_NAME = "brdfLUT.png"; + // glTF file extension const std::string GLTF_EXT( ".gltf" ); @@ -208,7 +213,8 @@ void Scene3dView::SetCubeMap( const std::string& diffuseTexturePath, const std:: mLightType = Toolkit::Scene3dView::LightType::IMAGE_BASED_LIGHT; // BRDF texture - std::string imageBrdfUrl = DALI_IMAGE_DIR "brdfLUT.png"; + const std::string imageDirPath = AssetManager::GetDaliImagePath(); + const std::string imageBrdfUrl = imageDirPath + IMAGE_BRDF_FILE_NAME; mBRDFTexture = LoadTexture( imageBrdfUrl.c_str(), true ); if( !mBRDFTexture ) { diff --git a/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp b/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp index cd8438e..6b842fe 100755 --- a/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp +++ b/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp @@ -30,6 +30,7 @@ #include // INTERNAL INCLUDES +#include #include #include @@ -38,7 +39,7 @@ using namespace Dali; namespace { -const char* DEFAULT_INDICATOR_IMAGE_PATH = DALI_IMAGE_DIR "popup_scroll.9.png"; +const char* DEFAULT_INDICATOR_IMAGE_FILE_NAME = "popup_scroll.9.png"; const float DEFAULT_SLIDER_DEPTH(1.0f); const float DEFAULT_INDICATOR_SHOW_DURATION(0.5f); const float DEFAULT_INDICATOR_HIDE_DURATION(0.5f); @@ -240,7 +241,8 @@ void ScrollBar::SetScrollPropertySource( Handle handle, Property::Index property void ScrollBar::CreateDefaultIndicatorActor() { - Toolkit::ImageView indicator = Toolkit::ImageView::New( DEFAULT_INDICATOR_IMAGE_PATH ); + const std::string imageDirPath = AssetManager::GetDaliImagePath(); + Toolkit::ImageView indicator = Toolkit::ImageView::New( imageDirPath + DEFAULT_INDICATOR_IMAGE_FILE_NAME ); indicator.SetParentOrigin( ParentOrigin::TOP_LEFT ); indicator.SetAnchorPoint( AnchorPoint::TOP_LEFT ); indicator.SetStyleName( "ScrollBarIndicator" ); diff --git a/dali-toolkit/internal/controls/slider/slider-impl.cpp b/dali-toolkit/internal/controls/slider/slider-impl.cpp index 275995d..419d222 100755 --- a/dali-toolkit/internal/controls/slider/slider-impl.cpp +++ b/dali-toolkit/internal/controls/slider/slider-impl.cpp @@ -25,9 +25,10 @@ #include #include #include -#include // INTERNAL INCLUDES +#include +#include #include #include @@ -87,11 +88,11 @@ const float DEFAULT_HIT_HEIGHT = 72.0f; const float DEFAULT_HANDLE_HEIGHT = DEFAULT_HIT_HEIGHT; const float POPUP_TEXT_PADDING = 10.0f; -const char* SKINNED_TRACK_VISUAL = DALI_IMAGE_DIR "slider-skin.9.png"; -const char* SKINNED_HANDLE_VISUAL = DALI_IMAGE_DIR "slider-skin-handle.png"; -const char* SKINNED_PROGRESS_VISUAL = DALI_IMAGE_DIR "slider-skin-progress.9.png"; -const char* SKINNED_POPUP_VISUAL = DALI_IMAGE_DIR "slider-popup.9.png"; -const char* SKINNED_POPUP_ARROW_VISUAL = DALI_IMAGE_DIR "slider-popup-arrow.png"; +const char* SKINNED_TRACK_VISUAL_FILE_NAME = "slider-skin.9.png"; +const char* SKINNED_HANDLE_VISUAL_FILE_NAME = "slider-skin-handle.png"; +const char* SKINNED_PROGRESS_VISUAL_FILE_NAME = "slider-skin-progress.9.png"; +const char* SKINNED_POPUP_VISUAL_FILE_NAME = "slider-popup.9.png"; +const char* SKINNED_POPUP_ARROW_VISUAL_FILE_NAME = "slider-popup-arrow.png"; const Vector2 DEFAULT_HIT_REGION( DEFAULT_WIDTH, DEFAULT_HIT_HEIGHT ); const Vector2 DEFAULT_TRACK_REGION( DEFAULT_WIDTH, DEFAULT_HEIGHT ); @@ -176,11 +177,12 @@ void Slider::OnInitialize() SetTrackRegion( DEFAULT_TRACK_REGION ); SetHandleSize( DEFAULT_HANDLE_SIZE ); - SetTrackVisual( SKINNED_TRACK_VISUAL ); - SetHandleVisual( SKINNED_HANDLE_VISUAL ); - SetProgressVisual( SKINNED_PROGRESS_VISUAL ); - SetPopupVisual( SKINNED_POPUP_VISUAL ); - SetPopupArrowVisual( SKINNED_POPUP_ARROW_VISUAL ); + const std::string imageDirPath = AssetManager::GetDaliImagePath(); + SetTrackVisual( imageDirPath + SKINNED_TRACK_VISUAL_FILE_NAME ); + SetHandleVisual( imageDirPath + SKINNED_HANDLE_VISUAL_FILE_NAME ); + SetProgressVisual( imageDirPath + SKINNED_PROGRESS_VISUAL_FILE_NAME ); + SetPopupVisual( imageDirPath + SKINNED_POPUP_VISUAL_FILE_NAME ); + SetPopupArrowVisual( imageDirPath + SKINNED_POPUP_ARROW_VISUAL_FILE_NAME ); SetShowPopup( DEFAULT_SHOW_POPUP ); SetShowValue( DEFAULT_SHOW_VALUE ); diff --git a/dali-toolkit/internal/feedback/feedback-style.cpp b/dali-toolkit/internal/feedback/feedback-style.cpp index 4375a29..08d5d46 100644 --- a/dali-toolkit/internal/feedback/feedback-style.cpp +++ b/dali-toolkit/internal/feedback/feedback-style.cpp @@ -26,11 +26,10 @@ #include // INTERNAL INCLUDES +#include #include #include -using std::string; - namespace // unnamed namespace { @@ -38,7 +37,7 @@ namespace // unnamed namespace Debug::Filter* gLogFilter = Debug::Filter::New(Debug::General, false, "LOG_FEEDBACK"); #endif -const char* DEFAULT_FEEDBACK_THEME_PATH = DALI_STYLE_DIR"default-feedback-theme.json"; +const char* DEFAULT_FEEDBACK_THEME_FILE_NAME = "default-feedback-theme.json"; // Sets bool and string if the node has a child "name" void GetIfString(const Dali::Toolkit::TreeNode& node, const std::string& name, bool& exists, std::string& str) @@ -76,11 +75,11 @@ struct SignalFeedbackInfo bool mHasHapticFeedbackInfo; bool mHasSoundFeedbackInfo; - string mSignalName; - string mHapticFeedbackPattern; - string mSoundFeedbackPattern; - string mHapticFeedbackFile; - string mSoundFeedbackFile; + std::string mSignalName; + std::string mHapticFeedbackPattern; + std::string mSoundFeedbackPattern; + std::string mHapticFeedbackFile; + std::string mSoundFeedbackFile; }; typedef std::vector SignalFeedbackInfoContainer; @@ -95,7 +94,7 @@ struct FeedbackStyleInfo { } - string mTypeName; + std::string mTypeName; SignalFeedbackInfoContainer mSignalFeedbackInfoList; }; @@ -106,17 +105,20 @@ FeedbackStyle::FeedbackStyle() { mFeedback = Dali::FeedbackPlayer::Get(); - string defaultTheme; + const std::string styleDirPath = AssetManager::GetDaliStylePath(); + const std::string defaultThemeFilePath = styleDirPath + DEFAULT_FEEDBACK_THEME_FILE_NAME; + + std::string defaultTheme; - if( mFeedback && mFeedback.LoadFile( DEFAULT_FEEDBACK_THEME_PATH, defaultTheme ) ) + if( mFeedback && mFeedback.LoadFile( defaultThemeFilePath, defaultTheme ) ) { LoadTheme( defaultTheme ); DALI_LOG_INFO( gLogFilter, Debug::Verbose, "ResourceLoader::LoadTheme(%s) - loaded %d bytes\n", - DEFAULT_FEEDBACK_THEME_PATH, defaultTheme.size() ); + defaultThemeFilePath.c_str(), defaultTheme.size() ); } else { - DALI_LOG_ERROR("ResourceLoader::LoadTheme(%s) - failed to load\n", DEFAULT_FEEDBACK_THEME_PATH); + DALI_LOG_ERROR("ResourceLoader::LoadTheme(%s) - failed to load\n", defaultThemeFilePath.c_str()); } } @@ -127,7 +129,7 @@ FeedbackStyle::~FeedbackStyle() struct PlayFeedbackFromSignal { - PlayFeedbackFromSignal( FeedbackStyle& controller, const string& typeName, const string& signalName ) + PlayFeedbackFromSignal( FeedbackStyle& controller, const std::string& typeName, const std::string& signalName ) : mController( controller ), mTypeName( typeName ), mSignalName( signalName ) @@ -140,18 +142,16 @@ struct PlayFeedbackFromSignal } FeedbackStyle& mController; - string mTypeName; - string mSignalName; + std::string mTypeName; + std::string mSignalName; }; void FeedbackStyle::ObjectCreated( BaseHandle handle ) { - std::string typeName = handle.GetTypeName(); - if( handle ) { - string type = handle.GetTypeName(); + const std::string& type = handle.GetTypeName(); const FeedbackStyleInfo styleInfo = GetStyleInfo( type ); @@ -180,9 +180,9 @@ void FeedbackStyle::ObjectCreated( BaseHandle handle ) } } -const FeedbackStyleInfo& FeedbackStyle::GetStyleInfo( const string& type ) const +const FeedbackStyleInfo& FeedbackStyle::GetStyleInfo( const std::string& type ) const { - std::map::const_iterator iter( mStyleInfoLut.find( type ) ); + std::map::const_iterator iter( mStyleInfoLut.find( type ) ); if( iter != mStyleInfoLut.end() ) { return iter->second; @@ -197,7 +197,7 @@ void FeedbackStyle::StyleChanged( const std::string& userDefinedThemePath, Dali: { if( styleChange == StyleChange::THEME_CHANGE ) { - string userDefinedTheme; + std::string userDefinedTheme; if( mFeedback && mFeedback.LoadFile( userDefinedThemePath, userDefinedTheme ) ) { @@ -205,8 +205,11 @@ void FeedbackStyle::StyleChanged( const std::string& userDefinedThemePath, Dali: { DALI_LOG_ERROR("FeedbackStyle::StyleChanged() User defined theme failed to load! \n"); + const std::string styleDirPath = AssetManager::GetDaliStylePath(); + const std::string defaultThemeFilePath = styleDirPath + DEFAULT_FEEDBACK_THEME_FILE_NAME; + //If there is any problem is using the user defined theme, then fall back to default theme - if( !LoadTheme( DEFAULT_FEEDBACK_THEME_PATH ) ) + if( !LoadTheme( defaultThemeFilePath ) ) { //If the default theme fails, Then No luck! DALI_LOG_ERROR("FeedbackStyle::StyleChanged() Default theme failed to load! \n"); @@ -225,7 +228,7 @@ void FeedbackStyle::StyleChanged( const std::string& userDefinedThemePath, Dali: } } -bool FeedbackStyle::LoadTheme( const string& data ) +bool FeedbackStyle::LoadTheme( const std::string& data ) { bool result = false; @@ -244,7 +247,7 @@ bool FeedbackStyle::LoadTheme( const string& data ) return result; } -void FeedbackStyle::LoadFromString( const string& data ) +void FeedbackStyle::LoadFromString( const std::string& data ) { Toolkit::JsonParser parser = Toolkit::JsonParser::New(); const Toolkit::TreeNode* root = NULL; @@ -348,7 +351,7 @@ void FeedbackStyle::AddSignalInfo( FeedbackStyleInfo& styleInfo, SignalFeedbackI } } -void FeedbackStyle::PlayFeedback(const string& type, const string& signalName) +void FeedbackStyle::PlayFeedback(const std::string& type, const std::string& signalName) { const FeedbackStyleInfo styleInfo = GetStyleInfo(type); SignalFeedbackInfoConstIter iter; @@ -394,7 +397,7 @@ void FeedbackStyle::PlayFeedback(const string& type, const string& signalName) } } -FeedbackPattern FeedbackStyle::GetFeedbackPattern( const string &pattern ) +FeedbackPattern FeedbackStyle::GetFeedbackPattern( const std::string &pattern ) { if( 0 == mFeedbackPatternLut.size() ) { @@ -450,7 +453,7 @@ FeedbackPattern FeedbackStyle::GetFeedbackPattern( const string &pattern ) mFeedbackPatternLut["FEEDBACK_PATTERN_SLIDER_SWEEP"] = Dali::FEEDBACK_PATTERN_SLIDER_SWEEP; } - std::map::const_iterator iter( mFeedbackPatternLut.find( pattern ) ); + std::map::const_iterator iter( mFeedbackPatternLut.find( pattern ) ); if( iter != mFeedbackPatternLut.end() ) { diff --git a/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp b/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp index c0fffa0..691f9ab 100644 --- a/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp +++ b/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp @@ -37,6 +37,7 @@ #include // INTERNAL INCLUDES +#include #include #include #include @@ -63,7 +64,7 @@ Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_KEY const char* const IS_FOCUS_GROUP_PROPERTY_NAME = "isKeyboardFocusGroup"; // This property will be replaced by a flag in Control. -const char* const FOCUS_BORDER_IMAGE_PATH = DALI_IMAGE_DIR "keyboard_focus.9.png"; +const char* const FOCUS_BORDER_IMAGE_FILE_NAME = "keyboard_focus.9.png"; BaseHandle Create() { @@ -731,7 +732,8 @@ Actor KeyboardFocusManager::GetFocusIndicatorActor() if( ! mFocusIndicatorActor ) { // Create the default if it hasn't been set and one that's shared by all the keyboard focusable actors - mFocusIndicatorActor = Toolkit::ImageView::New( FOCUS_BORDER_IMAGE_PATH ); + const std::string imageDirPath = AssetManager::GetDaliImagePath(); + mFocusIndicatorActor = Toolkit::ImageView::New( imageDirPath + FOCUS_BORDER_IMAGE_FILE_NAME ); // Apply size constraint to the focus indicator mFocusIndicatorActor.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); diff --git a/dali-toolkit/internal/styling/style-manager-impl.cpp b/dali-toolkit/internal/styling/style-manager-impl.cpp index 066d812..a5a02dd 100644 --- a/dali-toolkit/internal/styling/style-manager-impl.cpp +++ b/dali-toolkit/internal/styling/style-manager-impl.cpp @@ -25,6 +25,7 @@ #include // INTERNAL INCLUDES +#include #include #include #include @@ -38,12 +39,12 @@ namespace const char* PORTRAIT_QUALIFIER = "portrait"; const char* FONT_SIZE_QUALIFIER = "fontsize"; -const char* DEFAULT_THEME = DALI_STYLE_DIR "dali-toolkit-default-theme.json"; +const char* DEFAULT_THEME_FILE_NAME = "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/"; +const char* DEFAULT_TOOLKIT_PACKAGE_PATH = "/toolkit/"; #if defined(DEBUG_ENABLED) Debug::Filter* gLogFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_STYLE"); @@ -108,10 +109,12 @@ Toolkit::StyleManager StyleManager::Get() StyleManager::StyleManager() : mDefaultFontSize( -1 ), mDefaultFontFamily(""), - mFeedbackStyle( NULL ) + mDefaultThemeFilePath(), + mFeedbackStyle( nullptr ) { // Add theme builder constants - mThemeBuilderConstants[ PACKAGE_PATH_KEY ] = DEFAULT_PACKAGE_PATH; + const std::string dataReadOnlyDir = AssetManager::GetDaliDataReadOnlyPath(); + mThemeBuilderConstants[ PACKAGE_PATH_KEY ] = dataReadOnlyDir + DEFAULT_TOOLKIT_PACKAGE_PATH; mThemeBuilderConstants[ APPLICATION_RESOURCE_PATH_KEY ] = Application::GetResourcePath(); mStyleMonitor = StyleMonitor::Get(); @@ -121,6 +124,10 @@ StyleManager::StyleManager() mDefaultFontSize = mStyleMonitor.GetDefaultFontSize(); } + // Set the full path for the default style theme. + const std::string styleDirPath = AssetManager::GetDaliStylePath(); + mDefaultThemeFilePath = styleDirPath + DEFAULT_THEME_FILE_NAME; + // Sound & haptic style mFeedbackStyle = new FeedbackStyle(); } @@ -137,7 +144,7 @@ void StyleManager::ApplyTheme( const std::string& themeFile ) void StyleManager::ApplyDefaultTheme() { - SetTheme( DEFAULT_THEME ); + SetTheme(mDefaultThemeFilePath); } const std::string& StyleManager::GetDefaultFontFamily() const @@ -240,10 +247,10 @@ void StyleManager::SetTheme( const std::string& themeFile ) { loading = true; mThemeBuilder = CreateBuilder( mThemeBuilderConstants ); - themeLoaded = LoadJSON( mThemeBuilder, DEFAULT_THEME ); // Sets themeLoaded to true if theme exists + themeLoaded = LoadJSON( mThemeBuilder, mDefaultThemeFilePath ); // Sets themeLoaded to true if theme exists } - if( themeFile.compare(DEFAULT_THEME) != 0 ) + if( themeFile.compare(mDefaultThemeFilePath) != 0 ) { // The theme is different to the default: Merge it loading = true; @@ -291,8 +298,8 @@ const Property::Map StyleManager::GetConfigurations() mThemeBuilder = CreateBuilder( mThemeBuilderConstants ); // Load default theme because this is first try to load stylesheet. - themeLoaded = LoadJSON( mThemeBuilder, DEFAULT_THEME ); - mThemeFile = DEFAULT_THEME; + themeLoaded = LoadJSON( mThemeBuilder, mDefaultThemeFilePath ); + mThemeFile = mDefaultThemeFilePath; if( themeLoaded ) { diff --git a/dali-toolkit/internal/styling/style-manager-impl.h b/dali-toolkit/internal/styling/style-manager-impl.h index 7ca7535..7b3fd53 100644 --- a/dali-toolkit/internal/styling/style-manager-impl.h +++ b/dali-toolkit/internal/styling/style-manager-impl.h @@ -229,6 +229,7 @@ private: int mDefaultFontSize; ///< Logical size, not a point-size std::string mDefaultFontFamily; + std::string mDefaultThemeFilePath; ///< The full path of the default theme file std::string mThemeFile; ///< The full path of the current theme file Property::Map mThemeBuilderConstants; ///< Contants to give the theme builder diff --git a/dali-toolkit/internal/visuals/visual-factory-cache.cpp b/dali-toolkit/internal/visuals/visual-factory-cache.cpp index 594c12f..854a43a 100644 --- a/dali-toolkit/internal/visuals/visual-factory-cache.cpp +++ b/dali-toolkit/internal/visuals/visual-factory-cache.cpp @@ -26,12 +26,6 @@ #include #include - -namespace -{ -const char * const BROKEN_VISUAL_IMAGE_URL( DALI_IMAGE_DIR "broken.png"); -} - namespace Dali { diff --git a/dali-toolkit/internal/visuals/visual-factory-impl.cpp b/dali-toolkit/internal/visuals/visual-factory-impl.cpp index 73c0afc..dc35220 100644 --- a/dali-toolkit/internal/visuals/visual-factory-impl.cpp +++ b/dali-toolkit/internal/visuals/visual-factory-impl.cpp @@ -26,6 +26,7 @@ #include // INTERNAL INCLUDES +#include #include #include #include @@ -74,7 +75,7 @@ BaseHandle Create() DALI_TYPE_REGISTRATION_BEGIN_CREATE( Toolkit::VisualFactory, Dali::BaseHandle, Create, true ) DALI_TYPE_REGISTRATION_END() -const char * const BROKEN_IMAGE_URL( DALI_IMAGE_DIR "broken.png" ); ///< URL For the broken image +const char* const BROKEN_IMAGE_FILE_NAME = "broken.png"; ///< The file name of the broken image. } // namespace @@ -95,7 +96,8 @@ void VisualFactory::OnStyleChangedSignal( Toolkit::StyleManager styleManager, St { if( type == StyleChange::THEME_CHANGE ) { - std::string brokenImageUrl(BROKEN_IMAGE_URL); + const std::string imageDirPath = AssetManager::GetDaliImagePath(); + std::string brokenImageUrl = imageDirPath + BROKEN_IMAGE_FILE_NAME; Property::Map config = Toolkit::DevelStyleManager::GetConfigurations( styleManager ); config["brokenImageUrl"].Get( brokenImageUrl ); @@ -410,7 +412,9 @@ Internal::VisualFactoryCache& VisualFactory::GetFactoryCache() { mFactoryCache = std::unique_ptr( new VisualFactoryCache( mPreMultiplyOnLoad ) ); - std::string brokenImageUrl(BROKEN_IMAGE_URL); + const std::string imageDirPath = AssetManager::GetDaliImagePath(); + std::string brokenImageUrl = imageDirPath + BROKEN_IMAGE_FILE_NAME; + Toolkit::StyleManager styleManager = Toolkit::StyleManager::Get(); if( styleManager ) {