kimagefilepreview.h

00001 /*
00002  *
00003  * This file is part of the KDE project.
00004  * Copyright (C) 2001 Martin R. Jones <mjones@kde.org>
00005  *               2001 Carsten Pfeiffer <pfeiffer@kde.org>
00006  *
00007  * You can Freely distribute this program under the GNU Library General Public
00008  * License. See the file "COPYING" for the exact licensing terms.
00009  */
00010 
00011 #ifndef KIMAGEFILEPREVIEW_H
00012 #define KIMAGEFILEPREVIEW_H
00013 
00014 #include <qpixmap.h>
00015 
00016 #include <kurl.h>
00017 #include <kpreviewwidgetbase.h>
00018 
00019 class QCheckBox;
00020 class QPushButton;
00021 class QLabel;
00022 class QTimer;
00023 
00024 class KFileDialog;
00025 class KFileItem;
00026 namespace KIO { class Job; class PreviewJob; }
00027 
00031 class KIO_EXPORT KImageFilePreview : public KPreviewWidgetBase
00032 {
00033     Q_OBJECT
00034 
00035     public:
00036         KImageFilePreview(QWidget *parent);
00037         ~KImageFilePreview();
00038 
00039         virtual QSize sizeHint() const;
00040 
00041     public slots:
00042         virtual void showPreview(const KURL &url);
00043         virtual void clearPreview();
00044 
00045     protected slots:
00046         void showPreview();
00047         void showPreview( const KURL& url, bool force );
00048 
00049         void toggleAuto(bool);
00050         virtual void gotPreview( const KFileItem*, const QPixmap& );
00051 
00052     protected:
00053         virtual void resizeEvent(QResizeEvent *e);
00054         virtual KIO::PreviewJob * createJob( const KURL& url,
00055                                                      int w, int h );
00056 
00057     private slots:
00058         void slotResult( KIO::Job * );
00059         virtual void slotFailed( const KFileItem* );
00060 
00061     private:
00062         bool autoMode;
00063         KURL currentURL;
00064         QTimer *timer;
00065         QLabel *imageLabel;
00066         QLabel *infoLabel;
00067         QCheckBox *autoPreview;
00068         QPushButton *previewButton;
00069         KIO::PreviewJob *m_job;
00070         protected:
00071                 virtual void virtual_hook( int id, void* data );
00072         private:
00073                 class KImageFilePreviewPrivate;
00074                 KImageFilePreviewPrivate *d;
00075 };
00076 
00077 #endif // KIMAGEFILEPREVIEW_H
KDE Home | KDE Accessibility Home | Description of Access Keys