[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-linux
Subject:    Re: [kde-linux] Applying the svg patch
From:       Adrian Codre <codreadrian () softhome ! net>
Date:       2002-02-28 0:26:50
[Download RAW message or body]

On Wednesday 27 February 2002 23:02, Tim Sutton wrote:
> Hi
>
> I am trying to apply the svg patch announced in this weeks kernel cousin. I
> eztracted the tarball and copied the patch file into kdelibs/kdecore . Then
> I tried to do
>
> patch -p SVG-ICONS
>
> But nothing seems to happen. What am I doing wrong in applying the patch?
>
> Also I successfully compiled ksvg in kdenonbeta but still cant seem to open
> any .svg files?
>
> Thanks
>
> Tim

with the inclussion of the Lunak modified malloc,  the patch doesn't work 
anymore. Try with patch -p0 < SVG-ICONS and with the atached patch.

-- 
"One ring to rule them all, one ring to find them,
one ring to bring them all... and in the darkness bind them"
["SVG-ICONS" (text/x-diff)]

? SVG-ICONS
? svgiconpatch.tar.gz
? svgicons
Index: Makefile.am
===================================================================
RCS file: /home/kde/kdelibs/kdecore/Makefile.am,v
retrieving revision 1.277
diff -u -p -b -r1.277 Makefile.am
--- Makefile.am	2002/01/30 18:00:00	1.277
+++ Makefile.am	2002/02/16 14:10:57
@@ -22,8 +22,10 @@
 
 INCLUDES = $(all_includes)
 
-SUBDIRS = malloc . tests
+CPPFLAGS = -DLIBART_COMPILATION
 
+SUBDIRS = malloc svgicons . tests
+
 lib_LTLIBRARIES = libkdefakes.la libkdecore.la
 
 include_HEADERS = kconfig.h kconfigdata.h ksimpleconfig.h kconfigbase.h \
@@ -81,7 +83,7 @@ libkdecore_la_SOURCES = libintl.cpp kapp
 	kmultipledrag.cpp kstaticdeleter.cpp kappdcopiface.cpp kappdcopiface.skel
 
 libkdecore_la_LDFLAGS = $(QT_LDFLAGS) $(KDE_RPATH) $(KDE_MT_LDFLAGS) $(X_LDFLAGS) \
                $(USER_LDFLAGS) -version-info 4:0 -no-undefined
-libkdecore_la_LIBADD = malloc/libklmalloc.la $(LIB_DCOP) ../libltdl/libltdlc.la \
$(LIB_XEXT) $(LIBRESOLV) $(LIBXINERAMA) $(LIB_DMALLOC) +libkdecore_la_LIBADD = \
svgicons/libkdesvgicons.la malloc/libklmalloc.la $(LIB_DCOP) ../libltdl/libltdlc.la \
$(LIB_XEXT) $(LIBRESOLV) $(LIBXINERAMA) $(LIB_DMALLOC)

 
 libkdecore_la_METASOURCES = AUTO
 
Index: kiconloader.cpp
===================================================================
RCS file: /home/kde/kdelibs/kdecore/kiconloader.cpp,v
retrieving revision 1.184
diff -u -p -b -r1.184 kiconloader.cpp
--- kiconloader.cpp	2002/02/14 16:57:45	1.184
+++ kiconloader.cpp	2002/02/16 14:10:58
@@ -41,6 +41,8 @@
 #include <stdlib.h>	//for abs
 #include <dirent.h>
 
+#include "svgicons/ksvgiconengine.h"
+#include "svgicons/ksvgiconpainter.h"
 
 /*** KIconThemeNode: A node in the icon theme dependancy tree. ***/
 
@@ -308,6 +310,14 @@ void KIconLoader::addBaseThemes(KIconThe
 KIcon KIconLoader::findMatchingIcon(const QString& name, int size) const
 {
     KIcon icon;
+    static const QString &svg_ext = KGlobal::staticQString(".svg");
+    icon = d->mpThemeRoot->findIcon(name + svg_ext, size, KIcon::MatchExact);
+    if (icon.isValid())
+      return icon;
+    icon = d->mpThemeRoot->findIcon(name + svg_ext, size, KIcon::MatchBest);
+    if (icon.isValid())
+      return icon;
+    
     static const QString &png_ext = KGlobal::staticQString(".png");
     icon = d->mpThemeRoot->findIcon(name + png_ext, size, KIcon::MatchExact);
     if (icon.isValid())
@@ -342,9 +352,10 @@ QString KIconLoader::iconPath(const QStr
     QString name = _name;
     QString ext = name.right(4);
 
+    static const QString &svg_ext = KGlobal::staticQString(".svg");
     static const QString &png_ext = KGlobal::staticQString(".png");
     static const QString &xpm_ext = KGlobal::staticQString(".xpm");
-    if (ext == png_ext || ext == xpm_ext)
+    if (ext == svg_ext || ext == png_ext || ext == xpm_ext)
     {
 #ifndef NDEBUG
 	kdDebug(264) << "Application " << KGlobal::instance()->instanceName()
@@ -356,6 +367,8 @@ QString KIconLoader::iconPath(const QStr
     QString path;
     if (group_or_size == KIcon::User)
     {
+	path = d->mpDirs->findResource("appicon", name + svg_ext);
+	if (path.isEmpty())
 	path = d->mpDirs->findResource("appicon", name + png_ext);
 	if (path.isEmpty())
 	     path = d->mpDirs->findResource("appicon", name + xpm_ext);
@@ -470,6 +483,7 @@ QPixmap KIconLoader::loadIcon(const QStr
 	group = KIcon::Desktop;
     }
 
+    static const QString &svg_ext = KGlobal::staticQString(".svg");
     static const QString &png_ext = KGlobal::staticQString(".png");
     static const QString &xpm_ext = KGlobal::staticQString(".xpm");
     if (!absolutePath)
@@ -480,7 +494,7 @@ QPixmap KIconLoader::loadIcon(const QStr
         else
         {
 	QString ext = name.right(4);
-	    if (ext == png_ext || ext == xpm_ext)
+	    if (ext == svg_ext || ext == png_ext || ext == xpm_ext)
 	{
 #ifndef NDEBUG
 	    kdDebug(264) << "Application "
@@ -565,11 +579,26 @@ QPixmap KIconLoader::loadIcon(const QStr
         if (inCache)
             return pix;
 
-        // Use the extension as the format. Works for XPM and PNG, which is all we \
support. +	// Use the extension as the format. Works for XPM and PNG, but not for SVG
         QString ext = icon.path.right(3).upper();
+	if(ext != "SVG")
+	{
         img = new QImage(icon.path, ext.latin1());
         if (img->isNull())
             return pix;
+	}
+	else
+	{
+	    // Special stuff for SVG icons
+	    KSVGIconEngine *svgEngine = new KSVGIconEngine();
+	    
+	    if(svgEngine->load(size, size, icon.path))
+		img = svgEngine->painter()->image();
+	    else
+		img = new QImage();
+	    
+	    delete svgEngine;
+	}
 
         iconType = icon.type;
         iconThreshold = icon.threshold;
Index: kicontheme.cpp
===================================================================
RCS file: /home/kde/kdelibs/kdecore/kicontheme.cpp,v
retrieving revision 1.39
diff -u -p -b -r1.39 kicontheme.cpp
--- kicontheme.cpp	2002/01/27 00:53:04	1.39
+++ kicontheme.cpp	2002/02/16 14:10:58
@@ -469,7 +469,7 @@ QString KIconThemeDir::iconPath(const QS
 QStringList KIconThemeDir::iconList() const
 {
     QDir dir(mDir);
-    QStringList lst = dir.entryList("*.png;*.xpm", QDir::Files);
+    QStringList lst = dir.entryList("*.svg;*.png;*.xpm", QDir::Files);
     QStringList result;
     QStringList::ConstIterator it;
     for (it=lst.begin(); it!=lst.end(); it++)


___________________________________________________
This message is from the kde-linux mailing list.
Account management:  http://mail.kde.org/mailman/listinfo/kde-linux.
Archives: http://lists.kde.org/.
More info: http://www.kde.org/faq.html.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic