not quite so much needs to be delayed to the init() function
[personal-kdebase.git] / workspace / plasma / dataengines / nowplaying / playerinterface / dbuswatcher.h
blob6d73e898c6199d79cec3cde4fa7539aee687812d
1 /*
2 * Copyright 2008 Alex Merry <alex.merry@kdemail.net>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this program. If not, see <http://www.gnu.org/licenses/>.
18 #ifndef DBUSWATCHER_H
19 #define DBUSWATCHER_H
21 #include <QObject>
22 #include <QHash>
23 #include <QString>
25 #include "player.h"
27 class QDBusConnectionInterface;
28 class DBusPlayerFactory;
30 class DBusWatcher : public QObject
32 Q_OBJECT
34 public:
35 DBusWatcher(QObject* parent = 0);
37 QList<Player::Ptr> players();
39 /**
40 * Adds a service to watch for.
42 * @param factory the factory for the player
44 void addFactory(DBusPlayerFactory* factory);
46 Q_SIGNALS:
47 /**
48 * A new service appeared on D-Bus
50 void newPlayer(Player::Ptr player);
51 /**
52 * A player disappeared from D-Bus
54 * @param player the now-invalid player
56 void playerDisappeared(Player::Ptr player);
58 private Q_SLOTS:
59 void serviceChange(const QString& name,
60 const QString& oldOwner,
61 const QString& newOwner);
63 private:
64 QList<DBusPlayerFactory*> m_factories;
65 QHash<QString,Player::Ptr> m_players;
66 QDBusConnectionInterface* m_bus;
69 #endif // DBUSWATCHER_H