Changeset View
Changeset View
Standalone View
Standalone View
src/embeddedimagedata.cpp
Show All 39 Lines | |||||
40 | 40 | | |||
41 | using namespace KFileMetaData; | 41 | using namespace KFileMetaData; | ||
42 | 42 | | |||
43 | class Q_DECL_HIDDEN EmbeddedImageData::Private | 43 | class Q_DECL_HIDDEN EmbeddedImageData::Private | ||
44 | { | 44 | { | ||
45 | public: | 45 | public: | ||
46 | QMimeDatabase mMimeDatabase; | 46 | QMimeDatabase mMimeDatabase; | ||
47 | QByteArray getFrontCover(const QString &fileUrl, const QString &mimeType) const; | 47 | QByteArray getFrontCover(const QString &fileUrl, const QString &mimeType) const; | ||
48 | static const QStringList mMimetypes; | ||||
49 | }; | ||||
48 | 50 | | |||
51 | const QStringList EmbeddedImageData::Private::mMimetypes = | ||||
52 | { | ||||
53 | QStringLiteral("audio/flac"), | ||||
54 | QStringLiteral("audio/mp4"), | ||||
55 | QStringLiteral("audio/mpeg"), | ||||
56 | QStringLiteral("audio/mpeg3"), | ||||
57 | QStringLiteral("audio/ogg"), | ||||
58 | QStringLiteral("audio/opus"), | ||||
59 | QStringLiteral("audio/x-mpeg"), | ||||
60 | QStringLiteral("audio/x-musepack"), | ||||
61 | QStringLiteral("audio/x-opus+ogg"), | ||||
62 | QStringLiteral("audio/x-vorbis+ogg"), | ||||
49 | }; | 63 | }; | ||
50 | 64 | | |||
51 | EmbeddedImageData::EmbeddedImageData() | 65 | EmbeddedImageData::EmbeddedImageData() | ||
52 | : d(std::unique_ptr<Private>(new Private())) | 66 | : d(std::unique_ptr<Private>(new Private())) | ||
53 | { | 67 | { | ||
54 | } | 68 | } | ||
55 | 69 | | |||
56 | EmbeddedImageData::~EmbeddedImageData() | 70 | EmbeddedImageData::~EmbeddedImageData() | ||
57 | = default; | 71 | = default; | ||
58 | 72 | | |||
73 | QStringList EmbeddedImageData::mimeTypes() const | ||||
bruns: `supportedMimeTypes()` ?
capital `T`, see `ImageType` and `QMimeType` | |||||
The "read" is supposed to mark that only read operations for these mimetypes are supported. I plan to add support for writing add some points, and the supported formats may differ. astippich: The "read" is supposed to mark that only read operations for these mimetypes are supported. I… | |||||
74 | { | ||||
75 | return d->mMimetypes; | ||||
76 | } | ||||
77 | | ||||
59 | QMap<EmbeddedImageData::ImageType, QByteArray> | 78 | QMap<EmbeddedImageData::ImageType, QByteArray> | ||
60 | EmbeddedImageData::imageData(const QString &fileUrl, | 79 | EmbeddedImageData::imageData(const QString &fileUrl, | ||
61 | const EmbeddedImageData::ImageTypes types) const | 80 | const EmbeddedImageData::ImageTypes types) const | ||
62 | { | 81 | { | ||
63 | QMap<EmbeddedImageData::ImageType, QByteArray> imageData; | 82 | QMap<EmbeddedImageData::ImageType, QByteArray> imageData; | ||
64 | 83 | | |||
65 | const auto &fileMimeType = d->mMimeDatabase.mimeTypeForFile(fileUrl); | 84 | const auto &fileMimeType = d->mMimeDatabase.mimeTypeForFile(fileUrl); | ||
66 | if (fileMimeType.name().startsWith(QStringLiteral("audio/"))) { | 85 | if (fileMimeType.name().startsWith(QStringLiteral("audio/"))) { | ||
▲ Show 20 Lines • Show All 112 Lines • Show Last 20 Lines |
supportedMimeTypes() ?
capital T, see ImageType and QMimeType