not quite so much needs to be delayed to the init() function
[personal-kdebase.git] / workspace / plasma / dataengines / nowplaying / playerinterface / playerfactory.h
blob27371f3162836e27e119588353231a7ed2929632
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 PLAYERFACTORY_H
19 #define PLAYERFACTORY_H
21 #include <QObject>
22 #include <QVariantList>
24 #include "player.h"
26 /**
27 * A player factory that creates players.
29 class PlayerFactory : public QObject
31 Q_OBJECT
32 public:
33 PlayerFactory(QObject* parent = 0);
34 /**
35 * Create a player.
37 * Returns 0 if a valid player could not be created.
39 virtual Player::Ptr create(const QVariantList& args = QVariantList()) = 0;
42 /**
43 * A player factory that is polled.
45 class PollingPlayerFactory : public PlayerFactory
47 Q_OBJECT
48 public:
49 PollingPlayerFactory(QObject* parent = 0);
50 /**
51 * Whether create(args) will return a player
53 * Note that just because this returns true, it
54 * should not be assumed that create(args) will not
55 * return 0. However, if this returns false,
56 * it can be assumed that create(args) will always
57 * return 0.
59 virtual bool exists(const QVariantList& args = QVariantList()) = 0;
62 /**
63 * A player factory that creates players based on a
64 * DBus service.
66 class DBusPlayerFactory : public PlayerFactory
68 Q_OBJECT
69 public:
70 DBusPlayerFactory(QObject* parent = 0);
71 /**
72 * Whether the given dbus service name is a service
73 * for this player
75 virtual bool matches(const QString& serviceName) = 0;
76 // don't let the QString overload hide this
77 virtual Player::Ptr create(const QVariantList& args = QVariantList()) = 0;
78 Player::Ptr create(const QString& serviceName);
81 #endif // PLAYERFACTORY_H