~ubuntu-branches/ubuntu/lucid/amarok/lucid-backports

« back to all changes in this revision

Viewing changes to src/meta/M3UPlaylist.h

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2011-03-03 10:27:39 UTC
  • mfrom: (114.1.20 natty)
  • Revision ID: james.westby@ubuntu.com-20110303102739-ar67wpa6mllo59n2
Tags: 2:2.4.0-0ubuntu4~lucid1
* Source backport to lucid (LP: #728447)
  - Drop version requirement on libindicate-qt-dev build-dep

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/****************************************************************************************
2
 
 * Copyright (c) 2007 Bart Cerneels <bart.cerneels@kde.org>                             *
3
 
 *                                                                                      *
4
 
 * This program is free software; you can redistribute it and/or modify it under        *
5
 
 * the terms of the GNU General Public License as published by the Free Software        *
6
 
 * Foundation; either version 2 of the License, or (at your option) any later           *
7
 
 * version.                                                                             *
8
 
 *                                                                                      *
9
 
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
10
 
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
11
 
 * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
12
 
 *                                                                                      *
13
 
 * You should have received a copy of the GNU General Public License along with         *
14
 
 * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
15
 
 ****************************************************************************************/
16
 
 
17
 
#ifndef METAM3UPLAYLIST_H
18
 
#define METAM3UPLAYLIST_H
19
 
 
20
 
#include <PlaylistFile.h>
21
 
 
22
 
class QTextStream;
23
 
class QString;
24
 
class QFile;
25
 
 
26
 
namespace Meta {
27
 
 
28
 
class M3UPlaylist;
29
 
 
30
 
typedef KSharedPtr<M3UPlaylist> M3UPlaylistPtr;
31
 
typedef QList<M3UPlaylistPtr> M3UPlaylistList;
32
 
 
33
 
/**
34
 
        @author Bart Cerneels <bart.cerneels@kde.org>
35
 
*/
36
 
class AMAROK_EXPORT_TESTS M3UPlaylist : public PlaylistFile
37
 
{
38
 
    public:
39
 
        M3UPlaylist();
40
 
        M3UPlaylist( Meta::TrackList tracks );
41
 
        M3UPlaylist( const KUrl &url );
42
 
 
43
 
        ~M3UPlaylist();
44
 
 
45
 
        /* Playlist virtual functions */
46
 
        virtual QString name() const { return prettyName(); }
47
 
        virtual QString prettyName() const { return m_url.fileName(); }
48
 
        virtual QString description() const;
49
 
 
50
 
        virtual int trackCount() const { return -1; }
51
 
        /** returns all tracks in this playlist */
52
 
        virtual TrackList tracks();
53
 
 
54
 
       /* the following has been copied from Meta.h
55
 
        * it is my hope that we can integrate Playlists
56
 
        * better into the rest of the Meta framework someday ~Bart Cerneels
57
 
        * TODO: Playlist : public MetaBase
58
 
        */
59
 
        bool hasCapabilityInterface( Meta::Capability::Type type ) const { Q_UNUSED( type ); return false; }
60
 
 
61
 
        Capability* createCapabilityInterface( Capability::Type type ) { Q_UNUSED( type ); return 0; }
62
 
 
63
 
        KUrl retrievableUrl() { return m_url; }
64
 
 
65
 
        /* PlaylistFile methods */
66
 
        bool isWritable();
67
 
        void setName( const QString &name );
68
 
 
69
 
        bool save( const KUrl &location, bool relative );
70
 
        bool load( QTextStream &stream ) { return loadM3u( stream ); }
71
 
 
72
 
    private:
73
 
        bool loadM3u( QTextStream &stream );
74
 
 
75
 
        KUrl m_url;
76
 
 
77
 
        bool m_tracksLoaded;
78
 
        TrackList m_tracks;
79
 
};
80
 
 
81
 
}
82
 
 
83
 
Q_DECLARE_METATYPE( Meta::M3UPlaylistPtr )
84
 
Q_DECLARE_METATYPE( Meta::M3UPlaylistList )
85
 
 
86
 
#endif