diff options
author | Javier S. Pedro <maemo@javispedro.com> | 2012-08-09 16:38:56 +0200 |
---|---|---|
committer | Javier S. Pedro <maemo@javispedro.com> | 2012-08-09 16:38:56 +0200 |
commit | c7c6a2c596637fd4942c7fb80341ca2ef7b47808 (patch) | |
tree | 0d4196fa95444dd7e14fbaed61299454609d4762 /sowatchd | |
parent | 406332eb6b3199d19388f359d04c9f184e6082b5 (diff) | |
download | sowatch-c7c6a2c596637fd4942c7fb80341ca2ef7b47808.tar.gz sowatch-c7c6a2c596637fd4942c7fb80341ca2ef7b47808.zip |
moving scanner logic to ui, new icon
Diffstat (limited to 'sowatchd')
-rw-r--r-- | sowatchd/allscanner.cpp | 40 | ||||
-rw-r--r-- | sowatchd/allscanner.h | 29 | ||||
-rw-r--r-- | sowatchd/main.cpp | 8 | ||||
-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/sowatchd.pro | 4 |
7 files changed, 2 insertions, 189 deletions
diff --git a/sowatchd/allscanner.cpp b/sowatchd/allscanner.cpp deleted file mode 100644 index a3e7d33..0000000 --- a/sowatchd/allscanner.cpp +++ /dev/null @@ -1,40 +0,0 @@ -#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 deleted file mode 100644 index 6a7160f..0000000 --- a/sowatchd/allscanner.h +++ /dev/null @@ -1,29 +0,0 @@ -#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/main.cpp b/sowatchd/main.cpp index 29eee28..2816830 100644 --- a/sowatchd/main.cpp +++ b/sowatchd/main.cpp @@ -4,9 +4,7 @@ #include <sowatch.h> #include "global.h" -#include "allscanner.h" #include "daemonadaptor.h" -#include "scanneradaptor.h" namespace sowatch { @@ -26,17 +24,11 @@ int main(int argc, char *argv[]) sowatch::daemon = new Daemon(&a); new DaemonAdaptor(sowatch::daemon); - AllScanner *scanner = new AllScanner(&a); - new ScannerAdaptor(scanner); QDBusConnection connection = QDBusConnection::sessionBus(); if (!connection.registerService("com.javispedro.sowatchd")) { qCritical("Could not register D-Bus service"); } - - 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"); } diff --git a/sowatchd/scanner.xml b/sowatchd/scanner.xml deleted file mode 100644 index 948ce0b..0000000 --- a/sowatchd/scanner.xml +++ /dev/null @@ -1,12 +0,0 @@ -<!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 deleted file mode 100644 index a3d9ad1..0000000 --- a/sowatchd/scanneradaptor.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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 deleted file mode 100644 index 17ffe54..0000000 --- a/sowatchd/scanneradaptor.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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/sowatchd.pro b/sowatchd/sowatchd.pro index 0794c2c..4b1b668 100644 --- a/sowatchd/sowatchd.pro +++ b/sowatchd/sowatchd.pro @@ -5,8 +5,8 @@ TEMPLATE = app QT += core gui dbus CONFIG -= app_bundle -SOURCES += main.cpp daemon.cpp allscanner.cpp scanneradaptor.cpp daemonadaptor.cpp -HEADERS += global.h daemon.h allscanner.h scanneradaptor.h daemonadaptor.h +SOURCES += main.cpp daemon.cpp daemonadaptor.cpp +HEADERS += global.h daemon.h daemonadaptor.h LIBS += -L$$OUT_PWD/../libsowatch/ -lsowatch INCLUDEPATH += $$PWD/../libsowatch |