Changeset View
Changeset View
Standalone View
Standalone View
src/widgets/previewjob.h
Show First 20 Lines • Show All 59 Lines • ▼ Show 20 Line(s) | 49 | enum ScaleType { | |||
---|---|---|---|---|---|
60 | /** | 60 | /** | ||
61 | * The preview will be scaled to the size specified when constructing | 61 | * The preview will be scaled to the size specified when constructing | ||
62 | * the PreviewJob. The result will be cached for later use. Per default | 62 | * the PreviewJob. The result will be cached for later use. Per default | ||
63 | * ScaledAndCached is set. | 63 | * ScaledAndCached is set. | ||
64 | */ | 64 | */ | ||
65 | ScaledAndCached | 65 | ScaledAndCached | ||
66 | }; | 66 | }; | ||
67 | 67 | | |||
68 | #ifndef KIOWIDGETS_NO_DEPRECATED | 68 | #if KIOWIDGETS_ENABLE_DEPRECATED_SINCE(4, 7) | ||
69 | /** | 69 | /** | ||
70 | * Creates a new PreviewJob. | 70 | * Creates a new PreviewJob. | ||
71 | * @param items a list of files to create previews for | 71 | * @param items a list of files to create previews for | ||
72 | * @param width the desired width | 72 | * @param width the desired width | ||
73 | * @param height the desired height, 0 to use the @p width | 73 | * @param height the desired height, 0 to use the @p width | ||
74 | * @param iconSize the size of the mimetype icon to overlay over the | 74 | * @param iconSize the size of the mimetype icon to overlay over the | ||
75 | * preview or zero to not overlay an icon. This has no effect if the | 75 | * preview or zero to not overlay an icon. This has no effect if the | ||
76 | * preview plugin that will be used doesn't use icon overlays. | 76 | * preview plugin that will be used doesn't use icon overlays. | ||
77 | * @param iconAlpha transparency to use for the icon overlay | 77 | * @param iconAlpha transparency to use for the icon overlay | ||
78 | * @param scale if the image is to be scaled to the requested size or | 78 | * @param scale if the image is to be scaled to the requested size or | ||
79 | * returned in its original size | 79 | * returned in its original size | ||
80 | * @param save if the image should be cached for later use | 80 | * @param save if the image should be cached for later use | ||
81 | * @param enabledPlugins If non-zero, this points to a list containing | 81 | * @param enabledPlugins If non-zero, this points to a list containing | ||
82 | * the names of the plugins that may be used. If enabledPlugins is zero | 82 | * the names of the plugins that may be used. If enabledPlugins is zero | ||
83 | * all available plugins are used. | 83 | * all available plugins are used. | ||
84 | * | 84 | * | ||
85 | * @deprecated Use PreviewJob(const KFileItemList&, const QSize&, const QStringList*) in combination | 85 | * @deprecated Since 4.7, use PreviewJob(const KFileItemList&, const QSize&, const QStringList*) in combination | ||
86 | * with the setter-methods instead. Note that the semantics of | 86 | * with the setter-methods instead. Note that the semantics of | ||
87 | * \p enabledPlugins has been slightly changed. | 87 | * \p enabledPlugins has been slightly changed. | ||
88 | */ | 88 | */ | ||
89 | KIOWIDGETS_DEPRECATED PreviewJob(const KFileItemList &items, int width, int height, | 89 | KIOWIDGETS_DEPRECATED_VERSION(4, 7, "Use PreviewJob(const KFileItemList&, const QSize&, const QStringList*)") | ||
90 | PreviewJob(const KFileItemList &items, int width, int height, | ||||
90 | int iconSize, int iconAlpha, bool scale, bool save, | 91 | int iconSize, int iconAlpha, bool scale, bool save, | ||
91 | const QStringList *enabledPlugins); | 92 | const QStringList *enabledPlugins); | ||
92 | #endif | 93 | #endif | ||
93 | 94 | | |||
94 | /** | 95 | /** | ||
95 | * @param items List of files to create previews for. | 96 | * @param items List of files to create previews for. | ||
96 | * @param size Desired size of the preview. | 97 | * @param size Desired size of the preview. | ||
97 | * @param enabledPlugins If non-zero it defines the list of plugins that | 98 | * @param enabledPlugins If non-zero it defines the list of plugins that | ||
▲ Show 20 Lines • Show All 105 Lines • ▼ Show 20 Line(s) | |||||
203 | 204 | | |||
204 | /** | 205 | /** | ||
205 | * Returns a list of all supported MIME types. The list can | 206 | * Returns a list of all supported MIME types. The list can | ||
206 | * contain entries like text/ * (without the space). | 207 | * contain entries like text/ * (without the space). | ||
207 | * @return the list of mime types | 208 | * @return the list of mime types | ||
208 | */ | 209 | */ | ||
209 | static QStringList supportedMimeTypes(); | 210 | static QStringList supportedMimeTypes(); | ||
210 | 211 | | |||
212 | #if KIOWIDGETS_ENABLE_DEPRECATED_SINCE(4, 5) | ||||
211 | /** | 213 | /** | ||
212 | * Returns the default "maximum file size", in bytes, used by PreviewJob. | 214 | * Returns the default "maximum file size", in bytes, used by PreviewJob. | ||
213 | * This is useful for applications providing a GUI for letting the user change the size. | 215 | * This is useful for applications providing a GUI for letting the user change the size. | ||
214 | * @since 4.1 | 216 | * @since 4.1 | ||
215 | * @deprecated PreviewJob uses different maximum file sizes dependent on the URL since 4.5. | 217 | * @deprecated Since 4.5, PreviewJob uses different maximum file sizes dependent on the URL. | ||
216 | * The returned file size is only valid for local URLs. | 218 | * The returned file size is only valid for local URLs. | ||
217 | */ | 219 | */ | ||
218 | #ifndef KIOWIDGETS_NO_DEPRECATED | 220 | KIOWIDGETS_DEPRECATED_VERSION(4, 5, "See API dox") | ||
219 | KIOWIDGETS_DEPRECATED static KIO::filesize_t maximumFileSize(); | 221 | static KIO::filesize_t maximumFileSize(); | ||
220 | #endif | 222 | #endif | ||
221 | 223 | | |||
222 | Q_SIGNALS: | 224 | Q_SIGNALS: | ||
223 | /** | 225 | /** | ||
224 | * Emitted when a thumbnail picture for @p item has been successfully | 226 | * Emitted when a thumbnail picture for @p item has been successfully | ||
225 | * retrieved. | 227 | * retrieved. | ||
226 | * @param item the file of the preview | 228 | * @param item the file of the preview | ||
227 | * @param preview the preview image | 229 | * @param preview the preview image | ||
Show All 11 Lines | 240 | protected Q_SLOTS: | |||
239 | void slotResult(KJob *job) override; | 241 | void slotResult(KJob *job) override; | ||
240 | 242 | | |||
241 | private: | 243 | private: | ||
242 | Q_PRIVATE_SLOT(d_func(), void startPreview()) | 244 | Q_PRIVATE_SLOT(d_func(), void startPreview()) | ||
243 | Q_PRIVATE_SLOT(d_func(), void slotThumbData(KIO::Job *, const QByteArray &)) | 245 | Q_PRIVATE_SLOT(d_func(), void slotThumbData(KIO::Job *, const QByteArray &)) | ||
244 | Q_DECLARE_PRIVATE(PreviewJob) | 246 | Q_DECLARE_PRIVATE(PreviewJob) | ||
245 | }; | 247 | }; | ||
246 | 248 | | |||
247 | #ifndef KIOWIDGETS_NO_DEPRECATED | 249 | #if KIOWIDGETS_ENABLE_DEPRECATED_SINCE(4, 7) | ||
248 | /** | 250 | /** | ||
249 | * Creates a PreviewJob to generate or retrieve a preview image | 251 | * Creates a PreviewJob to generate or retrieve a preview image | ||
250 | * for the given URL. | 252 | * for the given URL. | ||
251 | * | 253 | * | ||
252 | * @param items files to get previews for | 254 | * @param items files to get previews for | ||
253 | * @param width the maximum width to use | 255 | * @param width the maximum width to use | ||
254 | * @param height the maximum height to use, if this is 0, the same | 256 | * @param height the maximum height to use, if this is 0, the same | ||
255 | * value as width is used. | 257 | * value as width is used. | ||
256 | * @param iconSize the size of the mimetype icon to overlay over the | 258 | * @param iconSize the size of the mimetype icon to overlay over the | ||
257 | * preview or zero to not overlay an icon. This has no effect if the | 259 | * preview or zero to not overlay an icon. This has no effect if the | ||
258 | * preview plugin that will be used doesn't use icon overlays. | 260 | * preview plugin that will be used doesn't use icon overlays. | ||
259 | * @param iconAlpha transparency to use for the icon overlay | 261 | * @param iconAlpha transparency to use for the icon overlay | ||
260 | * @param scale if the image is to be scaled to the requested size or | 262 | * @param scale if the image is to be scaled to the requested size or | ||
261 | * returned in its original size | 263 | * returned in its original size | ||
262 | * @param save if the image should be cached for later use | 264 | * @param save if the image should be cached for later use | ||
263 | * @param enabledPlugins if non-zero, this points to a list containing | 265 | * @param enabledPlugins if non-zero, this points to a list containing | ||
264 | * the names of the plugins that may be used. | 266 | * the names of the plugins that may be used. | ||
265 | * @return the new PreviewJob | 267 | * @return the new PreviewJob | ||
266 | * @see PreviewJob::availablePlugins() | 268 | * @see PreviewJob::availablePlugins() | ||
267 | * @deprecated Use KIO::filePreview(const KFileItemList&, const QSize&, const QStringList*) in combination | 269 | * @deprecated Since 4.7, use KIO::filePreview(const KFileItemList&, const QSize&, const QStringList*) in combination | ||
268 | * with the setter-methods instead. Note that the semantics of | 270 | * with the setter-methods instead. Note that the semantics of | ||
269 | * \p enabledPlugins has been slightly changed. | 271 | * \p enabledPlugins has been slightly changed. | ||
270 | */ | 272 | */ | ||
271 | KIOWIDGETS_DEPRECATED_EXPORT PreviewJob *filePreview(const KFileItemList &items, int width, int height = 0, int iconSize = 0, int iconAlpha = 70, bool scale = true, bool save = true, const QStringList *enabledPlugins = nullptr); // KDE5: use enums instead of bool scale + bool save | 273 | KIOWIDGETS_DEPRECATED_VERSION(4, 7, "Use KIO::filePreview(const KFileItemList &, const QSize &, const QStringList *") | ||
274 | KIOWIDGETS_EXPORT PreviewJob *filePreview(const KFileItemList &items, int width, int height = 0, int iconSize = 0, int iconAlpha = 70, bool scale = true, bool save = true, const QStringList *enabledPlugins = nullptr); // KDE5: use enums instead of bool scale + bool save | ||||
275 | #endif | ||||
272 | 276 | | |||
277 | #if KIOWIDGETS_ENABLE_DEPRECATED_SINCE(4, 7) | ||||
273 | /** | 278 | /** | ||
274 | * Creates a PreviewJob to generate or retrieve a preview image | 279 | * Creates a PreviewJob to generate or retrieve a preview image | ||
275 | * for the given URL. | 280 | * for the given URL. | ||
276 | * | 281 | * | ||
277 | * @param items files to get previews for | 282 | * @param items files to get previews for | ||
278 | * @param width the maximum width to use | 283 | * @param width the maximum width to use | ||
279 | * @param height the maximum height to use, if this is 0, the same | 284 | * @param height the maximum height to use, if this is 0, the same | ||
280 | * value as width is used. | 285 | * value as width is used. | ||
281 | * @param iconSize the size of the mimetype icon to overlay over the | 286 | * @param iconSize the size of the mimetype icon to overlay over the | ||
282 | * preview or zero to not overlay an icon. This has no effect if the | 287 | * preview or zero to not overlay an icon. This has no effect if the | ||
283 | * preview plugin that will be used doesn't use icon overlays. | 288 | * preview plugin that will be used doesn't use icon overlays. | ||
284 | * @param iconAlpha transparency to use for the icon overlay | 289 | * @param iconAlpha transparency to use for the icon overlay | ||
285 | * @param scale if the image is to be scaled to the requested size or | 290 | * @param scale if the image is to be scaled to the requested size or | ||
286 | * returned in its original size | 291 | * returned in its original size | ||
287 | * @param save if the image should be cached for later use | 292 | * @param save if the image should be cached for later use | ||
288 | * @param enabledPlugins if non-zero, this points to a list containing | 293 | * @param enabledPlugins if non-zero, this points to a list containing | ||
289 | * the names of the plugins that may be used. | 294 | * the names of the plugins that may be used. | ||
290 | * @return the new PreviewJob | 295 | * @return the new PreviewJob | ||
291 | * @see PreviewJob::availablePlugins() | 296 | * @see PreviewJob::availablePlugins() | ||
292 | * @deprecated Use KIO::filePreview(const KFileItemList&, const QSize&, const QStringList*) in combination | 297 | * @deprecated Since 4.7, use KIO::filePreview(const KFileItemList&, const QSize&, const QStringList*) in combination | ||
293 | * with the setter-methods instead. Note that the semantics of | 298 | * with the setter-methods instead. Note that the semantics of | ||
294 | * \p enabledPlugins has been slightly changed. | 299 | * \p enabledPlugins has been slightly changed. | ||
295 | */ | 300 | */ | ||
296 | KIOWIDGETS_DEPRECATED_EXPORT PreviewJob *filePreview(const QList<QUrl> &items, int width, int height = 0, int iconSize = 0, int iconAlpha = 70, bool scale = true, bool save = true, const QStringList *enabledPlugins = nullptr); | 301 | KIOWIDGETS_DEPRECATED_VERSION(4, 7, "Use KIO::filePreview(const KFileItemList &, const QSize &, const QStringList *") | ||
302 | KIOWIDGETS_EXPORT PreviewJob *filePreview(const QList<QUrl> &items, int width, int height = 0, int iconSize = 0, int iconAlpha = 70, bool scale = true, bool save = true, const QStringList *enabledPlugins = nullptr); | ||||
297 | #endif | 303 | #endif | ||
298 | 304 | | |||
299 | /** | 305 | /** | ||
300 | * Creates a PreviewJob to generate a preview image for the given items. | 306 | * Creates a PreviewJob to generate a preview image for the given items. | ||
301 | * @param items List of files to create previews for. | 307 | * @param items List of files to create previews for. | ||
302 | * @param size Desired size of the preview. | 308 | * @param size Desired size of the preview. | ||
303 | * @param enabledPlugins If non-zero it defines the list of plugins that | 309 | * @param enabledPlugins If non-zero it defines the list of plugins that | ||
304 | * are considered for generating the preview. If | 310 | * are considered for generating the preview. If | ||
305 | * enabledPlugins is zero the plugins specified in the | 311 | * enabledPlugins is zero the plugins specified in the | ||
306 | * KConfigGroup "PreviewSettings" are used. | 312 | * KConfigGroup "PreviewSettings" are used. | ||
307 | * @since 4.7 | 313 | * @since 4.7 | ||
308 | */ | 314 | */ | ||
309 | KIOWIDGETS_EXPORT PreviewJob *filePreview(const KFileItemList &items, const QSize &size, const QStringList *enabledPlugins = nullptr); | 315 | KIOWIDGETS_EXPORT PreviewJob *filePreview(const KFileItemList &items, const QSize &size, const QStringList *enabledPlugins = nullptr); | ||
310 | } | 316 | } | ||
311 | 317 | | |||
312 | #endif | 318 | #endif |