"Fossies" - the Fresh Open Source Software Archive

Member "ownCloud-2.7.6.3261/cmake/modules/OCGenerateTheme.cmake" (5 Feb 2021, 3089 Bytes) of package /linux/misc/ownCloud-2.7.6.3261.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) CMake source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "OCGenerateTheme.cmake": 2.7.5.3180_vs_2.7.6.3261.

    1 function(__addIcon THEME ICON_NAME)
    2     set(options)
    3     set(oneValueArgs SRC_PATH)
    4     set(multiValueArgs)
    5     cmake_parse_arguments(_ICON "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
    6 
    7     if(NOT _ICON_SRC_PATH)
    8         set(_ICON_SRC_PATH ${THEME})
    9     endif()
   10 
   11     set(icon "theme/${_ICON_SRC_PATH}/${ICON_NAME}.svg")
   12     set(iconAlias "theme/${THEME}/${ICON_NAME}.svg")
   13     if (EXISTS ${OEM_THEME_DIR}/${icon})
   14         file(APPEND "${QRC}" "<file alias=\"${iconAlias}\">${OEM_THEME_DIR}/${icon}</file>\n")
   15     else()
   16         set(icon "theme/${_ICON_SRC_PATH}/${ICON_NAME}.png")
   17         set(iconAlias "theme/${THEME}/${ICON_NAME}.png")
   18         if (EXISTS ${OEM_THEME_DIR}/${icon})
   19             file(APPEND "${QRC}" "<file alias=\"${iconAlias}\">${OEM_THEME_DIR}/${icon}</file>\n")
   20         else()
   21             set(SIZES "16;22;32;48;64;128;256;512;1024")
   22             foreach(size ${SIZES})
   23                 set(icon "theme/${_ICON_SRC_PATH}/${ICON_NAME}-${size}.png")
   24                 set(iconAlias "theme/${THEME}/${ICON_NAME}-${size}.png")
   25                 if (EXISTS ${OEM_THEME_DIR}/${icon})
   26                     file(APPEND "${QRC}" "<file alias=\"${iconAlias}\">${OEM_THEME_DIR}/${icon}</file>\n")
   27                 endif()
   28             endforeach()
   29         endif()
   30     endif()
   31 endfunction()
   32 
   33 function(generate_theme TARGET OWNCLOUD_SIDEBAR_ICONS_OUT)
   34     if(NOT "${OEM_THEME_DIR}" STREQUAL "${PROJECT_SOURCE_DIR}")
   35         set(QRC ${CMAKE_BINARY_DIR}/theme.qrc)
   36         file(WRITE "${QRC}" "<RCC>\n<qresource prefix=\"/client/${APPLICATION_SHORTNAME}\">\n")
   37         __addIcon("universal" "${APPLICATION_ICON_NAME}-icon" SRC_PATH "colored")
   38         __addIcon("universal" "wizard_logo" SRC_PATH "colored")
   39 
   40         set(STATES "ok;error;information;offline;pause;sync")
   41         set(THEMES "colored;dark;black;white")
   42         foreach(theme ${THEMES})
   43             foreach(state ${STATES})
   44                 __addIcon(${theme} "state-${state}")
   45             endforeach()
   46         endforeach()
   47         file(APPEND "${QRC}" "</qresource>\n</RCC>\n")
   48         target_sources(${TARGET} PRIVATE ${QRC})
   49         # add executable icon on windows and osx
   50         file(GLOB_RECURSE OWNCLOUD_SIDEBAR_ICONS "${OEM_THEME_DIR}/theme/colored/*-${APPLICATION_ICON_NAME}-sidebar.png")
   51     else()
   52         file(GLOB_RECURSE OWNCLOUD_SIDEBAR_ICONS "${OEM_THEME_DIR}/theme/colored/*-${APPLICATION_ICON_NAME}-icon-sidebar.png")
   53     endif()
   54     set(${OWNCLOUD_SIDEBAR_ICONS_OUT} ${OWNCLOUD_SIDEBAR_ICONS} PARENT_SCOPE)
   55 endfunction()
   56 
   57 
   58 function(generate_legacy_icons theme_dir OUT)
   59     # allow legacy file names
   60     file(GLOB_RECURSE OWNCLOUD_ICONS_OLD "${theme_dir}/colored/${APPLICATION_ICON_NAME}-icon-*.png")
   61     foreach(icon ${OWNCLOUD_ICONS_OLD})
   62         get_filename_component(icon_name ${icon} NAME)
   63         string(REGEX MATCH "([0-9]+)" size ${icon_name})
   64         set(out_name "${CMAKE_BINARY_DIR}/${size}-app-icon.png")
   65         configure_file(${icon} ${out_name} COPYONLY)
   66         list(APPEND OWNCLOUD_ICONS ${out_name})
   67     endforeach()
   68     set(${OUT} ${OWNCLOUD_ICONS} PARENT_SCOPE)
   69 endfunction()