cachedtag.h 2.69 KB
Newer Older
1 2 3 4 5
/***************************************************************************
                          cachedtag.h  -  description
                             -------------------
    begin                : Sat Oct 5 2002
    copyright            : (C) 2002 by Scott Wheeler
6
    email                : wheeler@kde.org
7 8 9 10 11 12 13 14 15 16 17 18 19 20
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef CACHEDTAG_H
#define CACHEDTAG_H

21 22
#include <qdatastream.h>

23 24 25 26 27 28 29 30 31
#include "tag.h"

class CachedTag : public Tag
{
public: 
    CachedTag(const QString &file);
    virtual ~CachedTag();

    virtual void save();
32
    virtual bool hasTag() const;
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49

    virtual QString track() const;
    virtual QString artist() const;
    virtual QString album() const;
    virtual Genre genre() const;
    virtual int trackNumber() const;
    virtual QString trackNumberString() const;
    virtual int year() const;
    virtual QString yearString() const;
    virtual QString comment() const;

    virtual void setTrack(const QString &value);
    virtual void setArtist(const QString &value);
    virtual void setAlbum(const QString &value);
    virtual void setGenre(const Genre &value);
    virtual void setTrackNumber(int value);
    virtual void setYear(int value);
50 51 52 53 54 55 56 57 58 59 60
    virtual void setComment(const QString &value);

    virtual QString bitrateString() const;
    virtual QString lengthString() const;
    virtual int seconds() const;

    // CachedTag specific methods

    /**
     * Checks to see if the cache for this item is up to date.
     */
61
    virtual bool current() const;
62 63 64 65
    QDataStream &read(QDataStream &s);

private:
    Tag *proxiedTag();
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
    Tag *m_externalTag;

    QString m_tagTrack;
    QString m_tagArtist;
    QString m_tagAlbum;
    Genre m_tagGenre;
    int m_tagTrackNumber;
    QString m_tagTrackNumberString;
    int m_tagYear;
    QString m_tagYearString;
    QString m_tagComment;

    QString m_tagBitrateString;
    QString m_tagLengthString;
    int m_tagSeconds;

    bool m_tagExists;

    QString m_fileName;
    QDateTime m_modificationTime;
86 87
};

88 89
QDataStream &operator>>(QDataStream &s, CachedTag &t);

90
#endif