File indexing completed on 2024-05-05 04:52:23

0001 #!/bin/sh
0002 set -eu
0003 
0004 #ICONSET="Oxygen"
0005 ICONSET="Breeze"
0006 ORIGIN="local"
0007 
0008 # Those two icons are not found on Oxygem. They're modified versions
0009 # of the icons found at Oxygen:
0010 #       actions-audio-radio-encrypted
0011 #       actions-video-television-encrypted
0012 #
0013 
0014 ICONS="apps-kaffeine mimetypes-application-x-subrip actions-arrow-left actions-arrow-right devices-audio-card status-audio-volume-high status-audio-volume-low status-audio-volume-medium status-audio-volume-muted actions-configure actions-dialog-cancel status-dialog-error status-dialog-information actions-dialog-ok-apply actions-document-open-folder actions-document-save actions-edit-clear-list actions-edit-delete actions-edit-find actions-edit-rename actions-edit-undo actions-format-justify-center actions-go-jump actions-list-add devices-media-optical devices-media-optical-audio devices-media-optical-video actions-media-playback-pause actions-media-playback-start actions-media-playback-stop actions-media-record actions-media-skip-backward actions-media-skip-forward actions-page-zoom actions-player-time places-start-here-kde mimetypes-text-html actions-text-speak devices-video-television mimetypes-video-x-generic actions-view-fullscreen actions-view-list-details actions-view-media-playlist actions-view-pim-calendar actions-view-refresh actions-view-restore"
0015 
0016 if [ "$ICONSET" == "Oxygen" ]; then
0017         ICONS="$ICONS status-media-playlist-repeat status-media-playlist-shuffle"
0018 
0019         # To use the latest icons downloaded directly from the repository
0020         if [ "$ORIGIN" == "local" ]; then
0021                 ICONS_URL="file://$(pwd)/../oxygen-icons5/"
0022         else
0023                 ICONS_URL="https://quickgit.kde.org/?p=oxygen-icons5.git&a=blob&f="
0024         fi
0025 else
0026         if [ "$ORIGIN" == "local" ]; then
0027                 ICONS_URL="file://$(pwd)/../breeze-icons/icons/"
0028         else
0029                 ICONS="$ICONS actions-media-playlist-repeat actions-media-playlist-shuffle"
0030         fi
0031 fi
0032 
0033 if [ "$ORIGIN" == "local" ]; then
0034         ICONS_URL_END=""
0035 else
0036         ICONS_URL_END="&o=plain"
0037 fi
0038 
0039 if [ "$(grep KAFFEINE_MAJOR_VERSION CMakeLists.txt)" == "" ]; then
0040   echo "Entering into the Kaffeine dir"
0041   cd kaffeine
0042 fi
0043 
0044 rm -f $(for i in $ICONS; do echo icons/*-$i.*; done)
0045 
0046 if [ `find /usr/share/icons/oxygen | grep -i kaffeine | wc --lines` != 6 ] ; then
0047         echo "recheck number of icons"
0048         exit 1
0049 fi
0050 
0051 FILES=""
0052 ICONS_NOT_FOUND=""
0053 for i in $ICONS; do
0054         FOUND=""
0055         j=$(echo $i|sed "s,-,/,")
0056         curl -s "${ICONS_URL}scalable/$j.svgz${ICONS_URL_END}" -o icons/sc-$i.svgz && FOUND=1 && FILES="$FILES sc-$i.svgz" || true
0057 
0058         if [ "$FOUND" == "1" ]; then echo "Found $i.svgz"; continue; fi
0059 
0060         curl -s "${ICONS_URL}scalable/$j.svg${ICONS_URL_END}" -o icons/sc-$i.svg && FOUND=1 && FILES="$FILES sc-$i.svg" || true
0061 
0062         if [ "$FOUND" == "1" ]; then echo "Found $i.svg"; continue; fi
0063 
0064         for SIZE in 16 22 32 48 64 128 ; do
0065                 j=$(echo $i|sed "s,-,/,")
0066                 # Oxygen path
0067                 curl -s "${ICONS_URL}${SIZE}x$SIZE/$j.png${ICONS_URL_END}" -o icons/$SIZE-$i.png && FOUND=1 && FILES="$FILES $SIZE-$i.png" || true
0068                 if [ "$FOUND" == "" ]; then
0069                         # Breeze path
0070                         j=$(echo $j|sed "s,/,/${SIZE}/,")
0071                         curl -s "${ICONS_URL}$j.svg${ICONS_URL_END}" -o icons/sc-$i.svg && FOUND=1 && FILES="$FILES sc-$i.svg" || true
0072                 fi
0073         done
0074 
0075         if [ "$FOUND" == "1" ]; then echo "Found $i.png on several sizes"; continue; fi
0076 
0077         ICONS_NOT_FOUND="$ICONS_NOT_FOUND $i"
0078 done
0079 
0080 cat > icons/CMakeLists.txt << EOF
0081 # Auto-generated by ../tools/update_icons.sh
0082 #
0083 # Breeze Icons are developed by The KDE Visual Design Group.
0084 # All icons are licensed under LGPL3+
0085 
0086 ecm_install_icons(ICONS
0087         # This icon is a merge of Breeze audio-mp4.svg with lock.svg
0088         sc-actions-audio-radio-encrypted.svg
0089         # This icon is a merge of Breeze sc-devices-video-television.svg with lock.svg
0090         sc-actions-video-television-encrypted.svg
0091 
0092         # Those icons are copied as-is from ${ICONSET} theme
0093 
0094 EOF
0095 
0096 # Remve duplicated files
0097 FILES=$(echo "$FILES" | tr ' ' '\n' | sort -u | tr '\n' ' ')
0098 
0099 for i in $FILES; do
0100         echo -e "\t$i" >> icons/CMakeLists.txt
0101 done
0102 
0103 echo -e "\tDESTINATION \${ICON_INSTALL_DIR}\n)" >> icons/CMakeLists.txt
0104 
0105 # Add the two extra files
0106 FILES="$FILES sc-actions-audio-radio-encrypted.svg sc-actions-video-television-encrypted.svg"
0107 
0108 echo "<!DOCTYPE RCC><RCC version=\"1.0\">" >src/kaffeine.qrc
0109 for i in $FILES; do
0110         alias=$(echo $i|cut -d'-' -f 3-|cut -d'.' -f1)
0111         echo -e "\t<qresource>\n\t\t<file alias=\"$alias\">../icons/$i</file>\n\t</qresource>"
0112 done >>src/kaffeine.qrc
0113 echo "</RCC>" >>src/kaffeine.qrc
0114 
0115 if [ "$ICONS_NOT_FOUND" != "" ]; then
0116         echo "WARNING: Icons not found: $ICONS_NOT_FOUND"
0117 fi