File indexing completed on 2024-05-19 04:55:53
0001 /** 0002 * \file batchimportprofile.h 0003 * Profile containing a name list for source for batch import. 0004 * 0005 * \b Project: Kid3 0006 * \author Urs Fleisch 0007 * \date 2 Jan 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 #pragma once 0028 0029 #include <QList> 0030 #include "kid3api.h" 0031 0032 /** 0033 * Profile containing a name list for source for batch import. 0034 */ 0035 class KID3_CORE_EXPORT BatchImportProfile { 0036 public: 0037 /** 0038 * Properties of a source used during batch import. 0039 */ 0040 class Source { 0041 public: 0042 /** 0043 * Constructor. 0044 */ 0045 Source() : m_accuracy(0), 0046 m_standardTags(false), m_additionalTags(false), m_coverArt(false) { 0047 } 0048 0049 /** 0050 * Get name. 0051 * @return name. 0052 */ 0053 QString getName() const { return m_name; } 0054 0055 /** 0056 * Set name. 0057 * @param name name 0058 */ 0059 void setName(const QString& name) { m_name = name; } 0060 0061 /** 0062 * Get required accuracy. 0063 * An import will only be applied if at least the given accuracy is reached. 0064 * @return accuracy. 0065 */ 0066 int getRequiredAccuracy() const { return m_accuracy; } 0067 0068 /** 0069 * Set required accuracy. 0070 * @param accuracy accuracy 0071 */ 0072 void setRequiredAccuracy(int accuracy) { m_accuracy = accuracy; } 0073 0074 /** 0075 * Check if standard tags are fetched from this source. 0076 * @return true if standard tags are fetched. 0077 */ 0078 bool standardTagsEnabled() const { return m_standardTags; } 0079 0080 /** 0081 * Enable fetching of standard tags from this source. 0082 * @param enable true to fetch standard tags 0083 */ 0084 void enableStandardTags(bool enable) { m_standardTags = enable; } 0085 0086 /** 0087 * Check if additional tags are fetched from this source. 0088 * @return true if additional tags are fetched. 0089 */ 0090 bool additionalTagsEnabled() const { return m_additionalTags; } 0091 0092 /** 0093 * Enable fetching of additional tags from this source. 0094 * @param enable true to fetch additional tags 0095 */ 0096 void enableAdditionalTags(bool enable) { m_additionalTags = enable; } 0097 0098 /** 0099 * Check if cover art is fetched from this source. 0100 * @return true if cover art is fetched. 0101 */ 0102 bool coverArtEnabled() const { return m_coverArt; } 0103 0104 /** 0105 * Enable fetching of cover art from this source. 0106 * @param enable true to fetch cover art 0107 */ 0108 void enableCoverArt(bool enable) { m_coverArt = enable; } 0109 0110 private: 0111 QString m_name; 0112 int m_accuracy; 0113 bool m_standardTags; 0114 bool m_additionalTags; 0115 bool m_coverArt; 0116 }; 0117 0118 0119 /** 0120 * Constructor. 0121 */ 0122 BatchImportProfile(); 0123 0124 /** 0125 * Get name. 0126 * @return name. 0127 */ 0128 QString getName() const { return m_name; } 0129 0130 /** 0131 * Set name. 0132 * @param name name 0133 */ 0134 void setName(const QString& name) { m_name = name; } 0135 0136 /** 0137 * Set import sources used by this batch. 0138 * @param sources import sources 0139 */ 0140 void setSources(const QList<Source>& sources) { m_sources = sources; } 0141 0142 /** 0143 * Get import sources used by this batch. 0144 * @return sources. 0145 */ 0146 const QList<Source>& getSources() const { return m_sources; } 0147 0148 /** 0149 * Restore batch import sources from serialized string. 0150 * @param str string representation of import sources 0151 */ 0152 void setSourcesFromString(const QString& str); 0153 0154 /** 0155 * Serialize batch import sources as a string. 0156 * @return string representation of import sources. 0157 */ 0158 QString getSourcesAsString() const; 0159 0160 private: 0161 QString m_name; 0162 QList<Source> m_sources; 0163 };