Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[nemo-transferengine] Allow nemo-transferengine to be built on Qt5
  • Loading branch information
Vesa Halttunen committed May 13, 2013
1 parent 983922c commit 3fb3c88
Show file tree
Hide file tree
Showing 9 changed files with 151 additions and 11 deletions.
2 changes: 1 addition & 1 deletion lib/imageoperation.cpp
Expand Up @@ -25,7 +25,7 @@
****************************************************************************************/

#include "imageoperation.h"
#include <quillmetadata/QuillMetadata>
#include <QuillMetadata>

#include <QFileInfo>
#include <QtDebug>
Expand Down
12 changes: 8 additions & 4 deletions lib/lib.pro
@@ -1,10 +1,12 @@
TEMPLATE = lib
TARGET = nemotransferengine
equals(QT_MAJOR_VERSION, 4): TARGET = nemotransferengine
equals(QT_MAJOR_VERSION, 5): TARGET = nemotransferengine-qt5
DEPENDPATH += .
INCLUDEPATH += .
CONFIG += shared link_pkgconfig
QT += dbus
CONFIG += quillmetadata
equals(QT_MAJOR_VERSION, 4): PKGCONFIG += quillmetadata
equals(QT_MAJOR_VERSION, 5): PKGCONFIG += quillmetadata-qt5

system(qdbusxml2cpp -v -c TransferEngineInterface -p transferengineinterface.h:transferengineinterface.cpp -i metatypedeclarations.h ../dbus/org.nemo.transferengine.xml)

Expand Down Expand Up @@ -39,12 +41,14 @@ SOURCES += \
OTHER_FILES += nemotransfernegine.pc nemotransferengine-plugin.prf

headers.files = $$HEADERS
headers.path = /usr/include/TransferEngine
equals(QT_MAJOR_VERSION, 4): headers.path = /usr/include/TransferEngine
equals(QT_MAJOR_VERSION, 5): headers.path = /usr/include/TransferEngine-qt5

target.path = /usr/lib

pkgconfigpc.path = /usr/lib/pkgconfig/
pkgconfigpc.files = nemotransferengine.pc
equals(QT_MAJOR_VERSION, 4): pkgconfigpc.files = nemotransferengine.pc
equals(QT_MAJOR_VERSION, 5): pkgconfigpc.files = nemotransferengine-qt5.pc

prf.path = $$[QT_INSTALL_DATA]/mkspecs/features
prf.files = nemotransferengine-plugin.prf
Expand Down
11 changes: 11 additions & 0 deletions lib/nemotransferengine-qt5.pc
@@ -0,0 +1,11 @@
prefix=/usr
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include/TransferEngine-qt5

Name: libnemotransferengine-qt5
Description: Nemo transfer engine library for share plugins and transfer engine API
Version: 0.0.1
Requires: Qt5Core Qt5DBus
Libs: -L${libdir} -lnemotransferengine-qt5
Cflags: -I${includedir}
119 changes: 119 additions & 0 deletions rpm/transfer-engine-qt5.spec
@@ -0,0 +1,119 @@
Name: nemo-transferengine-qt5
Version: 0.0.16
Release: 0
Summary: Transfer Engine for uploading media content and tracking transfers.
Group: System Environment/Daemon
License: LGPLv2.1
URL: https://github.com/nemomobile/transfer-engine
Source0: %{name}-%{version}.tar.gz
BuildRequires: pkgconfig(Qt5Core)
BuildRequires: pkgconfig(accounts-qt5)
BuildRequires: desktop-file-utils
BuildRequires: pkgconfig(mlite5)
BuildRequires: pkgconfig(quillmetadata-qt5)

%description
%{summary}.

%files
%defattr(-,root,root,-)
%dir %{_datadir}/nemo-transferengine
%{_libdir}/*.so*
%{_bindir}/nemo-transfer-engine
%{_datadir}/dbus-1/services/org.nemo.transferengine.service
%{_datadir}/translations/nemo-transfer-engine_eng_en.qm



%package devel
Summary: Development headers for transfer engine library.
Group: Development/Libraries
Requires: nemo-transferengine = %{version}

%description -n nemo-transferengine-qt5-devel
%{summary}.

%files devel
%defattr(-,root,root,-)
%{_includedir}/TransferEngine-qt5/*.h
%{_qt_datadir}/mkspecs/features/nemotransferengine-plugin.prf
%{_libdir}/pkgconfig/nemotransferengine-qt5.pc

%package ts-devel
Summary: Translation source for Nemo TransferEngine
License: LGPLv2.1
Group: System Environment/Daemon

%description ts-devel
Translation source for Nemo TransferEngine

%files ts-devel
%defattr(-,root,root,-)
%{_datadir}/translations/source/nemo-transfer-engine.ts

%package tests
Summary: Unit tests for Nemo TransferEngine
License: LGPLv2.1
Group: System Environment/Daemon

%description tests
Unit tests for Nemo TransferEngine

%files tests
%defattr(-,root,root,-)
/opt/tests/nemo-transfer-engine/*

%package doc
Summary: Documentation for Nemo TransferEngine
License: BSD
Group: System Environment/Daemon

%description doc
Documentation for Nemo TransferEngine

%files doc
%defattr(-,root,root,-)
%{_datadir}/doc/nemo-transferengine/*



%prep
%setup -q -n %{name}-%{version}

%build

%qmake5

make %{?jobs:-j%jobs}
make docs

%install
rm -rf %{buildroot}
mkdir -p %{buildroot}/%{_datadir}/nemo-transferengine
%qmake_install

mkdir -p %{buildroot}/%{_docdir}/%{name}
cp -R doc/html/* %{buildroot}/%{_docdir}/%{name}/

%define def_uid $(grep "^UID_MIN" /etc/login.defs | tr -s " " | cut -d " " -f2)
%define def_user $(getent passwd %def_uid | sed 's/:.*//')
%define db_file /home/%{def_user}/.local/nemo-transferengine/transferdb.sqlite
%define te_pid $(pgrep -f nemo-transfer-engine)

%post -n nemo-transferengine-qt5
/sbin/ldconfig
if [ -n "%{te_pid}" ]
then
kill -s 10 %{te_pid}
fi

exit 0

%postun -n nemo-transferengine-qt5
/sbin/ldconfig

if [ -f "%{db_file}" ]
then
rm %{db_file}
fi
exit 0
7 changes: 4 additions & 3 deletions src/src.pro
Expand Up @@ -5,14 +5,15 @@ INCLUDEPATH += . ../lib

QT += dbus sql

LIBS += -L../lib -lnemotransferengine
equals(QT_MAJOR_VERSION, 4): LIBS += -L../lib -lnemotransferengine
equals(QT_MAJOR_VERSION, 5): LIBS += -L../lib -lnemotransferengine-qt5

# generate adaptor code
system(qdbusxml2cpp -c TransferEngineAdaptor -a transferengineadaptor.h:transferengineadaptor.cpp -i metatypedeclarations.h ../dbus/org.nemo.transferengine.xml)

CONFIG += link_pkgconfig
PKGCONFIG += mlite
PKGCONFIG += accounts-qt
equals(QT_MAJOR_VERSION, 4): PKGCONFIG += mlite accounts-qt
equals(QT_MAJOR_VERSION, 5): PKGCONFIG += mlite5 accounts-qt5

# translations
TS_FILE = $$OUT_PWD/nemo-transfer-engine.ts
Expand Down
5 changes: 3 additions & 2 deletions tests/tests.pro
Expand Up @@ -2,7 +2,9 @@ TEMPLATE = app
TARGET = ut_nemo-transfer-engine
DEPENDPATH += .
INCLUDEPATH += . ../src ../lib

CONFIG += link_pkgconfig
equals(QT_MAJOR_VERSION, 4): PKGCONFIG += quillmetadata
equals(QT_MAJOR_VERSION, 5): PKGCONFIG += quillmetadata-qt5

# Test files
HEADERS += \
Expand All @@ -27,7 +29,6 @@ SOURCES += \
../lib/mediaitem.cpp


LIBS += -lquillmetadata
QT += testlib

PATH = /opt/tests/nemo-transfer-engine
Expand Down
2 changes: 1 addition & 1 deletion tests/ut_imageoperation.cpp
Expand Up @@ -26,7 +26,7 @@

#include "ut_imageoperation.h"
#include <qtest.h>
#include <quillmetadata/QuillMetadata>
#include <QuillMetadata>
#include "imageoperation.h"
#include <QtDebug>
#include <QDir>
Expand Down
2 changes: 2 additions & 0 deletions tests/ut_mediatransferinterface.cpp
Expand Up @@ -149,6 +149,7 @@ void ut_mediatransferinterface::testProgress()



#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
void ut_mediatransferinterface::testStatus_data()
{
QTest::addColumn<MediaTransferInterface::TransferStatus>("status");
Expand Down Expand Up @@ -176,3 +177,4 @@ void ut_mediatransferinterface::testStatus()


Q_DECLARE_METATYPE(MediaTransferInterface::TransferStatus)
#endif
2 changes: 2 additions & 0 deletions tests/ut_mediatransferinterface.h
Expand Up @@ -59,8 +59,10 @@ private slots:
void cleanup();
void testSetMediaItem();
void testProgress();
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
void testStatus_data();
void testStatus();
#endif

private:
TestInterface *tf;
Expand Down

0 comments on commit 3fb3c88

Please sign in to comment.