examples: Port Qt examples to Qt5

This commit is contained in:
Sebastian Dröge 2014-01-20 09:46:15 +01:00
parent 26e3c92093
commit 5dd8e9cdd4
3 changed files with 37 additions and 15 deletions

View file

@ -275,21 +275,44 @@ AM_CONDITIONAL(HAVE_GTK_X11, test "x$HAVE_GTK_X11" = "xyes")
AM_CONDITIONAL(HAVE_GTK_QUARTZ, test "x$HAVE_GTK_QUARTZ" = "xyes") AM_CONDITIONAL(HAVE_GTK_QUARTZ, test "x$HAVE_GTK_QUARTZ" = "xyes")
dnl QT is optional and only used in examples dnl QT is optional and only used in examples
PKG_CHECK_MODULES(QT, QtGui >= 4.6, [ PKG_CHECK_MODULES(QT, Qt5Gui Qt5Widgets, [
HAVE_QT_GV=yes
HAVE_QT=yes HAVE_QT=yes
], [ ], [
HAVE_QT_GV=no HAVE_QT=no
PKG_CHECK_MODULES(QT, QtGui >= 4.0, HAVE_QT=yes, HAVE_QT=no)
]) ])
if test "x$HAVE_QT" = "xyes"; then if test "x$HAVE_QT" = "xyes"; then
AC_MSG_CHECKING([Qt moc]) AC_CHECK_TOOL(QT_MOC, moc)
QT4_MOC=`$PKG_CONFIG --variable=moc_location QtGui` AC_MSG_CHECKING([for Qt5 moc])
AC_MSG_RESULT($QT4_MOC) mocversion=`$QT_MOC -v 2>&1`
AC_SUBST(QT4_MOC) mocversiongrep=`echo $mocversion | grep "Qt 5\|moc 5"`
if test x"$mocversiongrep" != x"$mocversion"; then
AC_MSG_RESULT([no])
# moc was not the qt5 one, try with moc-qt5
AC_CHECK_TOOL(QT_MOC, moc-qt5)
AC_MSG_CHECKING([for Qt5 moc-qt5])
mocversion=`$QT_MOC -v 2>&1`
mocversiongrep=`echo $mocversion | grep "Qt 5\|moc 5"`
if test x"$mocversiongrep" != x"$mocversion"; then
AC_CHECK_TOOL(QTCHOOSER, qtchooser)
AC_MSG_CHECKING([for qtchooser])
qt5tooldir=`QT_SELECT=qt5 qtchooser -print-env | grep QTTOOLDIR | cut -d '=' -f 2 | cut -d \" -f 2`
mocversion=`$qt5tooldir/moc -v 2>&1`
mocversiongrep=`echo $mocversion | grep "Qt 5\|moc 5"`
if test x"$mocversiongrep" != x"$mocversion"; then
# no valid moc found
QT_MOC="no"
else
QT_MOC=$qt5tooldir/moc
fi
else
QT_MOC=$QT_MOC
fi
fi
AC_SUBST(QT_MOC)
AC_MSG_RESULT([$QT_MOC])
fi fi
AM_CONDITIONAL(HAVE_QT, test "x$HAVE_QT" = "xyes") AM_CONDITIONAL(HAVE_QT, test "x$HAVE_QT" = "xyes")
AM_CONDITIONAL(HAVE_QT_GV, test "x$HAVE_QT_GV" = "xyes") AM_CONDITIONAL(HAVE_QT_MOC, test "x$HAVE_QT_MOC" != "xno")
dnl chck for linux headers needed by the joystick seek example dnl chck for linux headers needed by the joystick seek example
AC_COMPILE_IFELSE( AC_COMPILE_IFELSE(

View file

@ -16,17 +16,17 @@ if HAVE_QT
EXAMPLES += qt-videooverlay EXAMPLES += qt-videooverlay
qt_videooverlay_SOURCES = qt-videooverlay.cpp qt_videooverlay_SOURCES = qt-videooverlay.cpp
qt_videooverlay_CXXFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CXXFLAGS) $(X_CFLAGS) $(QT_CFLAGS) qt_videooverlay_CXXFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CXXFLAGS) $(X_CFLAGS) $(QT_CFLAGS) -fPIC
qt_videooverlay_LDADD = \ qt_videooverlay_LDADD = \
$(top_builddir)/gst-libs/gst/video/libgstvideo-$(GST_API_VERSION).la \ $(top_builddir)/gst-libs/gst/video/libgstvideo-$(GST_API_VERSION).la \
$(GST_LIBS) $(X_LIBS) $(LIBM) $(QT_LIBS) $(GST_LIBS) $(X_LIBS) $(LIBM) $(QT_LIBS)
endif endif
if HAVE_QT_GV if HAVE_QT_MOC
EXAMPLES += qtgv-videooverlay EXAMPLES += qtgv-videooverlay
qtgv_videooverlay_SOURCES = qtgv-videooverlay.cpp qtgv-videooverlay.h qtgv_videooverlay_SOURCES = qtgv-videooverlay.cpp qtgv-videooverlay.h
qtgv_videooverlay_CXXFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CXXFLAGS) $(X_CFLAGS) $(QT_CFLAGS) qtgv_videooverlay_CXXFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CXXFLAGS) $(X_CFLAGS) $(QT_CFLAGS) -fPIC
qtgv_videooverlay_LDADD = \ qtgv_videooverlay_LDADD = \
$(top_builddir)/gst-libs/gst/video/libgstvideo-$(GST_API_VERSION).la \ $(top_builddir)/gst-libs/gst/video/libgstvideo-$(GST_API_VERSION).la \
$(GST_LIBS) $(X_LIBS) $(LIBM) $(QT_LIBS) $(GST_LIBS) $(X_LIBS) $(LIBM) $(QT_LIBS)
@ -36,11 +36,10 @@ qtgv_videooverlay_LDADD = \
nodist_qtgv_videooverlay_SOURCES = moc_qtgv-videooverlay.cpp nodist_qtgv_videooverlay_SOURCES = moc_qtgv-videooverlay.cpp
moc_%.cpp:%.h moc_%.cpp:%.h
$(AM_V_GEN)$(QT4_MOC) $< -o $@ $(AM_V_GEN)$(QT_MOC) $< -o $@
EXTRA_DIST = $(nodist_qtgv_videooverlay_SOURCES:moc_%.cpp=%.h) EXTRA_DIST = $(nodist_qtgv_videooverlay_SOURCES:moc_%.cpp=%.h)
CLEANFILES = $(nodist_qtgv_videooverlay_SOURCES) CLEANFILES = $(nodist_qtgv_videooverlay_SOURCES)
endif endif
endif endif

View file

@ -83,7 +83,7 @@ int main(int argc, char *argv[])
{ {
gst_init (&argc, &argv); gst_init (&argc, &argv);
QApplication app(argc, argv); QApplication app(argc, argv);
app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit ())); app.setQuitOnLastWindowClosed(true);
/* prepare the pipeline */ /* prepare the pipeline */