FlowVis 1.0
|
00001 #ifndef TRANSFERWIDGET_H 00002 #define TRANSFERWIDGET_H 00003 00004 #include <QDataStream> 00005 #include <QtGui> 00006 #include "hoverpoints.h" 00007 00018 00019 00020 00021 class TransferWidget : public QWidget 00022 { 00023 Q_OBJECT 00024 00025 public: 00026 TransferWidget(QWidget *parent = NULL); 00027 ~TransferWidget(); 00028 00029 void paintEvent(QPaintEvent *e); 00030 00042 friend QDataStream &operator<<(QDataStream &out,const TransferWidget *transfer); 00043 00055 friend QDataStream &operator>>(QDataStream &in,TransferWidget *transfer); 00056 00057 private: 00058 QLinearGradient gradient; 00059 QLinearGradient gradientWithAlpha; 00060 QGradientStops stops; 00061 QImage shadeImage; 00062 QImage transferImage; 00063 HoverPoints *hoverPoints; 00064 00065 void Init(); 00066 00077 00078 void calcShadeImage(); 00079 00090 00091 void calcGradientStops(); 00092 00105 00106 void saveToFile(QString filename); 00107 00123 00124 void loadFromFile(QString filename, QVector<QPointF> &points, QVector<QColor> &colors); 00125 00136 00137 void addTestPoints(); 00138 00139 signals: 00140 00153 00154 void InvokeChangeSelectedColor(const QColor &color); 00155 00168 00169 void InvokeUpdateColorSelector(const QColor &color); 00170 00183 00184 void TransferImageUpdated(const QImage &image); 00185 00186 public slots: 00187 void ChangeSelectedColor(const QColor &color){emit InvokeChangeSelectedColor(color);} 00188 00199 00200 void PointsChanged(); 00201 00214 00215 void SaveConfig(QString filename); 00216 00229 00230 void LoadConfig(QString filename); 00231 }; 00232 00233 QDataStream &operator<<(QDataStream &out,const TransferWidget *transfer); 00234 QDataStream &operator>>(QDataStream &in, TransferWidget *transfer); 00235 #endif // TRANSFERWIDGET_H