summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--filter-accela/ftnoir_filter_accela.cpp2
-rw-r--r--filter-accela/ftnoir_filter_accela.h2
-rw-r--r--gui/main-window.hpp2
-rw-r--r--gui/mapping-window.cpp (renamed from gui/curve-config.cpp)10
-rw-r--r--gui/mapping-window.hpp (renamed from gui/curve-config.h)6
-rw-r--r--gui/mapping-window.ui (renamed from gui/mapping.ui)30
-rw-r--r--opentrack-logic/main-settings.hpp15
-rw-r--r--opentrack-logic/mappings.hpp46
-rw-r--r--opentrack-logic/tracker.cpp12
-rw-r--r--opentrack-logic/tracker.h2
-rw-r--r--spline-widget/spline-widget.cpp34
-rw-r--r--spline-widget/spline-widget.hpp10
-rw-r--r--spline-widget/spline.cpp42
-rw-r--r--spline-widget/spline.hpp6
14 files changed, 110 insertions, 109 deletions
diff --git a/filter-accela/ftnoir_filter_accela.cpp b/filter-accela/ftnoir_filter_accela.cpp
index 24287e48..b165a56d 100644
--- a/filter-accela/ftnoir_filter_accela.cpp
+++ b/filter-accela/ftnoir_filter_accela.cpp
@@ -84,7 +84,7 @@ void FTNoIR_Filter::filter(const double* input, double *output)
for (int i = 0; i < 6; i++)
{
- Map& m = i >= 3 ? rot : trans;
+ spline& m = i >= 3 ? rot : trans;
smoothed_input[i] = smoothed_input[i] * (1.-alpha) + input[i] * alpha;
diff --git a/filter-accela/ftnoir_filter_accela.h b/filter-accela/ftnoir_filter_accela.h
index 7eda8c9e..eb1a30a4 100644
--- a/filter-accela/ftnoir_filter_accela.h
+++ b/filter-accela/ftnoir_filter_accela.h
@@ -43,7 +43,7 @@ public:
FTNoIR_Filter();
void filter(const double* input, double *output) override;
void center() override { first_run = true; }
- Map rot, trans;
+ spline rot, trans;
private:
settings_accela s;
bool first_run;
diff --git a/gui/main-window.hpp b/gui/main-window.hpp
index 66852e6f..14c7cf0d 100644
--- a/gui/main-window.hpp
+++ b/gui/main-window.hpp
@@ -30,7 +30,7 @@
#include "opentrack-logic/shortcuts.h"
#include "opentrack-logic/work.hpp"
#include "opentrack-logic/state.hpp"
-#include "curve-config.h"
+#include "mapping-window.hpp"
#include "options-dialog.hpp"
#include "process_detector.h"
diff --git a/gui/curve-config.cpp b/gui/mapping-window.cpp
index 3e262c48..108e1354 100644
--- a/gui/curve-config.cpp
+++ b/gui/mapping-window.cpp
@@ -6,7 +6,7 @@
* notice appear in all copies.
*/
-#include "curve-config.h"
+#include "mapping-window.hpp"
#include "opentrack-logic/main-settings.hpp"
#include "spline-widget/spline-widget.hpp"
MapWidget::MapWidget(Mappings& m) :
@@ -33,7 +33,7 @@ void MapWidget::reload()
{
{
struct {
- QFunctionConfigurator* qfc;
+ spline_widget* qfc;
Axis axis;
QCheckBox* checkbox;
bool altp;
@@ -58,12 +58,12 @@ void MapWidget::reload()
for (int i = 0; qfcs[i].qfc; i++)
{
const bool altp = qfcs[i].altp;
- Mapping& axis = m(qfcs[i].axis);
- Map* conf = altp ? &axis.curveAlt : &axis.curve;
+ Map& axis = m(qfcs[i].axis);
+ spline* conf = altp ? &axis.spline_alt : &axis.spline_main;
const auto& name = qfcs[i].altp ? axis.name2 : axis.name1;
if (altp)
{
- QFunctionConfigurator& qfc = *qfcs[i].qfc;
+ spline_widget& qfc = *qfcs[i].qfc;
connect(qfcs[i].checkbox, &QCheckBox::toggled,
this,
[&](bool f) -> void {qfc.setEnabled(f); qfc.force_redraw();});
diff --git a/gui/curve-config.h b/gui/mapping-window.hpp
index 2124aa81..e70a27c6 100644
--- a/gui/curve-config.h
+++ b/gui/mapping-window.hpp
@@ -1,16 +1,16 @@
#pragma once
#include <QWidget>
#include "opentrack-logic/mappings.hpp"
-#include "ui_mapping.h"
+#include "ui_mapping-window.h"
class MapWidget final : public QWidget
{
Q_OBJECT
public:
- MapWidget(Mappings &m);
+ MapWidget(Mappings& m);
void reload();
private:
- Ui::UICCurveConfigurationDialog ui;
+ Ui::mapping_window ui;
Mappings& m;
main_settings s;
diff --git a/gui/mapping.ui b/gui/mapping-window.ui
index 3e3a54ff..877feed4 100644
--- a/gui/mapping.ui
+++ b/gui/mapping-window.ui
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
- <class>UICCurveConfigurationDialog</class>
- <widget class="QWidget" name="UICCurveConfigurationDialog">
+ <class>mapping_window</class>
+ <widget class="QWidget" name="mapping_window">
<property name="geometry">
<rect>
<x>0</x>
@@ -59,7 +59,7 @@
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
- <widget class="QFunctionConfigurator" name="rxconfig" native="true">
+ <widget class="spline_widget" name="rxconfig" native="true">
<property name="colorBezier" stdset="0">
<color>
<red>255</red>
@@ -84,7 +84,7 @@
</widget>
</item>
<item>
- <widget class="QFunctionConfigurator" name="rxconfig_alt" native="true">
+ <widget class="spline_widget" name="rxconfig_alt" native="true">
<property name="colorBezier" stdset="0">
<color>
<red>255</red>
@@ -112,7 +112,7 @@
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
- <widget class="QFunctionConfigurator" name="ryconfig" native="true">
+ <widget class="spline_widget" name="ryconfig" native="true">
<property name="colorBezier" stdset="0">
<color>
<red>0</red>
@@ -137,7 +137,7 @@
</widget>
</item>
<item>
- <widget class="QFunctionConfigurator" name="ryconfig_alt" native="true">
+ <widget class="spline_widget" name="ryconfig_alt" native="true">
<property name="colorBezier" stdset="0">
<color>
<red>0</red>
@@ -165,7 +165,7 @@
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
- <widget class="QFunctionConfigurator" name="rzconfig" native="true">
+ <widget class="spline_widget" name="rzconfig" native="true">
<property name="colorBezier" stdset="0">
<color>
<red>0</red>
@@ -190,7 +190,7 @@
</widget>
</item>
<item>
- <widget class="QFunctionConfigurator" name="rzconfig_alt" native="true">
+ <widget class="spline_widget" name="rzconfig_alt" native="true">
<property name="colorBezier" stdset="0">
<color>
<red>0</red>
@@ -218,7 +218,7 @@
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
- <widget class="QFunctionConfigurator" name="txconfig" native="true">
+ <widget class="spline_widget" name="txconfig" native="true">
<property name="colorBezier" stdset="0">
<color>
<red>255</red>
@@ -243,7 +243,7 @@
</widget>
</item>
<item>
- <widget class="QFunctionConfigurator" name="txconfig_alt" native="true">
+ <widget class="spline_widget" name="txconfig_alt" native="true">
<property name="colorBezier" stdset="0">
<color>
<red>255</red>
@@ -271,7 +271,7 @@
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
- <widget class="QFunctionConfigurator" name="tyconfig" native="true">
+ <widget class="spline_widget" name="tyconfig" native="true">
<property name="colorBezier" stdset="0">
<color>
<red>255</red>
@@ -296,7 +296,7 @@
</widget>
</item>
<item>
- <widget class="QFunctionConfigurator" name="tyconfig_alt" native="true">
+ <widget class="spline_widget" name="tyconfig_alt" native="true">
<property name="colorBezier" stdset="0">
<color>
<red>255</red>
@@ -324,7 +324,7 @@
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_7">
<item>
- <widget class="QFunctionConfigurator" name="tzconfig" native="true">
+ <widget class="spline_widget" name="tzconfig" native="true">
<property name="colorBezier" stdset="0">
<color>
<red>0</red>
@@ -349,7 +349,7 @@
</widget>
</item>
<item>
- <widget class="QFunctionConfigurator" name="tzconfig_alt" native="true">
+ <widget class="spline_widget" name="tzconfig_alt" native="true">
<property name="colorBezier" stdset="0">
<color>
<red>0</red>
@@ -381,7 +381,7 @@
</widget>
<customwidgets>
<customwidget>
- <class>QFunctionConfigurator</class>
+ <class>spline_widget</class>
<extends>QWidget</extends>
<header>spline-widget/spline-widget.hpp</header>
</customwidget>
diff --git a/opentrack-logic/main-settings.hpp b/opentrack-logic/main-settings.hpp
index 81eb99cf..29f7f62c 100644
--- a/opentrack-logic/main-settings.hpp
+++ b/opentrack-logic/main-settings.hpp
@@ -62,7 +62,7 @@ struct module_settings
struct main_settings
{
- pbundle b;
+ pbundle b, b_map;
axis_opts a_x, a_y, a_z, a_yaw, a_pitch, a_roll;
value<bool> tcomp_p, tcomp_tz;
value<bool> tray_enabled;
@@ -77,12 +77,13 @@ struct main_settings
value<QString> tracklogging_filename;
main_settings() :
b(bundle("opentrack-ui")),
- a_x(b, "x", TX),
- a_y(b, "y", TY),
- a_z(b, "z", TZ),
- a_yaw(b, "yaw", Yaw),
- a_pitch(b, "pitch", Pitch),
- a_roll(b, "roll", Roll),
+ b_map(bundle("opentrack-mappings")),
+ a_x(b_map, "x", TX),
+ a_y(b_map, "y", TY),
+ a_z(b_map, "z", TZ),
+ a_yaw(b_map, "yaw", Yaw),
+ a_pitch(b_map, "pitch", Pitch),
+ a_roll(b_map, "roll", Roll),
tcomp_p(b, "compensate-translation", true),
tcomp_tz(b, "compensate-translation-disable-z-axis", false),
tray_enabled(b, "use-system-tray", false),
diff --git a/opentrack-logic/mappings.hpp b/opentrack-logic/mappings.hpp
index 9475ecb4..3e396980 100644
--- a/opentrack-logic/mappings.hpp
+++ b/opentrack-logic/mappings.hpp
@@ -13,46 +13,46 @@ using namespace options;
#include "spline-widget/spline.hpp"
#include "main-settings.hpp"
-class Mapping {
+class Map {
public:
- Mapping(QString primary,
+ Map(QString primary,
QString secondary,
int max_x,
int max_y,
axis_opts& opts) :
- curve(max_x, max_y),
- curveAlt(max_x, max_y),
+ spline_main(max_x, max_y),
+ spline_alt(max_x, max_y),
opts(opts),
name1(primary),
name2(secondary)
{
mem<QSettings> iniFile = group::ini_file();
- curve.loadSettings(*iniFile, primary);
- curveAlt.loadSettings(*iniFile, secondary);
+ spline_main.loadSettings(*iniFile, primary);
+ spline_alt.loadSettings(*iniFile, secondary);
}
- Map curve;
- Map curveAlt;
+ spline spline_main;
+ spline spline_alt;
axis_opts& opts;
QString name1, name2;
};
class Mappings {
private:
- Mapping axes[6];
+ Map axes[6];
public:
Mappings(std::vector<axis_opts*> opts) :
axes {
- Mapping("tx","tx_alt", 30, 75, *opts[TX]),
- Mapping("ty","ty_alt", 30, 75, *opts[TY]),
- Mapping("tz","tz_alt", 30, 75, *opts[TZ]),
- Mapping("rx", "rx_alt", 180, 180, *opts[Yaw]),
- Mapping("ry", "ry_alt", 180, 180, *opts[Pitch]),
- Mapping("rz", "rz_alt", 180, 180, *opts[Roll])
+ Map("tx","tx_alt", 30, 75, *opts[TX]),
+ Map("ty","ty_alt", 30, 75, *opts[TY]),
+ Map("tz","tz_alt", 30, 75, *opts[TZ]),
+ Map("rx", "rx_alt", 180, 180, *opts[Yaw]),
+ Map("ry", "ry_alt", 180, 180, *opts[Pitch]),
+ Map("rz", "rz_alt", 180, 180, *opts[Roll])
}
{}
- inline Mapping& operator()(int i) { return axes[i]; }
- inline const Mapping& operator()(int i) const { return axes[i]; }
+ inline Map& operator()(int i) { return axes[i]; }
+ inline const Map& operator()(int i) const { return axes[i]; }
void load_mappings()
{
@@ -60,8 +60,8 @@ public:
for (int i = 0; i < 6; i++)
{
- axes[i].curve.loadSettings(*iniFile, axes[i].name1);
- axes[i].curveAlt.loadSettings(*iniFile, axes[i].name2);
+ axes[i].spline_main.loadSettings(*iniFile, axes[i].name1);
+ axes[i].spline_alt.loadSettings(*iniFile, axes[i].name2);
axes[i].opts.b->reload();
}
}
@@ -71,8 +71,8 @@ public:
for (int i = 0; i < 6; i++)
{
- axes[i].curve.saveSettings(*iniFile, axes[i].name1);
- axes[i].curveAlt.saveSettings(*iniFile, axes[i].name2);
+ axes[i].spline_main.saveSettings(*iniFile, axes[i].name1);
+ axes[i].spline_alt.saveSettings(*iniFile, axes[i].name2);
axes[i].opts.b->save();
}
}
@@ -81,8 +81,8 @@ public:
{
for (int i = 0; i < 6; i++)
{
- axes[i].curve.invalidate_unsaved_settings();
- axes[i].curveAlt.invalidate_unsaved_settings();
+ axes[i].spline_main.invalidate_unsaved_settings();
+ axes[i].spline_alt.invalidate_unsaved_settings();
axes[i].opts.b->reload();
}
}
diff --git a/opentrack-logic/tracker.cpp b/opentrack-logic/tracker.cpp
index 746a29f4..ab1a7406 100644
--- a/opentrack-logic/tracker.cpp
+++ b/opentrack-logic/tracker.cpp
@@ -54,12 +54,12 @@ Tracker::rmat Tracker::get_camera_offset_matrix(double c)
return euler::euler_to_rmat(off);
}
-double Tracker::map(double pos, Mapping& axis)
+double Tracker::map(double pos, Map& axis)
{
bool altp = (pos < 0) && axis.opts.altp;
- axis.curve.setTrackingActive( !altp );
- axis.curveAlt.setTrackingActive( altp );
- auto& fc = altp ? axis.curveAlt : axis.curve;
+ axis.spline_main.setTrackingActive( !altp );
+ axis.spline_alt.setTrackingActive( altp );
+ auto& fc = altp ? axis.spline_alt : axis.spline_main;
return fc.getValue(pos);
}
@@ -355,8 +355,8 @@ void Tracker::run()
for (int i = 0; i < 6; i++)
{
- m(i).curve.setTrackingActive(false);
- m(i).curveAlt.setTrackingActive(false);
+ m(i).spline_main.setTrackingActive(false);
+ m(i).spline_alt.setTrackingActive(false);
}
}
diff --git a/opentrack-logic/tracker.h b/opentrack-logic/tracker.h
index 91ac3f2f..2153f7c0 100644
--- a/opentrack-logic/tracker.h
+++ b/opentrack-logic/tracker.h
@@ -57,7 +57,7 @@ private:
rmat r_b, r_b_real;
double t_b[3];
- double map(double pos, Mapping& axis);
+ double map(double pos, Map& axis);
void logic();
void t_compensate(const rmat& rmat, const euler_t& ypr, euler_t& output, bool rz);
void run() override;
diff --git a/spline-widget/spline-widget.cpp b/spline-widget/spline-widget.cpp
index ee2e3c73..17dbe31d 100644
--- a/spline-widget/spline-widget.cpp
+++ b/spline-widget/spline-widget.cpp
@@ -15,7 +15,7 @@ using namespace options;
#include <cmath>
#include <algorithm>
-QFunctionConfigurator::QFunctionConfigurator(QWidget *parent) :
+spline_widget::spline_widget(QWidget *parent) :
QWidget(parent),
_config(nullptr),
moving_control_point_idx(-1),
@@ -28,7 +28,7 @@ QFunctionConfigurator::QFunctionConfigurator(QWidget *parent) :
setMouseTracking(true);
}
-void QFunctionConfigurator::setConfig(Map* config, const QString& name)
+void spline_widget::setConfig(spline* config, const QString& name)
{
mem<QSettings> iniFile = group::ini_file();
if (name != "")
@@ -39,17 +39,17 @@ void QFunctionConfigurator::setConfig(Map* config, const QString& name)
update();
}
-void QFunctionConfigurator::set_preview_only(bool val)
+void spline_widget::set_preview_only(bool val)
{
_preview_only = val;
}
-bool QFunctionConfigurator::is_preview_only() const
+bool spline_widget::is_preview_only() const
{
return _preview_only;
}
-void QFunctionConfigurator::drawBackground()
+void spline_widget::drawBackground()
{
if (!_config)
return;
@@ -111,7 +111,7 @@ void QFunctionConfigurator::drawBackground()
}
}
-void QFunctionConfigurator::drawFunction()
+void spline_widget::drawFunction()
{
if (!_config)
return;
@@ -173,7 +173,7 @@ void QFunctionConfigurator::drawFunction()
painter.restore();
}
-void QFunctionConfigurator::paintEvent(QPaintEvent *e)
+void spline_widget::paintEvent(QPaintEvent *e)
{
QPainter p(this);
@@ -221,7 +221,7 @@ void QFunctionConfigurator::paintEvent(QPaintEvent *e)
}
}
-void QFunctionConfigurator::drawPoint(QPainter *painter, const QPointF &pos, QColor colBG, QColor border)
+void spline_widget::drawPoint(QPainter *painter, const QPointF &pos, QColor colBG, QColor border)
{
painter->save();
painter->setPen(border);
@@ -232,7 +232,7 @@ void QFunctionConfigurator::drawPoint(QPainter *painter, const QPointF &pos, QCo
painter->restore();
}
-void QFunctionConfigurator::drawLine(QPainter *painter, const QPointF &start, const QPointF &end, QPen &pen)
+void spline_widget::drawLine(QPainter *painter, const QPointF &start, const QPointF &end, QPen &pen)
{
painter->save();
painter->setPen(pen);
@@ -241,7 +241,7 @@ void QFunctionConfigurator::drawLine(QPainter *painter, const QPointF &start, co
painter->restore();
}
-void QFunctionConfigurator::mousePressEvent(QMouseEvent *e)
+void spline_widget::mousePressEvent(QMouseEvent *e)
{
if (!_config || !isEnabled())
return;
@@ -308,7 +308,7 @@ void QFunctionConfigurator::mousePressEvent(QMouseEvent *e)
update();
}
-void QFunctionConfigurator::mouseMoveEvent(QMouseEvent *e)
+void spline_widget::mouseMoveEvent(QMouseEvent *e)
{
if (!_config || !isEnabled())
return;
@@ -390,7 +390,7 @@ void QFunctionConfigurator::mouseMoveEvent(QMouseEvent *e)
}
}
-void QFunctionConfigurator::mouseReleaseEvent(QMouseEvent *e)
+void spline_widget::mouseReleaseEvent(QMouseEvent *e)
{
if (!_config || !isEnabled())
return;
@@ -406,7 +406,7 @@ void QFunctionConfigurator::mouseReleaseEvent(QMouseEvent *e)
}
}
-void QFunctionConfigurator::update_range()
+void spline_widget::update_range()
{
if (!_config)
return;
@@ -425,13 +425,13 @@ void QFunctionConfigurator::update_range()
update();
}
-bool QFunctionConfigurator::point_within_pixel(const QPointF &pt, const QPointF &pixel)
+bool spline_widget::point_within_pixel(const QPointF &pt, const QPointF &pixel)
{
QPointF tmp = pixel - point_to_pixel(pt);
return sqrt(QPointF::dotProduct(tmp, tmp)) < point_size;
}
-QPointF QFunctionConfigurator::pixel_coord_to_point(const QPointF& point)
+QPointF spline_widget::pixel_coord_to_point(const QPointF& point)
{
if (!_config)
return QPointF(-1, -1);
@@ -459,13 +459,13 @@ QPointF QFunctionConfigurator::pixel_coord_to_point(const QPointF& point)
return QPointF(x, y);
}
-QPointF QFunctionConfigurator::point_to_pixel(const QPointF& point)
+QPointF spline_widget::point_to_pixel(const QPointF& point)
{
return QPointF(pixel_bounds.x() + point.x() * c.x(),
pixel_bounds.y() + pixel_bounds.height() - point.y() * c.y());
}
-void QFunctionConfigurator::resizeEvent(QResizeEvent *)
+void spline_widget::resizeEvent(QResizeEvent *)
{
update_range();
}
diff --git a/spline-widget/spline-widget.hpp b/spline-widget/spline-widget.hpp
index cc416b60..577e6f7f 100644
--- a/spline-widget/spline-widget.hpp
+++ b/spline-widget/spline-widget.hpp
@@ -15,16 +15,16 @@
#include "spline.hpp"
#include "opentrack/plugin-api.hpp"
-class SPLINE_WIDGET_EXPORT QFunctionConfigurator : public QWidget
+class SPLINE_WIDGET_EXPORT spline_widget : 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)
public:
- QFunctionConfigurator(QWidget *parent = 0);
+ spline_widget(QWidget *parent = 0);
- Map* config();
- void setConfig(Map* config, const QString &name);
+ spline* config();
+ void setConfig(spline* config, const QString &name);
QColor colorBezier() const
{
@@ -63,7 +63,7 @@ private:
QPointF pixel_coord_to_point (const QPointF& point);
QPointF point_to_pixel(const QPointF& point);
- Map* _config;
+ spline* _config;
// bounds of the rectangle user can interact with
QRectF pixel_bounds;
diff --git a/spline-widget/spline.cpp b/spline-widget/spline.cpp
index 7bac6b78..48b508ef 100644
--- a/spline-widget/spline.cpp
+++ b/spline-widget/spline.cpp
@@ -21,47 +21,47 @@
#include <QDebug>
-void Map::setTrackingActive(bool blnActive)
+void spline::setTrackingActive(bool blnActive)
{
activep = blnActive;
}
-Map::Map() : Map(0, 0)
+spline::spline() : spline(0, 0)
{
}
-void Map::removeAllPoints()
+void spline::removeAllPoints()
{
QMutexLocker foo(&_mutex);
cur.input.clear();
reload();
}
-void Map::setMaxInput(qreal max_input)
+void spline::setMaxInput(qreal max_input)
{
QMutexLocker l(&_mutex);
max_x = max_input;
}
-void Map::setMaxOutput(qreal max_output)
+void spline::setMaxOutput(qreal max_output)
{
QMutexLocker l(&_mutex);
max_y = max_output;
}
-qreal Map::maxInput() const
+qreal spline::maxInput() const
{
QMutexLocker l(&_mutex);
return max_x;
}
-qreal Map::maxOutput() const
+qreal spline::maxOutput() const
{
QMutexLocker l(&_mutex);
return max_y;
}
-Map::Map(qreal maxx, qreal maxy) :
+spline::spline(qreal maxx, qreal maxy) :
_mutex(QMutex::Recursive),
max_x(0),
max_y(0),
@@ -74,7 +74,7 @@ Map::Map(qreal maxx, qreal maxy) :
reload();
}
-float Map::getValue(float x)
+float spline::getValue(float x)
{
QMutexLocker foo(&_mutex);
float q = x * precision();
@@ -88,14 +88,14 @@ float Map::getValue(float x)
return ret;
}
-bool Map::getLastPoint(QPointF& point )
+bool spline::getLastPoint(QPointF& point )
{
QMutexLocker foo(&_mutex);
point = last_input_value;
return activep;
}
-float Map::getValueInternal(int x)
+float spline::getValueInternal(int x)
{
float sign = x < 0 ? -1 : 1;
x = abs(x);
@@ -123,7 +123,7 @@ static bool sortFn(const QPointF& one, const QPointF& two)
return one.x() < two.x();
}
-void Map::reload()
+void spline::reload()
{
if (cur.input.size())
{
@@ -202,7 +202,7 @@ void Map::reload()
cur.data.clear();
}
-void Map::removePoint(int i)
+void spline::removePoint(int i)
{
QMutexLocker foo(&_mutex);
if (i >= 0 && i < cur.input.size())
@@ -212,7 +212,7 @@ void Map::removePoint(int i)
}
}
-void Map::addPoint(QPointF pt)
+void spline::addPoint(QPointF pt)
{
QMutexLocker foo(&_mutex);
cur.input.append(pt);
@@ -220,7 +220,7 @@ void Map::addPoint(QPointF pt)
std::stable_sort(cur.input.begin(), cur.input.end(), sortFn);
}
-void Map::movePoint(int idx, QPointF pt)
+void spline::movePoint(int idx, QPointF pt)
{
QMutexLocker foo(&_mutex);
if (idx >= 0 && idx < cur.input.size())
@@ -232,20 +232,20 @@ void Map::movePoint(int idx, QPointF pt)
}
}
-const QList<QPointF> Map::getPoints()
+const QList<QPointF> spline::getPoints()
{
QMutexLocker foo(&_mutex);
return cur.input;
}
-void Map::invalidate_unsaved_settings()
+void spline::invalidate_unsaved_settings()
{
QMutexLocker foo(&_mutex);
cur = saved;
reload();
}
-void Map::loadSettings(QSettings& settings, const QString& title)
+void spline::loadSettings(QSettings& settings, const QString& title)
{
QMutexLocker foo(&_mutex);
QPointF newPoint;
@@ -275,7 +275,7 @@ void Map::loadSettings(QSettings& settings, const QString& title)
saved = cur;
}
-bool Map::State::operator==(const State& other) const
+bool spline::State::operator==(const State& other) const
{
if (input.size() != other.input.size())
return false;
@@ -297,7 +297,7 @@ bool Map::State::operator==(const State& other) const
return true;
}
-void Map::saveSettings(QSettings& settings, const QString& title)
+void spline::saveSettings(QSettings& settings, const QString& title)
{
QMutexLocker foo(&_mutex);
@@ -335,7 +335,7 @@ void Map::saveSettings(QSettings& settings, const QString& title)
}
-int Map::precision() const
+int spline::precision() const
{
if (cur.input.size())
return (value_count-1) / std::max<float>(1.f, (cur.input[cur.input.size() - 1].x()));
diff --git a/spline-widget/spline.hpp b/spline-widget/spline.hpp
index 5d83aefd..6387c87a 100644
--- a/spline-widget/spline.hpp
+++ b/spline-widget/spline.hpp
@@ -24,7 +24,7 @@
# define SPLINE_WIDGET_EXPORT Q_DECL_IMPORT
#endif
-class SPLINE_WIDGET_EXPORT Map
+class SPLINE_WIDGET_EXPORT spline
{
private:
int precision() const;
@@ -48,8 +48,8 @@ private:
public:
qreal maxInput() const;
qreal maxOutput() const;
- Map();
- Map(qreal maxx, qreal maxy);
+ spline();
+ spline(qreal maxx, qreal maxy);
float getValue(float x);
bool getLastPoint(QPointF& point);