Changeset View
Changeset View
Standalone View
Standalone View
plugins/dockers/overview/overviewwidget.h
Context not available. | |||||
19 | 19 | | |||
---|---|---|---|---|---|
20 | #ifndef OVERVIEWWIDGET_H | 20 | #ifndef OVERVIEWWIDGET_H | ||
21 | #define OVERVIEWWIDGET_H | 21 | #define OVERVIEWWIDGET_H | ||
22 | 22 | #include <QObject> | |||
23 | #include <QWidget> | 23 | #include <QWidget> | ||
24 | #include <QPixmap> | 24 | #include <QPixmap> | ||
25 | #include <QMutex> | ||||
26 | #include "kis_idle_watcher.h" | ||||
27 | #include "kis_simple_stroke_strategy.h" | ||||
25 | 28 | | |||
26 | class KisCanvas2; | 29 | class KisCanvas2; | ||
27 | class KisSignalCompressor; | 30 | class KisSignalCompressor; | ||
28 | class KoCanvasBase; | 31 | class KoCanvasBase; | ||
29 | 32 | | |||
33 | class OverviewThumbnailStrokeStrategy : public QObject, public KisSimpleStrokeStrategy | ||||
34 | { | ||||
35 | Q_OBJECT | ||||
36 | public: | ||||
37 | OverviewThumbnailStrokeStrategy(KisImageWSP image); | ||||
38 | ~OverviewThumbnailStrokeStrategy(); | ||||
39 | | ||||
40 | static QList<KisStrokeJobData*> createJobsData(KisPaintDeviceSP dev, const QRect& imageRect, KisPaintDeviceSP thumbDev, const QSize &thumbnailSize); | ||||
41 | | ||||
42 | private: | ||||
43 | void initStrokeCallback(); | ||||
44 | void doStrokeCallback(KisStrokeJobData *data); | ||||
45 | void finishStrokeCallback(); | ||||
46 | void cancelStrokeCallback(); | ||||
47 | | ||||
48 | Q_SIGNALS: | ||||
49 | //Emitted when thumbnail is updated and overviewImage is fully generated. | ||||
50 | void thumbnailUpdated(QImage pixmap); | ||||
51 | | ||||
52 | | ||||
53 | private: | ||||
54 | struct Private; | ||||
55 | const QScopedPointer<Private> m_d; | ||||
56 | QMutex m_thumbnailMergeMutex; | ||||
57 | KisImageSP m_image; | ||||
58 | }; | ||||
59 | | ||||
30 | class OverviewWidget : public QWidget | 60 | class OverviewWidget : public QWidget | ||
31 | { | 61 | { | ||
32 | Q_OBJECT | 62 | Q_OBJECT | ||
Context not available. | |||||
37 | virtual ~OverviewWidget(); | 67 | virtual ~OverviewWidget(); | ||
38 | 68 | | |||
39 | virtual void setCanvas(KoCanvasBase *canvas); | 69 | virtual void setCanvas(KoCanvasBase *canvas); | ||
40 | virtual void unsetCanvas() { m_canvas = 0; } | 70 | virtual void unsetCanvas() | ||
71 | { | ||||
72 | m_canvas = 0; | ||||
73 | } | ||||
41 | 74 | | |||
42 | public Q_SLOTS: | 75 | public Q_SLOTS: | ||
43 | void startUpdateCanvasProjection(); | 76 | void startUpdateCanvasProjection(); | ||
77 | void generateThumbnail(); | ||||
78 | void updateThumbnail(QImage pixmap); | ||||
44 | 79 | | |||
45 | protected: | 80 | protected: | ||
46 | void resizeEvent(QResizeEvent *event); | 81 | void resizeEvent(QResizeEvent *event); | ||
47 | void showEvent(QShowEvent *event); | 82 | void showEvent(QShowEvent *event); | ||
48 | void paintEvent(QPaintEvent *event); | 83 | void paintEvent(QPaintEvent *event); | ||
49 | 84 | | |||
50 | virtual void mousePressEvent(QMouseEvent* event); | 85 | virtual void mousePressEvent(QMouseEvent* event); | ||
51 | virtual void mouseMoveEvent(QMouseEvent* event); | 86 | virtual void mouseMoveEvent(QMouseEvent* event); | ||
52 | virtual void mouseReleaseEvent(QMouseEvent* event); | 87 | virtual void mouseReleaseEvent(QMouseEvent* event); | ||
53 | virtual void wheelEvent(QWheelEvent* event); | 88 | virtual void wheelEvent(QWheelEvent* event); | ||
54 | 89 | | |||
55 | private: | 90 | private: | ||
56 | QSize calculatePreviewSize(); | 91 | QSize calculatePreviewSize(); | ||
57 | QPointF previewOrigin(); | 92 | QPointF previewOrigin(); | ||
58 | QTransform imageToPreviewTransform(); | 93 | QTransform imageToPreviewTransform(); | ||
59 | QPolygonF previewPolygon(); | 94 | QPolygonF previewPolygon(); | ||
60 | 95 | | |||
61 | KisSignalCompressor *m_compressor; | | |||
62 | QPixmap m_pixmap; | 96 | QPixmap m_pixmap; | ||
63 | KisCanvas2 *m_canvas; | 97 | KisCanvas2 *m_canvas; | ||
64 | 98 | | |||
Context not available. | |||||
66 | QPointF m_lastPos; | 100 | QPointF m_lastPos; | ||
67 | 101 | | |||
68 | QColor m_outlineColor; | 102 | QColor m_outlineColor; | ||
103 | KisIdleWatcher m_imageIdleWatcher; | ||||
104 | KisStrokeId strokeId; | ||||
105 | QMutex mutex; | ||||
69 | }; | 106 | }; | ||
70 | 107 | | |||
71 | 108 | | |||
109 | | ||||
72 | #endif /* OVERVIEWWIDGET_H */ | 110 | #endif /* OVERVIEWWIDGET_H */ | ||
Context not available. |