2012-02-21 13:41:02 +00:00
|
|
|
#ifndef _PAYSAGES_QT_BASEPREVIEW_H_
|
|
|
|
#define _PAYSAGES_QT_BASEPREVIEW_H_
|
2011-12-26 21:53:29 +00:00
|
|
|
|
|
|
|
#include <QMutex>
|
|
|
|
#include <QImage>
|
|
|
|
#include <QWidget>
|
2012-01-18 16:20:14 +00:00
|
|
|
#include <QThread>
|
2011-12-26 21:53:29 +00:00
|
|
|
|
2012-02-21 13:41:02 +00:00
|
|
|
class BasePreview:public QWidget
|
2011-12-26 21:53:29 +00:00
|
|
|
{
|
2012-01-05 18:39:17 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
2011-12-26 21:53:29 +00:00
|
|
|
public:
|
2012-02-21 13:41:02 +00:00
|
|
|
BasePreview(QWidget* parent);
|
|
|
|
~BasePreview();
|
2012-01-16 21:29:21 +00:00
|
|
|
|
2012-02-05 12:17:51 +00:00
|
|
|
void start();
|
2011-12-26 21:53:29 +00:00
|
|
|
void doRender();
|
2011-12-27 19:03:46 +00:00
|
|
|
void redraw();
|
2012-01-22 18:39:42 +00:00
|
|
|
|
2012-01-20 16:25:09 +00:00
|
|
|
void setScaling(double scaling);
|
2011-12-26 21:53:29 +00:00
|
|
|
|
|
|
|
protected:
|
2012-01-25 22:32:06 +00:00
|
|
|
virtual void updateData();
|
2012-01-18 19:49:03 +00:00
|
|
|
virtual QColor getColor(double x, double y);
|
2011-12-26 21:53:29 +00:00
|
|
|
|
|
|
|
double xoffset;
|
|
|
|
double yoffset;
|
|
|
|
double scaling;
|
|
|
|
|
2012-01-25 22:32:06 +00:00
|
|
|
private:
|
|
|
|
void forceRender();
|
|
|
|
void renderPixbuf();
|
|
|
|
|
|
|
|
void resizeEvent(QResizeEvent* event);
|
|
|
|
void paintEvent(QPaintEvent* event);
|
2012-02-06 20:54:23 +00:00
|
|
|
|
|
|
|
void wheelEvent(QWheelEvent* event);
|
2012-01-25 22:32:06 +00:00
|
|
|
|
|
|
|
QThread* updater;
|
|
|
|
|
|
|
|
QMutex* lock_drawing;
|
2011-12-26 21:53:29 +00:00
|
|
|
QImage* pixbuf;
|
|
|
|
|
|
|
|
int mousex;
|
|
|
|
int mousey;
|
|
|
|
|
2012-01-16 21:29:21 +00:00
|
|
|
bool alive;
|
|
|
|
bool need_rerender;
|
|
|
|
bool need_render;
|
2012-01-22 18:39:42 +00:00
|
|
|
|
2012-01-25 22:32:06 +00:00
|
|
|
double conf_scroll_xmin;
|
|
|
|
double conf_scroll_xmax;
|
|
|
|
double conf_scroll_ymin;
|
|
|
|
double conf_scroll_ymax;
|
|
|
|
|
|
|
|
double conf_scale_min;
|
|
|
|
double conf_scale_max;
|
|
|
|
double conf_scale_step;
|
2012-01-22 18:39:42 +00:00
|
|
|
|
|
|
|
signals:
|
|
|
|
void contentChange();
|
2012-01-25 22:32:06 +00:00
|
|
|
void redrawRequested();
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void handleRedraw();
|
2011-12-26 21:53:29 +00:00
|
|
|
};
|
|
|
|
|
2012-01-16 21:29:21 +00:00
|
|
|
#endif
|