File: windowsimagecreator.cpp

package info (click to toggle)
kio-extras 4%3A22.12.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 10,768 kB
  • sloc: cpp: 26,898; ansic: 4,443; perl: 1,058; xml: 97; sh: 69; python: 28; makefile: 9
file content (35 lines) | stat: -rw-r--r-- 905 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*
    windowsimagecreator.cpp - Thumbnail Creator for Microsoft Windows Images

    SPDX-FileCopyrightText: 2009 Pali Rohár <pali.rohar@gmail.com>

    SPDX-License-Identifier: GPL-2.0-or-later
*/

#include "windowsimagecreator.h"
#include "icoutils.h"
#include "macros.h"

#include <QString>
#include <QImage>
#include <QImageReader>
#include <QMimeDatabase>

EXPORT_THUMBNAILER_WITH_JSON(WindowsImageCreator, "windowsimagethumbnail.json")

bool WindowsImageCreator::create(const QString &path, int width, int height, QImage &img)
{
    if (IcoUtils::loadIcoImage(path, img, width, height)) {
        return true;
    }

    // Maybe it's an animated cursor
    if (QMimeDatabase().mimeTypeForFile(path).name() == QLatin1String("application/x-navi-animation")) {
        QImageReader reader(path, "ani");
        return reader.read(&img);
    }

    return false;

}
#include "windowsimagecreator.moc"