1
/****************************************************************************************
2
* Copyright (c) 2009 Seb Ruiz <ruiz@kde.org> *
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 *
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. *
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
****************************************************************************************/
17
#include "IpodArtworkCapability.h"
18
#include "IpodHandler.h"
20
using namespace Handler;
22
IpodArtworkCapability::IpodArtworkCapability( Meta::IpodHandler *handler )
23
: ArtworkCapability( handler )
24
, m_handler( handler )
28
IpodArtworkCapability::~IpodArtworkCapability()
33
QImage IpodArtworkCapability::getCover( const Meta::MediaDeviceTrackPtr &track )
35
return m_handler->libGetCoverArt( track );
38
void IpodArtworkCapability::setCover( Meta::MediaDeviceAlbumPtr album, const QImage &image )
40
foreach( Meta::TrackPtr t, album->tracks() )
42
Meta::MediaDeviceTrackPtr track = Meta::MediaDeviceTrackPtr::dynamicCast( t );
43
m_handler->libSetCoverArt( track, image );
47
void IpodArtworkCapability::setCoverPath( Meta::MediaDeviceAlbumPtr album, const QString &path )
49
foreach( Meta::TrackPtr t, album->tracks() )
51
Meta::MediaDeviceTrackPtr track = Meta::MediaDeviceTrackPtr::dynamicCast( t );
52
m_handler->libSetCoverArtPath( track, path );
56
bool IpodArtworkCapability::canUpdateCover() const
58
return m_handler->isWritable() && m_handler->supportsArtwork();