filehandle.h 2.49 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/***************************************************************************
    begin                : Sun Feb 29 2004
    copyright            : (C) 2004 by Scott Wheeler
    email                : wheeler@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.                                   *
 *                                                                         *
 ***************************************************************************/

16 17
#ifndef FILEHANDLE_H
#define FILEHANDLE_H
18

19
#include <qstringlist.h>
Laurent Montel's avatar
Laurent Montel committed
20 21
//Added by qt3to4:
#include <Q3ValueList>
22

23 24 25
class QFileInfo;
class QDateTime;
class QDataStream;
26
class CoverInfo;
27 28

class Tag;
29
class CacheDataStream;
30 31 32 33 34 35 36 37 38 39 40

/**
 * An value based, explicitly shared wrapper around file related information
 * used in JuK's playlists.
 */

class FileHandle
{
public:
    FileHandle();
    FileHandle(const FileHandle &f);
41
    explicit FileHandle(const QFileInfo &info, const QString &path = QString::null);
42
    explicit FileHandle(const QString &path);
43
    FileHandle(const QString &path, CacheDataStream &s);
44 45
    ~FileHandle();

46 47 48 49
    /**
     * Forces the FileHandle to reread its information from the disk.
     */
    void refresh();
50
    void setFile(const QString &path);
51

52
    Tag *tag() const;
53
    CoverInfo *coverInfo() const;
54 55
    QString absFilePath() const;
    const QFileInfo &fileInfo() const;
56

57
    bool isNull() const;
58 59 60
    bool current() const;
    const QDateTime &lastModified() const;

61 62
    void read(CacheDataStream &s);

63 64
    FileHandle &operator=(const FileHandle &f);
    bool operator==(const FileHandle &f) const;
65 66
    bool operator!=(const FileHandle &f) const;

67 68 69
    static QStringList properties();
    QString property(const QString &name) const;

70
    static const FileHandle &null();
71 72 73 74

private:
    class FileHandlePrivate;
    FileHandlePrivate *d;
75 76

    void setup(const QFileInfo &info, const QString &path);
77 78
};

Laurent Montel's avatar
Laurent Montel committed
79
typedef Q3ValueList<FileHandle> FileHandleList;
80

81 82 83
QDataStream &operator<<(QDataStream &s, const FileHandle &f);
CacheDataStream &operator>>(CacheDataStream &s, FileHandle &f);

84
#endif
85 86

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