X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=icons%2Fimport%2Fimport_theme.pl;fp=icons%2Fimport%2Fimport_theme.pl;h=e835a76ad045a2b516f64cdbde9d1d81cbbcfba5;hp=f02e3f8e309c4ed133c8f9f23abba329a8322485;hb=799dbc090d9bb9ca4a85711e6253ebda9fef266e;hpb=d70ad670bcbf15a8ecad709433fe985fabda3303 diff --git a/icons/import/import_theme.pl b/icons/import/import_theme.pl index f02e3f8e..e835a76a 100755 --- a/icons/import/import_theme.pl +++ b/icons/import/import_theme.pl @@ -5,9 +5,9 @@ # 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. +# Additional icons can be specified in whitelist-icons; you can also blacklist icons. # -# NOTE: Unless you are a Quassel developer and need to bump the icons we ship, you shouldn'y +# NOTE: Unless you are a Quassel developer and need to bump the icons we ship, you shouldn't # need to use this script! # USAGE: ./import/import_theme.pl $systhemefolder $themename @@ -24,13 +24,16 @@ my $themename = shift; $themename = $themename ? $themename : "oxygen"; my $qrcfile_kde = $themename . ".qrc"; -my $extrafile = "import/extra-icons"; +my $whitelistfile = "import/whitelist-icons"; my $blacklistfile = "import/blacklisted-icons"; +my $extrafile = "import/extra-icons.qrc." . $themename; my %req_icons; my %found_icons; my %blacklist; -my %extra; +my %themeblacklist; +my %whitelist; +my $extrafilecontent; # First, load the icon blacklist open BLACKLIST, "<$blacklistfile" or die "Could not open $blacklistfile\n"; @@ -48,6 +51,7 @@ if ($hasthemeblacklist) { s/#.*//; next unless my ($name) = /([-\w]+)\s*/; $blacklist{$name} = 1; + $themeblacklist{$name} = 1; } close BLACKLIST; } else { @@ -63,14 +67,27 @@ foreach(@results) { unless exists $blacklist{$name}; } -# Add extra icons -open EXTRA, "<$extrafile" or die "Could not open $extrafile\n"; -while() { +# Add whitelist icons +open WHITELIST, "<$whitelistfile" or die "Could not open $whitelistfile\n"; +while() { s/#.*//; next unless my ($name) = /([-\w]+)\s*/; - $req_icons{$name} = 1; + $req_icons{$name} = 1 + unless exists $themeblacklist{$name}; +} +close WHITELIST; + +# Read in extra-icons +my $hasthemeextrafile = 1; +local $/; +open EXTRAFILE, "<$extrafile" or $hasthemeextrafile = 0; +if($hasthemeextrafile) { + binmode EXTRAFILE; + $extrafilecontent = ; + close EXTRAFILE; +} else { + $extrafilecontent = ""; } -close EXTRA; # Clean old output dir print "Removing old $themename...\n"; @@ -131,7 +148,7 @@ system "cp $themefolder/AUTHORS $themefolder/CONTRIBUTING $themefolder/COPYING $ # Generate .qrc my @file_list; -generate_qrc($themename, $qrcfile_kde); +generate_qrc($themename, $qrcfile_kde, $extrafilecontent); print "Done.\n"; @@ -142,11 +159,13 @@ sub generate_qrc { @file_list = (); find(\&push_icon_path, $dir); + @file_list = sort(@file_list ); my $files = join "\n", @file_list; my $qrc = "\n" ." \n" ."$files\n" + ."$extrafilecontent\n" ." \n" ."\n";