Add a script and skeleton directory for importing icons from Oxygen
authorManuel Nickschas <sputnick@quassel-irc.org>
Sat, 31 Jan 2009 01:37:51 +0000 (02:37 +0100)
committerManuel Nickschas <sputnick@quassel-irc.org>
Sat, 31 Jan 2009 02:01:13 +0000 (03:01 +0100)
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.

icons/import/blacklisted-icons [new file with mode: 0644]
icons/import/extra-icons [new file with mode: 0644]
icons/import/import_oxygen.pl [new file with mode: 0755]
icons/missing_icons [deleted file]
icons/oxygen_quassel/AUTHORS [new file with mode: 0644]
icons/oxygen_quassel/CONTRIBUTING [new file with mode: 0644]
icons/oxygen_quassel/COPYING [new file with mode: 0644]
icons/oxygen_quassel/README.Quassel [new file with mode: 0644]

diff --git a/icons/import/blacklisted-icons b/icons/import/blacklisted-icons
new file mode 100644 (file)
index 0000000..139597f
--- /dev/null
@@ -0,0 +1,2 @@
+
+
diff --git a/icons/import/extra-icons b/icons/import/extra-icons
new file mode 100644 (file)
index 0000000..8b13789
--- /dev/null
@@ -0,0 +1 @@
+
diff --git a/icons/import/import_oxygen.pl b/icons/import/import_oxygen.pl
new file mode 100755 (executable)
index 0000000..16c4116
--- /dev/null
@@ -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(<BLACKLIST>) {
+  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(<EXTRA>) {
+  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>$File::Find::name</file>";
+}
+
+my $files = join "\n", @file_list;
+
+my $qrc = "<RCC>\n"
+         ."  <qresource prefix=\"/icons\">\n"
+         ."$files\n"
+         ."  </qresource>\n"
+         ."</RCC>\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 (file)
index aacace0..0000000
+++ /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 (file)
index 0000000..e35a25e
--- /dev/null
@@ -0,0 +1,23 @@
+Oxygen Icon Theme has been developed by The Oxygen Team.
+
+Art Directors:
+David Vignoni <david@oxygen-icons.org>
+Nuno F. Pinheiro <nuno@oxygen-icons.org>
+David J. Miller <miller@oxygen-icons.org>
+
+Naming Coordinator
+Jakob Petsovits <jpetso@gmx.at>
+
+Designers:
+David J. Miller <miller@oxygen-icons.org>
+David Vignoni <david@oxygen-icons.org>
+Johann Ollivier Lapeyre <johann@oxygen-icons.org>
+Kenneth Wimer <ken@oxygen-icons.org> 
+Nuno F. Pinheiro <nuno@oxygen-icons.org>
+Riccardo Iaconelli <riccardo@oxygen-icons.org>
+
+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 <piacentini@kde.org> : game icons mashup
diff --git a/icons/oxygen_quassel/CONTRIBUTING b/icons/oxygen_quassel/CONTRIBUTING
new file mode 100644 (file)
index 0000000..bbf2081
--- /dev/null
@@ -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 (file)
index 0000000..c87ac56
--- /dev/null
@@ -0,0 +1,48 @@
+The Oxygen Icon Theme
+    Copyright (C) 2007 David Vignoni <david@icon-king.com>
+    Copyright (C) 2007 Johann Ollivier Lapeyre <johann@oxygen-icons.org>
+    Copyright (C) 2007 Kenneth Wimer <kwwii@bootsplash.org>
+    Copyright (C) 2007 Nuno Fernades Pinheiro <nf.pinheiro@gmail.com>
+    Copyright (C) 2007 Riccardo Iaconelli <riccardo@oxygen-icons.org>
+    Copyright (C) 2007 David Miller <miller@oxygen-icons.org>
+
+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 <http://www.gnu.org/licenses/>.
+
+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 (file)
index 0000000..e4fd45e
--- /dev/null
@@ -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