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
22 #include <QVariantList>
27 * A player factory that creates players.
29 class PlayerFactory
: public QObject
33 PlayerFactory(QObject
* parent
= 0);
37 * Returns 0 if a valid player could not be created.
39 virtual Player::Ptr
create(const QVariantList
& args
= QVariantList()) = 0;
43 * A player factory that is polled.
45 class PollingPlayerFactory
: public PlayerFactory
49 PollingPlayerFactory(QObject
* parent
= 0);
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
59 virtual bool exists(const QVariantList
& args
= QVariantList()) = 0;
63 * A player factory that creates players based on a
66 class DBusPlayerFactory
: public PlayerFactory
70 DBusPlayerFactory(QObject
* parent
= 0);
72 * Whether the given dbus service name is a service
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