previewjob.h
00001 // -*- c++ -*- 00002 // vim: ts=4 sw=4 et 00003 /* This file is part of the KDE libraries 00004 Copyright (C) 2000 David Faure <faure@kde.org> 00005 2000 Carsten Pfeiffer <pfeiffer@kde.org> 00006 2001 Malte Starostik <malte.starostik@t-online.de> 00007 00008 This library is free software; you can redistribute it and/or 00009 modify it under the terms of the GNU Library General Public 00010 License as published by the Free Software Foundation; either 00011 version 2 of the License, or (at your option) any later version. 00012 00013 This library is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 Library General Public License for more details. 00017 00018 You should have received a copy of the GNU Library General Public License 00019 along with this library; see the file COPYING.LIB. If not, write to 00020 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00021 Boston, MA 02110-1301, USA. 00022 */ 00023 00024 #ifndef __tdeio_previewjob_h__ 00025 #define __tdeio_previewjob_h__ 00026 00027 #include <tdefileitem.h> 00028 #include <tdeio/job.h> 00029 00030 class TQPixmap; 00031 00032 namespace TDEIO { 00037 class TDEIO_EXPORT PreviewJob : public TDEIO::Job 00038 { 00039 Q_OBJECT 00040 public: 00057 PreviewJob( const KFileItemList &items, int width, int height, 00058 int iconSize, int iconAlpha, bool scale, bool save, 00059 const TQStringList *enabledPlugins, bool deleteItems = false ); 00060 virtual ~PreviewJob(); 00061 00068 void removeItem( const KFileItem *item ); 00069 00076 void setIgnoreMaximumSize(bool ignoreSize = true); 00077 00084 static TQStringList availablePlugins(); 00085 00091 static TQStringList supportedMimeTypes(); 00092 00096 virtual void kill( bool quietly = true ); 00097 00098 signals: 00105 void gotPreview( const KFileItem *item, const TQPixmap &preview ); 00112 void failed( const KFileItem *item ); 00113 00114 protected: 00115 void getOrCreateThumbnail(); 00116 bool statResultThumbnail(); 00117 void createThumbnail( TQString ); 00118 00119 protected slots: 00120 virtual void slotResult( TDEIO::Job *job ); 00121 00122 private slots: 00123 void startPreview(); 00124 void slotThumbData(TDEIO::Job *, const TQByteArray &); 00125 00126 private: 00127 void determineNextFile(); 00128 void emitPreview(const TQImage &thumb); 00129 void emitFailed(const KFileItem *item = 0); 00130 00131 protected: 00132 virtual void virtual_hook( int id, void* data ); 00133 private: 00134 struct PreviewJobPrivate *d; 00135 }; 00136 00157 TDEIO_EXPORT PreviewJob *filePreview( const KFileItemList &items, int width, int height = 0, int iconSize = 0, int iconAlpha = 70, bool scale = true, bool save = true, const TQStringList *enabledPlugins = 0 ); 00158 00179 TDEIO_EXPORT PreviewJob *filePreview( const KURL::List &items, int width, int height = 0, int iconSize = 0, int iconAlpha = 70, bool scale = true, bool save = true, const TQStringList *enabledPlugins = 0 ); 00180 } 00181 00182 #endif