summaryrefslogtreecommitdiffhomepage
path: root/spline-widget
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-08-09 15:50:09 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-08-10 10:41:56 +0200
commit0eec855f4f5ac86f70525418918fd1ebb4d45e03 (patch)
treeb8014ad75774e00ba3c26f2b781d6ad0c6021c9a /spline-widget
parentf56f30f1d076c8b48a0bd4ce47b26ede618d2880 (diff)
spline-widget, gui: rename mapping-related files and classes
Adjust usages.
Diffstat (limited to 'spline-widget')
-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
4 files changed, 46 insertions, 46 deletions
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);