File indexing completed on 2024-05-05 04:48:33
0001 /**************************************************************************************** 0002 * Copyright (c) 2013 Konrad Zemek <konrad.zemek@gmail.com> * 0003 * * 0004 * This program is free software; you can redistribute it and/or modify it under * 0005 * the terms of the GNU General Public License as published by the Free Software * 0006 * Foundation; either version 2 of the License, or (at your option) any later * 0007 * version. * 0008 * * 0009 * This program is distributed in the hope that it will be useful, but WITHOUT ANY * 0010 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * 0011 * PARTICULAR PURPOSE. See the GNU General Public License for more details. * 0012 * * 0013 * You should have received a copy of the GNU General Public License along with * 0014 * this program. If not, see <http://www.gnu.org/licenses/>. * 0015 ****************************************************************************************/ 0016 0017 #ifndef STATSYNCING_SIMPLE_IMPORTER_MANAGER_H 0018 #define STATSYNCING_SIMPLE_IMPORTER_MANAGER_H 0019 0020 #include "ImporterManager.h" 0021 0022 using namespace StatSyncing; 0023 0024 /** 0025 * This macro can be used to reduce the amount of code needed in order to implement 0026 * ImporterManager subclass and export it as a plugin. If your manager doesn't do 0027 * anything other than give static info, you can replace the whole class with this macro. 0028 * You need to include the .moc file after this macro (\#include <YourFile.moc>). 0029 * See iTunes importer for usage example (ITunesManager.cpp file). 0030 */ 0031 #define AMAROK_EXPORT_SIMPLE_IMPORTER_PLUGIN( libname, JSON, TYPE, PRETTY_NAME, DESCRIPTION, \ 0032 ICON, ConfigWidget_T, ImporterProvider_T ) \ 0033 class libname : public ImporterManager \ 0034 { \ 0035 Q_PLUGIN_METADATA(IID AmarokPluginFactory_iid FILE JSON) \ 0036 Q_INTERFACES(Plugins::PluginFactory) \ 0037 Q_OBJECT \ 0038 \ 0039 public: \ 0040 libname() \ 0041 { \ 0042 } \ 0043 \ 0044 QString type() const \ 0045 override { \ 0046 return TYPE; \ 0047 } \ 0048 \ 0049 QString prettyName() const \ 0050 override { \ 0051 return PRETTY_NAME; \ 0052 } \ 0053 \ 0054 QString description() const \ 0055 override { \ 0056 return DESCRIPTION; \ 0057 } \ 0058 \ 0059 QIcon icon() const \ 0060 override { \ 0061 return ICON; \ 0062 } \ 0063 \ 0064 ProviderConfigWidget *configWidget( const QVariantMap &config ) \ 0065 override { \ 0066 return new ConfigWidget_T( config ); \ 0067 } \ 0068 \ 0069 protected: \ 0070 ImporterProviderPtr newInstance( const QVariantMap &config ) \ 0071 override { \ 0072 return ImporterProviderPtr( new ImporterProvider_T( config, this ) ); \ 0073 } \ 0074 }; \ 0075 0076 #endif // STATSYNCING_SIMPLE_IMPORTER_MANAGER_H