/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * 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.
#include <dali/devel-api/scripting/scripting.h>
// INTERNAL INCLUDES
+#include <dali-toolkit/devel-api/asset-manager/asset-manager.h>
#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
#include <dali-toolkit/public-api/visuals/image-visual-properties.h>
#include <dali-toolkit/public-api/visuals/text-visual-properties.h>
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
{
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 );
Scripting::GetEnumerationName<Toolkit::DevelVisual::Type>( visualType,
VISUAL_TYPE_TABLE,
VISUAL_TYPE_TABLE_COUNT ),
- visualType==Toolkit::DevelVisual::IMAGE?"url:":"",
- visualType==Toolkit::DevelVisual::IMAGE ?
- propertyMap.Find( Toolkit::ImageVisual::Property::URL, IMAGE_URL_NAME)->Get<std::string>().c_str()
- :"" );
-
+ ( visualType == Toolkit::DevelVisual::IMAGE ) ? "url:" : "",
+ ( visualType == Toolkit::DevelVisual::IMAGE ) ?
+ ( ([&] (){
+ // Return URL if present in PropertyMap else return "not found message"
+ Property::Value* imageURLValue = propertyMap.Find( Toolkit::ImageVisual::Property::URL, IMAGE_URL_NAME );
+ return ( imageURLValue ) ? imageURLValue->Get<std::string>().c_str() : "url not found in PropertyMap";
+ })()
+ )
+ : "" );
if( !visualPtr )
{
{
mFactoryCache = std::unique_ptr<VisualFactoryCache>( 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 )
{