From f0c67ccaf705321878cd0fd3f998cb037ef3c6e6 Mon Sep 17 00:00:00 2001 From: Lorn Potter Date: Sat, 4 May 2013 19:08:28 +1000 Subject: [PATCH] [connectionagent] fix qt5 package build --- connd/connd.pro | 22 +++++++++++-------- connd/qconnectionmanager.cpp | 14 +++++++++--- connectionagent.pro | 12 ++++++++-- .../connectionagentplugin.cpp | 6 +++++ connectionagentplugin/connectionagentplugin.h | 1 - .../connectionagentplugin.pro | 9 ++++++-- .../connectionagentplugin_plugin.cpp | 2 -- .../connectionagentplugin_plugin.h | 13 ++++++++++- makedist | 3 ++- rpm/connectionagent.spec | 14 +++++------- 10 files changed, 67 insertions(+), 29 deletions(-) diff --git a/connd/connd.pro b/connd/connd.pro index 6450bd7..a4b999d 100644 --- a/connd/connd.pro +++ b/connd/connd.pro @@ -2,18 +2,25 @@ QT += core network dbus gui QT -= gui -TARGET = connectionagent +equals(QT_MAJOR_VERSION, 4): { + TARGET = connectionagent + INCLUDEPATH += libconnman-qt + INCLUDEPATH += lipstick + LIBS += -lconnman-qt4 -llipstick +} +equals(QT_MAJOR_VERSION, 5): { + TARGET = connectionagent + INCLUDEPATH += libconnman-qt5 + INCLUDEPATH += lipstick + LIBS += -lconnman-qt5 -llipstick-qt5 +} + CONFIG += console link_pkgconfig CONFIG -= app_bundle TEMPLATE = app QT += core network dbus -QT -= gui - - -INCLUDEPATH += libconnman-qt -INCLUDEPATH += lipstick OTHER_FILES += com.jolla.Connectiond.xml @@ -29,9 +36,6 @@ HEADERS+= \ qconnectionmanager.h \ connadaptor.h -LIBS += -lconnman-qt4 -LIBS += -llipstick - target.path = /usr/bin INSTALLS += target diff --git a/connd/qconnectionmanager.cpp b/connd/qconnectionmanager.cpp index 89ae8b9..4081fe5 100644 --- a/connd/qconnectionmanager.cpp +++ b/connd/qconnectionmanager.cpp @@ -17,15 +17,23 @@ #include "qconnectionmanager.h" #include "connadaptor.h" +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#include +#include +#include +#include +#include +#else #include - #include #include #include #include +#endif + #include -#include +#include #include @@ -164,7 +172,7 @@ void QConnectionManager::sendUserReply(const QVariantMap &input) void QConnectionManager::onServiceAdded(const QString &servicePath) { - qDebug() << Q_FUNC_INFO; + qDebug() << Q_FUNC_INFO << servicePath; if (!servicesMap.contains(servicePath)) { updateServicesMap(); } diff --git a/connectionagent.pro b/connectionagent.pro index 9ffda0e..cf6367a 100644 --- a/connectionagent.pro +++ b/connectionagent.pro @@ -2,10 +2,18 @@ TEMPLATE = subdirs TEMPLATE += ordered - SUBDIRS += config SUBDIRS += connd SUBDIRS += connectionagentplugin -SUBDIRS += test/testqml +equals(QT_MAJOR_VERSION, 4): { + SUBDIRS += test/testqml + OTHER_FILES += rpm/connectionagent.spec \ + rpm/connectionagent.yaml +} + +equals(QT_MAJOR_VERSION, 5): { + OTHER_FILES += rpm/connectionagent-qt5.spec \ + rpm/connectionagent-qt5.yaml +} diff --git a/connectionagentplugin/connectionagentplugin.cpp b/connectionagentplugin/connectionagentplugin.cpp index 94265b4..1d32a3e 100644 --- a/connectionagentplugin/connectionagentplugin.cpp +++ b/connectionagentplugin/connectionagentplugin.cpp @@ -17,9 +17,15 @@ #include "connectionagentplugin.h" #include "connectionamanagerinterface.h" +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#include +#include +#include +#else #include #include #include +#endif #include diff --git a/connectionagentplugin/connectionagentplugin.h b/connectionagentplugin/connectionagentplugin.h index 9f819eb..f8fa7bb 100644 --- a/connectionagentplugin/connectionagentplugin.h +++ b/connectionagentplugin/connectionagentplugin.h @@ -17,7 +17,6 @@ #ifndef CONNECTIONAGENTPLUGIN_H #define CONNECTIONAGENTPLUGIN_H -#include #include "connectionagentplugin.h" #include "connectionamanagerinterface.h" diff --git a/connectionagentplugin/connectionagentplugin.pro b/connectionagentplugin/connectionagentplugin.pro index b69a5ff..37057e0 100644 --- a/connectionagentplugin/connectionagentplugin.pro +++ b/connectionagentplugin/connectionagentplugin.pro @@ -1,13 +1,18 @@ TEMPLATE = lib TARGET = connectionagentplugin -QT += declarative dbus +QT += dbus CONFIG += qt plugin uri = com.jolla.connection #create client #system(qdbusxml2cpp ../connd/com.jollamobile.Connectiond.xml -c ConnectionManagerInterface -p connectionamanagerinterface) - +equals(QT_MAJOR_VERSION, 4): { + QT += declarative +} +equals(QT_MAJOR_VERSION, 5): { + QT += quick +} SOURCES += \ connectionagentplugin_plugin.cpp \ connectionagentplugin.cpp \ diff --git a/connectionagentplugin/connectionagentplugin_plugin.cpp b/connectionagentplugin/connectionagentplugin_plugin.cpp index 69842f1..71718fc 100644 --- a/connectionagentplugin/connectionagentplugin_plugin.cpp +++ b/connectionagentplugin/connectionagentplugin_plugin.cpp @@ -17,8 +17,6 @@ #include "connectionagentplugin_plugin.h" #include "connectionagentplugin.h" -#include - /* *This class is for accessing connman's UserAgent from multiple sources. *This is because currently, there can only be one UserAgent per system. diff --git a/connectionagentplugin/connectionagentplugin_plugin.h b/connectionagentplugin/connectionagentplugin_plugin.h index 9d7de1f..add95b1 100644 --- a/connectionagentplugin/connectionagentplugin_plugin.h +++ b/connectionagentplugin/connectionagentplugin_plugin.h @@ -16,8 +16,19 @@ #ifndef CONNECTIONAGENTPLUGIN_PLUGIN_H #define CONNECTIONAGENTPLUGIN_PLUGIN_H +#include -#include +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +# include +# include +# include +# define QDeclarativeEngine QQmlEngine +# define QDeclarativeExtensionPlugin QQmlExtensionPlugin +#else +# include +# include +# include +#endif class ConnectionagentpluginPlugin : public QDeclarativeExtensionPlugin { diff --git a/makedist b/makedist index f260801..dbb5e3c 100755 --- a/makedist +++ b/makedist @@ -14,10 +14,11 @@ PROJECT=$(basename $PWD) # Parse it from any Qt *.pro or *.pri files in CWD: # PROJECT=$(grep -E "TARGET ?= ?" *.pr[io]|cut -d' ' -f3) -while getopts ht: o +while getopts qht: o do case $o in h) head=1;; t) TAG="$OPTARG";; + q) PROJECT="$PROJECT"-qt5;; ?) printf >&2 "Usage: $0 [-h] [-t TAG]\n" exit 2;; esac diff --git a/rpm/connectionagent.spec b/rpm/connectionagent.spec index dec89fc..cb1941b 100644 --- a/rpm/connectionagent.spec +++ b/rpm/connectionagent.spec @@ -1,6 +1,6 @@ # # Do NOT Edit the Auto-generated Part! -# Generated by: spectacle version 0.25 +# Generated by: spectacle version 0.26 # Name: connectionagent @@ -9,17 +9,17 @@ Name: connectionagent # << macros Summary: User Agent daemon -Version: 0.4 +Version: 0.6.2 Release: 0 Group: Communications/Connectivity Adaptation License: LGPLv2 URL: http://github.com/lpotter/connectionagent Source0: %{name}-%{version}.tar.bz2 Source100: connectionagent.yaml -Requires: connman-qt-declarative +Requires: connman-qt5-declarative BuildRequires: pkgconfig(QtCore) BuildRequires: pkgconfig(QtDBus) -BuildRequires: pkgconfig(connman-qt4) +BuildRequires: pkgconfig(connman-qt5) BuildRequires: pkgconfig(lipstick) %description @@ -45,7 +45,6 @@ Requires: %{name} = %{version} %description test This package contains the declarative plugin for connection agent. - %prep %setup -q -n %{name}-%{version} @@ -56,7 +55,7 @@ This package contains the declarative plugin for connection agent. # >> build pre # << build pre -%qmake +%qmake5 make %{?jobs:-j%jobs} @@ -72,7 +71,6 @@ rm -rf %{buildroot} # >> install post # << install post - %files %defattr(-,root,root,-) %{_bindir}/connectionagent @@ -83,7 +81,7 @@ rm -rf %{buildroot} %files declarative %defattr(-,root,root,-) -%{_libdir}/qt4/imports/com/jolla/connection/* +%{_libdir}/qt5/imports/com/jolla/connection/* # >> files declarative # << files declarative