Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/generate state icons from svg #4622

Merged
merged 3 commits into from
Jun 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
mgallien marked this conversation as resolved.
Show resolved Hide resolved
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.