summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-08-15 19:04:26 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2017-08-16 18:40:34 +0200
commitff2dc9445807ad930306f6ff386957fd8a38ad1d (patch)
treecc9b90817fbf3257e380ebd8e90a3757d1ee02a6
parent474a2e91501c5620e2eef651c8305f2ae7aacd19 (diff)
Better handling of icons
Use custom icon if needed or default one if none Change-Id: Ieaa096e3bf40f202e5204dbb48a977edc074d24b Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
-rw-r--r--cmake/cmake.d/02-macros.cmake20
-rw-r--r--samples.d/config.cmake.sample1
2 files changed, 16 insertions, 5 deletions
diff --git a/cmake/cmake.d/02-macros.cmake b/cmake/cmake.d/02-macros.cmake
index 3e4b919..aa7d33d 100644
--- a/cmake/cmake.d/02-macros.cmake
+++ b/cmake/cmake.d/02-macros.cmake
@@ -223,12 +223,22 @@ macro(wgt_package_build)
if(NOT EXISTS ${WIDGET_CONFIG_TEMPLATE})
MESSAGE(FATAL_ERROR "${Red}WARNING ! Missing mandatory files to build widget file.\nYou need a config.xml template: please specify WIDGET_CONFIG_TEMPLATE correctly.${ColourReset}")
endif()
- if(NOT EXISTS ${TEMPLATE_DIR}/icon-default.png)
- MESSAGE(FATAL_ERROR "${Red}WARNING ! Missing mandatory files to build widget file.\nYou need ${PROJECT_ICON} file in ${TEMPLATE_DIR} folder.${ColourReset}")
+ if(NOT WIDGET_TYPE)
+ MESSAGE(FATAL_ERROR "WIDGET_TYPE must be set in your config.cmake.\neg.: set(WIDGET_TYPE application/vnd.agl.service)")
+ endif()
+ if(NOT DEFINED PROJECT_ICON)
+ if( ${WIDGET_TYPE} MATCHES "agl.native")
+ set(PROJECT_ICON ${PKG_APP_TEMPLATE_DIR}/wgt/icon-native.png)
+ elseif( ${WIDGET_TYPE} MATCHES "agl.service")
+ set(PROJECT_ICON ${PKG_APP_TEMPLATE_DIR}/wgt/icon-service.png)
+ elseif( ${WIDGET_TYPE} MATCHES "x-executable")
+ set(PROJECT_ICON ${PKG_APP_TEMPLATE_DIR}/wgt/icon-qml.png)
+ elseif( ${WIDGET_TYPE} MATCHES "text/html")
+ set(PROJECT_ICON ${PKG_APP_TEMPLATE_DIR}/wgt/icon-html5.png)
+ else()
+ set(PROJECT_ICON ${PKG_APP_TEMPLATE_DIR}/wgt/icon-default.png)
+ endif()
endif()
- if(NOT WIDGET_TYPE)
- MESSAGE(FATAL_ERROR "WIDGET_TYPE must be set in your config.cmake.\neg.: set(WIDGET_TYPE application/vnd.agl.service)")
- endif()
if(NOT WIDGET_ENTRY_POINT)
set(WIDGET_ENTRY_POINT lib)
diff --git a/samples.d/config.cmake.sample b/samples.d/config.cmake.sample
index 8ca0349..c979181 100644
--- a/samples.d/config.cmake.sample
+++ b/samples.d/config.cmake.sample
@@ -105,6 +105,7 @@ set(LD_LIBRARY_PATH ${CMAKE_INSTALL_PREFIX}/lib64 ${CMAKE_INSTALL_PREFIX}/lib)
# Optional location for config.xml.in
# -----------------------------------
+set(WIDGET_ICON ${PROJECT_APP_TEMPLATES_DIR}/wgt/${PROJECT_ICON})
#set(WIDGET_CONFIG_TEMPLATE ${CMAKE_CURRENT_SOURCE_DIR}/conf.d/wgt/config.xml.in)
# Mandatory widget Mimetype specification of the main unit