[Kst] branches/work/kst/portto4/kst/src/datasources/qimagesource

George Staikos staikos at kde.org
Thu Feb 22 23:56:48 CET 2007


SVN commit 636381 by staikos:

qimagesource is ported and at least one bug is fixed.  Will forward port


 M  +2 -17     CMakeLists.txt  
 M  +7 -7      qimagesource.cpp  


--- branches/work/kst/portto4/kst/src/datasources/qimagesource/CMakeLists.txt #636380:636381
@@ -1,5 +1,5 @@
 
-include_directories( ${CMAKE_SOURCE_DIR}/kst/src/libkst ${CMAKE_SOURCE_DIR}/kst/src/extdate ${KDE4_INCLUDE_DIR} ${QT_INCLUDES}  )
+include_directories( ${CMAKE_SOURCE_DIR}/src/libkst ${CMAKE_SOURCE_DIR}/src/extdate ${KDE4_INCLUDE_DIR} ${QT_INCLUDES}  )
 
 
 ########### next target ###############
@@ -10,7 +10,7 @@
 
 kde4_add_plugin(kstdata_qimagesource ${kstdata_qimagesource_PART_SRCS})
 
-target_link_libraries(kstdata_qimagesource  ${KDE4_KDECORE_LIBS} )
+target_link_libraries(kstdata_qimagesource  ${KDE4_KDECORE_LIBS} kst)
 
 install(TARGETS kstdata_qimagesource DESTINATION ${PLUGIN_INSTALL_DIR} )
 
@@ -20,18 +20,3 @@
 install( FILES  kstdata_qimagesource.desktop DESTINATION ${SERVICES_INSTALL_DIR}/kst )
 
 
-
-#original Makefile.am contents follow:
-
-#INCLUDES=-I$(top_srcdir)/kst/src/libkst -I$(top_srcdir)/kst/src/extdate $(all_includes)
-#
-#kde_module_LTLIBRARIES=kstdata_qimagesource.la
-#
-#kstdata_qimagesource_la_LDFLAGS=$(all_libraries) -module -avoid-version
-#kstdata_qimagesource_la_SOURCES=qimagesource.cpp
-#
-#METASOURCES=AUTO
-#
-#services_DATA=kstdata_qimagesource.desktop
-#servicesdir=$(kde_servicesdir)/kst
-#
--- branches/work/kst/portto4/kst/src/datasources/qimagesource/qimagesource.cpp #636380:636381
@@ -16,12 +16,13 @@
  ***************************************************************************/
 
 #include "qimagesource.h"
+#include <QImageReader>
 #include <qcolor.h>
 
 
 QimagesourceSource::QimagesourceSource(KConfig *cfg, const QString& filename, const QString& type)
 : KstDataSource(cfg, filename, type) {
-  _image.reset();
+  _image = QImage();
   if (init()) {
     _valid = true;
   }
@@ -40,7 +41,7 @@
 
 bool QimagesourceSource::init() {
 
-  _image.reset();
+  _image = QImage();
   _matrixList.clear();
   _fieldList.clear();
   _frameCount = 0;
@@ -64,7 +65,7 @@
     _matrixList.append( "4" );
     return update() == KstObject::UPDATE;
   } else {
-    _image.reset();
+    _image = QImage();
     return false;
   }
 }
@@ -242,16 +243,15 @@
 }
 
 int understands_qimagesource(KConfig*, const QString& filename) {
-  QString ftype( QImage::imageFormat( filename ) );
+  QString ftype( QImageReader::imageFormat( filename ) );
 
   if ( ftype.isEmpty() ) return 0;
 
   if ( ftype == "TIFF" ) {
-    if ( ftype.find( ".tif",  -5, false )<0 ) return 0;
+    if ( !filename.endsWith(".tif") ) return 0;
   }
 
   return 90;
-
 }
 
 
@@ -266,7 +266,7 @@
   if (typeSuggestion) {
     *typeSuggestion = "QImage compatible Image";
   }
-  if ( QImage::imageFormat( filename ) ) {
+  if ( !QImageReader::imageFormat( filename ).isEmpty() ) {
     fieldList.append("INDEX");
     fieldList.append( "GRAY" );
     fieldList.append( "RED" );


More information about the Kst mailing list