1 /** 2 * \file itaggedfilefactory.h 3 * Interface for tagged file factory. 4 * 5 * \b Project: Kid3 6 * \author Urs Fleisch 7 * \date 22 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 #pragma once 28 29 #include <QtPlugin> 30 #include <QStringList> 31 #include "kid3api.h" 32 33 class QPersistentModelIndex; 34 class TaggedFile; 35 36 /** 37 * Interface for tagged file factory. 38 */ 39 class KID3_CORE_EXPORT ITaggedFileFactory { 40 public: 41 /** 42 * Destructor. 43 */ 44 virtual ~ITaggedFileFactory(); 45 46 /** 47 * Get name of factory, the same as the QObject::objectName() of the plugin. 48 * @return factory name. 49 */ 50 virtual QString name() const = 0; 51 52 /** 53 * Get keys of available tagged file formats. 54 * @return list of keys. 55 */ 56 virtual QStringList taggedFileKeys() const = 0; 57 58 /** 59 * Get features supported. 60 * @param key tagged file key 61 * @return bit mask with TaggedFile::Feature flags set. 62 */ 63 virtual int taggedFileFeatures(const QString& key) const = 0; 64 65 /** 66 * Initialize tagged file factory. 67 * This method has to be called before creating a tagged file. 68 * It can be called after the application is initialized and therefore can 69 * access application data which is not possible in the constructor. 70 * 71 * @param key tagged file key 72 */ 73 virtual void initialize(const QString& key) = 0; 74 75 /** 76 * Create a tagged file. 77 * 78 * @param key tagged file key 79 * @param fileName filename 80 * @param idx model index 81 * @param features optional tagged file features (TaggedFile::Feature flags) 82 * to activate at creation 83 * 84 * @return tagged file, 0 if type not supported. 85 */ 86 virtual TaggedFile* createTaggedFile( 87 const QString& key, 88 const QString& fileName, 89 const QPersistentModelIndex& idx, 90 int features = 0) = 0; 91 92 /** 93 * Get a list with all extensions (e.g. ".mp3") supported by TaggedFile subclass. 94 * 95 * @param key tagged file key 96 * 97 * @return list of file extensions. 98 */ 99 virtual QStringList supportedFileExtensions(const QString& key) const = 0; 100 101 /** 102 * Notify about configuration change. 103 * This method shall be called when the configuration changes. 104 * 105 * @param key tagged file key 106 */ 107 virtual void notifyConfigurationChange(const QString& key) = 0; 108 }; 109 110 Q_DECLARE_INTERFACE(ITaggedFileFactory, 111 "org.kde.kid3.ITaggedFileFactory") 112