1 /** 2 * \file discogsimportplugin.cpp 3 * Discogs import plugin. 4 * 5 * \b Project: Kid3 6 * \author Urs Fleisch 7 * \date 13 Jul 2013 8 * 9 * Copyright (C) 2013-2018 Urs Fleisch 10 * 11 * This file is part of Kid3. 12 * 13 * Kid3 is free software; you can redistribute it and/or modify 14 * it under the terms of the GNU General Public License as published by 15 * the Free Software Foundation; either version 2 of the License, or 16 * (at your option) any later version. 17 * 18 * Kid3 is distributed in the hope that it will be useful, 19 * but WITHOUT ANY WARRANTY; without even the implied warranty of 20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 * GNU General Public License for more details. 22 * 23 * You should have received a copy of the GNU General Public License 24 * along with this program. If not, see <http://www.gnu.org/licenses/>. 25 */ 26 27 #include "discogsimportplugin.h" 28 #include "discogsimporter.h" 29 30 namespace { 31 32 const QLatin1String IMPORTER_NAME("DiscogsImport"); 33 34 } 35 36 /*! 37 * Constructor. 38 * @param parent parent object 39 */ DiscogsImportPlugin(QObject * parent)40DiscogsImportPlugin::DiscogsImportPlugin(QObject* parent) : QObject(parent) 41 { 42 setObjectName(QLatin1String("DiscogsImport")); 43 } 44 45 /** 46 * Get keys of available server importers. 47 * @return list of keys. 48 */ serverImporterKeys() const49QStringList DiscogsImportPlugin::serverImporterKeys() const 50 { 51 return {IMPORTER_NAME}; 52 } 53 54 /** 55 * Create server importer. 56 * @param key server importer key 57 * @param netMgr network access manager 58 * @param trackDataModel track data to be filled with imported values 59 * @return server importer instance, 0 if key unknown. 60 * @remarks The caller takes ownership of the returned instance. 61 */ createServerImporter(const QString & key,QNetworkAccessManager * netMgr,TrackDataModel * trackDataModel)62ServerImporter* DiscogsImportPlugin::createServerImporter( 63 const QString& key, 64 QNetworkAccessManager* netMgr, TrackDataModel* trackDataModel) 65 { 66 if (key == IMPORTER_NAME) { 67 return new DiscogsImporter(netMgr, trackDataModel); 68 } 69 return nullptr; 70 } 71