Plasma
dbuswatcher.h
Go to the documentation of this file.00001 /* 00002 * Copyright 2008 Alex Merry <alex.merry@kdemail.net> 00003 * 00004 * This library is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU Lesser General Public 00006 * License as published by the Free Software Foundation; either 00007 * version 2.1 of the License, or (at your option) any later version. 00008 * 00009 * This library is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * Lesser General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Lesser General Public 00015 * License along with this program. If not, see <http://www.gnu.org/licenses/>. 00016 */ 00017 00018 #ifndef DBUSWATCHER_H 00019 #define DBUSWATCHER_H 00020 00021 #include <QObject> 00022 #include <QHash> 00023 #include <QString> 00024 00025 #include "player.h" 00026 00027 class QDBusConnectionInterface; 00028 class DBusPlayerFactory; 00029 00030 class DBusWatcher : public QObject 00031 { 00032 Q_OBJECT 00033 00034 public: 00035 DBusWatcher(QObject* parent = 0); 00036 00037 QList<Player::Ptr> players(); 00038 00044 void addFactory(DBusPlayerFactory* factory); 00045 00046 Q_SIGNALS: 00050 void newPlayer(Player::Ptr player); 00056 void playerDisappeared(Player::Ptr player); 00057 00058 private Q_SLOTS: 00059 void serviceChange(const QString& name, 00060 const QString& oldOwner, 00061 const QString& newOwner); 00062 00063 private: 00064 QList<DBusPlayerFactory*> m_factories; 00065 QHash<QString,Player::Ptr> m_players; 00066 QDBusConnectionInterface* m_bus; 00067 }; 00068 00069 #endif // DBUSWATCHER_H