Skip to content

Commit

Permalink
Merge pull request #4622 from nextcloud/feature/generate-state-icons-…
Browse files Browse the repository at this point in the history
…from-svg

Feature/generate state icons from svg
  • Loading branch information
allexzander authored Jun 10, 2022
2 parents 7566d03 + db9d83b commit d7217d1
Show file tree
Hide file tree
Showing 92 changed files with 27 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -187,4 +187,5 @@ convert.exe
*-icon-win-folder.png
*-sidebar.png
*-w10startmenu.png
*state-*.png
theme.qrc
29 changes: 26 additions & 3 deletions src/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ endif()

function(generate_sized_png_from_svg icon_path size)
set(options)
set(oneValueArgs OUTPUT_ICON_NAME OUTPUT_ICON_PATH)
set(oneValueArgs OUTPUT_ICON_NAME OUTPUT_ICON_FULL_NAME_WLE OUTPUT_ICON_PATH)
set(multiValueArgs)

cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
Expand All @@ -392,11 +392,17 @@ function(generate_sized_png_from_svg icon_path size)
set(icon_name_dir ${ARG_OUTPUT_ICON_PATH})
endif ()

if (EXISTS "${icon_name_dir}/${size}-${icon_name_wle}.png")
set(output_icon_full_name_wle "${size}-${icon_name_wle}")

if (ARG_OUTPUT_ICON_FULL_NAME_WLE)
set(output_icon_full_name_wle ${ARG_OUTPUT_ICON_FULL_NAME_WLE})
endif ()

if (EXISTS "${icon_name_dir}/${output_icon_full_name_wle}.png")
return()
endif()

set(icon_output_name "${size}-${icon_name_wle}.png")
set(icon_output_name "${output_icon_full_name_wle}.png")
message(STATUS "Generate ${icon_output_name}")
execute_process(COMMAND
"${SVG_CONVERTER}" -w ${size} -h ${size} "${icon_path}" -o "${icon_output_name}"
Expand All @@ -413,6 +419,23 @@ function(generate_sized_png_from_svg icon_path size)
endif()
endfunction()

set(STATE_ICONS_COLORS colored black white)

foreach(state_icons_color ${STATE_ICONS_COLORS})
set(STATE_ICONS_PATH "${theme_dir}/${state_icons_color}/")

message("Generating state icons from SVG in path: "${STATE_ICONS_PATH})

file(GLOB_RECURSE STATE_ICONS_SVG "${STATE_ICONS_PATH}/state-*.svg")

foreach(state_icon_svg ${STATE_ICONS_SVG})
get_filename_component(status_icon_name_wle ${state_icon_svg} NAME_WLE)
foreach(size IN ITEMS 16;32;64;128;256)
generate_sized_png_from_svg(${state_icon_svg} ${size} OUTPUT_ICON_FULL_NAME_WLE "${status_icon_name_wle}-${size}")
endforeach()
endforeach()
endforeach()

if ((APPLICATION_ICON_SET MATCHES "PNG")
AND
(NOT EXISTS "${theme_dir}/colored/${APPLICATION_ICON_NAME}-icon.svg"))
Expand Down
Binary file removed theme/black/state-error-128.png
Binary file not shown.
Binary file removed theme/black/state-error-16.png
Binary file not shown.
Binary file removed theme/black/state-error-256.png
Binary file not shown.
Binary file removed theme/black/state-error-32.png
Binary file not shown.
Binary file removed theme/black/state-error-64.png
Binary file not shown.
Binary file removed theme/black/state-offline-128.png
Binary file not shown.
Binary file removed theme/black/state-offline-16.png
Binary file not shown.
Binary file removed theme/black/state-offline-256.png
Binary file not shown.
Binary file removed theme/black/state-offline-32.png
Binary file not shown.
Binary file removed theme/black/state-offline-64.png
Binary file not shown.
Binary file removed theme/black/state-ok-128.png
Binary file not shown.
Binary file removed theme/black/state-ok-16.png
Binary file not shown.
Binary file removed theme/black/state-ok-256.png
Binary file not shown.
Binary file removed theme/black/state-ok-32.png
Binary file not shown.
Binary file removed theme/black/state-ok-64.png
Binary file not shown.
Binary file removed theme/black/state-pause-128.png
Binary file not shown.
Binary file removed theme/black/state-pause-16.png
Binary file not shown.
Binary file removed theme/black/state-pause-256.png
Binary file not shown.
Binary file removed theme/black/state-pause-32.png
Binary file not shown.
Binary file removed theme/black/state-pause-64.png
Binary file not shown.
Binary file removed theme/black/state-sync-128.png
Binary file not shown.
Binary file removed theme/black/state-sync-16.png
Binary file not shown.
Binary file removed theme/black/state-sync-256.png
Binary file not shown.
Binary file removed theme/black/state-sync-32.png
Binary file not shown.
Binary file removed theme/black/state-sync-64.png
Binary file not shown.
Binary file removed theme/black/state-warning-128.png
Diff not rendered.
Binary file removed theme/black/state-warning-16.png
Diff not rendered.
Binary file removed theme/black/state-warning-256.png
Diff not rendered.
Binary file removed theme/black/state-warning-32.png
Diff not rendered.
Binary file removed theme/black/state-warning-64.png
Diff not rendered.
Binary file removed theme/colored/state-error-128.png
Diff not rendered.
Binary file removed theme/colored/state-error-16.png
Diff not rendered.
Binary file removed theme/colored/state-error-256.png
Diff not rendered.
Binary file removed theme/colored/state-error-32.png
Diff not rendered.
Binary file removed theme/colored/state-error-64.png
Diff not rendered.
Binary file removed theme/colored/state-offline-128.png
Diff not rendered.
Binary file removed theme/colored/state-offline-16.png
Diff not rendered.
Binary file removed theme/colored/state-offline-256.png
Diff not rendered.
Binary file removed theme/colored/state-offline-32.png
Diff not rendered.
Binary file removed theme/colored/state-offline-64.png
Diff not rendered.
Binary file removed theme/colored/state-ok-128.png
Diff not rendered.
Binary file removed theme/colored/state-ok-16.png
Diff not rendered.
Binary file removed theme/colored/state-ok-256.png
Diff not rendered.
Binary file removed theme/colored/state-ok-32.png
Diff not rendered.
Binary file removed theme/colored/state-ok-64.png
Diff not rendered.
Binary file removed theme/colored/state-pause-128.png
Diff not rendered.
Binary file removed theme/colored/state-pause-16.png
Diff not rendered.
Binary file removed theme/colored/state-pause-256.png
Diff not rendered.
Binary file removed theme/colored/state-pause-32.png
Diff not rendered.
Binary file removed theme/colored/state-pause-64.png
Diff not rendered.
Binary file removed theme/colored/state-sync-128.png
Diff not rendered.
Binary file removed theme/colored/state-sync-16.png
Diff not rendered.
Binary file removed theme/colored/state-sync-256.png
Diff not rendered.
Binary file removed theme/colored/state-sync-32.png
Diff not rendered.
Binary file removed theme/colored/state-sync-64.png
Diff not rendered.
Binary file removed theme/colored/state-warning-128.png
Diff not rendered.
Binary file removed theme/colored/state-warning-16.png
Diff not rendered.
Binary file removed theme/colored/state-warning-256.png
Diff not rendered.
Binary file removed theme/colored/state-warning-32.png
Diff not rendered.
Binary file removed theme/colored/state-warning-64.png
Diff not rendered.
Binary file removed theme/white/state-error-128.png
Diff not rendered.
Binary file removed theme/white/state-error-16.png
Diff not rendered.
Binary file removed theme/white/state-error-256.png
Diff not rendered.
Binary file removed theme/white/state-error-32.png
Diff not rendered.
Binary file removed theme/white/state-error-64.png
Diff not rendered.
Binary file removed theme/white/state-offline-128.png
Diff not rendered.
Binary file removed theme/white/state-offline-16.png
Diff not rendered.
Binary file removed theme/white/state-offline-256.png
Diff not rendered.
Binary file removed theme/white/state-offline-32.png
Diff not rendered.
Binary file removed theme/white/state-offline-64.png
Diff not rendered.
Binary file removed theme/white/state-ok-128.png
Diff not rendered.
Binary file removed theme/white/state-ok-16.png
Diff not rendered.
Binary file removed theme/white/state-ok-256.png
Diff not rendered.
Binary file removed theme/white/state-ok-32.png
Diff not rendered.
Binary file removed theme/white/state-ok-64.png
Diff not rendered.
Binary file removed theme/white/state-pause-128.png
Diff not rendered.
Binary file removed theme/white/state-pause-16.png
Diff not rendered.
Binary file removed theme/white/state-pause-256.png
Diff not rendered.
Binary file removed theme/white/state-pause-32.png
Diff not rendered.
Binary file removed theme/white/state-pause-64.png
Diff not rendered.
Binary file removed theme/white/state-sync-128.png
Diff not rendered.
Binary file removed theme/white/state-sync-16.png
Diff not rendered.
Binary file removed theme/white/state-sync-256.png
Diff not rendered.
Binary file removed theme/white/state-sync-32.png
Diff not rendered.
Binary file removed theme/white/state-sync-64.png
Diff not rendered.
Binary file removed theme/white/state-warning-128.png
Diff not rendered.
Binary file removed theme/white/state-warning-16.png
Diff not rendered.
Binary file removed theme/white/state-warning-256.png
Diff not rendered.
Binary file removed theme/white/state-warning-32.png
Diff not rendered.
Binary file removed theme/white/state-warning-64.png
Diff not rendered.

0 comments on commit d7217d1

Please sign in to comment.