krita

kis_previewwidget.h

00001 /*
00002  *  kis_previewwidget.h - part of Krita
00003  *
00004  *  Copyright (c) 2001 John Califf  <jcaliff@compuzone.net>
00005  *  Copyright (c) 2004 Bart Coppens <kde@bartcoppens.be>
00006  *  Copyright (c) 2005 Cyrille Berger <cberger@cberger.net>
00007  *  Copyright (c) 2007 Benjamin Schleimer <bensch128@yahoo.com>
00008  *
00009  *  This program is free software; you can redistribute it and/or modify
00010  *  it under the terms of the GNU General Public License as published by
00011  *  the Free Software Foundation; either version 2 of the License, or
00012  *  (at your option) any later version.
00013  *
00014  *  This program is distributed in the hope that it will be useful,
00015  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  *  GNU General Public License for more details.
00018  *
00019  *  You should have received a copy of the GNU General Public License
00020  *  along with this program; if not, write to the Free Software
00021  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00022  */
00023 #ifndef __kis_previewwidget_h__
00024 #define __kis_previewwidget_h__
00025 
00026 #include <qimage.h>
00027 #include <qevent.h>
00028 
00029 #include "kis_types.h"
00030 
00031 #include "kis_previewwidgetbase.h"
00032 
00033 class QWidget;
00034 class KisProfile;
00035 class KisFilter;
00036 class KisFilterConfiguration;
00037 class QTimer;
00038 class KisLabelProgress;
00039 
00048 class KisPreviewWidget : public PreviewWidgetBase
00049 {
00050     Q_OBJECT
00051 
00052 public:
00054     KisPreviewWidget( QWidget* parent = 0, const char* name = 0 );
00055     virtual ~KisPreviewWidget();
00056 
00058     bool getAutoUpdate() const;
00059 
00060     void wheelEvent(QWheelEvent * e);
00061 
00068     void runFilter(KisFilter * filter, KisFilterConfiguration * config);
00069 
00070 public slots:
00071 
00073     void slotSetDevice(KisPaintDeviceSP dev);
00074 
00076     void slotSetAutoUpdate(bool set);
00077 
00079     void setPreviewDisplayed(bool v);
00080     
00082     void needUpdate();
00083     
00084 signals:
00086     void updated();
00087 
00088 private slots:
00089 
00090     void zoomIn();
00091     void zoomOut();
00092     void zoomOneToOne();
00093 
00097     void forceUpdate();
00098 
00102     void updateZoom();
00103 
00106     void runFilterHelper();
00107 
00108 private:
00112     void zoomChanged(const double zoom);
00113 
00114     bool m_autoupdate; 
00115     bool m_previewIsDisplayed; 
00116 
00117     QImage m_scaledOriginal; 
00118     bool m_dirtyOriginal; 
00119     KisPaintDeviceSP m_origDevice; 
00120     
00121     QImage m_scaledPreview; 
00122     bool m_dirtyPreview; 
00123     KisPaintDeviceSP m_previewDevice; 
00124     KisImageSP m_scaledImage; 
00125 
00126     double m_filterZoom; 
00127     double m_zoom; 
00128     KisProfile * m_profile; 
00129 
00130     KisLabelProgress *m_progress; 
00131 
00132     QTimer * m_zoomTimer; 
00133     QTimer * m_filterTimer; 
00134     KisFilter * m_filter; 
00135     KisFilterConfiguration * m_config; 
00136     bool m_firstFilter; 
00137     bool m_firstZoom; 
00138 };
00139 
00140 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys