Changeset View
Changeset View
Standalone View
Standalone View
src/widgets/thumbcreator.h
Show All 14 Lines | 1 | /* This file is part of the KDE libraries | |||
---|---|---|---|---|---|
15 | along with this library; see the file COPYING.LIB. If not, write to | 15 | along with this library; see the file COPYING.LIB. If not, write to | ||
16 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
17 | Boston, MA 02110-1301, USA. | 17 | Boston, MA 02110-1301, USA. | ||
18 | */ | 18 | */ | ||
19 | 19 | | |||
20 | #ifndef _THUMBCREATOR_H_ | 20 | #ifndef _THUMBCREATOR_H_ | ||
21 | #define _THUMBCREATOR_H_ | 21 | #define _THUMBCREATOR_H_ | ||
22 | 22 | | |||
23 | #include <QtGlobal> | ||||
24 | | ||||
23 | #include "kiowidgets_export.h" | 25 | #include "kiowidgets_export.h" | ||
24 | 26 | | |||
25 | class QString; | 27 | class QString; | ||
26 | class QImage; | 28 | class QImage; | ||
27 | class QWidget; | 29 | class QWidget; | ||
28 | 30 | | |||
29 | /** | 31 | /** | ||
30 | * @class ThumbCreator thumbcreator.h <KIO/ThumbCreator> | 32 | * @class ThumbCreator thumbcreator.h <KIO/ThumbCreator> | ||
▲ Show 20 Lines • Show All 97 Lines • ▼ Show 20 Line(s) | 111 | #endif | |||
128 | * above). | 130 | * above). | ||
129 | * @param height The requested preview height (see the note on scaling | 131 | * @param height The requested preview height (see the note on scaling | ||
130 | * above). | 132 | * above). | ||
131 | * @param img The QImage to store the preview in. | 133 | * @param img The QImage to store the preview in. | ||
132 | * | 134 | * | ||
133 | * @return @c true if a preview was successfully generated and store in @p | 135 | * @return @c true if a preview was successfully generated and store in @p | ||
134 | * img, @c false otherwise. | 136 | * img, @c false otherwise. | ||
135 | */ | 137 | */ | ||
136 | virtual bool create(const QString &path, int width, int height, QImage &img) = 0; // KF6 TODO: turn first arg into QUrl (see thumbnail/htmlcreator.cpp) | 138 | virtual bool create(const QString &path, int width, int height, QImage &img) = 0; // KF6 TODO: turn first arg into QUrl (see thumbnail/htmlcreator.cpp) | ||
broulik: You can't do that | |||||
137 | 139 | | |||
138 | /** | 140 | /** | ||
139 | * Returns the flags for this plugin. | 141 | * Returns the flags for this plugin. | ||
140 | * | 142 | * | ||
141 | * @return XOR'd flags values. | 143 | * @return XOR'd flags values. | ||
142 | * @see Flags | 144 | * @see Flags | ||
143 | */ | 145 | */ | ||
144 | virtual Flags flags() const; | 146 | virtual Flags flags() const; | ||
Show All 27 Lines | |||||
172 | 174 | | |||
173 | #if KIOWIDGETS_ENABLE_DEPRECATED_SINCE(5, 0) | 175 | #if KIOWIDGETS_ENABLE_DEPRECATED_SINCE(5, 0) | ||
174 | /** | 176 | /** | ||
175 | * @class ThumbCreatorV2 thumbcreator.h <KIO/ThumbCreator> | 177 | * @class ThumbCreatorV2 thumbcreator.h <KIO/ThumbCreator> | ||
176 | * @since 4.7 | 178 | * @since 4.7 | ||
177 | * @deprecated since 5.0, use ThumbCreator | 179 | * @deprecated since 5.0, use ThumbCreator | ||
178 | */ | 180 | */ | ||
179 | class KIOWIDGETS_DEPRECATED_VERSION(5, 0, "Use ThumbCreator") | 181 | class KIOWIDGETS_DEPRECATED_VERSION(5, 0, "Use ThumbCreator") | ||
180 | KIOWIDGETS_EXPORT ThumbCreatorV2 : public ThumbCreator | 182 | KIOWIDGETS_EXPORT ThumbCreatorV2 : public ThumbCreator | ||
You need to do like we once did: define an interface that inherits from ThumbCreator. In the job, use dynamic_cast to test whether the object provided by the kioslave supports the V3 interface or not. dfaure: You need to do like we once did: define an interface that inherits from ThumbCreator.
Call it… | |||||
I guess you mean in the thumbnail kio regarding instantiating Thumbcreator. meven: I guess you mean in the thumbnail kio regarding instantiating Thumbcreator.
Anyway it works… | |||||
181 | { | 183 | { | ||
182 | public: | 184 | public: | ||
183 | virtual ~ThumbCreatorV2(); | 185 | virtual ~ThumbCreatorV2(); | ||
184 | }; | 186 | }; | ||
185 | #endif | 187 | #endif | ||
186 | 188 | | |||
189 | /** | ||||
190 | * @class ThumbCreatorV3 thumbcreator.h <KIO/ThumbCreator> | ||||
191 | * @since 5.71 | ||||
dfaure: 5.70 is tagged already | |||||
meven: update | |||||
192 | */ | ||||
193 | class KIOWIDGETS_EXPORT ThumbCreatorV3 : public ThumbCreator | ||||
194 | { | ||||
195 | public: | ||||
196 | // TODO KF6 merge ThumbCreatorV3 to ThumbCreator | ||||
197 | virtual ~ThumbCreatorV3(); | ||||
198 | | ||||
199 | bool create(const QString &path, int width, int height, QImage &img) override; | ||||
200 | | ||||
201 | /** | ||||
202 | * Creates a thumbnail. | ||||
203 | * | ||||
204 | * @p height and @p height are supposed to be device independant, | ||||
205 | * the @p devicePixelRatio will be used to scale the resulting image. | ||||
206 | * | ||||
207 | * The resulting image may not have the requested devicePixelRatio, if, for instance, | ||||
208 | * the creator cannot generate a big enough image, use @see QImage::devicePixelRatio to check. | ||||
209 | * | ||||
210 | * @param path The path of the file to create a preview for. This is | ||||
211 | * always a local path. | ||||
212 | * @param width The requested preview width | ||||
213 | * @param height The requested preview height | ||||
214 | * @param img The QImage to store the preview in. | ||||
215 | * It may not respect the requested devicePixelRatio. | ||||
dfaure: docu? | |||||
meven: I wonder about moving qreal devicePixelRatio before img parameter | |||||
216 | * @param devicePixelRatio The requested device pixel ratio. | ||||
217 | * This is the ratio between device pixels (screen pixel) and | ||||
218 | * device independent pixels (virtual screen). | ||||
219 | * Defaults to 1 (no ratio applied) | ||||
220 | * @see QImage::devicePixelRatio() | ||||
221 | * | ||||
222 | * @return @c true if a preview was successfully generated and store in @p | ||||
223 | * img, @c false otherwise. | ||||
224 | */ | ||||
225 | virtual bool createV3(const QString &path, int width, int height, QImage &img, qreal devicePixelRatio = 1.0) = 0; | ||||
226 | }; | ||||
227 | | ||||
228 | | ||||
187 | // KF6 TODO: rename this to something less generic | 229 | // KF6 TODO: rename this to something less generic | ||
188 | typedef ThumbCreator *(*newCreator)(); | 230 | typedef ThumbCreator *(*newCreator)(); | ||
189 | 231 | | |||
190 | #endif | 232 | #endif |
You can't do that