I have made the following changes intended for : nemo:devel:mw / connman-qt
Please review and accept or decline. BOSS has already run some checks on this request. See the "Messages from BOSS" section below. https://build.merproject.org//request/show/210 Thank You, Dmitry Rozhkov [This message was auto-generated] --- Request # 210: Messages from BOSS: State: review at 2013-04-15T11:07:36 by cibot Reviews: accepted by cibot : Prechecks succeeded. new for nemo:devel:mw : Please replace this text with a review and approve/reject the review (not the SR). BOSS will take care of the rest Changes: submit: home:rozhkov:branches:nemo:devel:mw / connman-qt -> nemo:devel:mw / connman-qt changes files: -------------- --- connman-qt.changes +++ connman-qt.changes @@ -0,0 +1,6 @@ +* Mon Apr 15 2013 Dmitry Rozhkov <[email protected]> - 1.0.2 +- fixup the Counter API, and add to declarative +- update for qt5 build +- add roaming property to service +- Fix D-Bus introspection XMLs + old: ---- connman-qt-1.0.1.tar.bz2 new: ---- connman-qt-1.0.2.tar.bz2 spec files: ----------- --- connman-qt.spec +++ connman-qt.spec @@ -8,8 +8,8 @@ # >> macros # << macros -Summary: qt bindings for connman -Version: 1.0.1 +Summary: Qt bindings for connman +Version: 1.0.2 Release: 1 Group: System/GUI/Other License: Apache License @@ -32,7 +32,7 @@ %package tests -Summary: tests for connman-qt +Summary: Tests for connman-qt Group: Development/Libraries Requires: %{name} = %{version}-%{release} Requires: connman-qt-declarative other changes: -------------- ++++++ connman-qt-1.0.1.tar.bz2 -> connman-qt-1.0.2.tar.bz2 --- connman-qt.pro +++ connman-qt.pro @@ -11,3 +11,13 @@ !notest { SUBDIRS += test } + +equals(QT_MAJOR_VERSION, 4): { + OTHER_FILES += rpm/connman-qt.spec \ + rpm/connman-qt.yaml +} + +equals(QT_MAJOR_VERSION, 5): { + OTHER_FILES += rpm/connman-qt5.spec \ + rpm/connman-qt5.yaml +} --- examples +++ examples +(directory) --- examples/counters +++ examples/counters +(directory) --- examples/counters/counters.pro +++ examples/counters/counters.pro @@ -0,0 +1,19 @@ + +QT += core dbus + +QT -= gui + +TARGET = counters +CONFIG += console +CONFIG -= app_bundle + +TEMPLATE = app + +LIBS += -lconnman-qt4 +INCLUDEPATH += /usr/include/connman-qt + +SOURCES += main.cpp \ + networkcounter.cpp + +HEADERS += \ + networkcounter.h --- examples/counters/main.cpp +++ examples/counters/main.cpp @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Jolla Ltd +** Contact: [email protected] +** +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QCoreApplication> +#include "networkcounter.h" + + +int main(int argc, char *argv[]) +{ + QCoreApplication a(argc, argv); + NetworkCounter counter(&a); + + + + return a.exec(); +} --- examples/counters/networkcounter.cpp +++ examples/counters/networkcounter.cpp @@ -0,0 +1,87 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Jolla Ltd +** Contact: [email protected] +** +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "networkcounter.h" +#include <connman-qt/counter.h> +#include <QtCore> + +NetworkCounter::NetworkCounter(QObject *parent) : + QObject(parent) +{ + counter = new Counter(this); + + connect(counter,SIGNAL(counterChanged(QString,QVariantMap,bool)),this,SLOT(counterChanged(QString,QVariantMap,bool))); + connect(counter,SIGNAL(bytesReceivedChanged(quint32)),this,SLOT(bytesReceivedChanged(quint32))); + connect(counter,SIGNAL(bytesTransmittedChanged(quint32)),this,SLOT(bytesTransmittedChanged(quint32))); + connect(counter,SIGNAL(secondsOnlineChanged(quint32)),this,SLOT(secondsOnlineChanged(quint32))); + connect(counter,SIGNAL(roamingChanged(bool)),SLOT(roamingChanged(bool))); + + counter->setRunning(true); +} + +void NetworkCounter::counterChanged(const QString servicePath, const QVariantMap &counters, bool roaming) +{ + QTextStream out(stdout); + out << endl << Q_FUNC_INFO << " " << servicePath << " " << (roaming ? "roaming" : "home") << endl; +} + +void NetworkCounter::bytesReceivedChanged(quint32 bytesRx) +{ + QTextStream out(stdout); + out << Q_FUNC_INFO << " " << bytesRx << endl; +} + +void NetworkCounter::bytesTransmittedChanged(quint32 bytesTx) +{ + QTextStream out(stdout); + out << Q_FUNC_INFO << " " << bytesTx << endl; +} + +void NetworkCounter::secondsOnlineChanged(quint32 seconds) +{ + QTextStream out(stdout); + out << Q_FUNC_INFO << " " << seconds << endl; +} + +void NetworkCounter::roamingChanged(bool roaming) +{ + QTextStream out(stdout); + out << Q_FUNC_INFO << " " << roaming << endl; +} --- examples/counters/networkcounter.h +++ examples/counters/networkcounter.h @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Jolla Ltd +** Contact: [email protected] +** +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef NETWORKCOUNTER_H +#define NETWORKCOUNTER_H + +#include <QObject> +#include <connman-qt/counter.h> + +class NetworkCounter : public QObject +{ + Q_OBJECT +public: + explicit NetworkCounter(QObject *parent = 0); + +signals: + +public slots: + void counterChanged(const QString servicePath, const QVariantMap &counters, bool roaming); + + void bytesReceivedChanged(quint32 bytesRx); + + void bytesTransmittedChanged(quint32 bytesTx); + + void secondsOnlineChanged(quint32 seconds); + + void roamingChanged(bool roaming); +private: + Counter *counter; + +}; + +#endif // NETWORKCOUNTER_H --- libconnman-qt/connman-manager.xml +++ libconnman-qt/connman-manager.xml @@ -39,8 +39,14 @@ <method name="UnregisterCounter" tp:name-for-bindings="Unregister_Counter"> <arg name="path" type="o"/> </method> + + <method name="CreateSession" tp:name-for-bindings="Create_Session"> <arg name="settings" type="a{sv}"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/> + <arg name="notifier" type="o"/> + <arg name="session" type="o" direction="out"/> + </method> + <method name="DestroySession" tp:name-for-bindings="Destroy_Session"> <arg name="session" type="o"/> </method> @@ -80,13 +86,5 @@ <arg name="value" type="v"/> </signal> - <method name="CreateSession" tp:name-for-bindings="Create_Session"> - <arg name="settings" type="a{sv}"> - <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/> - <arg name="notifier" type="o"/> - <arg type="o" direction="out"/> - </method> - - </interface> </node> --- libconnman-qt/connman-notification.xml +++ libconnman-qt/connman-notification.xml @@ -4,9 +4,9 @@ <method name="Release" tp:name-for-bindings="Release" /> - <method name="Update" tp:name-for-bindings="Update"/> - <arg name="settings" type="a{sv}"> - <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value=QVariantMap"/> + <method name="Update" tp:name-for-bindings="Update"> + <arg name="settings" type="a{sv}"/> + <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/> </method> </interface> --- libconnman-qt/connman-session.xml +++ libconnman-qt/connman-session.xml @@ -13,10 +13,5 @@ <arg name="value" type="v"/> </method> - <method name="Update" tp:name-for-bindings="Update"/> - <arg name="settings" type="a{sv}"/> - <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value=QVariantMap"/> - </method> - </interface> </node> --- libconnman-qt/counter.cpp +++ libconnman-qt/counter.cpp @@ -16,14 +16,20 @@ Counter::Counter(QObject *parent) : QObject(parent), - m_manager(NetworkManagerFactory::createInstance()) + m_manager(NetworkManagerFactory::createInstance()), + bytesInHome(0), + bytesOutHome(0), + secondsOnlineHome(0), + bytesInRoaming(0), + bytesOutRoaming(0), + secondsOnlineRoaming(0), + roamingEnabled(0), + currentInterval(1), + currentAccuracy(1024), + isRunning(0) { new CounterAdaptor(this); QDBusConnection::systemBus().registerObject(COUNTER_PATH, this); - - if (m_manager->isAvailable()) { - m_manager->registerCounter(QString(COUNTER_PATH),1024,5); - } } Counter::~Counter() @@ -32,16 +38,154 @@ void Counter::serviceUsage(const QString &servicePath, const QVariantMap &counters, bool roaming) { - latestCounts.insert(servicePath, counters); Q_EMIT counterChanged(servicePath, counters, roaming); + + if (roaming != roamingEnabled) { + Q_EMIT roamingChanged(roaming); + roamingEnabled = roaming; + } + + quint32 rxbytes = counters["RX.Bytes"].toUInt(); + quint32 txbytes = counters["TX.Bytes"].toUInt(); + quint32 time = counters["Time"].toUInt(); + + if (rxbytes != 0) + Q_EMIT bytesReceivedChanged(rxbytes); + if ( txbytes!= 0) + Q_EMIT bytesTransmittedChanged(txbytes); + if (time!= 0) + Q_EMIT secondsOnlineChanged(time); + + if (roaming) { + if (rxbytes != 0) { + bytesInRoaming = rxbytes; + } + if (txbytes != 0) { + bytesOutRoaming = txbytes; + } + if (time != 0) { + secondsOnlineRoaming = time; + } + } else { + if (rxbytes != 0) { + bytesInHome = rxbytes; + } + if (txbytes != 0) { + bytesOutHome = txbytes; + } + if (time != 0) { + secondsOnlineHome = time; + } + } +} + +void Counter::release() +{ +} + +bool Counter::roaming() const +{ + return roamingEnabled; +} + +quint32 Counter::bytesReceived() const +{ + if (roamingEnabled) { + return bytesInRoaming; + } else { + return bytesInHome; + } + return 0; +} + +quint32 Counter::bytesTransmitted() const +{ + if (roamingEnabled) { + return bytesOutRoaming; + } else { + return bytesOutHome; + } + return 0; +} + +quint32 Counter::secondsOnline() const +{ + if (roamingEnabled) { + return secondsOnlineRoaming; + } else { + return secondsOnlineHome; + } + return 0; +} + +/* + *The accuracy value is in kilo-bytes. It defines + the update threshold. + +Changing the accuracy will reset the counters, as it will +need to be re registered from the manager. +*/ +void Counter::setAccuracy(quint32 accuracy) +{ + currentAccuracy = accuracy; + reRegister(); + Q_EMIT accuracyChanged(accuracy); +} + +quint32 Counter::accuracy() const +{ + return currentAccuracy; +} + +/* + *The interval value is in seconds. +Changing the accuracy will reset the counters, as it will +need to be re registered from the manager. +*/ +void Counter::setInterval(quint32 interval) +{ + currentInterval = interval; + reRegister(); + Q_EMIT intervalChanged(interval); +} + +quint32 Counter::interval() const +{ + return currentInterval; +} + +void Counter::reRegister() +{ + if (m_manager->isAvailable()) { + m_manager->unregisterCounter(QString(COUNTER_PATH)); + m_manager->registerCounter(QString(COUNTER_PATH),currentAccuracy,currentInterval); + } +} + +void Counter::setRunning(bool on) +{ + if (on) { + if (m_manager->isAvailable()) { + m_manager->registerCounter(QString(COUNTER_PATH),currentAccuracy,currentInterval); + isRunning = true; + } + } else { + if (m_manager->isAvailable()) { + m_manager->unregisterCounter(QString(COUNTER_PATH)); + isRunning = false; + } + } } -QVariantMap Counter::latestStats(const QString &servicePath) +bool Counter::running() const { - return latestCounts[servicePath]; + return isRunning; } +/* + *This is the dbus adaptor to the connman interface + **/ CounterAdaptor::CounterAdaptor(Counter* parent) : QDBusAbstractAdaptor(parent), m_counter(parent) @@ -54,16 +198,18 @@ void CounterAdaptor::Release() { + m_counter->release(); } void CounterAdaptor::Usage(const QDBusObjectPath &service_path, const QVariantMap &home, const QVariantMap &roaming) { - if (roaming.isEmpty()) { + if (!home.isEmpty()) { // home m_counter->serviceUsage(service_path.path(), home, false); - } else if (home.isEmpty()) { + } + if (!roaming.isEmpty()) { //roaming m_counter->serviceUsage(service_path.path(), roaming, true); } --- libconnman-qt/counter.h +++ libconnman-qt/counter.h @@ -17,41 +17,82 @@ class NetworkManager; +/* + * Proxy class for interface net.connman.Counter + */ class Counter : public QObject { Q_OBJECT + Q_PROPERTY(quint32 bytesReceived READ bytesReceived NOTIFY bytesReceivedChanged) + Q_PROPERTY(quint32 bytesTransmitted READ bytesTransmitted NOTIFY bytesTransmittedChanged) + Q_PROPERTY(quint32 secondsOnline READ secondsOnline NOTIFY secondsOnlineChanged) + Q_PROPERTY(bool roaming READ roaming NOTIFY roamingChanged) + Q_PROPERTY(quint32 accuracy READ accuracy WRITE setAccuracy NOTIFY accuracyChanged) + Q_PROPERTY(quint32 interval READ interval WRITE setInterval NOTIFY intervalChanged) + + Q_PROPERTY(bool running READ running WRITE setRunning NOTIFY runningChanged) + Q_DISABLE_COPY(Counter) public: explicit Counter(QObject *parent = 0); virtual ~Counter(); - void serviceUsage(const QString &servicePath, const QVariantMap &counters, bool roaming); - void secondsOnline(const QString &servicePath); - QVariantMap latestStats(const QString &servicePath); - QPair <quint32, quint32> latestBytes(const QString &servicePath); + quint32 bytesReceived() const; + quint32 bytesTransmitted() const; + quint32 secondsOnline() const; + + bool roaming() const; + + quint32 accuracy() const; + void setAccuracy(quint32 accuracy); + + quint32 interval() const; + void setInterval(quint32 interval); + + bool running() const; + void setRunning(bool on); signals: - // "RX.Bytes", "RX.Packets" - // "TX.Bytes", "TX.Packets" - // "Time" - void counterChanged(const QString servicePath, const QVariantMap &counters, bool roaming); - -public slots: + void counterChanged(const QString servicePath, const QVariantMap &counters, bool roaming); + void bytesReceivedChanged(quint32 bytesRx); + void bytesTransmittedChanged(quint32 bytesTx); + void secondsOnlineChanged(quint32 seconds); + void roamingChanged(bool roaming); + void accuracyChanged(quint32 accuracy); + void intervalChanged(quint32 interval); + void runningChanged(bool running); private: NetworkManager* m_manager; - QMap <QString,QVariantMap> latestCounts; -}; + friend class CounterAdaptor; + + void serviceUsage(const QString &servicePath, const QVariantMap &counters, bool roaming); + void release(); + + quint32 bytesInHome; + quint32 bytesOutHome; + quint32 secondsOnlineHome; + + quint32 bytesInRoaming; + quint32 bytesOutRoaming; + quint32 secondsOnlineRoaming; + bool roamingEnabled; + quint32 currentInterval; + quint32 currentAccuracy; + bool isRunning; + + void reRegister(); +}; class CounterAdaptor : public QDBusAbstractAdaptor { - Q_OBJECT; - Q_CLASSINFO("D-Bus Interface", "net.connman.Counter"); + Q_OBJECT + Q_CLASSINFO("D-Bus Interface", "net.connman.Counter") public: - explicit CounterAdaptor(Counter* parent); + explicit CounterAdaptor(Counter *parent); virtual ~CounterAdaptor(); public slots: @@ -61,7 +102,6 @@ const QVariantMap &roaming); private: - Counter* m_counter; - friend class CounterAdaptor; + Counter *m_counter; }; #endif // COUNTER_H --- libconnman-qt/libconnman-qt.pro +++ libconnman-qt/libconnman-qt.pro @@ -4,7 +4,8 @@ CONFIG += create_pc create_prl QT += core dbus QT -= gui -TARGET = $$qtLibraryTarget(connman-qt4) +equals(QT_MAJOR_VERSION, 4): TARGET = $$qtLibraryTarget(connman-qt4) +equals(QT_MAJOR_VERSION, 5): TARGET = $$qtLibraryTarget(connman-qt5) OBJECTS_DIR += build MOC_DIR += build --- libconnman-qt/networkmanager.cpp +++ libconnman-qt/networkmanager.cpp @@ -198,18 +198,6 @@ void NetworkManager::updateServices(const ConnmanObjectList &changed, const QList<QDBusObjectPath> &removed) { - - foreach (QDBusObjectPath obj, removed) { - Q_EMIT serviceRemoved(obj.path()); - if (m_servicesCache.contains(obj.path())) { - m_servicesCache.value(obj.path())->deleteLater(); - m_servicesCache.remove(obj.path()); - } else { - // connman maintains a virtual "hidden" wifi network and removes it upon init - pr_dbg() << "attempted to remove non-existing service"; - } - } - ConnmanObject connmanobj; int order = -1; NetworkService *service = NULL; @@ -219,21 +207,35 @@ QStringList serviceList; foreach (connmanobj, changed) { order++; + bool addedService = false; if (!m_servicesCache.contains(connmanobj.objpath.path())) { service = new NetworkService(connmanobj.objpath.path(), connmanobj.properties, this); m_servicesCache.insert(connmanobj.objpath.path(), service); - Q_EMIT serviceAdded(connmanobj.objpath.path()); + addedService = true; } else { service = m_servicesCache.value(connmanobj.objpath.path()); } - m_servicesOrder.push_back(service); serviceList.push_back(service->path()); if (order == 0) updateDefaultRoute(service); + if (addedService) { //emit this after m_servicesOrder is updated + Q_EMIT serviceAdded(connmanobj.objpath.path()); + } + } + + foreach (QDBusObjectPath obj, removed) { + if (m_servicesCache.contains(obj.path())) { + m_servicesCache.value(obj.path())->deleteLater(); + m_servicesCache.remove(obj.path()); + Q_EMIT serviceRemoved(obj.path()); + } else { + // connman maintains a virtual "hidden" wifi network and removes it upon init + pr_dbg() << "attempted to remove non-existing service"; + } } if (order == -1) --- libconnman-qt/networkservice.cpp +++ libconnman-qt/networkservice.cpp @@ -53,6 +53,7 @@ const QString NetworkService::Proxy("Proxy"); const QString NetworkService::ProxyConfig("Proxy.Configuration"); const QString NetworkService::Ethernet("Ethernet"); +const QString NetworkService::Roaming("Roaming"); NetworkService::NetworkService(const QString &path, const QVariantMap &properties, QObject* parent) : QObject(parent), @@ -73,86 +74,111 @@ NetworkService::~NetworkService() {} -const QString NetworkService::name() const { +const QString NetworkService::name() const +{ return m_propertiesCache.value(Name).toString(); } -const QString NetworkService::state() const { +const QString NetworkService::state() const +{ return m_propertiesCache.value(State).toString(); } -const QString NetworkService::error() const { +const QString NetworkService::error() const +{ return m_propertiesCache.value(Error).toString(); } -const QString NetworkService::type() const { +const QString NetworkService::type() const +{ return m_propertiesCache.value(Type).toString(); } -const QStringList NetworkService::security() const { +const QStringList NetworkService::security() const +{ return m_propertiesCache.value(Security).toStringList(); } -uint NetworkService::strength() const { +uint NetworkService::strength() const +{ return m_propertiesCache.value(Strength).toUInt(); } -bool NetworkService::favorite() const { +bool NetworkService::favorite() const +{ return m_propertiesCache.value(Favorite).toBool(); } -bool NetworkService::autoConnect() const { +bool NetworkService::autoConnect() const +{ return m_propertiesCache.value(AutoConnect).toBool(); } -const QString NetworkService::path() const { +const QString NetworkService::path() const +{ return m_path; } -const QVariantMap NetworkService::ipv4() const { +const QVariantMap NetworkService::ipv4() const +{ return qdbus_cast<QVariantMap>(m_propertiesCache.value(IPv4)); } -const QVariantMap NetworkService::ipv4Config() const { +const QVariantMap NetworkService::ipv4Config() const +{ return qdbus_cast<QVariantMap>(m_propertiesCache.value(IPv4Config)); } -const QVariantMap NetworkService::ipv6() const { +const QVariantMap NetworkService::ipv6() const +{ return qdbus_cast<QVariantMap>(m_propertiesCache.value(IPv6)); } -const QVariantMap NetworkService::ipv6Config() const { +const QVariantMap NetworkService::ipv6Config() const +{ return qdbus_cast<QVariantMap>(m_propertiesCache.value(IPv6Config)); } -const QStringList NetworkService::nameservers() const { +const QStringList NetworkService::nameservers() const +{ return m_propertiesCache.value(Nameservers).toStringList(); } -const QStringList NetworkService::nameserversConfig() const { +const QStringList NetworkService::nameserversConfig() const +{ return m_propertiesCache.value(NameserversConfig).toStringList(); } -const QStringList NetworkService::domains() const { +const QStringList NetworkService::domains() const +{ return m_propertiesCache.value(Domains).toStringList(); } -const QStringList NetworkService::domainsConfig() const { +const QStringList NetworkService::domainsConfig() const +{ return m_propertiesCache.value(DomainsConfig).toStringList(); } -const QVariantMap NetworkService::proxy() const { +const QVariantMap NetworkService::proxy() const +{ return qdbus_cast<QVariantMap>(m_propertiesCache.value(Proxy)); } -const QVariantMap NetworkService::proxyConfig() const { +const QVariantMap NetworkService::proxyConfig() const +{ return qdbus_cast<QVariantMap>(m_propertiesCache.value(ProxyConfig)); } -const QVariantMap NetworkService::ethernet() const { +const QVariantMap NetworkService::ethernet() const +{ return qdbus_cast<QVariantMap>(m_propertiesCache.value(Ethernet)); } +bool NetworkService::roaming() const +{ + return m_propertiesCache.value(Roaming).toBool(); +} + void NetworkService::requestConnect() { // increase reply timeout when connecting @@ -278,6 +304,8 @@ emit ethernetChanged(qdbus_cast<QVariantMap>(m_propertiesCache.value(Ethernet))); } else if (name == QLatin1String("type")) { Q_EMIT typeChanged(tmp.toString()); + } else if (name == Roaming) { + emit roamingChanged(tmp.toBool()); } } --- libconnman-qt/networkservice.h +++ libconnman-qt/networkservice.h @@ -42,6 +42,7 @@ Q_PROPERTY(QVariantMap proxy READ proxy NOTIFY proxyChanged) Q_PROPERTY(QVariantMap proxyConfig READ proxyConfig WRITE setProxyConfig NOTIFY proxyConfigChanged) Q_PROPERTY(QVariantMap ethernet READ ethernet NOTIFY ethernetChanged) + Q_PROPERTY(bool roaming READ roaming NOTIFY roamingChanged) public: NetworkService(const QString &path, const QVariantMap &properties, QObject* parent); @@ -69,6 +70,7 @@ const QVariantMap proxy() const; const QVariantMap proxyConfig() const; const QVariantMap ethernet() const; + bool roaming() const; void setPath(const QString &path); @@ -94,6 +96,7 @@ void ethernetChanged(const QVariantMap ðernet); void connectRequestFailed(const QString &error); void typeChanged(const QString &type); + void roamingChanged(bool roaming); public slots: void requestConnect(); @@ -133,6 +136,7 @@ static const QString Proxy; static const QString ProxyConfig; static const QString Ethernet; + static const QString Roaming; private slots: void updateProperty(const QString &name, const QDBusVariant &value); --- libconnman-qt/sessionagent.cpp +++ libconnman-qt/sessionagent.cpp @@ -17,9 +17,6 @@ SessionAgent *sessionAgent = new SessionAgent("/ConnmanSessionAgent",this); connect(sessionAgent,SIGNAL(settingsUpdated(QVariantMap)), this,SLOT(sessionSettingsUpdated(QVariantMap))); - - sessionAgent->registerSession(); // you MUST call this! - sessionAgent->setAllowedBearers(QStringList() << "wifi" << "ethernet" << "cellular"); sessionAgent->requestConnect(); --- plugin/components.cpp +++ plugin/components.cpp @@ -15,6 +15,7 @@ #include "technologymodel.h" #include "useragent.h" #include "networksession.h" +#include "counter.h" void Components::registerTypes(const char *uri) { @@ -26,6 +27,7 @@ qmlRegisterType<NetworkSession>(uri,0,2,"NetworkSession"); qmlRegisterType<NetworkManager>(uri,0,2,"NetworkManager"); qmlRegisterType<NetworkTechnology>(uri,0,2,"NetworkTechnology"); + qmlRegisterType<Counter>(uri,0,2,"NetworkCounter"); } @@ -35,4 +37,6 @@ Q_UNUSED(engine); } +#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) Q_EXPORT_PLUGIN(Components) +#endif --- plugin/components.h +++ plugin/components.h @@ -8,9 +8,19 @@ #ifndef COMPONENTS_H #define COMPONENTS_H +#include <QtPlugin> -#include <QtDeclarative/qdeclarative.h> -#include <QtDeclarative/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 Components : public QDeclarativeExtensionPlugin { @@ -18,6 +28,7 @@ public: void registerTypes(const char *uri); + void initializeEngine(QDeclarativeEngine *engine, const char *uri); }; --- plugin/plugin.json +++ plugin/plugin.json @@ -0,0 +1,2 @@ +{} + --- plugin/plugin.pro +++ plugin/plugin.pro @@ -1,12 +1,22 @@ TARGET=ConnmanQtDeclarative TEMPLATE = lib -QT += declarative dbus +QT += dbus CONFIG += plugin SOURCES = components.cpp networkingmodel.cpp technologymodel.cpp HEADERS = components.h networkingmodel.h technologymodel.h - INCLUDEPATH += ../libconnman-qt -LIBS += -L../libconnman-qt -lconnman-qt4 +LIBS += -L../libconnman-qt + +equals(QT_MAJOR_VERSION, 4): { + QT += declarative + LIBS += -lconnman-qt4 +} + +equals(QT_MAJOR_VERSION, 5): { + QT += quick + LIBS += -lconnman-qt5 + OTHER_FILES += plugin.json qmldirs +} target.path = $$[QT_INSTALL_IMPORTS]/MeeGo/Connman qmldir.files += qmldir --- plugin/technologymodel.cpp +++ plugin/technologymodel.cpp @@ -37,10 +37,9 @@ { m_manager = NetworkManagerFactory::createInstance(); - QHash<int, QByteArray> roles; - roles[ServiceRole] = "networkService"; - setRoleNames(roles); - +#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) + setRoleNames(roleNames()); +#endif connect(m_manager, SIGNAL(availabilityChanged(bool)), this, SLOT(managerAvailabilityChanged(bool))); @@ -59,6 +58,13 @@ { } +QHash<int, QByteArray> TechnologyModel::roleNames() const +{ + QHash<int, QByteArray> roles; + roles[ServiceRole] = "networkService"; + return roles; +} + QVariant TechnologyModel::data(const QModelIndex &index, int role) const { switch (role) { --- plugin/technologymodel.h +++ plugin/technologymodel.h @@ -66,6 +66,7 @@ NetworkManager* m_manager; NetworkTechnology* m_tech; QVector<NetworkService *> m_services; + QHash<int, QByteArray> roleNames() const; private slots: void updateTechnologies(); --- rpm +++ rpm +(directory) --- rpm/connman-qt.changes +++ rpm/connman-qt.changes @@ -0,0 +1,142 @@ +* Tue Mar 12 2013 Dmitry Rozhkov <[email protected]> - 1.0.1 +- add Tethering API + +* Fri Mar 01 2013 Dmitry Rozhkov <[email protected]> - 1.0.0 +- bumped version to 1.0.0 +- networkmanager: delete service and technology objects upon connman's death +- technologymodel: update service list upon start +- optimizations in init code + +* Mon Feb 25 2013 Dmitry Rozhkov <[email protected]> - 0.4.3.2 +- useragent: pass requested fields as map instead of list + +* Thu Feb 21 2013 Lorn Potter <[email protected]> - 0.4.3.2 +- bumped version to 0.4.3.2 +- various fixes + +* Wed Feb 13 2013 Lorn Potter <[email protected]> - 0.4.3 +- bumped version to 0.4.3 +- add NetworkService, NetworkManager and NetworkTechnology to declarative plugin +- make more declarative friendly +- update xml files to new qtproject + +* Fri Jan 4 2013 Lorn Potter <[email protected]> - 0.4.1 +- Add ConnectRequest to agent API + +* Fri Dec 28 2012 Dmitry Rozhkov <[email protected]> - 0.4.0 +- Added Counter API +- Added Session API +- networkservice: added error property + +* Thu Dec 20 2012 Dmitry Rozhkov <[email protected]> - 0.3.5 +- Relocate UserAgent class to libconnman-qt + +* Wed Dec 19 2012 Dmitry Rozhkov <[email protected]> - 0.3.4 +- technologymodel: Untie TechnologyModel from WiFi +- add session, notification and counter API +- technologymodel: move user agent to dedicated class +- useragent: iterate over credentials fields on C++ side, not JS + +* Wed Dec 12 2012 Dmitry Rozhkov <[email protected]> - 0.3.3 +- Fixes JB#4032 - implement proper DBus marshalling for Proxy.Configuration + +* Tue Dec 04 2012 Dmitry Rozhkov <[email protected]> - 0.3.2 +- Emit autoConnectChanged signal upon updates of autoConnect property. +- Add NetworkService::remove() method + +* Mon Dec 03 2012 Dmitry Rozhkov <[email protected]> - 0.3.1 +- Applied patch from Pascal Bach. +- Initial refactoring of NetworkingModel. + +* Tue Nov 27 2012 Dmitry Rozhkov <[email protected]> - 0.3.0 +- Applied patch from Felipe Tonello adding TechnologyAdded and + TechnologyRemoved signals. +- Added technology filter to NetworkManager::getServies() method. + +* Fri Aug 10 2012 Dmitry Rozhkov <[email protected]> - 0.2.2 +- Applied patch from Kuisma Salonen tracking availability of + connman service. Fixes NEMO#226. + +* Wed Jul 11 2012 Dmitry Rozhkov <[email protected]> - 0.2.1 +- Added setters for advanced settings of NetworkService +- register NetworkService as declarative uncreatable type + +* Thu Jul 05 2012 Dmitry Rozhkov <[email protected]> - 0.2.0 +- Added properties ipv4, nameservers, domains and proxy to + NetworkService class. +- Added signal errorReported to NetworkService class. + +* Fri Jun 15 2012 Dmitry Rozhkov <[email protected]> - 0.1.4 +- initial adaptation for connman 1.1 + +* Tue Jul 19 2011 Kevron Rees <[email protected]> - 0.1.3 +- patch fixes BMC #20075 - method not updating +- patch Fixes BMC #20803 - fixed constant spaming +- patch Fixes BMC #20805 - removal of currentDate and currentTime methods + +* Mon Jun 27 2011 Kevron Rees <[email protected]> - 0.1.3 +- Fixes 15544 - swapped setters for gateway/method + +* Mon Jun 27 2011 Kevron Rees <[email protected]> - 0.1.2 +- Fixed BMC 20120 - network list model emitting rowsRemoved begin 0 and end 0 + +* Mon Jun 27 2011 Kevron Rees <[email protected]> - 0.1.1 +- Fixes BMC #18814 - unable to set time and date + +* Fri Jun 09 2011 Kevron Rees <[email protected]> - 0.1.0 +- Fixes Bug 17998 - slow connections animation + +* Mon Jun 06 2011 Kevron Rees <[email protected]> - 0.0.9 +- fixes BMC #17583 16899 16917 16938 - use new connman api + +* Thu May 26 2011 Kevron Rees <[email protected]> - 0.0.8 +- Fixed Requires to install connman-qt-declarative by default + +* Thu May 26 2011 Kevron Rees <[email protected]> - 0.0.8 +- Fixes BMC #17582 - Wrong default route + +* Fri Apr 29 2011 Kevron Rees <[email protected]> - 0.0.7 +- Fixes BMC #15728 - settings crashes when networks disappear + +* Fri Apr 15 2011 Kevron Rees <[email protected]> - 0.0.6 +- Fixes BMC #15127 - security label not updated + +* Fri Apr 01 2011 Kevron Rees <[email protected]> - 0.0.5 +- fixes BMC #15446 bluetooth internet connect button does nothing + the fix required a way to get the service by name from the model + so that the service could be used in the bluetooth app to connect + +* Fri Apr 01 2011 Kevron Rees <[email protected]> - 0.0.4 +- fixes BMC #14923 where defaultRoute may become invalid in some situations + +* Thu Mar 24 2011 Kevron Rees <[email protected]> - 0.0.3 +- pulled in latest from upstream + +* Thu Feb 25 2011 Kevron Rees <[email protected]> - 0.0.2 +- resolves FEA #13383 + +* Thu Feb 17 2011 Kevron Rees <[email protected]> - 0.0.2 +- updated to work with connman 0.69.x + +* Mon Feb 07 2011 Kevron Rees <[email protected]> - 0.0.2 +- renames library to connman-qt4 + +* Mon Jan 24 2011 Kevron Rees <[email protected]> - 0.0.2 +- fixed IPv4 property changed updating + +* Mon Jan 10 2011 Kevron Rees <[email protected]> - 0.0.2 +- new upstream version + +* Thu Jan 06 2011 Kevron Rees <[email protected]> - 0.0.1 +- updated to use new connman version + +* Tue Dec 09 2010 Kevron Rees <[email protected]> - 0.0.1 +- added properties (see git log for more details) + +* Tue Nov 16 2010 Kevron Rees <[email protected]> - 0.0.1 +- fixed up enums for connman > 0.60 + +* Wed Nov 3 2010 Kevron Rees <[email protected]> - 0.0.1 +- initial release +- added some required methods +- added count property --- rpm/connman-qt.spec +++ rpm/connman-qt.spec @@ -0,0 +1,126 @@ +# +# Do NOT Edit the Auto-generated Part! +# Generated by: spectacle version 0.25 +# + +Name: connman-qt + +# >> macros +# << macros + +Summary: qt bindings for connman +Version: 1.0.1 +Release: 1 +Group: System/GUI/Other +License: Apache License +URL: https://github.com/nemomobile/libconnman-qt.git +Source0: %{name}-%{version}.tar.bz2 +Source100: connman-qt.yaml +Requires: connman >= 1.10 +Requires(post): /sbin/ldconfig +Requires(postun): /sbin/ldconfig +BuildRequires: pkgconfig(QtCore) >= 4.6.0 +BuildRequires: pkgconfig(QtDBus) +BuildRequires: pkgconfig(QtOpenGL) +BuildRequires: pkgconfig(QtGui) +BuildRequires: pkgconfig(dbus-1) +BuildRequires: doxygen +BuildRequires: qt-devel-tools + +%description +This is a library for working with connman using Qt + + +%package tests +Summary: tests for connman-qt +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} +Requires: connman-qt-declarative + +%description tests +This package contains the test applications for testing libconnman-qt + + +%package declarative +Summary: Declarative plugin for Qt Quick for connman-qt +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} +Requires: connman-qt + +%description declarative +This package contains the files necessary to develop +applications using libconnman-qt + + +%package devel +Summary: Development files for connman-qt +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} + +%description devel +This package contains the files necessary to develop +applications using libconnman-qt + + + +%prep +%setup -q -n %{name}-%{version} + +# >> setup +# << setup + +%build +# >> build pre +export PATH=$PATH:/usr/lib/qt4/bin +qmake install_prefix=/usr +# << build pre + +%qmake + +make %{?jobs:-j%jobs} + +# >> build post +# << build post + +%install +rm -rf %{buildroot} +# >> install pre +export INSTALL_ROOT=%{buildroot} +# << install pre +%qmake_install + +# >> install post +# << install post + + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + +%files +%defattr(-,root,root,-) +%{_libdir}/libconnman-qt4.so.* +# >> files +# << files + +%files tests +%defattr(-,root,root,-) +%{_usr}/lib/libconnman-qt4/test +# >> files tests +# << files tests + +%files declarative +%defattr(-,root,root,-) +%{_usr}/lib/qt4/imports/MeeGo/Connman +# >> files declarative +# << files declarative + +%files devel +%defattr(-,root,root,-) +%{_usr}/include/connman-qt +%{_usr}/lib/pkgconfig/connman-qt4.pc +%{_usr}/lib/connman-qt4.pc +%{_usr}/lib/libconnman-qt4.prl +%{_usr}/lib/libconnman-qt4.so +# >> files devel +# << files devel --- rpm/connman-qt.yaml +++ rpm/connman-qt.yaml @@ -0,0 +1,59 @@ +Name: connman-qt5 +Summary: qt bindings for connman +Version: 1.0.1 +Release: 1 +Group: System/GUI/Other +License: Apache License +URL: https://github.com/nemomobile/libconnman-qt.git +Sources: + - "%{name}-%{version}.tar.bz2" +Description: | + This is a library for working with connman using Qt + +Requires: + - connman >= 1.10 +PkgBR: + - doxygen + - qt-devel-tools +PkgConfigBR: + - QtCore >= 4.6.0 + - QtDBus + - QtOpenGL + - QtGui + - dbus-1 +Configure: none +Builder: qmake +Files: + - "%{_libdir}/libconnman-qt4.so.*" +SubPackages: + - Name: tests + Summary: tests for connman-qt + Group: Development/Libraries + Description: | + This package contains the test applications for testing libconnman-qt + Requires: + - connman-qt-declarative + Files: + - "%{_usr}/lib/libconnman-qt4/test" + - Name: declarative + Summary: Declarative plugin for Qt Quick for connman-qt + Group: Development/Libraries + Description: | + This package contains the files necessary to develop + applications using libconnman-qt + Requires: + - connman-qt + Files: + - "%{_usr}/lib/qt4/imports/MeeGo/Connman" + - Name: devel + Summary: Development files for connman-qt + Group: Development/Libraries + Description: | + This package contains the files necessary to develop + applications using libconnman-qt + Files: + - "%{_usr}/include/connman-qt" + - "%{_usr}/lib/pkgconfig/connman-qt4.pc" + - "%{_usr}/lib/connman-qt4.pc" + - "%{_usr}/lib/libconnman-qt4.prl" + - "%{_usr}/lib/libconnman-qt4.so" --- rpm/connman-qt5.spec +++ rpm/connman-qt5.spec @@ -0,0 +1,126 @@ +# +# Do NOT Edit the Auto-generated Part! +# Generated by: spectacle version 0.25 +# + +Name: connman-qt5 + +# >> macros +# << macros + +Summary: qt bindings for connman +Version: 1.0.1 +Release: 1 +Group: System/GUI/Other +License: Apache License +URL: https://github.com/nemomobile/libconnman-qt.git +Source0: %{name}-%{version}.tar.bz2 +Source100: connman-qt.yaml +Requires: connman >= 1.10 +Requires(post): /sbin/ldconfig +Requires(postun): /sbin/ldconfig +BuildRequires: pkgconfig(Qt5Core) +BuildRequires: pkgconfig(Qt5DBus) +BuildRequires: pkgconfig(Qt5OpenGL) +BuildRequires: pkgconfig(Qt5Gui) +BuildRequires: pkgconfig(dbus-1) +BuildRequires: doxygen +BuildRequires: qt-devel-tools + +%description +This is a library for working with connman using Qt + + +%package tests +Summary: tests for connman-qt +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} +Requires: connman-qt-declarative + +%description tests +This package contains the test applications for testing libconnman-qt + + +%package declarative +Summary: Declarative plugin for Qt Quick for connman-qt +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} +Requires: connman-qt + +%description declarative +This package contains the files necessary to develop +applications using libconnman-qt + + +%package devel +Summary: Development files for connman-qt +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} + +%description devel +This package contains the files necessary to develop +applications using libconnman-qt + + + +%prep +%setup -q -n %{name}-%{version} + +# >> setup +# << setup + +%build +# >> build pre +export PATH=$PATH:/usr/lib/qt4/bin +qmake install_prefix=/usr +# << build pre + +%qmake + +make %{?jobs:-j%jobs} + +# >> build post +# << build post + +%install +rm -rf %{buildroot} +# >> install pre +export INSTALL_ROOT=%{buildroot} +# << install pre +%qmake_install + +# >> install post +# << install post + + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + +%files +%defattr(-,root,root,-) +%{_libdir}/libconnman-qt4.so.* +# >> files +# << files + +%files tests +%defattr(-,root,root,-) +%{_usr}/lib/libconnman-qt4/test +# >> files tests +# << files tests + +%files declarative +%defattr(-,root,root,-) +%{_usr}/lib/qt4/imports/MeeGo/Connman +# >> files declarative +# << files declarative + +%files devel +%defattr(-,root,root,-) +%{_usr}/include/connman-qt +%{_usr}/lib/pkgconfig/connman-qt4.pc +%{_usr}/lib/connman-qt4.pc +%{_usr}/lib/libconnman-qt4.prl +%{_usr}/lib/libconnman-qt4.so +# >> files devel +# << files devel --- rpm/connman-qt5.yaml +++ rpm/connman-qt5.yaml @@ -0,0 +1,60 @@ +Name: connman-qt5 +Summary: qt bindings for connman +Version: 1.0.1 +Release: 1 +Group: System/GUI/Other +License: Apache License +URL: https://github.com/nemomobile/libconnman-qt.git +Sources: + - "%{name}-%{version}.tar.bz2" +Description: | + This is a library for working with connman using Qt + +Requires: + - connman >= 1.10 +PkgBR: + - doxygen + - qt5-tools +PkgConfigBR: + - Qt5Core + - Qt5DBus + - Qt5Gui + - Qt5Quick + - Qt5Qml + - dbus-1 +Configure: none +Builder: qmake +Files: + - "%{_libdir}/libconnman-qt5.so.*" +SubPackages: + - Name: tests + Summary: tests for connman-qt + Group: Development/Libraries + Description: | + This package contains the test applications for testing libconnman-qt + Requires: + - connman-qt-declarative + Files: + - "%{_usr}/lib/libconnman-qt5/test" + - Name: declarative + Summary: Declarative plugin for Qt Quick for connman-qt + Group: Development/Libraries + Description: | + This package contains the files necessary to develop + applications using libconnman-qt + Requires: + - connman-qt + Files: + - "%{_usr}/lib/qt5/imports/MeeGo/Connman" + - Name: devel + Summary: Development files for connman-qt + Group: Development/Libraries + Description: | + This package contains the files necessary to develop + applications using libconnman-qt + Files: + - "%{_usr}/include/connman-qt" + - "%{_usr}/lib/pkgconfig/connman-qt5.pc" + - "%{_usr}/lib/connman-qt5.pc" + - "%{_usr}/lib/libconnman-qt5.prl" + - "%{_usr}/lib/libconnman-qt5.so" --- test/main.cpp +++ test/main.cpp @@ -1,20 +1,32 @@ #include <QApplication> #include <QWidget> + +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#include <QQuickView> +#include <qqml.h> +#else +#include <QGLWidget> #include <QDeclarativeView> #include <QDeclarativeContext> -#include <QGLWidget> #include <qdeclarative.h> +#endif + int main(int argc, char *argv[]) { - QApplication a(argc, argv); + QApplication a(argc, argv); - QDeclarativeView *view = new QDeclarativeView; +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) + QQuickView *view = new QQuickView; + view->setResizeMode(QQuickView::SizeRootObjectToView); +#else + QDeclarativeView *view = new QDeclarativeView; view->setViewport(new QGLWidget); - view->setSource(QUrl::fromLocalFile("main.qml")); - view->setGeometry(0,0,800,480); - view->setResizeMode(QDeclarativeView::SizeRootObjectToView); - view->show(); + view->setResizeMode(QDeclarativeView::SizeRootObjectToView); +#endif + view->setSource(QUrl::fromLocalFile("main.qml")); + view->setGeometry(0,0,800,480); + view->show(); return a.exec(); } --- test/test.pro +++ test/test.pro @@ -4,9 +4,18 @@ # #------------------------------------------------- -QT += core declarative gui opengl +QT += core gui -TARGET = testconnman-qt +equals(QT_MAJOR_VERSION, 4): { + QT += declarative opengl + TARGET = testconnman-qt + target.path = $$INSTALL_ROOT/usr/lib/libconnman-qt4/test +} +equals(QT_MAJOR_VERSION, 5): { + QT += quick + TARGET = testconnman-qt5 + target.path = $$INSTALL_ROOT/usr/lib/libconnman-qt5/test +} CONFIG += console CONFIG -= app_bundle @@ -19,7 +28,6 @@ HEADERS += -target.path = $$INSTALL_ROOT/usr/lib/libconnman-qt4/test qml.files = $$OTHER_FILES qml.path = $$target.path ++++++ connman-qt.yaml --- connman-qt.yaml +++ connman-qt.yaml @@ -1,6 +1,6 @@ Name: connman-qt -Summary: qt bindings for connman -Version: 1.0.1 +Summary: Qt bindings for connman +Version: 1.0.2 Release: 1 Group: System/GUI/Other License: Apache License @@ -27,7 +27,7 @@ - "%{_libdir}/libconnman-qt4.so.*" SubPackages: - Name: tests - Summary: tests for connman-qt + Summary: Tests for connman-qt Group: Development/Libraries Description: | This package contains the test applications for testing libconnman-qt
