[Kde-imaging] branches/extragear/kde3/libs/kipi-plugins

Valerio Fuoglio valerio at ulteo.com
Sun Jul 22 19:18:38 CEST 2007


SVN commit 690988 by vfuoglio:

Dropped imlib2 dipendency from SlideShow plugin

CCMAIL: kde-imaging at kde.org



 M  +3 -7      Makefile.am  
 M  +1 -0      NEWS  
 M  +1 -2      README  
 M  +0 -12     configure.in.bot  
 M  +0 -63     configure.in.in  
 M  +4 -4      slideshow/Makefile.am  
 D             slideshow/imlibiface.cpp  
 D             slideshow/imlibiface.h  
 M  +69 -15    slideshow/slideshow.cpp  
 M  +30 -4     slideshow/slideshow.h  


--- branches/extragear/kde3/libs/kipi-plugins/Makefile.am #690987:690988
@@ -1,9 +1,5 @@
 # Do *NOT* indent the content of the ifs, this will break the generated
 # Makefile
-if compile_SLIDESHOW
-SLIDESHOWDIR = slideshow
-endif
-
 if compile_KAMERAKLIENT
 KAMERAKLIENTDIR = kameraklient
 endif
@@ -30,9 +26,9 @@
 
 SUBDIRS = common printwizard mpegencoder cdarchiving simpleviewerexport \
 	      sendimages batchprocessimages wallpaper findimages galleryexport flickrexport \
-	      jpeglossless timeadjust gpssync metadataedit imageviewer picasawebexport\
-	      $(SLIDESHOWDIR) $(KAMERAKLIENTDIR) $(ACQUIREIMAGESDIR) $(RAWCONVERTERDIR) \
-	      $(HTMLEXPORTDIR) $(IPODEXPORTDIR) $(CALENDARDIR)
+	      jpeglossless timeadjust gpssync metadataedit imageviewer picasawebexport slideshow \
+	      $(KAMERAKLIENTDIR) $(ACQUIREIMAGESDIR) $(RAWCONVERTERDIR) $(HTMLEXPORTDIR)  \
+              $(IPODEXPORTDIR) $(CALENDARDIR)
 
 rcdir = $(kde_datadir)/kipi
 rc_DATA = tips
--- branches/extragear/kde3/libs/kipi-plugins/NEWS #690987:690988
@@ -8,6 +8,7 @@
 PrintWizard    : Added exif management.
 PrintWizard    : Prints exif date-time info.
 PicasaWebExport: New plugin to export pictures to Picasa web service (by Vardhman Jain).
+SlideShow      : Dropped imlib2 dependency
 
 Kipi-plugins BUG FIXING from B.K.O (http://bugs.kde.org):
 
--- branches/extragear/kde3/libs/kipi-plugins/README #690987:690988
@@ -115,7 +115,6 @@
 libxslt     >= 1.1                          http://xmlsoft.org/XSLT
 libgpod     >= 0.4.2                        http://www.gtkpod.org/libgpod
 libkcal     >= 3.4.x                        http://pim.kde.org
-imlib2      >= 1.1.0                        http://www.enlightenment.org/Libraries/Imlib2
 ImageMagick >= 5.5.4 (runtime dependency)   http://www.imagemagick.org
 MJPEGTools  >= 1.6.0 (runtime dependency)   http://mjpeg.sourceforge.net
 K3b         >= 0.11  (runtime dependency)   http://www.k3b.org
@@ -124,7 +123,7 @@
 -------------------------------------------------------------------------
 
 jpeglossless       : imagemagick (runtime dependency)
-slideshow          : libimlib2, OpenGL support for libqt
+slideshow          : OpenGL support for libqt
 batchprocessimages : imagemagick (runtime dependency)
 cdarchiving        : k3b (runtime dependency)
 kameraklient       : libgphoto2
--- branches/extragear/kde3/libs/kipi-plugins/configure.in.bot #690987:690988
@@ -73,18 +73,6 @@
   echo "-- libkcal found.................. YES"
 fi
 
-if test -z "$ac_imlib2_config"; then
-  echo "-- imlib2 found................... NO"
-  echo ""
-  echo "SlideShow plugin needs imlib2-config. This plugin will not be compiled!"
-  echo "To complile this plugin, please install imlib2 development package."
-  echo "imlib2 website is at http://www.enlightenment.org/Libraries/Imlib2"
-  echo ""
-  all_tests=bad
-else
-  echo "-- imlib2 found................... YES"
-fi
-
 if test "x$have_GL" != "xyes"; then
   echo "-- OpenGL found................... NO"
   echo ""
--- branches/extragear/kde3/libs/kipi-plugins/configure.in.in #690987:690988
@@ -369,68 +369,5 @@
     AC_SUBST(GL_LIBS)
 fi
 
-#---------------------------------------------------------
-#
-# imlib2-detection - Slideshow plugin
-#
-#---------------------------------------------------------
 
-AC_DEFUN([KDE_FIND_IMLIB2_CONFIG],
-   [AC_MSG_CHECKING([for imlib2-config])
 
-imlib2_config_given=NO
-ac_imlib2_config=""
-
-AC_ARG_WITH(imlib2-config,
-        [  --with-imlib2-config     directory where \"imlib2-config\" lies ],
-        [  ac_imlib2_config="$withval/imlib2-config"
-           imlib2_config_given=yes
-        ])
-
-if test "$imlib2_config_given" = "yes"; then
-  if test ! -r $ac_imlib2_config; then
-    AC_MSG_RESULT(wrong file specified)
-    ac_imlib2_config=""
-  else
-    IMLIB2_CFLAGS=`$ac_imlib2_config --cflags`
-    LIB_IMLIB2=`$ac_imlib2_config --libs`
-    AC_SUBST(LIB_IMLIB2)
-    AC_SUBST(IMLIB2_CFLAGS)
-    AC_MSG_RESULT($ac_imlib2_config)
-  fi
-else
-  ac_imlib2_config=`which imlib2-config 2>/dev/null`
-  if test -z "$ac_imlib2_config"; then
-    AC_MSG_RESULT(no)
-  else
-    dummy=`echo "$ac_imlib2_config" | grep '/imlib2-config'`
-    if test -z "$dummy"; then
-      AC_MSG_RESULT(no)
-      ac_imlib2_config=""
-    else
-      LIB_IMLIB2=`$ac_imlib2_config --libs`
-      IMLIB2_CFLAGS=`$ac_imlib2_config --cflags`
-      imlib2_config=`echo "$LIB_IMLIB2" | grep lImlib2`
-      if test -z "$imlib2_config"; then
-        AC_MSG_RESULT(no)
-        ac_imlib2_config=""
-      else
-        AC_SUBST(LIB_IMLIB2)
-        AC_SUBST(IMLIB2_CFLAGS)
-        AC_MSG_RESULT($ac_imlib2_config)
-      fi
-    fi
-  fi
-fi
-
-])
-
-dnl Check if Imlib2 is installed properly
-KDE_FIND_IMLIB2_CONFIG
-
-AM_CONDITIONAL(compile_SLIDESHOW, test -n "$ac_imlib2_config" -a "$have_GL" = yes )
-
-if test -z "$ac_imlib2_config" -o "$have_GL" != yes; then
-	AC_MSG_WARN([Slideshow plugin will not be compiled])
-fi
-
--- branches/extragear/kde3/libs/kipi-plugins/slideshow/Makefile.am #690987:690988
@@ -1,6 +1,6 @@
 METASOURCES = AUTO
 
-INCLUDES = $(KIPI_PLUGINS_COMMON_INCLUDE) $(IMLIB2_CFLAGS)  $(LIBKIPI_CFLAGS) \
+INCLUDES = $(KIPI_PLUGINS_COMMON_INCLUDE) $(LIBKIPI_CFLAGS) \
 	   $(LIBKDCRAW_CFLAGS) $(all_includes)
 
 # Install this plugin in the KDE modules directory
@@ -9,10 +9,10 @@
 kipiplugin_slideshow_la_DEPENDENCIES = $(LIBKIPI_LIBS_DEP) $(LIBKDCRAW_LIBS_DEP) 
 
 kipiplugin_slideshow_la_SOURCES = plugin_slideshow.cpp slideshow.cpp \
-	slideshowconfig.cpp imlibiface.cpp slideshowgl.cpp toolbar.cpp slideshowconfigbase.ui listimageitems.cpp
+	slideshowconfig.cpp slideshowgl.cpp toolbar.cpp slideshowconfigbase.ui listimageitems.cpp
 
-#kipiplugin_slideshow_la_LIBADD = -lkdefx $(LIB_IMLIB2) $(GL_LIBS) $(LIBKIPI_LIBS) $(LIB_KDEUI) $(LIB_KDECORE) $(LIB_QT)
-kipiplugin_slideshow_la_LIBADD = -lkdefx -lImlib2 $(GL_LIBS) $(LIBKIPI_LIBS) $(LIBKDCRAW_LIBS)  \
+#kipiplugin_slideshow_la_LIBADD = -lkdefx  $(GL_LIBS) $(LIBKIPI_LIBS) $(LIB_KDEUI) $(LIB_KDECORE) $(LIB_QT)
+kipiplugin_slideshow_la_LIBADD = -lkdefx $(GL_LIBS) $(LIBKIPI_LIBS) $(LIBKDCRAW_LIBS)  \
 	                         $(LIB_KDEUI) $(LIB_KDECORE) $(LIB_KIO) $(LIB_QT)
 
 kipiplugin_slideshow_la_LDFLAGS = $(KIPI_PLUGINS_COMMON_LDFLAGS) -module $(KDE_PLUGIN) $(all_libraries) -lkipiplugins
--- branches/extragear/kde3/libs/kipi-plugins/slideshow/slideshow.cpp #690987:690988
@@ -25,13 +25,16 @@
 
 #include <qtimer.h>
 #include <qpixmap.h>
+#include <qimage.h>
 #include <qapplication.h>
 #include <qdesktopwidget.h>
 #include <qevent.h>
 #include <qcursor.h>
 #include <qfont.h>
+#include <qwmatrix.h>
 
 #include <kdebug.h>
+#include <kurl.h>
 #include <qtextcodec.h>
 
 extern "C"
@@ -42,17 +45,73 @@
 #include <time.h>
 }
 
-#include "imlibiface.h"
 #include "slideshow.h"
 #include "toolbar.h"
 
 #include <kdebug.h>
 
 namespace KIPISlideShowPlugin
+{ 
+
+//////////////////////////////////////   SlideShowImage CLASS   /////////////////////////////////////////
+
+SlideShowImage::SlideShowImage(QString path, int angle)
 {
+  m_path      =  new KURL(path);
+  m_filename = new QString(m_path->fileName());
 
-/////////////////////////////////////////////////////////////////////////////////////////////////////
+  m_angle     =  angle;
+  
+  // Rotate according to angle
+  if ( m_angle != 0 ) 
+  {
+    QWMatrix matrix;
+    matrix.rotate((double)m_angle);
+    
+    QImage toRotate(path);
+    m_qpixmap = new QPixmap(toRotate.xForm( matrix ));
+  }
+  else
+    m_qpixmap   =  new QPixmap(path);
+  
+}
 
+SlideShowImage::~SlideShowImage() {
+  if (m_filename)
+    delete(m_filename);
+  
+  if (m_qpixmap)
+    delete (m_qpixmap);
+  
+  if (m_path)
+    delete (m_path);
+}
+
+QPixmap* SlideShowImage::qpixmap() { return m_qpixmap; }
+QString SlideShowImage::filename() { return *m_filename; }
+
+void SlideShowImage::scale(int width, int height)
+{ 
+  QPixmap pixmap(width,height);
+  pixmap.fill(Qt::black);
+  QPainter p(&pixmap);
+  
+  QPixmap pix((m_qpixmap->convertToImage()).smoothScale(width, height, QImage::ScaleMin));
+  p.drawPixmap((width-pix.width())/2,
+                (height-pix.height())/2, pix,
+                 0, 0, pix.width(), pix.height());
+  
+  if ( m_qpixmap )
+    delete(m_qpixmap);
+  
+  m_qpixmap = new QPixmap(pixmap);
+}
+
+int SlideShowImage::height() { return m_qpixmap->height(); }
+int SlideShowImage::width() { return m_qpixmap->width();}
+
+/////////////////////////////////////////   SlideShow CLASS   //////////////////////////////////////////
+
 SlideShow::SlideShow(const FileList& fileList, const QStringList& commentsList, bool ImagesHasComments)
                      : QWidget(0, 0, WStyle_StaysOnTop | WType_Popup |
                                WX11BypassWM | WDestructiveClose)
@@ -94,7 +153,6 @@
 
     // ---------------------------------------------------------------
     
-    m_imIface   = new ImlibIface(this);
     m_currImage = 0;
     m_fileIndex = -1; // start with -1
     m_effect        = 0;
@@ -161,8 +219,6 @@
 
     if (m_currImage)
         delete m_currImage;
-    if (m_imIface)
-        delete m_imIface;
     
     if (m_config) {
         delete m_config;
@@ -346,11 +402,10 @@
     FileAnglePair fileAngle = m_fileList[m_fileIndex];
     QString file(fileAngle.first);
     int     angle(fileAngle.second);
+
+    m_currImage = new SlideShowImage(file,angle);
+    m_currImage->scale(width(), height());
     
-    m_currImage = new ImImageSS(m_imIface, file, angle);
-    m_currImage->fitSize(width(), height());
-    m_currImage->render();
-
     if (m_printName)
         printFilename();
     
@@ -395,9 +450,8 @@
     QString file(fileAngle.first);
     int     angle(fileAngle.second);
     
-    m_currImage = new ImImageSS(m_imIface, file, angle);
-    m_currImage->fitSize(width(), height());
-    m_currImage->render();
+    m_currImage = new SlideShowImage(file,angle);
+    m_currImage->scale(width(), height());
 
     if (m_printName)
         printFilename();
@@ -418,8 +472,8 @@
         return;
     
     bitBlt(this, 0, 0, m_currImage->qpixmap(),
-           0, 0, m_currImage->qpixmap()->width(),
-           m_currImage->qpixmap()->height(), Qt::CopyROP, true);
+           0, 0, m_currImage->width(),
+           m_currImage->height(), Qt::CopyROP, true);
 }
 
 
@@ -465,7 +519,7 @@
         bool breakLine = FALSE; // End Of Line found
         uint currIndex; //  Comments QString current index
 
-        // Check m_im_inal lines dimension
+        // Check minimal lines dimension
 
         uint commentsLinesLengthLocal = m_commentsLinesLength;
 
--- branches/extragear/kde3/libs/kipi-plugins/slideshow/slideshow.h #690987:690988
@@ -25,6 +25,7 @@
 // KDE includes
 
 #include <kconfig.h>
+#include <kurl.h>
 
 // QT includes
 
@@ -34,8 +35,10 @@
 #include <qstring.h>
 #include <qwidget.h>
 #include <qpainter.h>
+#include <qpixmap.h>
 #include <qmap.h>
 #include <qfont.h>
+#include <qstring.h>
 
 // Includes for libKIPI.
 #include <libkipi/imagecollection.h>
@@ -49,14 +52,38 @@
 namespace KIPISlideShowPlugin
 {
 
-class ImlibIface;
-class ImImageSS;
 class ToolBar;
 
 class SlideShow;
 
 typedef int (SlideShow::*EffectMethod)(bool);
 
+//////////////////////////////////////   SlideShowImage CLASS   /////////////////////////////////////////
+
+class SlideShowImage
+{
+  public:
+    
+    SlideShowImage(QString path, int angle);    
+    ~SlideShowImage();
+  
+  public:
+    QPixmap* qpixmap();
+    QString filename();
+    void scale(int width, int height);
+    int height();
+    int width();
+    
+  private:
+    
+    QPixmap* m_qpixmap;
+    QString* m_filename;
+    KURL*    m_path;
+    int      m_angle;
+};
+
+/////////////////////////////////////////   SlideShow CLASS   //////////////////////////////////////////
+
 class SlideShow : public QWidget
 {
     Q_OBJECT
@@ -109,8 +136,7 @@
     
     QMap<QString, EffectMethod> Effects;
 
-    ImlibIface*   m_imIface;
-    ImImageSS*    m_currImage;
+    SlideShowImage*   m_currImage;
     
     FileList    m_fileList;
     QStringList m_commentsList;


More information about the Kde-imaging mailing list