File indexing completed on 2023-05-30 11:30:44

0001 /**
0002  * Copyright (C) 2004 Michael Pyne <mpyne@kde.org>
0003  *
0004  * This program is free software; you can redistribute it and/or modify it under
0005  * the terms of the GNU General Public License as published by the Free Software
0006  * Foundation; either version 2 of the License, or (at your option) any later
0007  * version.
0008  *
0009  * This program is distributed in the hope that it will be useful, but WITHOUT ANY
0010  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
0011  * PARTICULAR PURPOSE. See the GNU General Public License for more details.
0012  *
0013  * You should have received a copy of the GNU General Public License along with
0014  * this program.  If not, see <http://www.gnu.org/licenses/>.
0015  */
0016 
0017 #ifndef CATEGORYREADERINTERFACE_H
0018 #define CATEGORYREADERINTERFACE_H
0019 
0020 #include "tagrenameroptions.h"
0021 
0022 enum TagType;
0023 
0024 class QString;
0025 
0026 template<class T> class QList;
0027 
0028 /**
0029  * This class is used to map categories into values.  You should implement the
0030  * functionality in a subclass.
0031  *
0032  * @author Michael Pyne <mpyne@kde.org>
0033  */
0034 class CategoryReaderInterface
0035 {
0036 public:
0037     virtual ~CategoryReaderInterface() { }
0038 
0039     /**
0040      * Returns the textual representation of \p type, without any processing done
0041      * on it.  For example, track values shouldn't be expanded out to the minimum
0042      * width from this function.  No CategoryID is needed since the value is constant
0043      * for a category.
0044      *
0045      * @param type, The category to retrieve the value of.
0046      * @return textual representation of that category's value.
0047      */
0048     virtual QString categoryValue(TagType type) const = 0;
0049 
0050     /**
0051      * Returns the user-specified prefix string for \p category.
0052      *
0053      * @param category the category to retrieve the value for.
0054      * @return user-specified prefix string for \p category.
0055      */
0056     virtual QString prefix(const CategoryID &category) const = 0;
0057 
0058     /**
0059      * Returns the user-specified suffix string for \p category.
0060      *
0061      * @param category the category to retrieve the value for.
0062      * @return user-specified suffix string for \p category.
0063      */
0064     virtual QString suffix(const CategoryID &category) const = 0;
0065 
0066     /**
0067      * Returns the user-specified empty action for \p category.
0068      *
0069      * @param category the category to retrieve the value for.
0070      * @return user-specified empty action for \p category.
0071      */
0072     virtual TagRenamerOptions::EmptyActions emptyAction(const CategoryID &category) const = 0;
0073 
0074     /**
0075      * Returns the user-specified empty text for \p category.  This text might
0076      * be used to replace an empty value.
0077      *
0078      * @param category the category to retrieve the value for.
0079      * @return the user-specified empty text for \p category.
0080      */
0081     virtual QString emptyText(const CategoryID &category) const = 0;
0082 
0083     /**
0084      * @return the categories in the order the user has chosen.  Categories may
0085      * be repeated (which is why CategoryID has the categoryNumber value to
0086      * disambiguate duplicates).
0087      */
0088     virtual QList<CategoryID> categoryOrder() const = 0;
0089 
0090     /**
0091      * @return track width for the Track item identified by categoryNum.
0092      */
0093     virtual int trackWidth(int categoryNum) const = 0;
0094 
0095     // You probably shouldn't reimplement this
0096     virtual QString value(const CategoryID &category) const;
0097 
0098     virtual QString separator() const = 0;
0099 
0100     virtual QString musicFolder() const = 0;
0101 
0102     /**
0103      * @param index the zero-based index of the item just before the
0104      *        separator in question.
0105      * @return true if a folder separator should be placed between the tags
0106      * at index and index + 1.
0107      */
0108     virtual bool hasFolderSeparator(int index) const = 0;
0109 
0110     virtual bool isDisabled(const CategoryID &category) const = 0;
0111 
0112     // You probably shouldn't reimplement this
0113     virtual bool isRequired(const CategoryID &category) const;
0114 
0115     // You probably shouldn't reimplement this
0116     virtual bool isEmpty(TagType category) const;
0117 
0118     // You probably shouldn't reimplement this
0119     virtual QString fixupTrack(const QString &track, int categoryNum) const;
0120 };
0121 
0122 #endif /* CATEGORYREADERINTERFACE_H */
0123 
0124 // vim: set et sw=4 tw=0 sta: