1
/*
2
 *  Copyright (c) 2007 Maximilian Kossick <maximilian.kossick@googlemail.com>
3
 *
4
 *  This program is free software; you can redistribute it and/or modify
5
 *  it under the terms of the GNU General Public License as published by
6
 *  the Free Software Foundation; either version 2 of the License, or
7
 *  (at your option) any later version.
8
 *
9
 *  This program is distributed in the hope that it will be useful,
10
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 *  GNU General Public License for more details.
13
 *
14
 *  You should have received a copy of the GNU General Public License
15
 *  along with this program; if not, write to the Free Software
16
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
 */
18
19
#ifndef AMAROK_AMAROKMIMEDATA_H
20
#define AMAROK_AMAROKMIMEDATA_H
21
22
#include "amarok_export.h"
23
#include "amarokurls/BookmarkGroup.h"
24
#include "meta/Meta.h"
25
#include "meta/Playlist.h"
26
#include "podcasts/PodcastMeta.h"
27
#include "collection/QueryMaker.h"
28
// #include "browsers/playlistbrowser/SqlPlaylistGroup.h"
29
30
#include <QList>
31
#include <QMap>
32
#include <QMimeData>
33
34
class AMAROK_EXPORT AmarokMimeData : public QMimeData
35
{
36
    Q_OBJECT
37
    public:
38
        static const QString TRACK_MIME;
39
        static const QString PLAYLIST_MIME;
40
41
        static const QString PLAYLISTBROWSERGROUP_MIME;
42
43
        static const QString PODCASTCHANNEL_MIME;
44
        static const QString PODCASTEPISODE_MIME;
45
46
        static const QString AMAROKURL_MIME;
47
        static const QString BOOKMARKGROUP_MIME;
48
49
        AmarokMimeData();
50
        virtual ~AmarokMimeData();
51
52
        virtual QStringList formats() const;
53
        virtual bool hasFormat( const QString &mimeType ) const;
54
55
        Meta::TrackList tracks() const;
56
        void setTracks( const Meta::TrackList &tracks );
57
        void addTracks( const Meta::TrackList &tracks );
58
59
        Meta::PlaylistList playlists() const;
60
        void setPlaylists( const Meta::PlaylistList &playlists );
61
        void addPlaylists( const Meta::PlaylistList &playlists );
62
63
        QStringList playlistGroups() const;
64
        void setPlaylistGroups( const QStringList &groups );
65
        void addPlaylistGroup( const QString &group );
66
67
        Meta::PodcastChannelList podcastChannels() const;
68
        void setPodcastChannels( const Meta::PodcastChannelList &channels );
69
        void addPodcastChannels( const Meta::PodcastChannelList &channels );
70
71
        Meta::PodcastEpisodeList podcastEpisodes() const;
72
        void setPodcastEpisodes( const Meta::PodcastEpisodeList &episodes );
73
        void addPodcastEpisodes( const Meta::PodcastEpisodeList &episodes );
74
75
        QList<QueryMaker*> queryMakers();
76
        void addQueryMaker( QueryMaker *queryMaker );
77
        void setQueryMakers( const QList<QueryMaker*> &queryMakers );
78
79
        BookmarkList bookmarks() const;
80
        void setBookmarks( const BookmarkList &bookmarks );
81
        void addBookmarks( const BookmarkList &bookmarks );
82
83
        BookmarkGroupList bookmarkGroups() const;
84
        void setBookmarkGroups( const BookmarkGroupList &groups );
85
        void addBookmarkGroups( const BookmarkGroupList &groups );
86
87
        /**
88
            There is a lot of time to run the queries while the user is dragging.
89
            This method runs all queries passed to this object. It will do nothing if there
90
            are no queries.
91
         */
92
        void startQueries();
93
94
    signals:
95
        void trackListSignal( Meta::TrackList ) const;
96
97
    public slots:
98
        void getTrackListSignal() const;
99
100
    protected:
101
        virtual QVariant retrieveData( const QString &mimeType, QVariant::Type type ) const;
102
103
    private slots:
104
        void newResultReady( const QString &collectionId, const Meta::TrackList &tracks );
105
        void queryDone();
106
107
    private:
108
        class Private;
109
        Private * const d;
110
111
        AmarokMimeData( const AmarokMimeData& );
112
        AmarokMimeData& operator=( const AmarokMimeData& );
113
};
114
115
116
#endif