|
|
// -*- c++ -*- // vim: ts=4 sw=4 et /* This file is part of the KDE libraries Copyright (C) 2000 David Faure2000 Carsten Pfeiffer 2001 Malte Starostik This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __kio_previewjob_h__ #define __kio_previewjob_h__ #include #include class QPixmap; namespace KIO { class PreviewJob : public KIO::Job { Q_OBJECT public: PreviewJob( const KFileItemList &items, int width, int height, int iconSize, int iconAlpha, bool scale, bool save, const QStringList *enabledPlugins, bool deleteItems = false ); virtual ~PreviewJob(); /** * Removes an item from preview processing. Use this if you passed * an item to @ref filePreview and want to delete it now. * * @param item the item that should be removed from the preview queue */ void removeItem( const KFileItem *item ); /** * @return a list of all available preview plugins. The list * contains the basenames of the plugins' .desktop files (no path, * no .desktop). */ static QStringList availablePlugins(); /** * @return a list of all supported MIME types. The list can * contain entries like text/ * (without the space). */ static QStringList supportedMimeTypes(); signals: void gotPreview( const KFileItem *item, const QPixmap &preview ); void failed( const KFileItem *item ); protected: void getOrCreateThumbnail(); bool statResultThumbnail(); void createThumbnail( QString ); protected slots: virtual void slotResult( KIO::Job *job ); private slots: void startPreview(); void slotThumbData(KIO::Job *, const QByteArray &); private: void determineNextFile(); void emitPreview(const QPixmap &pix); void emitFailed(const KFileItem *item = 0); void saveThumbnail(const QByteArray &imgData); private: struct PreviewJobPrivate *d; }; /** * Generate or retrieve a preview image for the given URL. * * @param items files to get previews for * @param width the maximum width to use * @param height the maximum height to use, if this is 0, the same * value as width is used. * @param iconSize the size of the mimetype icon to overlay over the * preview or zero to not overlay an icon. This has no effect if the * preview plugin that will be used doesn't use icon overlays. * @param iconAlpha transparency to use for the icon overlay * @param scale if the image is to be scaled to the requested size or * returned in its original size * @param save if the image should be cached for later use * @param enabledPlugins if non-zero, this points to a list containing * the names of the plugins that may be used. * see @ref PreviewJob::availablePlugins. */ 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 = 0 ); /** * Same as above, but takes a URL list instead of KFileItemList */ PreviewJob *filePreview( const KURL::List &items, int width, int height = 0, int iconSize = 0, int iconAlpha = 70, bool scale = true, bool save = true, const QStringList *enabledPlugins = 0 ); }; #endif
Generated by: dfaure on kde.faure.org on Thu Jan 17 22:16:53 2002, using kdoc 2.0a53. |