2
* turencontrollermanager.cpp
3
* Copyright (C) 2006 Remko Troncon
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this library; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
#ifndef QT_STATICPLUGIN
22
#define QT_STATICPLUGIN
26
#include <QPluginLoader>
27
#include <QCoreApplication>
30
#include "tunecontrollermanager.h"
31
#include "tunecontrollerplugin.h"
34
* \class TuneControllerManager
35
* \brief A manager for all tune controller plugins.
39
TuneControllerManager::TuneControllerManager() : QObject(QCoreApplication::instance())
41
foreach(QObject* plugin,QPluginLoader::staticInstances()) {
48
* \brief Returns a list of all the supported controllers.
50
QList<QString> TuneControllerManager::controllerNames() const
52
return plugins_.keys();
57
* \brief Creates a new controller.
59
TuneController* TuneControllerManager::createController(const QString& name) const
61
return plugins_[name]->createController();
66
* \brief Loads a TuneControllerPlugin from a file.
68
bool TuneControllerManager::loadPlugin(const QString& file)
70
//return QPluginLoader(file).load();
71
return loadPlugin(QPluginLoader(file).instance());
75
bool TuneControllerManager::loadPlugin(QObject* plugin)
80
TuneControllerPlugin* tcplugin = qobject_cast<TuneControllerPlugin*>(plugin);
82
if(!plugins_.contains(tcplugin->name())) {
83
//qDebug() << "Registering plugin " << tcplugin->name();
84
plugins_[tcplugin->name()] = tcplugin;
93
* \brief Retrieves the global plugin manager.
95
TuneControllerManager* TuneControllerManager::instance()
98
instance_ = new TuneControllerManager();
102
TuneControllerManager* TuneControllerManager::instance_ = 0;
105
// ----------------------------------------------------------------------------
108
Q_IMPORT_PLUGIN(itunesplugin)
112
Q_IMPORT_PLUGIN(xmmsplugin);
116
Q_IMPORT_PLUGIN(winampplugin);
120
Q_IMPORT_PLUGIN(psifileplugin);