Warning, file /multimedia/juk/coverinfo.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /** 0002 * Copyright (C) 2004 Nathan Toone <nathan@toonetown.com> 0003 * Copyright (C) 2008 Michael Pyne <mpyne@kde.org> 0004 * 0005 * This program is free software; you can redistribute it and/or modify it under 0006 * the terms of the GNU General Public License as published by the Free Software 0007 * Foundation; either version 2 of the License, or (at your option) any later 0008 * version. 0009 * 0010 * This program is distributed in the hope that it will be useful, but WITHOUT ANY 0011 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 0012 * PARTICULAR PURPOSE. See the GNU General Public License for more details. 0013 * 0014 * You should have received a copy of the GNU General Public License along with 0015 * this program. If not, see <http://www.gnu.org/licenses/>. 0016 */ 0017 0018 #ifndef COVERINFO_H 0019 #define COVERINFO_H 0020 0021 #include "filehandle.h" 0022 #include "covermanager.h" 0023 0024 #include <QImage> 0025 0026 class QPixmap; 0027 0028 class CoverInfo 0029 { 0030 friend class FileHandle; 0031 0032 public: 0033 enum CoverSize { FullSize, Thumbnail }; 0034 0035 explicit CoverInfo(const FileHandle &file); 0036 0037 bool hasCover() const; 0038 0039 void clearCover(); 0040 void setCover(const QImage &image = QImage()); 0041 0042 // Use this to assign to a specific cover id. 0043 void setCoverId(coverKey id); 0044 0045 /** 0046 * This function sets the cover identifier for all tracks that have the 0047 * same Artist and Album as this track, to the cover identifier of this 0048 * track. 0049 * 0050 * @param overwriteExistingCovers If set to true, this function will always 0051 * apply the new cover to a track even if the track already had 0052 * a different cover set. 0053 */ 0054 void applyCoverToWholeAlbum(bool overwriteExistingCovers = false) const; 0055 0056 coverKey coverId() const; 0057 0058 QPixmap pixmap(CoverSize size) const; 0059 0060 /** 0061 * Returns the path to the cover data. For embedded covers the art will be 0062 * extracted to a temporary file, and the returned path will be that of the 0063 * temporary file. The temporary file will be owned by the caller. 0064 * 0065 * Note that it is possible to have a valid filename even for covers that 0066 * do not have "coverKey" since JuK supports using cover.{jpg,png} in a 0067 * directory. 0068 * 0069 * @param fallbackFileName The filename (including full absolute path) 0070 * of the file to write to if embedded album art is present and to be 0071 * extracted. 0072 * 0073 * If no cover is present, an empty string is returned. 0074 */ 0075 QString localPathToCover(const QString &fallbackFileName) const; 0076 0077 void popup() const; 0078 0079 private: 0080 QImage scaleCoverToThumbnail(const QImage &image) const; 0081 0082 // Not supported for all file types as we must build on top of TagLib 0083 // support. 0084 QImage embeddedAlbumArt() const; 0085 0086 bool hasEmbeddedAlbumArt() const; 0087 0088 FileHandle m_file; 0089 0090 // Mutable to allow this info to be cached. 0091 mutable bool m_hasCover; 0092 mutable bool m_hasAttachedCover; 0093 mutable bool m_haveCheckedForCover; 0094 mutable coverKey m_coverKey; 0095 }; 0096 0097 #endif 0098 0099 // vim: set et sw=4 tw=0 sta: