diff options
author | Javier S. Pedro <maemo@javispedro.com> | 2012-04-26 01:36:20 +0200 |
---|---|---|
committer | Javier S. Pedro <maemo@javispedro.com> | 2012-04-26 01:36:20 +0200 |
commit | 93f3acd128d6b349efe14e97b12c2703ca4f81f3 (patch) | |
tree | 937f3de2307444f0c28d6d21f26f1580e789b074 /sowatchd | |
parent | 1375a26b135547fdd8e07db62acf8116a8482560 (diff) | |
download | sowatch-93f3acd128d6b349efe14e97b12c2703ca4f81f3.tar.gz sowatch-93f3acd128d6b349efe14e97b12c2703ca4f81f3.zip |
Moved the core framework to GConf & D-Bus
Diffstat (limited to 'sowatchd')
-rw-r--r-- | sowatchd/allscanner.cpp | 40 | ||||
-rw-r--r-- | sowatchd/allscanner.h | 29 | ||||
-rw-r--r-- | sowatchd/com.javispedro.sowatch.service.sowatch-service.service | 3 | ||||
-rw-r--r-- | sowatchd/daemon.cpp | 123 | ||||
-rw-r--r-- | sowatchd/daemon.h | 19 | ||||
-rw-r--r-- | sowatchd/daemon.xml | 10 | ||||
-rw-r--r-- | sowatchd/daemonadaptor.cpp | 49 | ||||
-rw-r--r-- | sowatchd/daemonadaptor.h | 51 | ||||
-rw-r--r-- | sowatchd/main.cpp | 80 | ||||
-rw-r--r-- | sowatchd/scanner.xml | 12 | ||||
-rw-r--r-- | sowatchd/scanneradaptor.cpp | 43 | ||||
-rw-r--r-- | sowatchd/scanneradaptor.h | 55 | ||||
-rw-r--r-- | sowatchd/service.cpp | 15 | ||||
-rw-r--r-- | sowatchd/service.h | 26 | ||||
-rw-r--r-- | sowatchd/service.xml | 14 | ||||
-rw-r--r-- | sowatchd/sowatchd.pro | 54 |
16 files changed, 432 insertions, 191 deletions
diff --git a/sowatchd/allscanner.cpp b/sowatchd/allscanner.cpp new file mode 100644 index 0000000..a3e7d33 --- /dev/null +++ b/sowatchd/allscanner.cpp @@ -0,0 +1,40 @@ +#include "allscanner.h" + +using namespace sowatch; + +AllScanner::AllScanner(QObject *parent) : + WatchScanner(parent), _finishedCount(0) +{ + QList<WatchPluginInterface*> plugins = Registry::registry()->getWatchPlugins(); + foreach (WatchPluginInterface* driver, plugins) { + WatchScanner* scanner = driver->getScanner(this); + if (scanner) { + _scanners += scanner; + connect(scanner, SIGNAL(finished()), this, SLOT(handleFinished())); + connect(scanner, SIGNAL(watchFound(QVariantMap)), + this, SIGNAL(watchFound(QVariantMap))); + } + } +} + +void AllScanner::start() +{ + if (_scanners.empty()) { + emit finished(); + } else { + foreach (WatchScanner* scanner, _scanners) { + scanner->start(); + } + emit started(); + } +} + +void AllScanner::handleFinished() +{ + qDebug() << "one finished"; + _finishedCount++; + if (_finishedCount >= _scanners.length()) { + qDebug() << "all finished"; + emit finished(); + } +} diff --git a/sowatchd/allscanner.h b/sowatchd/allscanner.h new file mode 100644 index 0000000..6a7160f --- /dev/null +++ b/sowatchd/allscanner.h @@ -0,0 +1,29 @@ +#ifndef ALLSCANNER_H +#define ALLSCANNER_H + +#include <QtCore/QObject> +#include <QtCore/QList> + +#include <sowatch.h> + +namespace sowatch +{ + +class AllScanner : public WatchScanner +{ + Q_OBJECT +public: + explicit AllScanner(QObject *parent = 0); + void start(); + +private: + QList<WatchScanner*> _scanners; + int _finishedCount; + +private slots: + void handleFinished(); +}; + +} + +#endif // ALLSCANNER_H diff --git a/sowatchd/com.javispedro.sowatch.service.sowatch-service.service b/sowatchd/com.javispedro.sowatch.service.sowatch-service.service deleted file mode 100644 index 714d1c4..0000000 --- a/sowatchd/com.javispedro.sowatch.service.sowatch-service.service +++ /dev/null @@ -1,3 +0,0 @@ -[D-BUS Service] -Name=com.nokia.qtmobility.sfw.sowatch-service -Exec=/opt/sowatch/bin/sowatchd diff --git a/sowatchd/daemon.cpp b/sowatchd/daemon.cpp index 3cbfb64..61144de 100644 --- a/sowatchd/daemon.cpp +++ b/sowatchd/daemon.cpp @@ -6,74 +6,123 @@ using namespace sowatch; Daemon::Daemon(QObject *parent) : QObject(parent), - _registry(Registry::registry()) + _registry(Registry::registry()), + _settings(new GConfKey("/apps/sowatch", this)) { - initWatches(); + connect(_settings, SIGNAL(subkeyChanged(QString)), SLOT(settingsChanged(QString))); + QStringList activeWatches = _settings->value("active-watches").toStringList(); + foreach (const QString& s, activeWatches) { + startWatch(s); + } } -void Daemon::initWatches() +QString Daemon::getWatchStatus(const QString &name) { - QSettings settings; - int size = settings.beginReadArray("watches"); - - for (int i = 0; i < size; i++) { - settings.setArrayIndex(i); - QString driver = settings.value("driver").toString().toLower(); - WatchPluginInterface *plugin = _registry->getWatchPlugin(driver); - if (plugin) { - Watch *watch = plugin->getWatch(driver, settings, this); - if (watch) { - initWatch(watch, settings); - } else { - qWarning() << "Driver" << driver << "refused to getWatch"; - } + if (_servers.contains(name)) { + WatchServer* server = _servers[name]; + Watch* watch = server->watch(); + if (watch->isConnected()) { + return QLatin1String("connected"); } else { - qWarning() << "Invalid driver" << driver; + return QLatin1String("enabled"); } + } else { + return QLatin1String("disabled"); } +} - settings.endArray(); - qDebug() << "handling" << _servers.size() << "watches"; +void Daemon::terminate() +{ + QApplication::quit(); } -void Daemon::initWatch(Watch* watch, QSettings& settings) +void Daemon::startWatch(const QString &name) { - int size; + qDebug() << "Starting watch" << name; + QScopedPointer<ConfigKey> watchSettings(_settings->getSubkey(name)); + + const QString driver = watchSettings->value("driver").toString().toLower(); + if (driver.isEmpty()) { + qWarning() << "Watch" << name << "has no driver setting"; + return; + } + + WatchPluginInterface *watchPlugin = _registry->getWatchPlugin(driver); + if (!watchPlugin) { + qWarning() << "Invalid driver" << driver; + return; + } + + // Create the watch object from the plugin + Watch *watch = watchPlugin->getWatch(driver, watchSettings.data(), this); + if (!watch) { + qWarning() << "Driver" << driver << "failed to initiate watch"; + } // Create the server WatchServer* server = new WatchServer(watch, this); - _servers.append(server); + _servers[name] = server; // Configure the server - server->setNextWatchletButton(settings.value("nextWatchletButton").toString()); + server->setNextWatchletButton(watchSettings->value("next-watchlet-button").toString()); // Initialize providers - size = settings.beginReadArray("notifications"); - for (int i = 0; i < size; i++) { - settings.setArrayIndex(i); - QString id = settings.value("provider").toString().toLower(); + QStringList list; + list = watchSettings->value("active-notifications").toStringList(); + foreach (const QString& s, list) { + QScopedPointer<ConfigKey> settings(watchSettings->getSubkey(s)); + QString id = settings->value("id").toString().toLower(); NotificationPluginInterface *plugin = _registry->getNotificationPlugin(id); if (plugin) { - NotificationProvider *provider = plugin->getProvider(id, settings, server); + NotificationProvider *provider = plugin->getProvider(id, settings.data(), server); server->addProvider(provider); } else { qWarning() << "Unknown notification provider" << id; } } - settings.endArray(); // Initialize watchlets - size = settings.beginReadArray("watchlets"); - for (int i = 0; i < size; i++) { - settings.setArrayIndex(i); - QString id = settings.value("id").toString().toLower(); + list = watchSettings->value("active-watchlets").toStringList(); + foreach (const QString& s, list) { + QScopedPointer<ConfigKey> settings(watchSettings->getSubkey(s)); + QString id = settings->value("id").toString().toLower(); WatchletPluginInterface *plugin = _registry->getWatchletPlugin(id); if (plugin) { - plugin->getWatchlet(id, settings, server); - // Watchlets are associated to server via parent-child relationship. + Watchlet *watchlet = plugin->getWatchlet(id, settings.data(), server); + server->addWatchlet(watchlet); } else { qWarning() << "Unknown watchlet" << id; } } - settings.endArray(); +} + +void Daemon::stopWatch(const QString &name) +{ + qDebug() << "Stopping watch" << name; +} + +#if TODO +void Daemon::initWatch(Watch* watch, QSettings& settings) +{ + int size; + + +} +#endif + +void Daemon::settingsChanged(const QString &subkey) +{ + qDebug() << "Daemon settings changed" << subkey; + if (subkey == "active-watches") { + QSet<QString> confActiveWatches = _settings->value("active-watches").toStringList().toSet(); + QSet<QString> curActiveWatches = _servers.keys().toSet(); + QSet<QString> removed = curActiveWatches - confActiveWatches; + QSet<QString> added = confActiveWatches - curActiveWatches; + foreach (const QString& s, removed) { + stopWatch(s); + } + foreach (const QString& s, added) { + startWatch(s); + } + } } diff --git a/sowatchd/daemon.h b/sowatchd/daemon.h index 249f525..ba62585 100644 --- a/sowatchd/daemon.h +++ b/sowatchd/daemon.h @@ -2,9 +2,7 @@ #define WATCHDAEMON_H #include <QtCore/QObject> -#include <QtCore/QList> #include <QtCore/QMap> -#include <QtCore/QSettings> #include <sowatch.h> @@ -17,12 +15,21 @@ class Daemon : public QObject public: explicit Daemon(QObject *parent = 0); -protected: + Q_INVOKABLE QString getWatchStatus(const QString& name); + +public slots: + void terminate(); + +private: Registry* _registry; - QList<WatchServer*> _servers; + ConfigKey* _settings; + QMap<QString, WatchServer*> _servers; + + void startWatch(const QString& name); + void stopWatch(const QString& name); - void initWatches(); - void initWatch(Watch* watch, QSettings& settings); +private slots: + void settingsChanged(const QString& subkey); }; } diff --git a/sowatchd/daemon.xml b/sowatchd/daemon.xml new file mode 100644 index 0000000..0a08913 --- /dev/null +++ b/sowatchd/daemon.xml @@ -0,0 +1,10 @@ +<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> +<node> + <interface name="com.javispedro.sowatch.Daemon"> + <method name="GetWatchStatus"> + <arg name="watch" type="s" direction="in" /> + <arg name="status" type="s" direction="out" /> + </method> + <method name="Terminate" /> + </interface> +</node> diff --git a/sowatchd/daemonadaptor.cpp b/sowatchd/daemonadaptor.cpp new file mode 100644 index 0000000..c8a322a --- /dev/null +++ b/sowatchd/daemonadaptor.cpp @@ -0,0 +1,49 @@ +/* + * This file was generated by qdbusxml2cpp version 0.7 + * Command line was: qdbusxml2cpp -c DaemonAdaptor -a daemonadaptor daemon.xml + * + * qdbusxml2cpp is Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). + * + * This is an auto-generated file. + * Do not edit! All changes made to it will be lost. + */ + +#include "daemonadaptor.h" +#include <QtCore/QMetaObject> +#include <QtCore/QByteArray> +#include <QtCore/QList> +#include <QtCore/QMap> +#include <QtCore/QString> +#include <QtCore/QStringList> +#include <QtCore/QVariant> + +/* + * Implementation of adaptor class DaemonAdaptor + */ + +DaemonAdaptor::DaemonAdaptor(QObject *parent) + : QDBusAbstractAdaptor(parent) +{ + // constructor + setAutoRelaySignals(true); +} + +DaemonAdaptor::~DaemonAdaptor() +{ + // destructor +} + +QString DaemonAdaptor::GetWatchStatus(const QString &watch) +{ + // handle method call com.javispedro.sowatch.Daemon.GetWatchStatus + QString status; + QMetaObject::invokeMethod(parent(), "getWatchStatus", Q_RETURN_ARG(QString, status), Q_ARG(QString, watch)); + return status; +} + +void DaemonAdaptor::Terminate() +{ + // handle method call com.javispedro.sowatch.Daemon.Terminate + QMetaObject::invokeMethod(parent(), "terminate"); +} + diff --git a/sowatchd/daemonadaptor.h b/sowatchd/daemonadaptor.h new file mode 100644 index 0000000..d16cb99 --- /dev/null +++ b/sowatchd/daemonadaptor.h @@ -0,0 +1,51 @@ +/* + * This file was generated by qdbusxml2cpp version 0.7 + * Command line was: qdbusxml2cpp -c DaemonAdaptor -a daemonadaptor daemon.xml + * + * qdbusxml2cpp is Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). + * + * This is an auto-generated file. + * This file may have been hand-edited. Look for HAND-EDIT comments + * before re-generating it. + */ + +#ifndef DAEMONADAPTOR_H_1335395583 +#define DAEMONADAPTOR_H_1335395583 + +#include <QtCore/QObject> +#include <QtDBus/QtDBus> +class QByteArray; +template<class T> class QList; +template<class Key, class Value> class QMap; +class QString; +class QStringList; +class QVariant; + +/* + * Adaptor class for interface com.javispedro.sowatch.Daemon + */ +class DaemonAdaptor: public QDBusAbstractAdaptor +{ + Q_OBJECT + Q_CLASSINFO("D-Bus Interface", "com.javispedro.sowatch.Daemon") + Q_CLASSINFO("D-Bus Introspection", "" +" <interface name=\"com.javispedro.sowatch.Daemon\">\n" +" <method name=\"GetWatchStatus\">\n" +" <arg direction=\"in\" type=\"s\" name=\"watch\"/>\n" +" <arg direction=\"out\" type=\"s\" name=\"status\"/>\n" +" </method>\n" +" <method name=\"Terminate\"/>\n" +" </interface>\n" + "") +public: + DaemonAdaptor(QObject *parent); + virtual ~DaemonAdaptor(); + +public: // PROPERTIES +public Q_SLOTS: // METHODS + QString GetWatchStatus(const QString &watch); + void Terminate(); +Q_SIGNALS: // SIGNALS +}; + +#endif diff --git a/sowatchd/main.cpp b/sowatchd/main.cpp index 22e63a2..29eee28 100644 --- a/sowatchd/main.cpp +++ b/sowatchd/main.cpp @@ -1,10 +1,12 @@ +#include <QtCore/QDebug> #include <QtGui/QApplication> -#include <QtServiceFramework/QServiceManager> -#include <QtServiceFramework/QRemoteServiceRegister> +#include <QtDBus/QDBusConnection> #include <sowatch.h> #include "global.h" -#include "service.h" +#include "allscanner.h" +#include "daemonadaptor.h" +#include "scanneradaptor.h" namespace sowatch { @@ -12,68 +14,32 @@ namespace sowatch } using namespace sowatch; -QTM_USE_NAMESPACE - - -static QString adjustPath(const QString &path) -{ -#ifdef Q_OS_UNIX -#ifdef Q_OS_MAC - if (!QDir::isAbsolutePath(path)) - return QCoreApplication::applicationDirPath() - + QLatin1String("/../Resources/") + path; -#else - QString pathInInstallDir; - const QString applicationDirPath = QCoreApplication::applicationDirPath(); - pathInInstallDir = QString::fromAscii("%1/../%2").arg(applicationDirPath, path); - - if (QFileInfo(pathInInstallDir).exists()) - return pathInInstallDir; -#endif -#endif - return path; -} - -static void unregisterService() -{ - QServiceManager m; - m.removeService("sowatch-service"); -} - -static void registerService() -{ - unregisterService(); - QServiceManager m; - QString path = adjustPath("xml/service.xml"); - if (!m.addService(path)) { - qWarning() << "Cannot register sowatch-service" << m.error() << "from" << path; - } -} int main(int argc, char *argv[]) { - QApplication a(argc, argv); // Some plugins might require a UI. + // Some plugins might require a user interface, so use QApplication instead + // of QCoreApplication + QApplication a(argc, argv); QApplication::setOrganizationDomain("com.javispedro.sowatch"); QApplication::setOrganizationName("sowatch"); QApplication::setApplicationName("sowatchd"); - sowatch::daemon = new Daemon(); - - registerService(); - - QRemoteServiceRegister *serviceRegister = new QRemoteServiceRegister(); - QRemoteServiceRegister::Entry entry = - serviceRegister->createEntry<Service>("sowatch-service", - "com.javispedro.sowatch.service", "1.0"); - entry.setInstantiationType(QRemoteServiceRegister::PrivateInstance); + sowatch::daemon = new Daemon(&a); + new DaemonAdaptor(sowatch::daemon); + AllScanner *scanner = new AllScanner(&a); + new ScannerAdaptor(scanner); - serviceRegister->setQuitOnLastInstanceClosed(false); - serviceRegister->publishEntries("sowatchd"); - - int res = a.exec(); + QDBusConnection connection = QDBusConnection::sessionBus(); + if (!connection.registerService("com.javispedro.sowatchd")) { + qCritical("Could not register D-Bus service"); + } - delete serviceRegister; - delete sowatch::daemon; + if (!connection.registerObject("/com/javispedro/sowatch/allscanner", scanner)) { + qCritical("Could not register scanner object"); + } + if (!connection.registerObject("/com/javispedro/sowatch/daemon", sowatch::daemon)) { + qCritical("Could not register daemon object"); + } - return res; + return a.exec(); } diff --git a/sowatchd/scanner.xml b/sowatchd/scanner.xml new file mode 100644 index 0000000..948ce0b --- /dev/null +++ b/sowatchd/scanner.xml @@ -0,0 +1,12 @@ +<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> +<node> + <interface name="com.javispedro.sowatch.WatchScanner"> + <method name="Start" /> + <signal name="Started" /> + <signal name="Finished" /> + <signal name="WatchFound"> + <annotation name="com.trolltech.QtDBus.QtTypeName.In0" value="QVariantMap" /> + <arg name="info" type="a{sv}" /> + </signal> + </interface> +</node> diff --git a/sowatchd/scanneradaptor.cpp b/sowatchd/scanneradaptor.cpp new file mode 100644 index 0000000..a3d9ad1 --- /dev/null +++ b/sowatchd/scanneradaptor.cpp @@ -0,0 +1,43 @@ +/* + * This file was generated by qdbusxml2cpp version 0.7 + * Command line was: qdbusxml2cpp -c ScannerAdaptor -a scanneradaptor scanner.xml + * + * qdbusxml2cpp is Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). + * + * This is an auto-generated file. + * Do not edit! All changes made to it will be lost. + */ + +#include "scanneradaptor.h" +#include <QtCore/QMetaObject> +#include <QtCore/QByteArray> +#include <QtCore/QList> +#include <QtCore/QMap> +#include <QtCore/QString> +#include <QtCore/QStringList> +#include <QtCore/QVariant> + +/* + * Implementation of adaptor class ScannerAdaptor + */ + +ScannerAdaptor::ScannerAdaptor(QObject *parent) + : QDBusAbstractAdaptor(parent) +{ + // constructor + connect(parent, SIGNAL(started()), this, SIGNAL(Started())); + connect(parent, SIGNAL(finished()), this, SIGNAL(Finished())); + connect(parent, SIGNAL(watchFound(QVariantMap)), + this, SIGNAL(WatchFound(QVariantMap))); +} + +ScannerAdaptor::~ScannerAdaptor() +{ + // destructor +} + +void ScannerAdaptor::Start() +{ + // handle method call com.javispedro.sowatch.WatchScanner.Start + QMetaObject::invokeMethod(parent(), "start"); +} diff --git a/sowatchd/scanneradaptor.h b/sowatchd/scanneradaptor.h new file mode 100644 index 0000000..17ffe54 --- /dev/null +++ b/sowatchd/scanneradaptor.h @@ -0,0 +1,55 @@ +/* + * This file was generated by qdbusxml2cpp version 0.7 + * Command line was: qdbusxml2cpp -c ScannerAdaptor -a scanneradaptor scanner.xml + * + * qdbusxml2cpp is Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). + * + * This is an auto-generated file. + * This file may have been hand-edited. Look for HAND-EDIT comments + * before re-generating it. + */ + +#ifndef SCANNERADAPTOR_H_1335303169 +#define SCANNERADAPTOR_H_1335303169 + +#include <QtCore/QObject> +#include <QtDBus/QtDBus> +class QByteArray; +template<class T> class QList; +template<class Key, class Value> class QMap; +class QString; +class QStringList; +class QVariant; + +/* + * Adaptor class for interface com.javispedro.sowatch.WatchScanner + */ +class ScannerAdaptor: public QDBusAbstractAdaptor +{ + Q_OBJECT + Q_CLASSINFO("D-Bus Interface", "com.javispedro.sowatch.WatchScanner") + Q_CLASSINFO("D-Bus Introspection", "" +" <interface name=\"com.javispedro.sowatch.WatchScanner\">\n" +" <method name=\"Start\"/>\n" +" <signal name=\"Started\"/>\n" +" <signal name=\"Finished\"/>\n" +" <signal name=\"WatchFound\">\n" +" <annotation value=\"QVariantMap\" name=\"com.trolltech.QtDBus.QtTypeName.In0\"/>\n" +" <arg type=\"a{sv}\" name=\"info\"/>\n" +" </signal>\n" +" </interface>\n" + "") +public: + ScannerAdaptor(QObject *parent); + virtual ~ScannerAdaptor(); + +public: // PROPERTIES +public Q_SLOTS: // METHODS + void Start(); +Q_SIGNALS: // SIGNALS + void Finished(); + void Started(); + void WatchFound(const QVariantMap &info); +}; + +#endif diff --git a/sowatchd/service.cpp b/sowatchd/service.cpp deleted file mode 100644 index 0b3777c..0000000 --- a/sowatchd/service.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include "global.h" -#include "service.h" - -using namespace sowatch; - -Service::Service(QObject *parent) : - QObject(parent) -{ - -} - -void Service::terminate() -{ - QCoreApplication::exit(0); -} diff --git a/sowatchd/service.h b/sowatchd/service.h deleted file mode 100644 index 797dc3d..0000000 --- a/sowatchd/service.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef SERVICE_H -#define SERVICE_H - -#include <QtCore/QObject> -#include <QtCore/QList> -#include <QtCore/QSettings> - -#include <sowatch.h> - -namespace sowatch -{ - -class Service : public QObject -{ - Q_OBJECT -public: - explicit Service(QObject *parent = 0); - -public slots: - void terminate(); - -}; - -} - -#endif // SERVICE_H diff --git a/sowatchd/service.xml b/sowatchd/service.xml deleted file mode 100644 index b2ebc06..0000000 --- a/sowatchd/service.xml +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<SFW version="1.1"> -<service> - <name>sowatch-service</name> - <ipcaddress>sowatchd</ipcaddress> - <description>Sowatch Service</description> - <interface> - <name>com.javispedro.sowatch.service</name> - <version>1.0</version> - <description></description> - <capabilities></capabilities> - </interface> -</service> -</SFW> diff --git a/sowatchd/sowatchd.pro b/sowatchd/sowatchd.pro index 5c195c6..0794c2c 100644 --- a/sowatchd/sowatchd.pro +++ b/sowatchd/sowatchd.pro @@ -1,45 +1,33 @@ -TEMPLATE = app - TARGET = sowatchd -QT += core gui -CONFIG -= app_bundle - -# Qt Mobility 1.2 -maemo5 { - CONFIG += mobility12 -} else { - CONFIG += mobility -} -MOBILITY += serviceframework - -SOURCES += main.cpp daemon.cpp service.cpp +TEMPLATE = app -HEADERS += global.h daemon.h service.h +QT += core gui dbus +CONFIG -= app_bundle -win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../libsowatch/release/ -lsowatch -else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../libsowatch/debug/ -lsowatch -else:symbian: LIBS += -lsowatch -else:unix: LIBS += -L$$OUT_PWD/../libsowatch/ -lsowatch +SOURCES += main.cpp daemon.cpp allscanner.cpp scanneradaptor.cpp daemonadaptor.cpp +HEADERS += global.h daemon.h allscanner.h scanneradaptor.h daemonadaptor.h +LIBS += -L$$OUT_PWD/../libsowatch/ -lsowatch INCLUDEPATH += $$PWD/../libsowatch DEPENDPATH += $$PWD/../libsowatch xml.files = service.xml INSTALLS += xml -unix { - !isEmpty(MEEGO_VERSION_MAJOR)|maemo5 { - QMAKE_RPATHDIR += /opt/sowatch/lib - target.path = /opt/sowatch/bin - xml.path = /opt/sowatch/xml - } else { - target.path = /usr/bin - xml.path = /usr/share/sowatch/xml - } - INSTALLS += target - - dbus.path = /usr/share/dbus-1/services - dbus.files = com.javispedro.sowatch.service.sowatch-service.service - INSTALLS += dbus +!isEmpty(MEEGO_VERSION_MAJOR)|maemo5 { + QMAKE_RPATHDIR += /opt/sowatch/lib + target.path = /opt/sowatch/bin + xml.path = /opt/sowatch/xml +} else { + target.path = /usr/bin + xml.path = /usr/share/sowatch/xml } +INSTALLS += target + +dbus.path = /usr/share/dbus-1/services +dbus.files = com.javispedro.sowatch.service.sowatch-service.service +INSTALLS += dbus + +OTHER_FILES += scanner.xml \ + daemon.xml |