17
17
#ifndef MEDIADEVICEHANDLER_WRITECAPABILITY_H
18
18
#define MEDIADEVICEHANDLER_WRITECAPABILITY_H
20
#include "mediadevicecollection_export.h"
21
#include "WriteCapabilityBase.h"
22
#include "../../MediaDeviceMeta.h"
20
#include "core-impl/collections/mediadevicecollection/MediaDeviceMeta.h"
21
#include "core-impl/collections/mediadevicecollection/handler/MediaDeviceHandlerCapability.h"
22
#include "core-impl/collections/mediadevicecollection/support/mediadevicecollection_export.h"
27
class MEDIADEVICECOLLECTION_EXPORT WriteCapability : public Handler::WriteCapabilityBase
27
class MEDIADEVICECOLLECTION_EXPORT WriteCapability : public Handler::Capability
32
WriteCapability( QObject *parent ) : WriteCapabilityBase( parent ) {}
32
WriteCapability( QObject *parent ) : Capability( parent ) {}
33
33
virtual ~WriteCapability();
35
static Type capabilityInterfaceType() { return Handler::Capability::Writable; }
38
* Returns a list of formats supported by the device, all in lowercase
39
* For example mp3, mpeg, aac. This is used to avoid copying unsupported
40
* types to a particular device.
42
virtual QStringList supportedFormats() = 0; // md:write
45
* Finds the place to copy the track to on the device, which
46
* could be a url in the case of Ipods, or a folder in the
47
* case of MTP devices.
48
* @param srcTrack The source track of the copy
49
* @param destTrack The destination track whose path we seek
51
virtual void findPathToCopy( const Meta::TrackPtr &srcTrack, const Meta::MediaDeviceTrackPtr &destTrack ) = 0;
54
* libCopyTrack does the actual file copying. For Ipods, it uses KIO,
55
* for MTPs this uses a libmtp call
56
* Copy the file associate with srcTrack to destTrack
57
* @param srcTrack The track being copied from
58
* @param destTrack The track being copied to
59
* @return Whether or not the track copy was successful
61
virtual bool libCopyTrack( const Meta::TrackPtr &srcTrack, Meta::MediaDeviceTrackPtr &destTrack ) = 0;
64
* libDeleteTrack does the actual file deleting. For Ipods, it uses KIO,
65
* for MTPs this uses a libmtp call. Must emit libRemoveTrackDone when finished.
66
* @param track The track whose file is to be deleted
67
* @return Whether or not the track removal was successful
69
virtual bool libDeleteTrackFile( const Meta::MediaDeviceTrackPtr &track ) = 0;
72
* This function is called just before copying tracks begin and allows
73
* a subclass to prepare to copy, e.g. for Ipods it would initialize
74
* the job counter to 0.
76
virtual void prepareToCopy() = 0;
79
* This function is called just before deleting tracks begin and allows
80
* a subclass to prepare to delete, e.g. for Ipods it would initialize
81
* the m_tracksdeleting to keep track of urls it is deleting.
83
virtual void prepareToDelete() = 0;
86
* Tells subclass that it can update the track, usually because
87
* the track's tags have changed.
88
* @param track The track whose tags should be updated
90
virtual void updateTrack( Meta::MediaDeviceTrackPtr &track )
36
96
* Creates a new track struct particular to the library of the device
37
97
* e.g. LIBMTP_new_track_t(), and associates it with the track for