File indexing completed on 2024-05-19 04:49:32

0001 
0002 /****************************************************************************************
0003  * Copyright (c) 2010 Rick W. Chen <stuffcorpse@archlinux.us>                           *
0004  *                                                                                      *
0005  * This program is free software; you can redistribute it and/or modify it under        *
0006  * the terms of the GNU General Public License as published by the Free Software        *
0007  * Foundation; either version 2 of the License, or (at your option) any later           *
0008  * version.                                                                             *
0009  *                                                                                      *
0010  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
0011  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
0012  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
0013  *                                                                                      *
0014  * You should have received a copy of the GNU General Public License along with         *
0015  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
0016  ****************************************************************************************/
0017 
0018 #ifndef AMAROK_PLUGINFACTORY_H
0019 #define AMAROK_PLUGINFACTORY_H
0020 
0021 #include "core/amarokcore_export.h"
0022 
0023 #include <QObject>
0024 #include <QtPlugin>
0025 
0026 namespace Plugins {
0027 
0028 /** Baseclass for Amarok plugins.
0029  *
0030  *  This class is subclassed for the different type of Amarok plugins.
0031  *  - CollectionPlugin
0032  *  - ServicePlugin
0033  *  - ImportPlugin
0034  *  - StoragePlugin
0035  *
0036  */
0037 class AMAROKCORE_EXPORT PluginFactory : public QObject
0038 {
0039     Q_OBJECT
0040 
0041 public:
0042     PluginFactory();
0043     ~PluginFactory() override = 0;
0044 
0045     /** Initialize the service plugin of this type.
0046     *
0047     * Reimplemented by subclasses, which must set
0048     * m_initialized = true when the function has finished.
0049     *
0050     * This function is called by the PluginManager after
0051     * setting the plugin in the different sub-plugin managers
0052     * */
0053     virtual void init() = 0;
0054 
0055 protected:
0056     bool m_initialized;
0057 };
0058 
0059 } // namespace Plugins
0060 
0061 #define AmarokPluginFactory_iid "org.kde.amarok.plugin_factory"
0062 
0063 Q_DECLARE_INTERFACE( Plugins::PluginFactory, AmarokPluginFactory_iid )
0064 
0065 #endif /* AMAROK_PLUGINFACTORY_H */