1 | /* ============================================================ |
---|
2 | * |
---|
3 | * This file is a part of kipi-plugins project |
---|
4 | * http://www.kipi-plugins.org |
---|
5 | * |
---|
6 | * Date : 2004-05-01 |
---|
7 | * Description : image files selector dialog. |
---|
8 | * |
---|
9 | * Copyright (C) 2004-2009 by Gilles Caulier <caulier dot gilles at gmail dot com> |
---|
10 | * |
---|
11 | * This program is free software; you can redistribute it |
---|
12 | * and/or modify it under the terms of the GNU General |
---|
13 | * Public License as published by the Free Software Foundation; |
---|
14 | * either version 2, or (at your option) any later version. |
---|
15 | * |
---|
16 | * This program is distributed in the hope that it will be useful, |
---|
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
19 | * GNU General Public License for more details. |
---|
20 | * |
---|
21 | * ============================================================ */ |
---|
22 | |
---|
23 | #ifndef IMAGEDIALOG_H |
---|
24 | #define IMAGEDIALOG_H |
---|
25 | |
---|
26 | // Qt includes |
---|
27 | |
---|
28 | #include <QThread> |
---|
29 | #include <QImage> |
---|
30 | |
---|
31 | // KDE includes |
---|
32 | |
---|
33 | #include <kurl.h> |
---|
34 | #include <kpreviewwidgetbase.h> |
---|
35 | |
---|
36 | // LibKIPI includes |
---|
37 | |
---|
38 | #include <libkipi/interface.h> |
---|
39 | |
---|
40 | // Local includes |
---|
41 | |
---|
42 | #include "kipiplugins_export.h" |
---|
43 | |
---|
44 | namespace KIPIPlugins |
---|
45 | { |
---|
46 | |
---|
47 | class ImageDialogPrivate; |
---|
48 | class ImageDialogPreviewPrivate; |
---|
49 | |
---|
50 | class KIPIPLUGINS_EXPORT ImageDialogPreview : public KPreviewWidgetBase |
---|
51 | { |
---|
52 | Q_OBJECT |
---|
53 | |
---|
54 | public: |
---|
55 | |
---|
56 | explicit ImageDialogPreview(KIPI::Interface *iface, QWidget *parent=0); |
---|
57 | ~ImageDialogPreview(); |
---|
58 | |
---|
59 | QSize sizeHint() const; |
---|
60 | |
---|
61 | private Q_SLOTS: |
---|
62 | |
---|
63 | void showPreview(); |
---|
64 | void showPreview(const KUrl&); |
---|
65 | void slotThumbnail(const KUrl&, const QPixmap&); |
---|
66 | void slotKDEPreview(const KFileItem&, const QPixmap&); |
---|
67 | void slotKDEPreviewFailed(const KFileItem&); |
---|
68 | void slotRawThumb(const KUrl&, const QImage&); |
---|
69 | void clearPreview(); |
---|
70 | |
---|
71 | private: |
---|
72 | |
---|
73 | void resizeEvent(QResizeEvent *e); |
---|
74 | |
---|
75 | private: |
---|
76 | |
---|
77 | ImageDialogPreviewPrivate* const d; |
---|
78 | }; |
---|
79 | |
---|
80 | // ------------------------------------------------------------------------ |
---|
81 | |
---|
82 | class KIPIPLUGINS_EXPORT ImageDialog |
---|
83 | { |
---|
84 | |
---|
85 | public: |
---|
86 | |
---|
87 | ImageDialog(QWidget* parent, KIPI::Interface* iface, bool singleSelect=false, bool onlyRaw=false); |
---|
88 | ~ImageDialog(); |
---|
89 | |
---|
90 | KUrl url() const; |
---|
91 | KUrl::List urls() const; |
---|
92 | |
---|
93 | bool onlyRaw() const; |
---|
94 | bool singleSelect() const; |
---|
95 | QString fileFormats() const; |
---|
96 | |
---|
97 | static KUrl getImageUrl(QWidget* parent, KIPI::Interface* iface, bool onlyRaw=false); |
---|
98 | static KUrl::List getImageUrls(QWidget* parent, KIPI::Interface* iface, bool onlyRaw=false); |
---|
99 | |
---|
100 | private: |
---|
101 | |
---|
102 | ImageDialogPrivate* const d; |
---|
103 | }; |
---|
104 | |
---|
105 | // ------------------------------------------------------------------------ |
---|
106 | |
---|
107 | class LoadRawThumbThreadPriv; |
---|
108 | |
---|
109 | class KIPIPLUGINS_EXPORT LoadRawThumbThread : public QThread |
---|
110 | { |
---|
111 | Q_OBJECT |
---|
112 | |
---|
113 | public: |
---|
114 | |
---|
115 | explicit LoadRawThumbThread(QObject *parent, int size=256); |
---|
116 | ~LoadRawThumbThread(); |
---|
117 | |
---|
118 | void getRawThumb(const KUrl& url); |
---|
119 | void cancel(); |
---|
120 | |
---|
121 | Q_SIGNALS: |
---|
122 | |
---|
123 | void signalRawThumb(const KUrl&, const QImage& img); |
---|
124 | |
---|
125 | private: |
---|
126 | |
---|
127 | void run(); |
---|
128 | |
---|
129 | private: |
---|
130 | |
---|
131 | LoadRawThumbThreadPriv* const d; |
---|
132 | }; |
---|
133 | |
---|
134 | } // namespace KIPIPlugins |
---|
135 | |
---|
136 | #endif /* IMAGEDIALOG_H */ |
---|