File indexing completed on 2024-05-12 04:55:37
0001 /** 0002 * \file freedbimportplugin.cpp 0003 * Freedb import plugin. 0004 * 0005 * \b Project: Kid3 0006 * \author Urs Fleisch 0007 * \date 13 Jul 2013 0008 * 0009 * Copyright (C) 2013-2018 Urs Fleisch 0010 * 0011 * This file is part of Kid3. 0012 * 0013 * Kid3 is free software; you can redistribute it and/or modify 0014 * it under the terms of the GNU General Public License as published by 0015 * the Free Software Foundation; either version 2 of the License, or 0016 * (at your option) any later version. 0017 * 0018 * Kid3 is distributed in the hope that it will be useful, 0019 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0021 * GNU General Public License for more details. 0022 * 0023 * You should have received a copy of the GNU General Public License 0024 * along with this program. If not, see <http://www.gnu.org/licenses/>. 0025 */ 0026 0027 #include "freedbimportplugin.h" 0028 #include "freedbimporter.h" 0029 0030 namespace { 0031 0032 const QLatin1String FREEDB_IMPORTER_NAME("FreedbImport"); 0033 0034 } 0035 0036 /*! 0037 * Constructor. 0038 * @param parent parent object 0039 */ 0040 FreedbImportPlugin::FreedbImportPlugin(QObject* parent) : QObject(parent) 0041 { 0042 setObjectName(QLatin1String("FreedbImport")); 0043 } 0044 0045 /** 0046 * Get keys of available server importers. 0047 * @return list of keys. 0048 */ 0049 QStringList FreedbImportPlugin::serverImporterKeys() const 0050 { 0051 return {FREEDB_IMPORTER_NAME}; 0052 } 0053 0054 /** 0055 * Create server importer. 0056 * @param key server importer key 0057 * @param netMgr network access manager 0058 * @param trackDataModel track data to be filled with imported values 0059 * @return server importer instance, 0 if key unknown. 0060 * @remarks The caller takes ownership of the returned instance. 0061 */ 0062 ServerImporter* FreedbImportPlugin::createServerImporter( 0063 const QString& key, 0064 QNetworkAccessManager* netMgr, TrackDataModel* trackDataModel) 0065 { 0066 if (key == FREEDB_IMPORTER_NAME) { 0067 return new FreedbImporter(netMgr, trackDataModel); 0068 } 0069 return nullptr; 0070 }