Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorHannah von Reth <hannah.vonreth@owncloud.com>2020-11-04 14:34:35 +0300
committerHannah von Reth <vonreth@kde.org>2020-11-04 19:21:52 +0300
commit09875801016842b9325274acf91d88946a8720d2 (patch)
tree964bbfd39c0594352c8dc60e53f1fe5a16b5c74a /cmake
parent0d1fa8177acc5b61ebd3bdc2555769226282891d (diff)
Generate theme qrc automatically, fall back to core icons
Diffstat (limited to 'cmake')
-rw-r--r--cmake/modules/OCGenerateTheme.cmake46
1 files changed, 46 insertions, 0 deletions
diff --git a/cmake/modules/OCGenerateTheme.cmake b/cmake/modules/OCGenerateTheme.cmake
new file mode 100644
index 000000000..158454edb
--- /dev/null
+++ b/cmake/modules/OCGenerateTheme.cmake
@@ -0,0 +1,46 @@
+function(__addIcon THEME ICON_NAME)
+ set(icon "theme/${THEME}/${ICON_NAME}.svg")
+ if (EXISTS ${OEM_THEME_DIR}/${icon})
+ file(APPEND "${QRC}" "<file alias=\"${icon}\">${OEM_THEME_DIR}/${icon}</file>\n")
+ else()
+ set(SIZES "16;22,32;48;64;128;256;512;1024")
+ foreach(size ${SIZES})
+ set(icon "theme/${THEME}/${ICON_NAME}-${size}.png")
+ if (EXISTS ${OEM_THEME_DIR}/${icon})
+ file(APPEND "${QRC}" "<file alias=\"${icon}\">${OEM_THEME_DIR}/${icon}</file>\n")
+ endif()
+ endforeach()
+ endif()
+endfunction()
+
+function(generate_theme TARGET)
+ if(NOT "${OEM_THEME_DIR}" STREQUAL "${PROJECT_SOURCE_DIR}")
+ set(QRC ${CMAKE_BINARY_DIR}/theme.qrc)
+ file(WRITE "${QRC}" "<RCC>\n<qresource prefix=\"/client\">\n")
+ __addIcon("colored" "${APPLICATION_SHORTNAME}-icon")
+
+ set(STATES "ok;error;information;offline;pause;sync")
+ set(THEMES "colored;dark;black;white")
+ foreach(theme ${THEMES})
+ foreach(state ${STATES})
+ __addIcon(${theme} "state-${state}")
+ endforeach()
+ endforeach()
+ file(APPEND "${QRC}" "</qresource>\n</RCC>\n")
+ target_sources(${TARGET} PRIVATE ${QRC})
+ endif()
+endfunction()
+
+
+function(generate_legacy_icons theme_dir OUT)
+ # allow legacy file names
+ file(GLOB_RECURSE OWNCLOUD_ICONS_OLD "${theme_dir}/colored/${APPLICATION_ICON_NAME}-icon-*.png")
+ foreach(icon ${OWNCLOUD_ICONS_OLD})
+ get_filename_component(icon_name ${icon} NAME)
+ string(REGEX MATCH "([0-9]+)" size ${icon_name})
+ set(out_name "${CMAKE_BINARY_DIR}/${size}-app-icon.png")
+ configure_file(${icon} ${out_name} COPYONLY)
+ list(APPEND OWNCLOUD_ICONS ${out_name})
+ endforeach()
+ set(${OUT} ${OWNCLOUD_ICONS} PARENT_SCOPE)
+endfunction()