1 | /** |
2 | * PIC_RW - Qt PIC Support |
3 | * Copyright (C) 2007 Ruben Lopez <r.lopez@bren.es> |
4 | * |
5 | * This library is free software; you can redistribute it and/or |
6 | * modify it under the terms of the GNU Lesser General Public |
7 | * License as published by the Free Software Foundation; either |
8 | * version 2 of the License, or (at your option) any later version. |
9 | * |
10 | * This library is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | * Lesser General Public License for more details. |
14 | * |
15 | * You should have received a copy of the GNU Lesser General Public |
16 | * License along with this library; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | * ---------------------------------------------------------------------------- |
19 | */ |
20 | |
21 | #include "pic_io_plugin.h" |
22 | #include "pic_io_handler.h" |
23 | |
24 | QImageIOPlugin::Capabilities SoftimagePICPlugin::capabilities(QIODevice *device, const QByteArray &format) const { |
25 | if (format == "pic" ) { |
26 | return Capabilities(CanRead | CanWrite); |
27 | } |
28 | if (!(format.isEmpty() && device->isOpen())) { |
29 | return 0; |
30 | } |
31 | |
32 | Capabilities cap; |
33 | if (device->isReadable() && SoftimagePICHandler::canRead(device)) { |
34 | cap |= CanRead; |
35 | } |
36 | if (device->isWritable()) { |
37 | cap |= CanWrite; |
38 | } |
39 | return cap; |
40 | } |
41 | |
42 | QStringList SoftimagePICPlugin::keys() const { |
43 | return QStringList() << "pic" ; |
44 | } |
45 | |
46 | QImageIOHandler * SoftimagePICPlugin::create(QIODevice *device, const QByteArray &format) const { |
47 | QImageIOHandler * handler = new SoftimagePICHandler(); |
48 | handler->setDevice(device); |
49 | handler->setFormat(format); |
50 | return handler; |
51 | } |
52 | |
53 | Q_EXPORT_STATIC_PLUGIN(SoftimagePICPlugin) |
54 | Q_EXPORT_PLUGIN2(softimagePICPlugin, SoftimagePICPlugin) |
55 | |
56 | |