1 | /* |
2 | * Copyright (C) 2010 Pau Garcia i Quiles <pgquiles@elpauer.org> |
3 | * Essentially a rip-off of code for Kamoso by: |
4 | * Copyright (C) 2008-2009 by Aleix Pol <aleixpol@kde.org> |
5 | * Copyright (C) 2008-2009 by Alex Fiestas <alex@eyeos.org> |
6 | * |
7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU Lesser General Public License as published by |
9 | * the Free Software Foundation; either version 2 of the License, or |
10 | * (at your option) any later version. |
11 | * |
12 | * This program is distributed in the hope that it will be useful, |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | * GNU General Public License for more details. |
16 | * |
17 | * You should have received a copy of the GNU Lesser General Public License |
18 | * along with this program; if not, write to the Free Software |
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, |
20 | * Boston, MA 02110-1301, USA. |
21 | */ |
22 | |
23 | #include "kipiinterface.h" |
24 | #include "ksnapshotinfoshared.h" |
25 | #include "ksnapshotimagecollectionshared.h" |
26 | #include "ksnapshot.h" |
27 | #include "kipiimagecollectionselector.h" |
28 | #include <libkipi/uploadwidget.h> |
29 | #include <libkipi/imagecollectionshared.h> |
30 | #include <libkipi/imageinfo.h> |
31 | #include <libkipi/imageinfoshared.h> |
32 | #include <libkipi/plugin.h> |
33 | #include <libkipi/interface.h> |
34 | #include <libkipi/pluginloader.h> |
35 | #include <libkipi/imagecollection.h> |
36 | #include <libkipi/imagecollectionselector.h> |
37 | |
38 | struct KIPIInterfacePrivate { |
39 | KSnapshot *ksnapshot; |
40 | KIPI::PluginLoader* pluginLoader; |
41 | }; |
42 | |
43 | KIPIInterface::KIPIInterface(KSnapshot* ksnapshot) |
44 | :KIPI::Interface(ksnapshot) |
45 | , d(new KIPIInterfacePrivate) { |
46 | d->ksnapshot = ksnapshot; |
47 | } |
48 | |
49 | KIPIInterface::~KIPIInterface() { |
50 | delete d; |
51 | } |
52 | |
53 | KIPI::ImageCollection KIPIInterface::currentAlbum() { |
54 | return KIPI::ImageCollection(new KSnapshotImageCollectionShared(d->ksnapshot)); |
55 | } |
56 | |
57 | KIPI::ImageCollection KIPIInterface::currentSelection() { |
58 | return KIPI::ImageCollection(new KSnapshotImageCollectionShared(d->ksnapshot)); |
59 | } |
60 | |
61 | QList<KIPI::ImageCollection> KIPIInterface::allAlbums() { |
62 | QList<KIPI::ImageCollection> list; |
63 | list << currentSelection(); |
64 | return list; |
65 | } |
66 | |
67 | KIPI::ImageInfo KIPIInterface::info(const KUrl& url) { |
68 | return KIPI::ImageInfo(new KSnapshotInfoShared(this,url)); |
69 | } |
70 | |
71 | bool KIPIInterface::addImage(const KUrl&, QString&) |
72 | { |
73 | return true; |
74 | } |
75 | void KIPIInterface::delImage( const KUrl& ) |
76 | { |
77 | |
78 | } |
79 | void KIPIInterface::refreshImages( const KUrl::List& ) |
80 | { |
81 | // TODO Implement? |
82 | } |
83 | |
84 | KIPI::ImageCollectionSelector* KIPIInterface::imageCollectionSelector(QWidget *parent) { |
85 | return new KIPIImageCollectionSelector(this, parent); |
86 | } |
87 | |
88 | KIPI::UploadWidget* KIPIInterface::uploadWidget(QWidget *parent) { |
89 | return (new KIPI::UploadWidget(parent)); |
90 | } |
91 | |
92 | int KIPIInterface::features() const { |
93 | return KIPI::HostAcceptNewImages; |
94 | } |
95 | |