-
Notifications
You must be signed in to change notification settings - Fork 0
/
qblpplugin.cpp
45 lines (37 loc) · 989 Bytes
/
qblpplugin.cpp
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
41
42
43
44
45
#include "qblpplugin.h"
#include "qblphandler.h"
QBlpPlugin::QBlpPlugin(QObject *parent) :
QImageIOPlugin(parent)
{
}
QBlpPlugin::~QBlpPlugin()
{
}
QStringList QBlpPlugin::keys() const
{
return QStringList() << "blp";
}
QImageIOPlugin::Capabilities QBlpPlugin::capabilities(
QIODevice *device, const QByteArray &format) const
{
if (format == "blp")
return Capabilities(CanRead);//TODO: add CanWrite support
if (!(format.isEmpty() && device->isOpen()))
return {};
Capabilities cap;
if (device->isReadable() && QBlpHandler::canRead(device))
cap |= CanRead;
return cap;
}
QImageIOHandler *QBlpPlugin::create(
QIODevice *device, const QByteArray &format) const
{
QImageIOHandler *handler = new QBlpHandler;
handler->setDevice(device);
handler->setFormat(format);
return handler;
}
#if QT_VERSION < 0x050000
Q_EXPORT_STATIC_PLUGIN(QBlpPlugin)
Q_EXPORT_PLUGIN2(QBlp, QBlpPlugin)
#endif // QT_VERSION < 0x050000