Changeset View
Changeset View
Standalone View
Standalone View
src/embeddedimagedata.h
Show All 17 Lines | |||||
18 | * | 18 | * | ||
19 | */ | 19 | */ | ||
20 | 20 | | |||
21 | #ifndef KFILEMETADATA_EMBEDDEDIMAGEDATA_H | 21 | #ifndef KFILEMETADATA_EMBEDDEDIMAGEDATA_H | ||
22 | #define KFILEMETADATA_EMBEDDEDIMAGEDATA_H | 22 | #define KFILEMETADATA_EMBEDDEDIMAGEDATA_H | ||
23 | 23 | | |||
24 | #include "kfilemetadata_export.h" | 24 | #include "kfilemetadata_export.h" | ||
25 | #include <QByteArray> | 25 | #include <QByteArray> | ||
26 | #include <QFlags> | ||||
26 | #include <QMap> | 27 | #include <QMap> | ||
27 | #include <memory> | 28 | #include <memory> | ||
28 | 29 | | |||
29 | namespace KFileMetaData { | 30 | namespace KFileMetaData { | ||
30 | 31 | | |||
31 | /** | 32 | /** | ||
32 | * \class EmbeddedImageData embeddedimagedata.h <KFileMetaData/EmbeddedImageData> | 33 | * \class EmbeddedImageData embeddedimagedata.h <KFileMetaData/EmbeddedImageData> | ||
33 | * | 34 | * | ||
34 | * \brief The EmbeddedImageData is a class which extracts the images stored | 35 | * \brief The EmbeddedImageData is a class which extracts and writes the images | ||
35 | * in the metadata tags of files as byte arrays. For example, the front cover | 36 | * stored in the metadata tags of files as byte arrays. For example, the front | ||
36 | * art of music albums may be extracted with this class. The byte array will | 37 | * cover art of music albums may be extracted with this class. The byte array | ||
37 | * mostly contain jpeg or png files, which can be loaded into e.g. QImage. | 38 | * will mostly contain jpeg or png files, which can be loaded into e.g. QImage. | ||
38 | * | 39 | * | ||
39 | * \author Alexander Stippich <a.stippich@gmx.net> | 40 | * \author Alexander Stippich <a.stippich@gmx.net> | ||
40 | */ | 41 | */ | ||
41 | class KFILEMETADATA_EXPORT EmbeddedImageData { | 42 | class KFILEMETADATA_EXPORT EmbeddedImageData { | ||
42 | public: | 43 | public: | ||
43 | EmbeddedImageData(); | 44 | EmbeddedImageData(); | ||
44 | virtual ~EmbeddedImageData(); | 45 | virtual ~EmbeddedImageData(); | ||
45 | enum ImageType { | 46 | enum ImageType { | ||
Show All 10 Lines | |||||
56 | 57 | | |||
57 | /** | 58 | /** | ||
58 | * Provides a list of mimetypes which are supported for reading | 59 | * Provides a list of mimetypes which are supported for reading | ||
59 | * of embedded images in e.g. audio files. | 60 | * of embedded images in e.g. audio files. | ||
60 | * @since 5.52 | 61 | * @since 5.52 | ||
61 | */ | 62 | */ | ||
62 | QStringList mimeTypes() const; | 63 | QStringList mimeTypes() const; | ||
63 | 64 | | |||
65 | /** | ||||
66 | * Write the images to the metadata tags in a file. | ||||
67 | * Currently, only the front cover is supported. | ||||
68 | * Mimetype is only correctly set for jpeg and png files. | ||||
69 | * @since 5.62 | ||||
70 | */ | ||||
71 | void writeImageData(const QString &fileUrl, QMap<ImageType, QByteArray> &imageData); | ||||
72 | | ||||
64 | private: | 73 | private: | ||
65 | class Private; | 74 | class Private; | ||
66 | std::unique_ptr<Private> d; | 75 | std::unique_ptr<Private> d; | ||
67 | EmbeddedImageData& operator=(const EmbeddedImageData&); | 76 | EmbeddedImageData& operator=(const EmbeddedImageData&); | ||
68 | }; | 77 | }; | ||
69 | 78 | | |||
70 | } | 79 | } | ||
71 | 80 | | |||
72 | #endif // KFILEMETADATA_EMBEDDEDIMAGEDATA_H | 81 | #endif // KFILEMETADATA_EMBEDDEDIMAGEDATA_H |