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 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 AMAROK_AMAROKMIMEDATA_H
18
#define AMAROK_AMAROKMIMEDATA_H
19
20
#include "amarok_export.h"
21
#include "amarokurls/BookmarkGroup.h"
22
#include "core/meta/Meta.h"
23
#include "core/playlists/Playlist.h"
24
#include "core/podcasts/PodcastMeta.h"
25
#include "core/collections/QueryMaker.h"
26
27
#include <QList>
28
#include <QMap>
29
#include <QMimeData>
30
31
class AMAROK_EXPORT AmarokMimeData : public QMimeData
32
{
33
    Q_OBJECT
34
    public:
35
        static const QString TRACK_MIME;
36
        static const QString PLAYLIST_MIME;
37
38
        static const QString PLAYLISTBROWSERGROUP_MIME;
39
40
        static const QString PODCASTCHANNEL_MIME;
41
        static const QString PODCASTEPISODE_MIME;
42
43
        static const QString AMAROKURL_MIME;
44
        static const QString BOOKMARKGROUP_MIME;
45
46
        AmarokMimeData();
47
        virtual ~AmarokMimeData();
48
49
        virtual QStringList formats() const;
50
        virtual bool hasFormat( const QString &mimeType ) const;
51
52
        Meta::TrackList tracks() const;
53
        void setTracks( const Meta::TrackList &tracks );
54
        void addTracks( const Meta::TrackList &tracks );
55
56
        Playlists::PlaylistList playlists() const;
57
        void setPlaylists( const Playlists::PlaylistList &playlists );
58
        void addPlaylists( const Playlists::PlaylistList &playlists );
59
60
        QStringList playlistGroups() const;
61
        void setPlaylistGroups( const QStringList &groups );
62
        void addPlaylistGroup( const QString &group );
63
64
        Podcasts::PodcastChannelList podcastChannels() const;
65
        void setPodcastChannels( const Podcasts::PodcastChannelList &channels );
66
        void addPodcastChannels( const Podcasts::PodcastChannelList &channels );
67
68
        Podcasts::PodcastEpisodeList podcastEpisodes() const;
69
        void setPodcastEpisodes( const Podcasts::PodcastEpisodeList &episodes );
70
        void addPodcastEpisodes( const Podcasts::PodcastEpisodeList &episodes );
71
72
        QList<Collections::QueryMaker*> queryMakers();
73
        void addQueryMaker( Collections::QueryMaker *queryMaker );
74
        void setQueryMakers( const QList<Collections::QueryMaker*> &queryMakers );
75
76
        BookmarkList bookmarks() const;
77
        void setBookmarks( const BookmarkList &bookmarks );
78
        void addBookmarks( const BookmarkList &bookmarks );
79
80
        BookmarkGroupList bookmarkGroups() const;
81
        void setBookmarkGroups( const BookmarkGroupList &groups );
82
        void addBookmarkGroups( const BookmarkGroupList &groups );
83
84
        /**
85
            There is a lot of time to run the queries while the user is dragging.
86
            This method runs all queries passed to this object. It will do nothing if there
87
            are no queries.
88
         */
89
        void startQueries();
90
91
    signals:
92
        void trackListSignal( Meta::TrackList ) const;
93
94
    public slots:
95
        void getTrackListSignal() const;
96
97
    protected:
98
        virtual QVariant retrieveData( const QString &mimeType, QVariant::Type type ) const;
99
100
    private slots:
101
        void newResultReady( const QString &collectionId, const Meta::TrackList &tracks );
102
        void queryDone();
103
104
    private:
105
        class Private;
106
        Private * const d;
107
108
        AmarokMimeData( const AmarokMimeData& );
109
        AmarokMimeData& operator=( const AmarokMimeData& );
110
};
111
112
113
#endif