diff options
author | Andrew den Exter <andrew.den.exter@jollamobile.com> | 2014-02-06 17:14:18 +0000 |
---|---|---|
committer | Martyn Russell <martyn@lanedo.com> | 2014-02-06 17:30:29 +0000 |
commit | 5bab8ee72d2956e3814ced2ff3824bbadd2c8663 (patch) | |
tree | 8617c315a59041de6146869e7c86f32f1af4ef71 | |
parent | b7b028cb71833b168babe5e392f425cf3acf3221 (diff) | |
download | libmediaart-5bab8ee72d2956e3814ced2ff3824bbadd2c8663.tar.gz |
extract: Port Qt backend to Qt5 and NEMO platform
Commits squashed and based on tracker commits:
----------------------------------------------
8b3b8fe Fixes after review for Qt5 port
934eb10 Use minimal in Nemo for QGuiApplication for in case the compositor isn't running yet. Use QGuiApplication instead of QCoreApplicati
601be18 Port to Qt5.
8dfadf3 tracker-extract: Fix compile of Qt media art backend
-rw-r--r-- | configure.ac | 70 | ||||
-rw-r--r-- | libmediaart/extractqt.cpp | 29 |
2 files changed, 79 insertions, 20 deletions
diff --git a/configure.ac b/configure.ac index 2cf04e2..81777b4 100644 --- a/configure.ac +++ b/configure.ac @@ -139,7 +139,8 @@ CFLAGS="$CFLAGS" # Library required versions GLIB_REQUIRED=2.35.1 GDKPIXBUF_REQUIRED=2.12.0 -QT_REQUIRED=4.7.1 +QT5_REQUIRED=5.0.0 +QT4_REQUIRED=4.7.1 # Check requirements for libmediaart LIBMEDIAART_REQUIRED="glib-2.0 >= $GLIB_REQUIRED @@ -213,30 +214,51 @@ selected_for_media_art="no (disabled)" ################################################################## 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]) - - LIBMEDIAART_CFLAGS="$LIBMEDIAART_CFLAGS $QT_CFLAGS" - LIBMEDIAART_LIBS="$LIBMEDIAART_LIBS $QT_LIBS" - - if test "x$have_qt" = "xyes"; then + PKG_CHECK_MODULES(QT5, + [Qt5Gui >= $QT5_REQUIRED], + [have_qt5=yes], + [have_qt5=no]) + PKG_CHECK_MODULES(QT4, + [QtGui >= $QT4_REQUIRED], + [have_qt4=yes], + [have_qt4=no]) + + if test "x$have_qt5" = "xyes"; then + LIBMEDIAART_CFLAGS="$LIBMEDIAART_CFLAGS $QT5_CFLAGS -fPIC" + LIBMEDIAART_LIBS="$LIBMEDIAART_LIBS $QT5_LIBS" + + AC_DEFINE(HAVE_QT5, [], [Define if we have Qt5]) AC_DEFINE(HAVE_QT, [], [Define if we have Qt]) LIBMEDIAART_BACKEND=QtGui - selected_for_media_art="yes (qt)" + + selected_for_media_art="yes (qt5)" + else + if test "x$have_qt4" = "xyes"; then + LIBMEDIAART_CFLAGS="$LIBMEDIAART_CFLAGS $QT4_CFLAGS -fPIC" + LIBMEDIAART_LIBS="$LIBMEDIAART_LIBS $QT4_LIBS" + + AC_DEFINE(HAVE_QT4, [], [Define if we have Qt4]) + AC_DEFINE(HAVE_QT, [], [Define if we have Qt]) + + selected_for_media_art="yes (qt4)" + fi fi else - have_qt="no (disabled)" + have_qt4="no (disabled)" + have_qt5="no (disabled)" fi if test "x$enable_qt" = "xyes"; then - if test "x$have_qt" != "xyes"; then - AC_MSG_ERROR([Couldn't find Qt >= $QT_REQUIRED.]) + if test "x$have_qt5" != "xyes"; then + if test "x$have_qt4" != "xyes"; then + AC_MSG_ERROR([Couldn't find Qt4 >= $QT4_REQUIRED or Qt5 >= $QT5_REQUIRED.]) + fi fi fi -AM_CONDITIONAL(HAVE_QT, test "x$have_qt" = "xyes") +AM_CONDITIONAL(HAVE_QT4, test "x$have_qt4" = "xyes") +AM_CONDITIONAL(HAVE_QT5, test "x$have_qt5" = "xyes") +AM_CONDITIONAL(HAVE_QT, test "x$have_qt5" = "xyes" || test "x$have_qt4" = "xyes") if test "x$enable_gdkpixbuf" != "xno" && test "x$enable_quill" != "xyes"; then PKG_CHECK_MODULES(GDKPIXBUF, @@ -266,6 +288,22 @@ AM_CONDITIONAL(HAVE_GDKPIXBUF, test "x$have_gdkpixbuf" = "xyes") AC_SUBST(LIBMEDIAART_BACKEND) +################################################################# +# Check if we should install nemo specific features +################################################################# + +AC_ARG_ENABLE(nemo, + AS_HELP_STRING([--enable-nemo], + [enable nemo specific [[default=no]]]), + [enable_nemo="$enableval"], + [enable_nemo=no]) + +AM_CONDITIONAL(HAVE_NEMO, test "x$enable_nemo" = "xyes") + +if test "x$enable_nemo" = "xyes" ; then + AC_DEFINE(HAVE_NEMO, 1, [Define if we enable Nemo specific features]) +fi + #################################################################### # Should we build GLib based unit tests #################################################################### @@ -319,4 +357,6 @@ Build Configuration: Enable documentation: $enable_gtk_doc Support media art processing: $selected_for_media_art + + Support Nemo $enable_nemo " diff --git a/libmediaart/extractqt.cpp b/libmediaart/extractqt.cpp index 7651189..d41cc10 100644 --- a/libmediaart/extractqt.cpp +++ b/libmediaart/extractqt.cpp @@ -20,31 +20,50 @@ * Philip Van Hoof <philip@codeminded.be> */ -#include "tracker-main.h" +#include "config.h" #include <QFile> #include <QBuffer> #include <QImageReader> #include <QImageWriter> +#ifdef HAVE_QT5 +#include <QCoreApplication> +#else #include <QApplication> +#endif #include <QColor> #include <QPainter> #include <glib.h> -#include "tracker-media-art-generic.h" +#ifdef HAVE_NEMO +#include <stdlib.h> +#endif G_BEGIN_DECLS +#ifdef HAVE_QT5 +static QGuiApplication *app = NULL; +#else /* HAVE_QT4 (we fallback to Qt4) */ static QApplication *app = NULL; +#endif /* HAVE_QT5 */ void media_art_plugin_init (void) { - int argc = 0; - char *argv[2] = { NULL, NULL }; + int argc = 1; + char *argv[2] = { (char*) "libmediaart", NULL }; - app = new QApplication (argc, argv, QApplication::Tty); +#ifdef HAVE_QT5 + +#ifdef HAVE_NEMO + setenv("QT_QPA_PLATFORM", "minimal", 1); +#endif /* HAVE_NEMO */ + + app = new QGuiApplication (argc, argv); +#else /* HAVE_QT4 (we fallback to Qt4) */ + app = new QApplication (argc, argv, QApplication::Tty); +#endif /* HAVE_QT5 */ } void |