1 /**************************************************************************************** 2 * Copyright (c) 2012 Matěj Laitl <matej@laitl.cz> * 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 #include "FileTrackProvider.h" 18 19 #include "core-impl/meta/file/File.h" 20 FileTrackProvider()21FileTrackProvider::FileTrackProvider() 22 { 23 } 24 ~FileTrackProvider()25FileTrackProvider::~FileTrackProvider() 26 { 27 } 28 29 bool possiblyContainsTrack(const QUrl & url) const30FileTrackProvider::possiblyContainsTrack( const QUrl &url ) const 31 { 32 if( !url.isLocalFile() ) 33 return false; 34 35 return MetaFile::Track::isTrack( url ); 36 } 37 38 Meta::TrackPtr trackForUrl(const QUrl & url)39FileTrackProvider::trackForUrl( const QUrl &url ) 40 { 41 if( !possiblyContainsTrack( url ) ) 42 return Meta::TrackPtr(); 43 return Meta::TrackPtr( new MetaFile::Track( url ) ); 44 } 45