[tracker/albumart-qt] tracker-extract: Port QuillImageFilter usage to QImage



commit a802026572b5fa1518a5e8c17e17abc32d17720c
Author: Philip Van Hoof <philip codeminded be>
Date:   Thu Oct 21 11:10:25 2010 +0200

    tracker-extract: Port QuillImageFilter usage to QImage

 configure.ac                                       |   44 ++++++++++----------
 src/tracker-extract/Makefile.am                    |    8 ++--
 ...-albumart-quill.cpp => tracker-albumart-qt.cpp} |   45 +++----------------
 3 files changed, 33 insertions(+), 64 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 5c29453..8a5f1c2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -141,7 +141,7 @@ LIBNOTIFY_REQUIRED=0.4.3
 HAL_REQUIRED=0.5
 UPOWER_REQUIRED=0.9.0
 GDKPIXBUF_REQUIRED=2.12.0
-QUILL_REQUIRED=1.0.0
+QT_REQUIRED=4.7.1
 MEEGOTOUCH_REQUIRED=0.20
 POPPLER_REQUIRED=0.12.2
 CAIRO_REQUIRED=1.0
@@ -528,45 +528,45 @@ AC_ARG_ENABLE(gdkpixbuf,
               [enable_gdkpixbuf=auto])
 
 ##################################################################
-# Check for QUILL needed for the MP3 album art extractor
+# Check for Qt needed for the MP3 album art extractor
 ##################################################################
 
-AC_ARG_ENABLE(quill,
-              AS_HELP_STRING([--enable-quill],
-                             [enable QUILL support, (MP3 album art) [[default=auto]]]),,
-              [enable_quill=auto])
+AC_ARG_ENABLE(qt,
+              AS_HELP_STRING([--enable-qt],
+                             [enable Qt support, (MP3 album art) [[default=auto]]]),,
+              [enable_qt=auto])
 
 selected_for_albumart="no  (disabled)"
 
 
 ##################################################################
-# Check for QUILL needed for the MP3 album art extractor cont
+# Check for Qt needed for the MP3 album art extractor cont
 ##################################################################
 
 
-if test "x$enable_quill" != "xno" && test "x$enable_gdkpixbuf" != "xyes"; then
-   PKG_CHECK_MODULES(QUILL,
-                     [quillimagefilter >= $QUILL_REQUIRED],
-                     [have_quill=yes],
-                     [have_quill=no])
-   AC_SUBST(QUILL_LIBS)
-   AC_SUBST(QUILL_CFLAGS)
+if test "x$enable_qt" != "xno" && test "x$enable_gdkpixbuf" != "xyes"; then
+   PKG_CHECK_MODULES(QT,
+                     [QtGui >= $QT_REQUIRED],
+                     [have_qt=yes],
+                     [have_qt=no])
+   AC_SUBST(QT_LIBS)
+   AC_SUBST(QT_CFLAGS)
 
-   if test "x$have_quill" = "xyes"; then
-      AC_DEFINE(HAVE_QUILL, [], [Define if we have QUILL])
-      selected_for_albumart="yes (libquill)"
+   if test "x$have_qt" = "xyes"; then
+      AC_DEFINE(HAVE_QT, [], [Define if we have Qt])
+      selected_for_albumart="yes (qt)"
    fi
 else
-   have_quill="no  (disabled)"
+   have_qt="no  (disabled)"
 fi
 
-if test "x$enable_quill" = "xyes"; then
-   if test "x$have_quill" != "xyes"; then
-      AC_MSG_ERROR([Couldn't find QUILL >= $QUILL_REQUIRED.])
+if test "x$enable_qt" = "xyes"; then
+   if test "x$have_qt" != "xyes"; then
+      AC_MSG_ERROR([Couldn't find Qt >= $QT_REQUIRED.])
    fi
 fi
 
-AM_CONDITIONAL(HAVE_QUILL, test "x$have_quill" = "xyes")
+AM_CONDITIONAL(HAVE_QT, test "x$have_qt" = "xyes")
 
 ##################################################################
 # Check for GdkPixbuf, needed for the MP3 album art extractor cont
diff --git a/src/tracker-extract/Makefile.am b/src/tracker-extract/Makefile.am
index 3c46ab0..d6f4a9d 100644
--- a/src/tracker-extract/Makefile.am
+++ b/src/tracker-extract/Makefile.am
@@ -371,10 +371,10 @@ if HAVE_GDKPIXBUF
 tracker_extract_LDADD += $(GDKPIXBUF_LIBS)
 tracker_extract_SOURCES += tracker-albumart-pixbuf.c
 else
-if HAVE_QUILL
-INCLUDES += $(QUILL_CFLAGS)
-tracker_extract_SOURCES += tracker-albumart-quill.cpp
-tracker_extract_LDADD += $(QUILL_LIBS)
+if HAVE_QT
+INCLUDES += $(QT_CFLAGS)
+tracker_extract_SOURCES += tracker-albumart-qt.cpp
+tracker_extract_LDADD += $(QT_LIBS)
 else
 tracker_extract_SOURCES += tracker-albumart-dummy.c
 endif
diff --git a/src/tracker-extract/tracker-albumart-quill.cpp b/src/tracker-extract/tracker-albumart-qt.cpp
similarity index 63%
rename from src/tracker-extract/tracker-albumart-quill.cpp
rename to src/tracker-extract/tracker-albumart-qt.cpp
index 84b93bb..906d1f0 100644
--- a/src/tracker-extract/tracker-albumart-quill.cpp
+++ b/src/tracker-extract/tracker-albumart-qt.cpp
@@ -1,4 +1,3 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 /*
  * Copyright (C) 2010, Nokia
  *
@@ -25,15 +24,13 @@
 #include <QFile>
 #include <QBuffer>
 #include <QImageReader>
-#include <QuillImageFilterFactory>
+#include <QImageWriter>
 
 #include <glib.h>
 #include <gio/gio.h>
 
 #include "tracker-albumart-generic.h"
 
-#define TRACKER_ALBUMART_QUILL_SAVE "org.maemo.save"
-
 G_BEGIN_DECLS
 
 gboolean
@@ -43,8 +40,7 @@ tracker_albumart_file_to_jpeg (const gchar *filename,
 	QFile file (filename);
 
 	if (!file.open (QIODevice::ReadOnly)) {
-		g_message ("Could not get QFile from JPEG file:'%s'",
-		           filename);
+		g_message ("Could not get QFile from file: '%s'", filename);
 		return FALSE;
 	}
 
@@ -56,28 +52,15 @@ tracker_albumart_file_to_jpeg (const gchar *filename,
 	QImageReader reader (&buffer);
 
 	if (!reader.canRead ()) {
-		g_message ("Could not get QImageReader from JPEG file, canRead was FALSE");
+		g_message ("Could not get QImageReader from file: '%s', reader.canRead was FALSE",
+		           filename);
 		return FALSE;
 	}
 
 	QImage image;
-	QuillImageFilter *filter;
 
 	image = reader.read ();
-	filter = QuillImageFilterFactory::createImageFilter (TRACKER_ALBUMART_QUILL_SAVE);
-
-	if (!filter) {
-		g_message ("Could not get QuillImageFilter from JPEG file using:'%s'",
-		           TRACKER_ALBUMART_QUILL_SAVE);
-
-		return FALSE;
-	}
-
-	filter->setOption (QuillImageFilter::FileFormat, QVariant (QString ("jpeg")));
-	filter->setOption (QuillImageFilter::FileName, QVariant (QString (target)));
-	filter->apply (image);
-
-	delete filter;
+	image.save (QString (target), "jpeg");
 
 	return TRUE;
 }
@@ -107,30 +90,16 @@ tracker_albumart_buffer_to_jpeg (const unsigned char *buffer,
 	}
 
 	if (!reader) {
-		g_message ("Could not get QImageReader from JPEG buffer");
+		g_message ("Could not get QImageReader from buffer");
 		return FALSE;
 	}
 
 	QImage image;
-	QuillImageFilter *filter;
 
 	image = reader->read ();
-	filter = QuillImageFilterFactory::createImageFilter (TRACKER_ALBUMART_QUILL_SAVE);
-
-	if (!filter) {
-		g_message ("Could not get QuillImageFilter from JPEG buffer using:'%s'",
-		           TRACKER_ALBUMART_QUILL_SAVE);
-		delete reader;
-
-		return FALSE;
-	}
-
-	filter->setOption (QuillImageFilter::FileFormat, QVariant (QString ("jpeg")));
-	filter->setOption (QuillImageFilter::FileName, QVariant (QString (target)));
-	filter->apply (image);
+	image.save (QString (target), "jpeg");
 
 	delete reader;
-	delete filter;
 
 	return TRUE;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]