1 /** 2 * \file batchimportprofile.h 3 * Profile containing a name list for source for batch import. 4 * 5 * \b Project: Kid3 6 * \author Urs Fleisch 7 * \date 2 Jan 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 <QList> 30 #include "kid3api.h" 31 32 /** 33 * Profile containing a name list for source for batch import. 34 */ 35 class KID3_CORE_EXPORT BatchImportProfile { 36 public: 37 /** 38 * Properties of a source used during batch import. 39 */ 40 class Source { 41 public: 42 /** 43 * Constructor. 44 */ Source()45 Source() : m_accuracy(0), 46 m_standardTags(false), m_additionalTags(false), m_coverArt(false) { 47 } 48 49 /** 50 * Get name. 51 * @return name. 52 */ getName()53 QString getName() const { return m_name; } 54 55 /** 56 * Set name. 57 * @param name name 58 */ setName(const QString & name)59 void setName(const QString& name) { m_name = name; } 60 61 /** 62 * Get required accuracy. 63 * An import will only be applied if at least the given accuracy is reached. 64 * @return accuracy. 65 */ getRequiredAccuracy()66 int getRequiredAccuracy() const { return m_accuracy; } 67 68 /** 69 * Set required accuracy. 70 * @param accuracy accuracy 71 */ setRequiredAccuracy(int accuracy)72 void setRequiredAccuracy(int accuracy) { m_accuracy = accuracy; } 73 74 /** 75 * Check if standard tags are fetched from this source. 76 * @return true if standard tags are fetched. 77 */ standardTagsEnabled()78 bool standardTagsEnabled() const { return m_standardTags; } 79 80 /** 81 * Enable fetching of standard tags from this source. 82 * @param enable true to fetch standard tags 83 */ enableStandardTags(bool enable)84 void enableStandardTags(bool enable) { m_standardTags = enable; } 85 86 /** 87 * Check if additional tags are fetched from this source. 88 * @return true if additional tags are fetched. 89 */ additionalTagsEnabled()90 bool additionalTagsEnabled() const { return m_additionalTags; } 91 92 /** 93 * Enable fetching of additional tags from this source. 94 * @param enable true to fetch additional tags 95 */ enableAdditionalTags(bool enable)96 void enableAdditionalTags(bool enable) { m_additionalTags = enable; } 97 98 /** 99 * Check if cover art is fetched from this source. 100 * @return true if cover art is fetched. 101 */ coverArtEnabled()102 bool coverArtEnabled() const { return m_coverArt; } 103 104 /** 105 * Enable fetching of cover art from this source. 106 * @param enable true to fetch cover art 107 */ enableCoverArt(bool enable)108 void enableCoverArt(bool enable) { m_coverArt = enable; } 109 110 private: 111 QString m_name; 112 int m_accuracy; 113 bool m_standardTags; 114 bool m_additionalTags; 115 bool m_coverArt; 116 }; 117 118 119 /** 120 * Constructor. 121 */ 122 BatchImportProfile(); 123 124 /** 125 * Get name. 126 * @return name. 127 */ getName()128 QString getName() const { return m_name; } 129 130 /** 131 * Set name. 132 * @param name name 133 */ setName(const QString & name)134 void setName(const QString& name) { m_name = name; } 135 136 /** 137 * Set import sources used by this batch. 138 * @param sources import sources 139 */ setSources(const QList<Source> & sources)140 void setSources(const QList<Source>& sources) { m_sources = sources; } 141 142 /** 143 * Get import sources used by this batch. 144 * @return sources. 145 */ getSources()146 const QList<Source>& getSources() const { return m_sources; } 147 148 /** 149 * Restore batch import sources from serialized string. 150 * @param str string representation of import sources 151 */ 152 void setSourcesFromString(const QString& str); 153 154 /** 155 * Serialize batch import sources as a string. 156 * @return string representation of import sources. 157 */ 158 QString getSourcesAsString() const; 159 160 private: 161 QString m_name; 162 QList<Source> m_sources; 163 }; 164