diff --git a/cmake/modules/AddAppIconMacro.cmake b/cmake/modules/AddAppIconMacro.cmake index 5d9d9d855e..4453a287e3 100644 --- a/cmake/modules/AddAppIconMacro.cmake +++ b/cmake/modules/AddAppIconMacro.cmake @@ -47,7 +47,13 @@ macro (KDE4_ADD_APP_ICON appsources pattern) endif (fn MATCHES ".*128.*") if (fn MATCHES ".*256.*" ) list (APPEND _icons ${it}) - endif (fn MATCHES ".*256.*") + endif (fn MATCHES ".*256.*") + if (fn MATCHES ".*512.*" ) + list (APPEND _icons ${it}) + endif (fn MATCHES ".*512.*") + if (fn MATCHES ".*1024.*" ) + list (APPEND _icons ${it}) + endif (fn MATCHES ".*1024.*") endforeach (it) if (_icons) add_custom_command(OUTPUT ${_outfilename}.ico ${_outfilename}.rc @@ -104,14 +110,14 @@ macro (KDE4_ADD_APP_ICON appsources pattern) foreach (it ${files}) if (it MATCHES ".*sidebar-16.*") configure_file(${it} ${appsources}.iconset/sidebar_16x16.png COPYONLY) - elseif (it MATCHES ".*sidebar-18.*") - configure_file(${it} ${appsources}.iconset/sidebar_18x18.png COPYONLY) elseif (it MATCHES ".*sidebar-32.*") + configure_file(${it} ${appsources}.iconset/sidebar_18x18.png COPYONLY) configure_file(${it} ${appsources}.iconset/sidebar_16x16@2x.png COPYONLY) - configure_file(${it} ${appsources}.iconset/sidebar_32x32.png COPYONLY) - elseif (it MATCHES ".*sidebar-36.*") - configure_file(${it} ${appsources}.iconset/sidebar_18x18@2x.png COPYONLY) elseif (it MATCHES ".*sidebar-64.*") + configure_file(${it} ${appsources}.iconset/sidebar_18x18@2x.png COPYONLY) + elseif (it MATCHES ".*sidebar-128.*") + configure_file(${it} ${appsources}.iconset/sidebar_32x32.png COPYONLY) + elseif (it MATCHES ".*sidebar-256.*") configure_file(${it} ${appsources}.iconset/sidebar_32x32@2x.png COPYONLY) endif() endforeach (it) diff --git a/cmake/modules/ECMAddAppIcon.cmake b/cmake/modules/ECMAddAppIcon.cmake index 6932584fb9..3934491bd9 100644 --- a/cmake/modules/ECMAddAppIcon.cmake +++ b/cmake/modules/ECMAddAppIcon.cmake @@ -8,8 +8,8 @@ # # ecm_add_app_icon( # ICONS [ [...]] -# [SIDEBAR_ICONS [ [...]] # Since 5.4x -# [OUTFILE_BASE ]) # Since 5.4x +# [SIDEBAR_ICONS [ [...]] # Since 5.49 +# [OUTFILE_BASENAME ]) # Since 5.49 # ) # # The given icons, whose names must match the pattern:: @@ -27,20 +27,21 @@ # # ``SIDEBAR_ICONS`` can be used to add Mac OS X sidebar # icons to the generated iconset. They are used when a folder monitored by the -# application is dragged into Finder's sidebar. Since 5.4x. +# application is dragged into Finder's sidebar. Since 5.49. # -# ``OUTFILE_BASE`` will be used as the basename for the icon file. If -# you specify it, the icon file will be called ``.icns`` on Mac OS X -# and ``.ico`` on Windows. If you don't specify it, it defaults -# to ``.``. Since 5.4x. +# ``OUTFILE_BASENAME`` will be used as the basename for the icon file. If +# you specify it, the icon file will be called ``.icns`` on Mac OS X +# and ``.ico`` on Windows. If you don't specify it, it defaults +# to ``.``. Since 5.49. # # # Windows notes # * Icons are compiled into the executable using a resource file. # * Icons may not show up in Windows Explorer if the executable # target does not have the ``WIN32_EXECUTABLE`` property set. -# * The tool png2ico is required. See :find-module:`FindPng2Ico`. -# * Supported sizes: 16, 32, 48, 64, 128. +# * One of the tools png2ico (See :find-module:`FindPng2Ico`) or +# icotool (see :find-module:`FindIcoTool`) is required. +# * Supported sizes: 16, 24, 32, 48, 64, 128, 256, 512 and 1024. # # Mac OS X notes # * The executable target must have the ``MACOSX_BUNDLE`` property set. @@ -101,7 +102,7 @@ include(CMakeParseArguments) function(ecm_add_app_icon appsources) set(options) - set(oneValueArgs OUTFILE_BASE) + set(oneValueArgs OUTFILE_BASENAME) set(multiValueArgs ICONS SIDEBAR_ICONS) cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) @@ -138,9 +139,9 @@ function(ecm_add_app_icon appsources) endif() - _ecm_add_app_icon_categorize_icons("${ARG_ICONS}" "icons" "16;32;48;64;128;256;512;1024") + _ecm_add_app_icon_categorize_icons("${ARG_ICONS}" "icons" "16;24;32;48;64;128;256;512;1024") if(ARG_SIDEBAR_ICONS) - _ecm_add_app_icon_categorize_icons("${ARG_SIDEBAR_ICONS}" "sidebar_icons" "16;18;32;36;64") + _ecm_add_app_icon_categorize_icons("${ARG_SIDEBAR_ICONS}" "sidebar_icons" "16;32;64;128;256") endif() set(mac_icons @@ -151,31 +152,37 @@ function(ecm_add_app_icon appsources) ${icons_at_128px} ${icons_at_256px} ${icons_at_512px} - ${icons_at_1024px} + ${icons_at_1024px}) + set(mac_sidebar_icons # Sidebar Icons: https://developer.apple.com/library/content/documentation/General/Conceptual/ExtensibilityPG/Finder.html#//apple_ref/doc/uid/TP40014214-CH15-SW15 ${sidebar_icons_at_16px} - ${sidebar_icons_at_18px} ${sidebar_icons_at_32px} - ${sidebar_icons_at_36px} - ${sidebar_icons_at_64px}) - if (NOT icons_at_128px) - message(AUTHOR_WARNING "No 128px icon provided; this will not work on Mac OS X") + ${sidebar_icons_at_64px} + ${sidebar_icons_at_128px} + ${sidebar_icons_at_256px}) + + if (NOT (mac_icons OR mac_sidebar_icons)) + message(AUTHOR_WARNING "No icons suitable for use on macOS provided") endif() - set(windows_icons ${icons_at_16px} - ${icons_at_32px} - ${icons_at_48px} - ${icons_at_64px} - ${icons_at_128px} - ${icons_at_256px}) - if (NOT windows_icons) + set(windows_icons ${icons_at_16px} + ${icons_at_24px} + ${icons_at_32px} + ${icons_at_48px} + ${icons_at_64px} + ${icons_at_128px} + ${icons_at_256px} + ${icons_at_512px} + ${icons_at_1024px}) + + if (NOT (windows_icons)) message(AUTHOR_WARNING "No icons suitable for use on Windows provided") endif() - if (ARG_OUTFILE_BASE) - set (_outfilebasename "${ARG_OUTFILE_BASE}") + if (ARG_OUTFILE_BASENAME) + set (_outfilebasename "${ARG_OUTFILE_BASENAME}") else() set (_outfilebasename "${appsources}") endif() @@ -185,26 +192,15 @@ function(ecm_add_app_icon appsources) set(saved_CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}") set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_FIND_MODULE_DIR}) find_package(Png2Ico) + find_package(IcoTool) set(CMAKE_MODULE_PATH "${saved_CMAKE_MODULE_PATH}") - if (Png2Ico_FOUND) - if (Png2Ico_HAS_RCFILE_ARGUMENT) - add_custom_command( - OUTPUT "${_outfilename}.rc" "${_outfilename}.ico" - COMMAND Png2Ico::Png2Ico - ARGS - --rcfile "${_outfilename}.rc" - "${_outfilename}.ico" - ${windows_icons} - DEPENDS ${windows_icons} - WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" - ) - else() + function(create_windows_icon_and_rc command args deps) add_custom_command( OUTPUT "${_outfilename}.ico" - COMMAND Png2Ico::Png2Ico - ARGS "${_outfilename}.ico" ${windows_icons} - DEPENDS ${windows_icons} + COMMAND ${command} + ARGS ${args} + DEPENDS ${deps} WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" ) # this bit's a little hacky to make the dependency stuff work @@ -216,12 +212,72 @@ function(ecm_add_app_icon appsources) DEPENDS "${_outfilename}.ico" WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" ) - endif() + endfunction() + + if (IcoTool_FOUND) + list(APPEND icotool_args "-c" "-o" "${_outfilename}.ico") + + # According to https://stackoverflow.com/a/40851713/2886832 + # Windows always chooses the first icon above 255px, all other ones will be ignored + set(maxSize 0) + foreach(size 256 512 1024) + if(icons_at_${size}px) + set(maxSize "${size}") + endif() + endforeach() + + foreach(size 16 24 32 48 64 128 ${maxSize}) + if(NOT icons_at_${size}px) + continue() + endif() + + set(icotool_icon_arg "") + if(size STREQUAL "${maxSize}") + # maxSize icon needs to be included as raw png + list(APPEND icotool_args "-r") + endif() + + foreach(icon ${icons_at_${size}px}) + list(APPEND icotool_args "${icons_at_${size}px}") + endforeach() + endforeach() + + create_windows_icon_and_rc(IcoTool::IcoTool "${icotool_args}" "${windows_icons_modern}") set(${appsources} "${${appsources}};${_outfilename}.rc" PARENT_SCOPE) + + # standard png2ico has no rcfile argument + # NOTE: We generally use https://github.com/hiiamok/png2ImageMagickICO + # or similar on windows, which is why we provide resolutions >= 256px here. + # Standard png2ico will fail with this. + elseif(Png2Ico_FOUND AND NOT Png2Ico_HAS_RCFILE_ARGUMENT AND windows_icons) + set(png2ico_args) + list(APPEND png2ico_args "${_outfilename}.ico") + list(APPEND png2ico_args "${windows_icons}") + create_windows_icon_and_rc(Png2Ico::Png2Ico "${png2ico_args}" "${windows_icons}") + + set(${appsources} "${${appsources}};${_outfilename}.rc" PARENT_SCOPE) + + # png2ico from kdewin provides rcfile argument + elseif(Png2Ico_FOUND AND windows_icons) + add_custom_command( + OUTPUT "${_outfilename}.rc" "${_outfilename}.ico" + COMMAND Png2Ico::Png2Ico + ARGS + --rcfile "${_outfilename}.rc" + "${_outfilename}.ico" + ${windows_icons} + DEPENDS ${windows_icons} + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + ) + + set(${appsources} "${${appsources}};${_outfilename}.rc" PARENT_SCOPE) + + # else none of the supported tools was found else() - message(WARNING "Unable to find the png2ico utility - application will not have an application icon!") + message(WARNING "Unable to find the png2ico or icotool utilities or icons in matching sizes - application will not have an application icon!") endif() - elseif (APPLE AND mac_icons) + + elseif (APPLE AND (mac_icons OR mac_sidebar_icons)) # first generate .iconset directory structure, then convert to .icns format using the Mac OS X "iconutil" utility, # to create retina compatible icon, you need png source files in pixel resolution 16x16, 32x32, 64x64, 128x128, # 256x256, 512x512, 1024x1024 @@ -246,8 +302,11 @@ function(ecm_add_app_icon appsources) WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" ) list(APPEND iconset_icons - "${_outfilename}.iconset/${type}_${sizename}.png") + "${_outfilename}.iconset/${type}_${sizename}.png") endmacro() + + # List of supported sizes and filenames taken from: + # https://developer.apple.com/library/content/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Optimizing/Optimizing.html#//apple_ref/doc/uid/TP40012302-CH7-SW4 foreach(size 16 32 128 256 512) math(EXPR double_size "2 * ${size}") foreach(file ${icons_at_${size}px}) @@ -258,14 +317,25 @@ function(ecm_add_app_icon appsources) endforeach() endforeach() - foreach(size 16 18 32) - math(EXPR double_size "2 * ${size}") - foreach(file ${sidebar_icons_at_${size}px}) - copy_icon("${file}" "${size}x${size}" "sidebar") - endforeach() - foreach(file ${sidebar_icons_at_${double_size}px}) - copy_icon("${file}" "${size}x${size}@2x" "sidebar") - endforeach() + # List of supported sizes and filenames taken from: + # https://developer.apple.com/library/content/documentation/General/Conceptual/ExtensibilityPG/Finder.html#//apple_ref/doc/uid/TP40014214-CH15-SW15 + foreach(file ${sidebar_icons_at_16px}) + copy_icon("${file}" "16x16" "sidebar") + endforeach() + foreach(file ${sidebar_icons_at_32px}) + copy_icon("${file}" "16x16@2x" "sidebar") + endforeach() + foreach(file ${sidebar_icons_at_32px}) + copy_icon("${file}" "18x18" "sidebar") + endforeach() + foreach(file ${sidebar_icons_at_64px}) + copy_icon("${file}" "18x18@2x" "sidebar") + endforeach() + foreach(file ${sidebar_icons_at_128px}) + copy_icon("${file}" "32x32" "sidebar") + endforeach() + foreach(file ${sidebar_icons_at_256px}) + copy_icon("${file}" "32x32@2x" "sidebar") endforeach() # generate .icns icon file diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index f6e296cd2c..d94b19813e 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -251,7 +251,7 @@ if(APPLE) file(GLOB_RECURSE OWNCLOUD_SIDEBAR_ICONS "${theme_dir}/colored/*-${APPLICATION_ICON_NAME}-sidebar*") MESSAGE(STATUS "OWNCLOUD_SIDEBAR_ICONS: ${APPLICATION_ICON_NAME}: ${OWNCLOUD_SIDEBAR_ICONS}") endif() -ecm_add_app_icon(final_src ICONS "${OWNCLOUD_ICONS}" SIDEBAR_ICONS "${OWNCLOUD_SIDEBAR_ICONS}" OUTFILE_BASE "${APPLICATION_ICON_NAME}") +ecm_add_app_icon(final_src ICONS "${OWNCLOUD_ICONS}" SIDEBAR_ICONS "${OWNCLOUD_SIDEBAR_ICONS}" OUTFILE_BASENAME "${APPLICATION_ICON_NAME}") if(UNIX AND NOT APPLE) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIE") diff --git a/theme.qrc b/theme.qrc index 11641c3861..44d0dfc728 100644 --- a/theme.qrc +++ b/theme.qrc @@ -1,12 +1,14 @@ - theme/colored/512-Nextcloud-icon.png - theme/colored/256-Nextcloud-icon.png - theme/colored/128-Nextcloud-icon.png - theme/colored/22-Nextcloud-icon.png + theme/colored/16-Nextcloud-icon.png + theme/colored/24-Nextcloud-icon.png theme/colored/32-Nextcloud-icon.png theme/colored/48-Nextcloud-icon.png theme/colored/64-Nextcloud-icon.png + theme/colored/128-Nextcloud-icon.png + theme/colored/256-Nextcloud-icon.png + theme/colored/512-Nextcloud-icon.png + theme/colored/1024-Nextcloud-icon.png theme/colored/state-error-32.png theme/colored/state-error-64.png theme/colored/state-error-128.png diff --git a/theme/colored/1024-Nextcloud-icon.png b/theme/colored/1024-Nextcloud-icon.png index b8c89ee031..e6bea6dbbf 100644 Binary files a/theme/colored/1024-Nextcloud-icon.png and b/theme/colored/1024-Nextcloud-icon.png differ diff --git a/theme/colored/128-Nextcloud-icon.png b/theme/colored/128-Nextcloud-icon.png index c97f368075..78c88f5f65 100644 Binary files a/theme/colored/128-Nextcloud-icon.png and b/theme/colored/128-Nextcloud-icon.png differ diff --git a/theme/colored/128-Nextcloud-sidebar.png b/theme/colored/128-Nextcloud-sidebar.png new file mode 100644 index 0000000000..4ca9fae9b0 Binary files /dev/null and b/theme/colored/128-Nextcloud-sidebar.png differ diff --git a/theme/colored/16-Nextcloud-icon.png b/theme/colored/16-Nextcloud-icon.png index 36bcce79c4..8a52d672bd 100644 Binary files a/theme/colored/16-Nextcloud-icon.png and b/theme/colored/16-Nextcloud-icon.png differ diff --git a/theme/colored/16-Nextcloud-sidebar.png b/theme/colored/16-Nextcloud-sidebar.png index 4b448544ea..4bcc1a54fd 100644 Binary files a/theme/colored/16-Nextcloud-sidebar.png and b/theme/colored/16-Nextcloud-sidebar.png differ diff --git a/theme/colored/18-Nextcloud-sidebar.png b/theme/colored/18-Nextcloud-sidebar.png deleted file mode 100644 index f52cec6e34..0000000000 Binary files a/theme/colored/18-Nextcloud-sidebar.png and /dev/null differ diff --git a/theme/colored/22-Nextcloud-icon.png b/theme/colored/22-Nextcloud-icon.png deleted file mode 100644 index d12e6826e9..0000000000 Binary files a/theme/colored/22-Nextcloud-icon.png and /dev/null differ diff --git a/theme/colored/24-Nextcloud-icon.png b/theme/colored/24-Nextcloud-icon.png new file mode 100644 index 0000000000..826e15b252 Binary files /dev/null and b/theme/colored/24-Nextcloud-icon.png differ diff --git a/theme/colored/256-Nextcloud-icon.png b/theme/colored/256-Nextcloud-icon.png index 11b0833cac..a83201edd1 100644 Binary files a/theme/colored/256-Nextcloud-icon.png and b/theme/colored/256-Nextcloud-icon.png differ diff --git a/theme/colored/256-Nextcloud-sidebar.png b/theme/colored/256-Nextcloud-sidebar.png new file mode 100644 index 0000000000..19da6fe9d0 Binary files /dev/null and b/theme/colored/256-Nextcloud-sidebar.png differ diff --git a/theme/colored/32-Nextcloud-icon.png b/theme/colored/32-Nextcloud-icon.png index 052da904e0..bdf479dbf6 100644 Binary files a/theme/colored/32-Nextcloud-icon.png and b/theme/colored/32-Nextcloud-icon.png differ diff --git a/theme/colored/32-Nextcloud-sidebar.png b/theme/colored/32-Nextcloud-sidebar.png index 5b16f41485..e49a15c838 100644 Binary files a/theme/colored/32-Nextcloud-sidebar.png and b/theme/colored/32-Nextcloud-sidebar.png differ diff --git a/theme/colored/36-Nextcloud-sidebar.png b/theme/colored/36-Nextcloud-sidebar.png deleted file mode 100644 index f95ced3f75..0000000000 Binary files a/theme/colored/36-Nextcloud-sidebar.png and /dev/null differ diff --git a/theme/colored/48-Nextcloud-icon.png b/theme/colored/48-Nextcloud-icon.png index a1a9625f99..0ae67b48e6 100644 Binary files a/theme/colored/48-Nextcloud-icon.png and b/theme/colored/48-Nextcloud-icon.png differ diff --git a/theme/colored/512-Nextcloud-icon.png b/theme/colored/512-Nextcloud-icon.png index 9f40c76cfa..d5936039cd 100644 Binary files a/theme/colored/512-Nextcloud-icon.png and b/theme/colored/512-Nextcloud-icon.png differ diff --git a/theme/colored/64-Nextcloud-icon.png b/theme/colored/64-Nextcloud-icon.png index f11f36320d..32be410efe 100644 Binary files a/theme/colored/64-Nextcloud-icon.png and b/theme/colored/64-Nextcloud-icon.png differ diff --git a/theme/colored/64-Nextcloud-sidebar.png b/theme/colored/64-Nextcloud-sidebar.png index 7be370e1e4..bd1adb490d 100644 Binary files a/theme/colored/64-Nextcloud-sidebar.png and b/theme/colored/64-Nextcloud-sidebar.png differ diff --git a/theme/colored/Nextcloud-icon.svg b/theme/colored/Nextcloud-icon.svg index bf7753aa37..24ecc907a7 100644 --- a/theme/colored/Nextcloud-icon.svg +++ b/theme/colored/Nextcloud-icon.svg @@ -1,70 +1 @@ - -image/svg+xml \ No newline at end of file + \ No newline at end of file