Generate qt and gtk zbarcam applications

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
epel9
Mauro Carvalho Chehab 8 years ago
parent 7715ab8df2
commit f637bc2280

@ -3,7 +3,7 @@
Name: zbar Name: zbar
Version: 0.10 Version: 0.10
Release: 28%{?dist} Release: 29%{?dist}
Summary: Bar code reader Summary: Bar code reader
Group: User Interface/X Hardware Support Group: User Interface/X Hardware Support
@ -16,6 +16,8 @@ Patch2: zbar_choose_supported_format_first.patch
Patch3: zbar_use_REQBUFS_properly.patch Patch3: zbar_use_REQBUFS_properly.patch
Patch4: zbar_configure_ac_use_m4_pattern_allow.patch Patch4: zbar_configure_ac_use_m4_pattern_allow.patch
Patch5: zbar_add_support_for_qt5.patch Patch5: zbar_add_support_for_qt5.patch
Patch6: zbar_generate_qt_gtk_apps.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: autoconf automake libtool python-devel gettext-devel BuildRequires: autoconf automake libtool python-devel gettext-devel
@ -92,6 +94,7 @@ scanning widget.
%patch3 -p1 %patch3 -p1
%patch4 -p1 %patch4 -p1
%patch5 -p1 %patch5 -p1
%patch6 -p1
%build %build
autoreconf -vfi autoreconf -vfi
@ -162,6 +165,7 @@ rm -rf $RPM_BUILD_ROOT
%files gtk %files gtk
%defattr(-,root,root,-) %defattr(-,root,root,-)
%{_libdir}/libzbargtk.so.* %{_libdir}/libzbargtk.so.*
%{_bindir}/zbarcam-gtk
%files gtk-devel %files gtk-devel
%defattr(-,root,root,-) %defattr(-,root,root,-)
@ -177,6 +181,7 @@ rm -rf $RPM_BUILD_ROOT
%files qt %files qt
%defattr(-,root,root,-) %defattr(-,root,root,-)
%{_libdir}/libzbarqt.so.* %{_libdir}/libzbarqt.so.*
%{_bindir}/zbarcam-qt
%files qt-devel %files qt-devel
%defattr(-,root,root,-) %defattr(-,root,root,-)
@ -186,7 +191,7 @@ rm -rf $RPM_BUILD_ROOT
%changelog %changelog
* Sun Mar 26 2017 Mauro Carvalho Chehab <mchehab@s-opensource.com> - 0.10-29 * Sun Mar 26 2017 Mauro Carvalho Chehab <mchehab@s-opensource.com> - 0.10-29
- Make zbar-qt to use Qt5 - Make zbar-qt to use Qt5 and generate gtk and qt applications
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.10-28 * Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.10-28
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

@ -0,0 +1,148 @@
From 76a286fd34d5159b55de4d4f276dcbf69d1b263e Mon Sep 17 00:00:00 2001
From: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Date: Sun, 26 Mar 2017 09:43:07 -0300
Subject: [PATCH] zbarcam: add qt and gtk variants
The original zbarcam use standard X11 libraries to display
video. That provides an ugly interface, and could be
slow on high resolutions.
As Zbar has already test examples for qt and gtk, let's
promote them to real applications. One advantage is that
both qt and gtk libraries will be tested when building
those.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
diff --git a/qt/Makefile.am.inc b/qt/Makefile.am.inc
index dc1525e0d52a..5f860bfa31bc 100644
--- a/qt/Makefile.am.inc
+++ b/qt/Makefile.am.inc
@@ -7,6 +7,7 @@ qt_libzbarqt_la_SOURCES = qt/QZBar.cpp qt/QZBarThread.h qt/QZBarThread.cpp
nodist_qt_libzbarqt_la_SOURCES = qt/moc_QZBar.cpp qt/moc_QZBarThread.cpp
BUILT_SOURCES += $(nodist_qt_libzbarqt_la_SOURCES)
DISTCLEANFILES += $(nodist_qt_libzbarqt_la_SOURCES)
+CLEANFILES += qt/moc_%.cpp
qt/moc_%.cpp: qt/%.h
$(MOC) $(qt_libzbarqt_la_CPPFLAGS) $< -o $@
diff --git a/test/Makefile.am.inc b/test/Makefile.am.inc
index 7340a7f2f61f..8496eb30f3cc 100644
--- a/test/Makefile.am.inc
+++ b/test/Makefile.am.inc
@@ -45,26 +45,6 @@ test_dbg_scan_CPPFLAGS = $(MAGICK_CFLAGS) $(AM_CPPFLAGS)
test_dbg_scan_LDADD = $(MAGICK_LIBS) -lMagick++ zbar/libzbar.la $(AM_LDADD)
endif
-if HAVE_GTK
-check_PROGRAMS += test/test_gtk
-test_test_gtk_SOURCES = test/test_gtk.c test/scan_video.c
-test_test_gtk_CPPFLAGS = $(GTK_CFLAGS) $(AM_CPPFLAGS)
-test_test_gtk_LDADD = $(GTK_LIBS) gtk/libzbargtk.la $(AM_LDADD)
-endif
-
-if HAVE_QT
-check_PROGRAMS += test/test_qt
-test_test_qt_SOURCES = test/test_qt.cpp test/scan_video.c
-nodist_test_test_qt_SOURCES = test/moc_test_qt.h
-test_test_qt_CPPFLAGS = -Itest $(QT_CFLAGS) $(AM_CPPFLAGS)
-test_test_qt_LDADD = $(QT_LIBS) qt/libzbarqt.la $(AM_LDADD)
-BUILT_SOURCES += $(nodist_test_test_qt_SOURCES)
-DISTCLEANFILES += $(nodist_test_test_qt_SOURCES)
-
-test/moc_%.h: test/%.cpp
- $(MOC) -i $(test_test_qt_CPPFLAGS) $< -o $@
-endif
-
EXTRA_DIST += test/test_pygtk.py test/test_perl.pl
# automake bug in "monolithic mode"?
diff --git a/zbarcam/Makefile.am.inc b/zbarcam/Makefile.am.inc
index ea869bcd2e11..5aa788a23da5 100644
--- a/zbarcam/Makefile.am.inc
+++ b/zbarcam/Makefile.am.inc
@@ -2,7 +2,32 @@ bin_PROGRAMS += zbarcam/zbarcam
zbarcam_zbarcam_SOURCES = zbarcam/zbarcam.c
zbarcam_zbarcam_LDADD = zbar/libzbar.la
# automake bug in "monolithic mode"?
-CLEANFILES += zbarcam/.libs/zbarcam
+CLEANFILES += zbarcam/.libs/zbarcam zbarcam/moc_zbarcam_qt.h
+
+if HAVE_GTK
+bin_PROGRAMS += zbarcam/zbarcam-gtk
+check_PROGRAMS += zbarcam/zbarcam-gtk
+zbarcam_zbarcam_gtk_SOURCES = zbarcam/zbarcam-gtk.c zbarcam/scan_video.c
+zbarcam_zbarcam_gtk_CPPFLAGS = $(GTK_CFLAGS) $(AM_CPPFLAGS)
+zbarcam_zbarcam_gtk_LDADD = $(GTK_LIBS) gtk/libzbargtk.la $(AM_LDADD)
+endif
+
+if HAVE_QT
+bin_PROGRAMS += zbarcam/zbarcam-qt
+check_PROGRAMS += zbarcam/zbarcam-qt
+
+zbarcam_zbarcam_qt_SOURCES = zbarcam/zbarcam-qt.cpp zbarcam/scan_video.c
+nodist_zbarcam_zbarcam_qt_SOURCES = zbarcam/moc_zbarcam_qt.h
+zbarcam_zbarcam_qt_CPPFLAGS = -Izbarcam $(QT_CFLAGS) $(AM_CPPFLAGS)
+zbarcam_zbarcam_qt_LDADD = $(QT_LIBS) qt/libzbarqt.la $(AM_LDADD)
+BUILT_SOURCES += $(nodist_zbarcam_zbarcam_qt_SOURCES)
+DISTCLEANFILES += $(nodist_zbarcam_zbarcam_qt_SOURCES) zbarcam/moc_zbarcam_qt.h
+
+
+zbarcam/moc_zbarcam_qt.h: zbarcam/zbarcam-qt.cpp
+ $(MOC) -i $(zbarcam_zbarcam_qt_CPPFLAGS) $< -o $@
+endif
+
if WIN32
zbarcam_zbarcam_SOURCES += zbarcam/zbarcam.rc
diff --git a/test/scan_video.c b/zbarcam/scan_video.c
similarity index 100%
rename from test/scan_video.c
rename to zbarcam/scan_video.c
diff --git a/test/test_gtk.c b/zbarcam/zbarcam-gtk.c
similarity index 100%
rename from test/test_gtk.c
rename to zbarcam/zbarcam-gtk.c
diff --git a/test/test_qt.cpp b/zbarcam/zbarcam-qt.cpp
similarity index 97%
rename from test/test_qt.cpp
rename to zbarcam/zbarcam-qt.cpp
index 96d2f9541453..3a39a338b59d 100644
--- a/test/test_qt.cpp
+++ b/zbarcam/zbarcam-qt.cpp
@@ -40,7 +40,7 @@ int scan_video(void *add_device,
const char *default_device);
}
-class TestQZBar : public QWidget
+class ZbarcamQZBar : public QWidget
{
Q_OBJECT
@@ -52,7 +52,7 @@ protected:
}
public:
- TestQZBar (const char *default_device)
+ ZbarcamQZBar (const char *default_device)
{
// drop-down list of video devices
QComboBox *videoList = new QComboBox;
@@ -142,7 +142,7 @@ private:
zbar::QZBar *zbar;
};
-#include "moc_test_qt.h"
+#include "moc_zbarcam_qt.h"
int main (int argc, char *argv[])
{
@@ -152,7 +152,7 @@ int main (int argc, char *argv[])
if(argc > 1)
dev = argv[1];
- TestQZBar window(dev);
+ ZbarcamQZBar window(dev);
window.show();
return(app.exec());
}
Loading…
Cancel
Save