/src/kio-extras/thumbnail/windowsimagecreator.cpp
Line | Count | Source |
1 | | /* |
2 | | windowsimagecreator.cpp - Thumbnail Creator for Microsoft Windows Images |
3 | | |
4 | | SPDX-FileCopyrightText: 2009 Pali Rohár <pali.rohar@gmail.com> |
5 | | |
6 | | SPDX-License-Identifier: GPL-2.0-or-later |
7 | | */ |
8 | | |
9 | | #include "windowsimagecreator.h" |
10 | | #include "icoutils.h" |
11 | | |
12 | | #include <QImage> |
13 | | #include <QImageReader> |
14 | | #include <QString> |
15 | | |
16 | | #include <KPluginFactory> |
17 | | |
18 | 0 | K_PLUGIN_CLASS_WITH_JSON(WindowsImageCreator, "windowsimagethumbnail.json") Unexecuted instantiation: windowsimagethumbnail_factory::tr(char const*, char const*, int) Unexecuted instantiation: windowsimagethumbnail_factory::~windowsimagethumbnail_factory() |
19 | 0 |
|
20 | 0 | WindowsImageCreator::WindowsImageCreator(QObject *parent, const QVariantList &args) |
21 | 3.40k | : KIO::ThumbnailCreator(parent, args) |
22 | 3.40k | { |
23 | 3.40k | } |
24 | | |
25 | | KIO::ThumbnailResult WindowsImageCreator::create(const KIO::ThumbnailRequest &request) |
26 | 3.40k | { |
27 | 3.40k | const QString path = request.url().toLocalFile(); |
28 | 3.40k | QImage img; |
29 | 3.40k | if (IcoUtils::loadIcoImage(path, img, request.targetSize().width(), request.targetSize().height())) { |
30 | 3.03k | return KIO::ThumbnailResult::pass(img); |
31 | 3.03k | } |
32 | | |
33 | | // Maybe it's an animated cursor |
34 | 369 | if (request.mimeType() == QLatin1String("application/x-navi-animation")) { |
35 | 0 | QImageReader reader(path, "ani"); |
36 | 0 | reader.read(&img); |
37 | 0 | return KIO::ThumbnailResult::pass(img); |
38 | 0 | } |
39 | | |
40 | 369 | return KIO::ThumbnailResult::fail(); |
41 | 369 | } |
42 | | |
43 | | #include "moc_windowsimagecreator.cpp" |
44 | | #include "windowsimagecreator.moc" |