File indexing completed on 2024-04-21 04:47:49

0001 /****************************************************************************************
0002  * Copyright (c) 2007 Maximilian Kossick <maximilian.kossick@googlemail.com>            *
0003  *                                                                                      *
0004  * This program is free software; you can redistribute it and/or modify it under        *
0005  * the terms of the GNU General Public License as published by the Free Software        *
0006  * Foundation; either version 2 of the License, or (at your option) any later           *
0007  * version.                                                                             *
0008  *                                                                                      *
0009  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
0010  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
0011  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
0012  *                                                                                      *
0013  * You should have received a copy of the GNU General Public License along with         *
0014  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
0015  ****************************************************************************************/
0016 
0017 #ifndef AMAROK_AMAROKMIMEDATA_H
0018 #define AMAROK_AMAROKMIMEDATA_H
0019 
0020 #include "amarok_export.h"
0021 #include "amarokurls/BookmarkGroup.h"
0022 #include "core/meta/forward_declarations.h"
0023 #include "core/playlists/Playlist.h"
0024 #include "core/podcasts/PodcastMeta.h"
0025 
0026 #include <QList>
0027 #include <QMimeData>
0028 
0029 namespace Collections {
0030     class QueryMaker;
0031 }
0032 
0033 class AMAROK_EXPORT AmarokMimeData : public QMimeData
0034 {
0035     Q_OBJECT
0036     public:
0037         static const QString TRACK_MIME;
0038         static const QString PLAYLIST_MIME;
0039 
0040         static const QString PLAYLISTBROWSERGROUP_MIME;
0041 
0042         static const QString PODCASTCHANNEL_MIME;
0043         static const QString PODCASTEPISODE_MIME;
0044 
0045         static const QString AMAROKURL_MIME;
0046         static const QString BOOKMARKGROUP_MIME;
0047 
0048         AmarokMimeData();
0049         ~AmarokMimeData() override;
0050 
0051         QStringList formats() const override;
0052         bool hasFormat( const QString &mimeType ) const override;
0053 
0054         Meta::TrackList tracks() const;
0055         void setTracks( const Meta::TrackList &tracks );
0056         void addTracks( const Meta::TrackList &tracks );
0057 
0058         Playlists::PlaylistList playlists() const;
0059         void setPlaylists( const Playlists::PlaylistList &playlists );
0060         void addPlaylists( const Playlists::PlaylistList &playlists );
0061 
0062         QStringList playlistGroups() const;
0063         void setPlaylistGroups( const QStringList &groups );
0064         void addPlaylistGroup( const QString &group );
0065 
0066         Podcasts::PodcastChannelList podcastChannels() const;
0067         void setPodcastChannels( const Podcasts::PodcastChannelList &channels );
0068         void addPodcastChannels( const Podcasts::PodcastChannelList &channels );
0069 
0070         Podcasts::PodcastEpisodeList podcastEpisodes() const;
0071         void setPodcastEpisodes( const Podcasts::PodcastEpisodeList &episodes );
0072         void addPodcastEpisodes( const Podcasts::PodcastEpisodeList &episodes );
0073 
0074         QList<Collections::QueryMaker*> queryMakers();
0075         void addQueryMaker( Collections::QueryMaker *queryMaker );
0076         void setQueryMakers( const QList<Collections::QueryMaker*> &queryMakers );
0077 
0078         BookmarkList bookmarks() const;
0079         void setBookmarks( const BookmarkList &bookmarks );
0080         void addBookmarks( const BookmarkList &bookmarks );
0081 
0082         BookmarkGroupList bookmarkGroups() const;
0083         void setBookmarkGroups( const BookmarkGroupList &groups );
0084         void addBookmarkGroups( const BookmarkGroupList &groups );
0085 
0086         /**
0087             There is a lot of time to run the queries while the user is dragging.
0088             This method runs all queries passed to this object. It will do nothing if there
0089             are no queries.
0090          */
0091         void startQueries();
0092 
0093     Q_SIGNALS:
0094         void trackListSignal( Meta::TrackList ) const;
0095 
0096     public Q_SLOTS:
0097         void getTrackListSignal() const;
0098 
0099     protected:
0100         QVariant retrieveData( const QString &mimeType, QVariant::Type type ) const override;
0101 
0102     private Q_SLOTS:
0103         void newResultReady( const Meta::TrackList &tracks );
0104         void queryDone();
0105 
0106     private:
0107         class Private;
0108         Private * const d;
0109 
0110         AmarokMimeData( const AmarokMimeData& );
0111         AmarokMimeData& operator=( const AmarokMimeData& );
0112 };
0113 
0114 
0115 #endif