diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2016-08-17 22:09:24 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2016-08-17 22:32:04 +0200 |
commit | fdef1901054e61e5996c59ac09d9a2646cc76341 (patch) | |
tree | 30d7af27313acb04be459c309c23091bc9d90df6 /spline-widget/spline-widget.hpp | |
parent | 62c137157ed04d08e6bcc7a741bcdb046943776f (diff) |
spline-widget: save spline control point list using options api
- spline widgets reload when spline bundle reloads
- every bundle reloads when profile gets changed
Importing old spline settings hasn't been implemented.
Control point positions are stored as raw floats. This is bad.
Diffstat (limited to 'spline-widget/spline-widget.hpp')
-rw-r--r-- | spline-widget/spline-widget.hpp | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/spline-widget/spline-widget.hpp b/spline-widget/spline-widget.hpp index 1dbdb8e1..9ad4f598 100644 --- a/spline-widget/spline-widget.hpp +++ b/spline-widget/spline-widget.hpp @@ -9,22 +9,29 @@ #pragma once +#include "spline.hpp" +#include "api/plugin-api.hpp" +#include "options/options.hpp" #include <QWidget> #include <QtGui> +#include <QMetaObject> #include <QPointF> -#include "spline.hpp" -#include "api/plugin-api.hpp" +#include <QDebug> +using namespace options; -class SPLINE_WIDGET_EXPORT spline_widget : public QWidget +class SPLINE_WIDGET_EXPORT spline_widget final : public QWidget { Q_OBJECT Q_PROPERTY(QColor colorBezier READ colorBezier WRITE setColorBezier) Q_PROPERTY(bool is_preview_only READ is_preview_only WRITE set_preview_only) + + using points_t = spline::points_t; public: spline_widget(QWidget *parent = 0); spline* config(); - void setConfig(spline* config, const QString &name); + + void setConfig(spline* config, bundle b); QColor colorBezier() const { @@ -49,6 +56,7 @@ protected slots: void mousePressEvent(QMouseEvent *e) override; void mouseMoveEvent(QMouseEvent *e) override; void mouseReleaseEvent(QMouseEvent *e) override; + void reload_spline(); private: void drawBackground(); void drawFunction(); @@ -68,13 +76,17 @@ private: // bounds of the rectangle user can interact with QRectF pixel_bounds; - int moving_control_point_idx; QPointF c; QColor spline_color; QPixmap _background; QPixmap _function; + + QMetaObject::Connection connection; + + int moving_control_point_idx; + int snap_x, snap_y; bool _draw_function, _preview_only; |