summaryrefslogtreecommitdiffhomepage
path: root/spline-widget/spline.hpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-08-09 15:06:49 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-08-09 15:07:59 +0200
commitc68bd5a5fe54ae9671cb03fae1fbb21fd6b621a8 (patch)
tree663f5e7c2fd915a0e2cb99ef6fa67b09b8bbb9a8 /spline-widget/spline.hpp
parent40a00851315e193f19ab71e516fbb4c135f44f03 (diff)
spline-widget: only rename files
Adjust usages.
Diffstat (limited to 'spline-widget/spline.hpp')
-rw-r--r--spline-widget/spline.hpp70
1 files changed, 70 insertions, 0 deletions
diff --git a/spline-widget/spline.hpp b/spline-widget/spline.hpp
new file mode 100644
index 00000000..5d83aefd
--- /dev/null
+++ b/spline-widget/spline.hpp
@@ -0,0 +1,70 @@
+/* Copyright (c) 2012-2016, Stanislaw Halik <sthalik@misaki.pl>
+
+ * Permission to use, copy, modify, and/or distribute this
+ * software for any purpose with or without fee is hereby granted,
+ * provided that the above copyright notice and this permission
+ * notice appear in all copies.
+ */
+
+#pragma once
+
+#include <QtGlobal>
+#include <QList>
+#include <QPointF>
+#include <QString>
+#include <QSettings>
+#include <QMutex>
+#include <vector>
+#include <limits>
+#include "opentrack-compat/qcopyable-mutex.hpp"
+
+#ifdef BUILD_spline_widget
+# define SPLINE_WIDGET_EXPORT Q_DECL_EXPORT
+#else
+# define SPLINE_WIDGET_EXPORT Q_DECL_IMPORT
+#endif
+
+class SPLINE_WIDGET_EXPORT Map
+{
+private:
+ int precision() const;
+ void reload();
+ float getValueInternal(int x);
+
+ struct State
+ {
+ QList<QPointF> input;
+ std::vector<float> data;
+ bool operator==(const State& s) const;
+ };
+
+ MyMutex _mutex;
+ QPointF last_input_value;
+ State cur, saved;
+ qreal max_x, max_y;
+ volatile bool activep;
+
+ static constexpr int value_count = 10000;
+public:
+ qreal maxInput() const;
+ qreal maxOutput() const;
+ Map();
+ Map(qreal maxx, qreal maxy);
+
+ float getValue(float x);
+ bool getLastPoint(QPointF& point);
+ void removePoint(int i);
+ void removeAllPoints();
+
+ void addPoint(QPointF pt);
+ void movePoint(int idx, QPointF pt);
+ const QList<QPointF> getPoints();
+ void setMaxInput(qreal MaxInput);
+ void setMaxOutput(qreal MaxOutput);
+
+ void saveSettings(QSettings& settings, const QString& title);
+ void loadSettings(QSettings& settings, const QString& title);
+ void invalidate_unsaved_settings();
+
+ void setTrackingActive(bool blnActive);
+};