~neon/juk/master

2424 by Michael Pyne
GIT_SILENT: Update source code license headers.
1
/**
2
 * Copyright (C) 2004 Nathan Toone <nathan@toonetown.com>
3
 * Copyright (C) 2008 Michael Pyne <mpyne@kde.org>
4
 *
5
 * This program is free software; you can redistribute it and/or modify it under
6
 * the terms of the GNU General Public License as published by the Free Software
7
 * Foundation; either version 2 of the License, or (at your option) any later
8
 * version.
9
 *
10
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY
11
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12
 * PARTICULAR PURPOSE. See the GNU General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU General Public License along with
15
 * this program.  If not, see <http://www.gnu.org/licenses/>.
16
 */
1299 by Scott Wheeler
Ok, huge patch from Nathan Toone to add a cover manager and such. There
17
18
#ifndef COVERINFO_H
19
#define COVERINFO_H
20
1316 by Scott Wheeler
Switch passing around tag pointers to passing around file handles. A little
21
#include "filehandle.h"
1485 by Michael Pyne
Add a CoverManager class to JuK (with a shockingly minimal GUI). It will
22
#include "covermanager.h"
1299 by Scott Wheeler
Ok, huge patch from Nathan Toone to add a cover manager and such. There
23
1951 by Michael Pyne
Be more careful in the event of a encrypted APIC frame (or compressed with no zlib in TagLib).
24
#include <QImage>
25
1917 by Michael Pyne
Add support for loading more types of covers to JuK trunk. Fixes bug 103118. Now JuK will pull covers
26
class QPixmap;
27
1299 by Scott Wheeler
Ok, huge patch from Nathan Toone to add a cover manager and such. There
28
class CoverInfo
29
{
30
    friend class FileHandle;
31
32
public:
1326 by Scott Wheeler
Actually use the enum properly rather than doing implicit conversion from
33
    enum CoverSize { FullSize, Thumbnail };
34
1316 by Scott Wheeler
Switch passing around tag pointers to passing around file handles. A little
35
    CoverInfo(const FileHandle &file);
1299 by Scott Wheeler
Ok, huge patch from Nathan Toone to add a cover manager and such. There
36
1952 by Michael Pyne
More --qt3support:
37
    bool hasCover() const;
1327 by Scott Wheeler
Put the CoverInfo API on a diet; there's no need duplicating this stuff over
38
39
    void clearCover();
1329 by Scott Wheeler
Clean up from my last commit and also in general -- this make sure that
40
    void setCover(const QImage &image = QImage());
1327 by Scott Wheeler
Put the CoverInfo API on a diet; there's no need duplicating this stuff over
41
1510 by Michael Pyne
Big huge update.
42
    // Use this to assign to a specific cover id.
43
    void setCoverId(coverKey id);
44
1553 by Scott Wheeler
Since 3.5 devel seems to have mostly slowed down, I'm synching with the branch
45
    /**
46
     * This function sets the cover identifier for all tracks that have the
47
     * same Artist and Album as this track, to the cover identifier of this
48
     * track.
49
     *
50
     * @param overwriteExistingCovers If set to true, this function will always
51
     *        apply the new cover to a track even if the track already had
52
     *        a different cover set.
53
     */
54
    void applyCoverToWholeAlbum(bool overwriteExistingCovers = false) const;
55
1952 by Michael Pyne
More --qt3support:
56
    coverKey coverId() const;
1512 by Michael Pyne
* Now you can drag covers to and from the little cover area on the "Now
57
1326 by Scott Wheeler
Actually use the enum properly rather than doing implicit conversion from
58
    QPixmap pixmap(CoverSize size) const;
2300 by Michael Pyne
juk/mpris2: Export album art in MPRIS metadata if present.
59
60
    /**
61
     * Returns the path to the cover data. For embedded covers the art will be
62
     * extracted to a temporary file, and the returned path will be that of the
63
     * temporary file. The temporary file will be owned by the caller.
64
     *
65
     * Note that it is possible to have a valid filename even for covers that
66
     * do not have "coverKey" since JuK supports using cover.{jpg,png} in a
67
     * directory.
68
     *
69
     * @param fallbackFileName The filename (including full absolute path)
70
     * of the file to write to if embedded album art is present and to be
71
     * extracted.
72
     *
73
     * If no cover is present, an empty string is returned.
74
     */
75
    QString localPathToCover(const QString &fallbackFileName) const;
76
1362 by Scott Wheeler
Clean up this function and make it automatically detect the popup direction.
77
    void popup() const;
1299 by Scott Wheeler
Ok, huge patch from Nathan Toone to add a cover manager and such. There
78
79
private:
1917 by Michael Pyne
Add support for loading more types of covers to JuK trunk. Fixes bug 103118. Now JuK will pull covers
80
    QImage scaleCoverToThumbnail(const QImage &image) const;
1327 by Scott Wheeler
Put the CoverInfo API on a diet; there's no need duplicating this stuff over
81
2288 by Michael Pyne
coverinfo: Add support for MP4 album art.
82
    // Not supported for all file types as we must build on top of TagLib
83
    // support.
84
    QImage embeddedAlbumArt() const;
85
86
    bool hasEmbeddedAlbumArt() const;
87
1316 by Scott Wheeler
Switch passing around tag pointers to passing around file handles. A little
88
    FileHandle m_file;
1952 by Michael Pyne
More --qt3support:
89
90
    // Mutable to allow this info to be cached.
91
    mutable bool m_hasCover;
92
    mutable bool m_hasAttachedCover;
93
    mutable bool m_haveCheckedForCover;
1487 by Michael Pyne
Speed up import of old style covers by not moving them until it's really really
94
    mutable coverKey m_coverKey;
1299 by Scott Wheeler
Ok, huge patch from Nathan Toone to add a cover manager and such. There
95
};
1562 by Michael Pyne
Since we're standardizing the source style, figured I'd throw in the Big Huge Vim Modeline
96
1299 by Scott Wheeler
Ok, huge patch from Nathan Toone to add a cover manager and such. There
97
#endif
98
1562 by Michael Pyne
Since we're standardizing the source style, figured I'd throw in the Big Huge Vim Modeline
99
// vim: set et sw=4 tw=0 sta: