/usr/include/libtomahawk/DropJob.h is in libtomahawk-dev 0.8.4+dfsg1-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | /* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2011, Michael Zanetti <mzanetti@kde.org>
* Copyright 2011, Leo Franchi <lfranchi@kde.org>
*
* Tomahawk 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 3 of the License, or
* (at your option) any later version.
*
* Tomahawk is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DROPJOB_H
#define DROPJOB_H
#include "Album.h"
#include "DllMacro.h"
#include "Typedefs.h"
#include <QObject>
#include <QStringList>
#include <QMimeData>
namespace Tomahawk {
class DropJobNotifier;
}
class DLLEXPORT DropJob : public QObject
{
Q_OBJECT
public:
explicit DropJob( QObject *parent = 0 );
~DropJob();
/**
* QMimeData helpers
*
* Call this to parse the tracks in a QMimeData object to query_ptrs. This will parse internal tomahawk
* data as well as all other formats supported (spotify, etc).
*
* Connect to tracks( QList< query_ptr> ); for the extracted tracks.
*/
enum DropType {
None = 0x00,
Playlist = 0x01,
Track = 0x02,
Album = 0x04,
Artist = 0x08,
All = 0xFF
};
Q_DECLARE_FLAGS(DropTypes, DropType)
enum DropAction {
Default = 0,
Append,
Create,
Move
};
/**
* Returns if the caller should accept this mimetype.
*
* \param data The mimetype object to check
* \param type The type of drop content to accept
* \param action What action is requested from the content, if not all data types support all actions
*/
static bool acceptsMimeData( const QMimeData* data, DropJob::DropTypes type = All, DropAction action = Append );
/**
* Return if the drop is primarily of the given type. Does not auto-convert (e.g. if the drop is of type playlist,
* even thougha playlist can be converted into tracks, this will return true only for the Playlist drop type).
*
* TODO Only implemented for Playlist atm. Extend when you need it.
*/
static bool isDropType( DropJob::DropType desired, const QMimeData* data );
static QStringList mimeTypes();
/**
* Set the drop types that should be extracted from this drop
*/
void setDropTypes( DropTypes types );
/**
* Set the action that the drop should do.
*
* For example, if dropping a playlist, Create will create a new playlist
* but Append will generate the raw tracks
*/
void setDropAction( DropAction action );
DropTypes dropTypes() const;
DropAction dropAction() const;
/**
* Begin the parsing of the mime data. The resulting tracks are exposed in the various signals
*/
void parseMimeData( const QMimeData* data );
void setGetWholeArtists( bool getWholeArtists );
void setGetWholeAlbums( bool getWholeAlbums );
void tracksFromMimeData( const QMimeData* data, bool allowDuplicates = false, bool onlyLocal = false, bool top10 = false );
void handleXspfs( const QString& files );
void handleM3u( const QString& urls );
void handleSpotifyUrls( const QString& urls );
void handleGroovesharkUrls( const QString& urls );
static bool canParseSpotifyPlaylists();
static void setCanParseSpotifyPlaylists( bool parseable );
signals:
/// QMimeData parsing results
void tracks( const QList< Tomahawk::query_ptr >& tracks );
private slots:
void expandedUrls( QStringList );
void informationForUrl( const QString& url, const QSharedPointer<QObject>& information );
void onTracksAdded( const QList<Tomahawk::query_ptr>& );
private:
/// handle parsing mime data
void handleAllUrls( const QString& urls );
void handleTrackUrls( const QString& urls );
QList< Tomahawk::query_ptr > tracksFromQueryList( const QMimeData* d );
QList< Tomahawk::query_ptr > tracksFromResultList( const QMimeData* d );
QList< Tomahawk::query_ptr > tracksFromArtistMetaData( const QMimeData* d );
QList< Tomahawk::query_ptr > tracksFromAlbumMetaData( const QMimeData* d );
void tracksFromMixedData( const QMimeData* d );
QList< Tomahawk::query_ptr > getArtist( const QString& artist, Tomahawk::ModelMode mode = Tomahawk::Mixed );
QList< Tomahawk::query_ptr > getAlbum( const QString& artist, const QString& album );
QList< Tomahawk::query_ptr > getTopTen( const QString& artist );
void removeDuplicates();
void removeRemoteSources();
static bool validateLocalFile( const QString& path, const QString& suffix = QString() );
static bool validateLocalFiles( const QString& paths, const QString& suffix = QString() );
int m_queryCount;
bool m_allowDuplicates;
bool m_onlyLocal;
bool m_getWholeArtists;
bool m_getWholeAlbums;
bool m_top10;
DropTypes m_dropTypes;
DropAction m_dropAction;
QList<Tomahawk::DropJobNotifier*> m_dropJob;
QList< Tomahawk::query_ptr > m_resultList;
QSet< Tomahawk::album_ptr > m_albumsToKeep;
QSet< Tomahawk::artist_ptr > m_artistsToKeep;
static bool s_canParseSpotifyPlaylists;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(DropJob::DropTypes)
#endif // DROPJOB_H
|