categoryreaderinterface.h 4.07 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/**
 * Copyright (C) 2004 Michael Pyne <mpyne@kde.org>
 *
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation; either version 2 of the License, or (at your option) any later
 * version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 * PARTICULAR PURPOSE. See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program.  If not, see <http://www.gnu.org/licenses/>.
 */
16

17 18
#ifndef CATEGORYREADERINTERFACE_H
#define CATEGORYREADERINTERFACE_H
19

20
#include "tagrenameroptions.h"
21

22
enum TagType;
23

24 25
class QString;

26
template<class T> class QList;
27 28 29 30 31

/**
 * This class is used to map categories into values.  You should implement the
 * functionality in a subclass.
 *
32
 * @author Michael Pyne <mpyne@kde.org>
33 34 35 36 37 38
 */
class CategoryReaderInterface
{
public:
    virtual ~CategoryReaderInterface() { }

39 40 41
    /**
     * Returns the textual representation of \p type, without any processing done
     * on it.  For example, track values shouldn't be expanded out to the minimum
42 43
     * width from this function.  No CategoryID is needed since the value is constant
     * for a category.
44
     *
45
     * @param type, The category to retrieve the value of.
46 47
     * @return textual representation of that category's value.
     */
48 49
    virtual QString categoryValue(TagType type) const = 0;

50 51 52 53 54 55
    /**
     * Returns the user-specified prefix string for \p category.
     *
     * @param category the category to retrieve the value for.
     * @return user-specified prefix string for \p category.
     */
56
    virtual QString prefix(const CategoryID &category) const = 0;
57

58 59 60 61 62 63
    /**
     * Returns the user-specified suffix string for \p category.
     *
     * @param category the category to retrieve the value for.
     * @return user-specified suffix string for \p category.
     */
64
    virtual QString suffix(const CategoryID &category) const = 0;
65

66 67 68 69 70 71
    /**
     * Returns the user-specified empty action for \p category.
     *
     * @param category the category to retrieve the value for.
     * @return user-specified empty action for \p category.
     */
72
    virtual TagRenamerOptions::EmptyActions emptyAction(const CategoryID &category) const = 0;
73

74 75 76 77 78 79 80
    /**
     * Returns the user-specified empty text for \p category.  This text might
     * be used to replace an empty value.
     *
     * @param category the category to retrieve the value for.
     * @return the user-specified empty text for \p category.
     */
81 82 83 84 85 86 87
    virtual QString emptyText(const CategoryID &category) const = 0;

    /**
     * @return the categories in the order the user has chosen.  Categories may
     * be repeated (which is why CategoryID has the categoryNumber value to
     * disambiguate duplicates).
     */
88
    virtual QList<CategoryID> categoryOrder() const = 0;
89

90 91 92
    /**
     * @return track width for the Track item identified by categoryNum.
     */
Scott Wheeler's avatar
Scott Wheeler committed
93
    virtual int trackWidth(int categoryNum) const = 0;
94 95

    // You probably shouldn't reimplement this
96
    virtual QString value(const CategoryID &category) const;
97 98 99

    virtual QString separator() const = 0;

Scott Wheeler's avatar
Scott Wheeler committed
100
    virtual QString musicFolder() const = 0;
101

102 103 104 105 106 107
    /**
     * @param index the zero-based index of the item just before the
     *        separator in question.
     * @return true if a folder separator should be placed between the tags
     * at index and index + 1.
     */
Scott Wheeler's avatar
Scott Wheeler committed
108
    virtual bool hasFolderSeparator(int index) const = 0;
109

110
    virtual bool isDisabled(const CategoryID &category) const = 0;
111 112

    // You probably shouldn't reimplement this
113
    virtual bool isRequired(const CategoryID &category) const;
114 115 116

    // You probably shouldn't reimplement this
    virtual bool isEmpty(TagType category) const;
117 118

    // You probably shouldn't reimplement this
Scott Wheeler's avatar
Scott Wheeler committed
119
    virtual QString fixupTrack(const QString &track, int categoryNum) const;
120 121
};

122
#endif /* CATEGORYREADERINTERFACE_H */
123

124
// vim: set et sw=4 tw=0 sta: