File: mobithumbnail.cpp

package info (click to toggle)
kdegraphics-mobipocket 4:20.12.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 196 kB
  • sloc: cpp: 586; xml: 149; makefile: 3
file content (40 lines) | stat: -rw-r--r-- 1,209 bytes parent folder | download | duplicates (2)
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
36
37
38
39
40
/***************************************************************************
 *   Copyright (C) 2008 by Jakub Stachowski <qbast@go2.pl>                 *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 ***************************************************************************/

#include "mobithumbnail.h"
#include "mobipocket.h"
#include "qfilestream.h"

#include <QFile>

extern "C"
{
    Q_DECL_EXPORT ThumbCreator *new_creator()
    {
        return new MobiThumbnail;
    }
}

bool MobiThumbnail::create(const QString &path, int width, int height, QImage &img)
{
    Q_UNUSED(width);
    Q_UNUSED(height);
    
    Mobipocket::QFileStream f(path);
    Mobipocket::Document doc(&f);
    if (!doc.isValid()) return false;
    img=doc.thumbnail();
    return !img.isNull();
}

ThumbCreator::Flags MobiThumbnail::flags() const
{
    return static_cast<Flags>(None);
}