From: Manuel Nickschas Date: Sat, 31 Jan 2009 01:37:51 +0000 (+0100) Subject: Add a script and skeleton directory for importing icons from Oxygen X-Git-Tag: 0.4.0~164 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=8e2fa5fff58dc2397d91f3e75a40c884fa7d1ceb Add a script and skeleton directory for importing icons from Oxygen This script scans the Quassel source for requested icons and imports only these from the given theme directory. Have a look at import/README.Quassel for details. --- diff --git a/icons/import/blacklisted-icons b/icons/import/blacklisted-icons new file mode 100644 index 00000000..139597f9 --- /dev/null +++ b/icons/import/blacklisted-icons @@ -0,0 +1,2 @@ + + diff --git a/icons/import/extra-icons b/icons/import/extra-icons new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/icons/import/extra-icons @@ -0,0 +1 @@ + diff --git a/icons/import/import_oxygen.pl b/icons/import/import_oxygen.pl new file mode 100755 index 00000000..16c4116f --- /dev/null +++ b/icons/import/import_oxygen.pl @@ -0,0 +1,138 @@ +#!/usr/bin/perl + +# This script scans the Quassel source for requested icons and imports the needed +# icons (and only them) from KDE's Oxygen theme. +# This relies on all icons being requested using one of the convenience constructors in +# (K)IconLoader, like this: +# widget->setIcon(SmallIcon("fubar")); +# Additional icons can be specified in extra-icons; you can also blacklist icons. +# +# NOTE: Unless you are a Quassel developer and need to bump the icons we ship, you shouldn'y +# need to use this script! + +# USAGE: ./import/import_oxygen.pl $systhemefolder +# Run from the icon/ directory. + +use strict; +use Data::Dumper; +use File::Find; + +my $oxygen = shift; + +my $source = "../src"; +my $skeleton = "oxygen_quassel"; +my $output = "oxygen"; +my $qrcfile = "oxygen.qrc"; + +my $extrafile = "import/extra-icons"; +my $blacklistfile = "import/blacklisted-icons"; + +my %sizes = ( + Desktop => 48, + Bar => 22, + MainBar => 22, + Small => 16, + Panel => 32, + Dialog => 22 +); + +my %req_icons; +my %blacklist; +my %extra; + +# First, load the icon blacklist +# Format: icon-name 16 22 32 +open BLACKLIST, "<$blacklistfile" or die "Could not open $blacklistfile\n"; +while() { + s/#.*//; + next unless my ($name, $sizes) = /([-\w]+)\s+(\d+(?:\s+\d+)*)?/; + $blacklist{$name} = $sizes; +} +close BLACKLIST; + +# We now grep the source for things like SmallIcon("fubar") and generate size and name from that +print "Grepping $source for requested icons...\n"; +my @results = `grep -r Icon\\(\\" $source`; +foreach(@results) { + next unless my ($type, $name) = /\W+(\s|Desktop|Bar|MainBar|Small|Panel|Dialog)Icon\("([-\w]+)/; + $type = "Desktop" if $type =~ /\s+/; + my $size = $sizes{$type}; + $req_icons{$size}{$name} = 1 + unless exists $blacklist{$name} and ($blacklist{$name} == undef or $blacklist{$name} =~ /$size/); +} + +# Add extra icons +open EXTRA, "<$extrafile" or die "Could not open $extrafile\n"; +while() { + s/#.*//; + next unless my ($name, $sizes) = /([-\w]+)\s+(\d+(?:\s+\d+)*)/; + foreach(split /\s+/, $sizes) { + $req_icons{$_}{$name} = 1; + } +} +close EXTRA; + +# Clean old output dir +print "Removing old $output...\n"; +system("rm -rf $output"); +# Copy skeleton +print "Copying skeleton from $skeleton...\n"; +system("cp -a $skeleton $output"); + +# Now copy the icons +my %scalables; + +print "Copying icons from $oxygen...\n"; +foreach my $size (keys %req_icons) { + my $sizestr = $size.'x'.$size; + opendir (BASEDIR, "$oxygen/$sizestr") or die "Could not open dir for size $size\n"; + foreach my $cat (readdir BASEDIR) { + next if $cat eq '.' or $cat eq '..'; + opendir (CATDIR, "$oxygen/$sizestr/$cat") or die "Could not open category dir\n"; + foreach my $icon (readdir CATDIR) { + $icon =~ s/\.png$//; + next unless exists $req_icons{$size}{$icon}; + $scalables{"$cat/$icon"} = 1; + system "cp -a $oxygen/$sizestr/$cat/$icon.png $output/$sizestr/$cat" + and die "Error while copying file $sizestr/$cat/$icon.png\n"; + delete $req_icons{$size}{$icon}; + } + closedir CATDIR; + } + closedir BASEDIR; +} + +# Copy scalables +foreach my $scalable (keys %scalables) { + system "cp -a $oxygen/scalable/$scalable.svgz $output/scalable/$scalable.svgz"; +} + +# Warn if we have still icons left +foreach my $size (keys %req_icons) { + foreach my $missing (keys %{ $req_icons{$size} }) { + print "Warning: Missing icon $missing (size $size)\n"; + } +} + +# Generate .qrc +my @file_list; +find(\&push_icon_path, $output); + +sub push_icon_path { + return unless /\.png$/; + push @file_list, " $File::Find::name"; +} + +my $files = join "\n", @file_list; + +my $qrc = "\n" + ." \n" + ."$files\n" + ." \n" + ."\n"; + +open QRC, ">$qrcfile" or die "Could not open $qrcfile for writing!\n"; +print QRC $qrc; +close QRC; + +print "Done.\n"; diff --git a/icons/missing_icons b/icons/missing_icons deleted file mode 100644 index aacace0a..00000000 --- a/icons/missing_icons +++ /dev/null @@ -1,3 +0,0 @@ -# Icons we'd like to have in an icon theme -status/network-connecting -toggle advanced/simple mode diff --git a/icons/oxygen_quassel/AUTHORS b/icons/oxygen_quassel/AUTHORS new file mode 100644 index 00000000..e35a25e7 --- /dev/null +++ b/icons/oxygen_quassel/AUTHORS @@ -0,0 +1,23 @@ +Oxygen Icon Theme has been developed by The Oxygen Team. + +Art Directors: +David Vignoni +Nuno F. Pinheiro +David J. Miller + +Naming Coordinator +Jakob Petsovits + +Designers: +David J. Miller +David Vignoni +Johann Ollivier Lapeyre +Kenneth Wimer +Nuno F. Pinheiro +Riccardo Iaconelli + +Thanks to: +Lee Olson: Contributed drawing used in application-x-bittorent icon. +Marco Aurélio "Coré": Improved audio-input-microphone icon. +Matthias Kretz: Contributed "audio-input-line" device icon. +Mauricio Piacentini : game icons mashup diff --git a/icons/oxygen_quassel/CONTRIBUTING b/icons/oxygen_quassel/CONTRIBUTING new file mode 100644 index 00000000..bbf20811 --- /dev/null +++ b/icons/oxygen_quassel/CONTRIBUTING @@ -0,0 +1,8 @@ +If you'd like to help us make Oxygen or contribute in any way please join the irc channel #kde-artists on freenode.net or send a mail to the kde-artists mailing list (artists@kde.org). One of the teeam is almost always online. We'd love to to discuss the possiblity with you :-) + +In order to coordinate the addition of icons to the theme itself, all artists should put their work in a dir labelled Oxygen/ARTIST_NAME (so, mine for instance is Oxygen/Ken/) this allows us to control not only the licensing of the theme but the compatability with the guidelines for creating Oxygen icons. + +NOTE: +Contributors should realize that the Oxygen icon theme mantainers can (and probably will) modify, delete, reuse contributed artwork. + +The Oxygen Team diff --git a/icons/oxygen_quassel/COPYING b/icons/oxygen_quassel/COPYING new file mode 100644 index 00000000..c87ac56a --- /dev/null +++ b/icons/oxygen_quassel/COPYING @@ -0,0 +1,48 @@ +The Oxygen Icon Theme + Copyright (C) 2007 David Vignoni + Copyright (C) 2007 Johann Ollivier Lapeyre + Copyright (C) 2007 Kenneth Wimer + Copyright (C) 2007 Nuno Fernades Pinheiro + Copyright (C) 2007 Riccardo Iaconelli + Copyright (C) 2007 David Miller + +and others + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library. If not, see . + +Clarification: + + The GNU Lesser General Public License or LGPL is written for + software libraries in the first place. We expressly want the LGPL to + be valid for this artwork library too. + + KDE Oxygen theme icons is a special kind of software library, it is an + artwork library, it's elements can be used in a Graphical User Interface, or + GUI. + + Source code, for this library means: + - where they exist, SVG; + - otherwise, if applicable, the multi-layered formats xcf or psd, or + otherwise png. + + The LGPL in some sections obliges you to make the files carry + notices. With images this is in some cases impossible or hardly useful. + + With this library a notice is placed at a prominent place in the directory + containing the elements. You may follow this practice. + + The exception in section 5 of the GNU Lesser General Public License covers + the use of elements of this art library in a GUI. + + kde-artists [at] kde.org diff --git a/icons/oxygen_quassel/README.Quassel b/icons/oxygen_quassel/README.Quassel new file mode 100644 index 00000000..e4fd45ea --- /dev/null +++ b/icons/oxygen_quassel/README.Quassel @@ -0,0 +1,17 @@ +This is a stripped version of the Oxygen icon theme, part of KDE4, as found +in KDE's svn. We have removed the parts of the theme we don't use in order to +conserve space in our own repository and to make downloads smaller. + +The icons found here have been imported from: +svn://anonsvn.kde.org/home/kde/trunk/KDE/kdebase/runtime/pics/oxygen +Revision: 917170 + +We, the authors of Quassel IRC, do solely distribute this icon set (or parts +thereof), we are not involved in creating/editing/maintaining it. Please see +the appropriate files, in particular AUTHORS and COPYING, in this directory. +All icon files in this directory were copied verbatim and not modified by us. + +We would like to thank the Oxygen team for creating such terrific artwork, +and we do hope that they see our use of their icon theme as a compliment :) + +The Quassel IRC Team