Skip to content

Commit

Permalink
[connectionagent] fix qt5 package build
Browse files Browse the repository at this point in the history
  • Loading branch information
Lorn Potter committed May 4, 2013
1 parent fa6d480 commit f0c67cc
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 29 deletions.
22 changes: 13 additions & 9 deletions connd/connd.pro
Expand Up @@ -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

Expand All @@ -29,9 +36,6 @@ HEADERS+= \
qconnectionmanager.h \
connadaptor.h

LIBS += -lconnman-qt4
LIBS += -llipstick

target.path = /usr/bin
INSTALLS += target

Expand Down
14 changes: 11 additions & 3 deletions connd/qconnectionmanager.cpp
Expand Up @@ -17,15 +17,23 @@
#include "qconnectionmanager.h"
#include "connadaptor.h"

#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <connman-qt5/useragent.h>
#include <connman-qt5/networkmanager.h>
#include <connman-qt5/networktechnology.h>
#include <connman-qt5/networkservice.h>
#include <connman-qt5/sessionagent.h>
#else
#include <connman-qt/useragent.h>

#include <connman-qt/networkmanager.h>
#include <connman-qt/networktechnology.h>
#include <connman-qt/networkservice.h>
#include <connman-qt/sessionagent.h>
#endif

#include <QtDBus/QDBusConnection>

#include <Qt/qobject.h>
#include <QObject>
#include <QSettings>


Expand Down Expand Up @@ -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();
}
Expand Down
12 changes: 10 additions & 2 deletions connectionagent.pro
Expand Up @@ -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
}

6 changes: 6 additions & 0 deletions connectionagentplugin/connectionagentplugin.cpp
Expand Up @@ -17,9 +17,15 @@
#include "connectionagentplugin.h"
#include "connectionamanagerinterface.h"

#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <connman-qt5/networkmanager.h>
#include <connman-qt5/networktechnology.h>
#include <connman-qt5/networkservice.h>
#else
#include <connman-qt/networkmanager.h>
#include <connman-qt/networktechnology.h>
#include <connman-qt/networkservice.h>
#endif

#include <qobject.h>

Expand Down
1 change: 0 additions & 1 deletion connectionagentplugin/connectionagentplugin.h
Expand Up @@ -17,7 +17,6 @@
#ifndef CONNECTIONAGENTPLUGIN_H
#define CONNECTIONAGENTPLUGIN_H

#include <QDeclarativeItem>
#include "connectionagentplugin.h"
#include "connectionamanagerinterface.h"

Expand Down
9 changes: 7 additions & 2 deletions 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 \
Expand Down
2 changes: 0 additions & 2 deletions connectionagentplugin/connectionagentplugin_plugin.cpp
Expand Up @@ -17,8 +17,6 @@
#include "connectionagentplugin_plugin.h"
#include "connectionagentplugin.h"

#include <qdeclarative.h>

/*
*This class is for accessing connman's UserAgent from multiple sources.
*This is because currently, there can only be one UserAgent per system.
Expand Down
13 changes: 12 additions & 1 deletion connectionagentplugin/connectionagentplugin_plugin.h
Expand Up @@ -16,8 +16,19 @@

#ifndef CONNECTIONAGENTPLUGIN_PLUGIN_H
#define CONNECTIONAGENTPLUGIN_PLUGIN_H
#include <QtPlugin>

#include <QDeclarativeExtensionPlugin>
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
# include <QtQml>
# include <QQmlEngine>
# include <QQmlExtensionPlugin>
# define QDeclarativeEngine QQmlEngine
# define QDeclarativeExtensionPlugin QQmlExtensionPlugin
#else
# include <QtDeclarative>
# include <QDeclarativeEngine>
# include <QDeclarativeExtensionPlugin>
#endif

class ConnectionagentpluginPlugin : public QDeclarativeExtensionPlugin
{
Expand Down
3 changes: 2 additions & 1 deletion makedist
Expand Up @@ -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
Expand Down
14 changes: 6 additions & 8 deletions 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
Expand All @@ -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
Expand All @@ -45,7 +45,6 @@ Requires: %{name} = %{version}
%description test
This package contains the declarative plugin for connection agent.


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

Expand All @@ -56,7 +55,7 @@ This package contains the declarative plugin for connection agent.
# >> build pre
# << build pre

%qmake
%qmake5

make %{?jobs:-j%jobs}

Expand All @@ -72,7 +71,6 @@ rm -rf %{buildroot}
# >> install post
# << install post


%files
%defattr(-,root,root,-)
%{_bindir}/connectionagent
Expand All @@ -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

Expand Down

0 comments on commit f0c67cc

Please sign in to comment.